FixedProtocol

public protocol FixedProtocol : WidgetProtocol

GtkFixed places its child widgets at fixed positions and with fixed sizes.

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 UI 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.

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.

  • ptr

    Untyped pointer to the underlying GtkFixed instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • fixed_ptr Default implementation

    Typed 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)

Fixed Class

  • 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 transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return 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:value:) Extension method

    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

Fixed Class: FixedProtocol extension (methods and fields)

  • Retrieves the translation transformation of the given child GtkWidget in the GtkFixed.

    See also: [methodGtk.Fixed.get_child_transform].

    Declaration

    Swift

    @inlinable
    func getChildPosition<WidgetT>(widget: WidgetT, x: UnsafeMutablePointer<CDouble>!, y: UnsafeMutablePointer<CDouble>!) where WidgetT : WidgetProtocol
  • getChildTransform(widget:) Extension method

    Retrieves the transformation for widget set using gtk_fixed_set_child_transform().

    Declaration

    Swift

    @inlinable
    func getChildTransform<WidgetT>(widget: WidgetT) -> UnsafeMutablePointer<GskTransform>? where WidgetT : WidgetProtocol
  • move(widget:x:y:) Extension method

    Sets a translation transformation to the given x and y coordinates to the child widget of the GtkFixed.

    Declaration

    Swift

    @inlinable
    func move<WidgetT>(widget: WidgetT, x: CDouble, y: CDouble) where WidgetT : WidgetProtocol
  • put(widget:x:y:) Extension method

    Adds a widget to a GtkFixed at the given position.

    Declaration

    Swift

    @inlinable
    func put<WidgetT>(widget: WidgetT, x: CDouble, y: CDouble) where WidgetT : WidgetProtocol
  • remove(widget:) Extension method

    Removes a child from fixed.

    Declaration

    Swift

    @inlinable
    func remove<WidgetT>(widget: WidgetT) where WidgetT : WidgetProtocol
  • Sets the transformation for widget.

    This is a convenience function that retrieves the [classGtk.FixedLayoutChild] instance associated to widget and calls [methodGtk.FixedLayoutChild.set_transform].

    Declaration

    Swift

    @inlinable
    func setChildTransform<WidgetT>(widget: WidgetT, transform: UnsafeMutablePointer<GskTransform>? = nil) where WidgetT : WidgetProtocol
  • parentInstance Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parentInstance: GtkWidget { get }