FixedProtocol
public protocol FixedProtocol : ContainerProtocol
The GtkFixed
widget is a container which can place child widgets
at fixed positions and with fixed sizes, given in pixels. GtkFixed
performs no automatic layout management.
For most applications, you should not use this container! It keeps
you from having to learn about the other GTK+ containers, but it
results in broken applications. With GtkFixed
, the following
things will result in truncated text, overlapping widgets, and
other display bugs:
Themes, which may change widget sizes.
Fonts other than the one you used to write the app will of course change the size of widgets containing text; keep in mind that users may use a larger font because of difficulty reading the default, or they may be using a different OS that provides different fonts.
Translation of text into other languages changes its size. Also, display of non-English text will use a different font in many cases.
In addition, GtkFixed
does not pay attention to text direction and thus may
produce unwanted results if your app is run under right-to-left languages
such as Hebrew or Arabic. That is: normally GTK+ will order containers
appropriately for the text direction, e.g. to put labels to the right of the
thing they label when using an RTL language, but it can’t do that with
GtkFixed
. So if you need to reorder widgets depending on the text direction,
you would need to manually detect it and adjust child positions accordingly.
Finally, fixed positioning makes it kind of annoying to add/remove GUI elements, since you have to reposition all the other elements. This is a long-term maintenance problem for your application.
If you know none of these things are an issue for your application,
and prefer the simplicity of GtkFixed
, by all means use the
widget. But you should be aware of the tradeoffs.
See also GtkLayout
, which shares the ability to perform fixed positioning
of child widgets and additionally adds custom drawing and scrollability.
The FixedProtocol
protocol exposes the methods and properties of an underlying GtkFixed
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Fixed
.
Alternatively, use FixedRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkFixed
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
fixed_ptr
Default implementationTyped pointer to the underlying
GtkFixed
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkFixed
instance.Declaration
Swift
var fixed_ptr: UnsafeMutablePointer<GtkFixed>! { get }
-
Required Initialiser for types conforming to
FixedProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
FixedPropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: FixedPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a Fixed property
Declaration
Swift
@inlinable func get(property: FixedPropertyName) -> GLibObject.Value
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
set(property:
Extension methodvalue: ) Set the value of a Fixed property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: FixedPropertyName, value v: GLibObject.Value)
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
move(widget:
Extension methodx: y: ) Moves a child of a
GtkFixed
container to the given position.Declaration
Swift
@inlinable func move<WidgetT>(widget: WidgetT, x: Int, y: Int) where WidgetT : WidgetProtocol
-
put(widget:
Extension methodx: y: ) Adds a widget to a
GtkFixed
container at the given position.Declaration
Swift
@inlinable func put<WidgetT>(widget: WidgetT, x: Int, y: Int) where WidgetT : WidgetProtocol
-
container
Extension methodUndocumented
Declaration
Swift
@inlinable var container: GtkContainer { get }