ToolItemProtocol

public protocol ToolItemProtocol : ActivatableProtocol, BinProtocol

GtkToolItems are widgets that can appear on a toolbar. To create a toolbar item that contain something else than a button, use gtk_tool_item_new(). Use gtk_container_add() to add a child widget to the tool item.

For toolbar items that contain buttons, see the GtkToolButton, GtkToggleToolButton and GtkRadioToolButton classes.

See the GtkToolbar class for a description of the toolbar widget, and GtkToolShell for a description of the tool shell interface.

The ToolItemProtocol protocol exposes the methods and properties of an underlying GtkToolItem 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 ToolItem. Alternatively, use ToolItemRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkToolItem instance.

    Declaration

    Swift

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

    Typed pointer to the underlying GtkToolItem instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkToolItem instance.

    Declaration

    Swift

    var tool_item_ptr: UnsafeMutablePointer<GtkToolItem>! { get }
  • Required Initialiser for types conforming to ToolItemProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

ToolItem Class

  • Bind a ToolItemPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: ToolItemPropertyName, 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 ToolItem property

    Declaration

    Swift

    @inlinable
    func get(property: ToolItemPropertyName) -> 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 ToolItem property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: ToolItemPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

ToolItem signals

  • Connect a Swift signal handler to the given, typed ToolItemSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: ToolItemSignalName, flags f: ConnectFlags = ConnectFlags(0), handler h: @escaping SignalHandler) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    handler

    The Swift signal handler (function or callback) to invoke on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • Connect a C signal handler to the given, typed ToolItemSignalName signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func connect(signal s: ToolItemSignalName, flags f: ConnectFlags = ConnectFlags(0), data userData: gpointer!, destroyData destructor: GClosureNotify? = nil, signalHandler h: @escaping GCallback) -> Int

    Parameters

    signal

    The signal to connect

    flags

    The connection flags to use

    data

    A pointer to user data to provide to the callback

    destroyData

    A GClosureNotify C function to destroy the data pointed to by userData

    signalHandler

    The C function to be called on the given signal

    Return Value

    The signal handler ID (always greater than 0 for successful connections)

  • This signal is emitted when the toolbar needs information from tool_item about whether the item should appear in the toolbar overflow menu. In response the tool item should either

    • call gtk_tool_item_set_proxy_menu_item() with a nil pointer and return true to indicate that the item should not appear in the overflow menu

    • call gtk_tool_item_set_proxy_menu_item() with a new menu item and return true, or

    • return false to indicate that the signal was not handled by the item. This means that the item will not appear in the overflow menu unless a later handler installs a menu item.

    The toolbar may cache the result of this signal. When the tool item changes how it will respond to this signal it must call gtk_tool_item_rebuild_menu() to invalidate the cache and ensure that the toolbar rebuilds its overflow menu.

    Note

    This represents the underlying create-menu-proxy signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onCreateMenuProxy(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef) -> Bool) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    true if the signal was handled, false if not Run the given callback whenever the createMenuProxy signal is emitted

  • createMenuProxySignal Extension method

    Typed create-menu-proxy signal for using the connect(signal:) methods

    Declaration

    Swift

    static var createMenuProxySignal: ToolItemSignalName { get }
  • This signal is emitted when some property of the toolbar that the item is a child of changes. For custom subclasses of GtkToolItem, the default handler of this signal use the functions

    • gtk_tool_shell_get_orientation()
    • gtk_tool_shell_get_style()
    • gtk_tool_shell_get_icon_size()
    • gtk_tool_shell_get_relief_style() to find out what the toolbar should look like and change themselves accordingly.

    Note

    This represents the underlying toolbar-reconfigured signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onToolbarReconfigured(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    handler

    The signal handler to call Run the given callback whenever the toolbarReconfigured signal is emitted

  • toolbarReconfiguredSignal Extension method

    Typed toolbar-reconfigured signal for using the connect(signal:) methods

    Declaration

    Swift

    static var toolbarReconfiguredSignal: ToolItemSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::is-important signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyIsImportant(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyIsImportant signal is emitted

  • notifyIsImportantSignal Extension method

    Typed notify::is-important signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyIsImportantSignal: ToolItemSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::visible-horizontal signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyVisibleHorizontal(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyVisibleHorizontal signal is emitted

  • Typed notify::visible-horizontal signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyVisibleHorizontalSignal: ToolItemSignalName { get }
  • The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

    Note that getting this signal doesn’t itself guarantee that the value of the property has actually changed. When it is emitted is determined by the derived GObject class. If the implementor did not create the property with G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results in notify being emitted, even if the new value is the same as the old. If they did pass G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only when they explicitly call g_object_notify() or g_object_notify_by_pspec(), and common practice is to do that only when the value has actually changed.

    This signal is typically used to obtain change notification for a single property, by specifying the property name as a detail in the g_signal_connect() call, like this:

    (C Language Example):

    g_signal_connect (text_view->buffer, "notify::paste-target-list",
                      G_CALLBACK (gtk_text_view_target_list_notify),
                      text_view)
    

    It is important to note that you must use canonical parameter names as detail strings for the notify signal.

    Note

    This represents the underlying notify::visible-vertical signal

    Declaration

    Swift

    @discardableResult
    @inlinable
    func onNotifyVisibleVertical(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolItemRef, _ pspec: ParamSpecRef) -> Void) -> Int

    Parameters

    flags

    Flags

    unownedSelf

    Reference to instance of self

    pspec

    the GParamSpec of the property which changed.

    handler

    The signal handler to call Run the given callback whenever the notifyVisibleVertical signal is emitted

  • notifyVisibleVerticalSignal Extension method

    Typed notify::visible-vertical signal for using the connect(signal:) methods

    Declaration

    Swift

    static var notifyVisibleVerticalSignal: ToolItemSignalName { get }

ToolItem Class: ToolItemProtocol extension (methods and fields)

  • getEllipsizeMode() Extension method

    Returns the ellipsize mode used for tool_item. Custom subclasses of GtkToolItem should call this function to find out how text should be ellipsized.

    Declaration

    Swift

    @inlinable
    func getEllipsizeMode() -> PangoEllipsizeMode
  • getExpand() Extension method

    Returns whether tool_item is allocated extra space. See gtk_tool_item_set_expand().

    Declaration

    Swift

    @inlinable
    func getExpand() -> Bool
  • getHomogeneous() Extension method

    Returns whether tool_item is the same size as other homogeneous items. See gtk_tool_item_set_homogeneous().

    Declaration

    Swift

    @inlinable
    func getHomogeneous() -> Bool
  • getIconSize() Extension method

    Returns the icon size used for tool_item. Custom subclasses of GtkToolItem should call this function to find out what size icons they should use.

    Declaration

    Swift

    @inlinable
    func getIconSize() -> GtkIconSize
  • getIsImportant() Extension method

    Returns whether tool_item is considered important. See gtk_tool_item_set_is_important()

    Declaration

    Swift

    @inlinable
    func getIsImportant() -> Bool
  • getOrientation() Extension method

    Returns the orientation used for tool_item. Custom subclasses of GtkToolItem should call this function to find out what size icons they should use.

    Declaration

    Swift

    @inlinable
    func getOrientation() -> GtkOrientation
  • If menu_item_id matches the string passed to gtk_tool_item_set_proxy_menu_item() return the corresponding GtkMenuItem.

    Custom subclasses of GtkToolItem should use this function to update their menu item when the GtkToolItem changes. That the menu_item_ids must match ensures that a GtkToolItem will not inadvertently change a menu item that they did not create.

    Declaration

    Swift

    @inlinable
    func getProxyMenuItem(menuItemID: UnsafePointer<gchar>!) -> WidgetRef!
  • getReliefStyle() Extension method

    Returns the relief style of tool_item. See gtk_button_set_relief(). Custom subclasses of GtkToolItem should call this function in the handler of the GtkToolItem::toolbar_reconfigured signal to find out the relief style of buttons.

    Declaration

    Swift

    @inlinable
    func getReliefStyle() -> GtkReliefStyle
  • getTextAlignment() Extension method

    Returns the text alignment used for tool_item. Custom subclasses of GtkToolItem should call this function to find out how text should be aligned.

    Declaration

    Swift

    @inlinable
    func getTextAlignment() -> Double
  • getTextOrientation() Extension method

    Returns the text orientation used for tool_item. Custom subclasses of GtkToolItem should call this function to find out how text should be orientated.

    Declaration

    Swift

    @inlinable
    func getTextOrientation() -> GtkOrientation
  • getTextSizeGroup() Extension method

    Returns the size group used for labels in tool_item. Custom subclasses of GtkToolItem should call this function and use the size group for labels.

    Declaration

    Swift

    @inlinable
    func getTextSizeGroup() -> SizeGroupRef!
  • getToolbarStyle() Extension method

    Returns the toolbar style used for tool_item. Custom subclasses of GtkToolItem should call this function in the handler of the GtkToolItemtoolbar_reconfigured signal to find out in what style the toolbar is displayed and change themselves accordingly

    Possibilities are:

    • GTK_TOOLBAR_BOTH, meaning the tool item should show both an icon and a label, stacked vertically
    • GTK_TOOLBAR_ICONS, meaning the toolbar shows only icons
    • GTK_TOOLBAR_TEXT, meaning the tool item should only show text
    • GTK_TOOLBAR_BOTH_HORIZ, meaning the tool item should show both an icon and a label, arranged horizontally

    Declaration

    Swift

    @inlinable
    func getToolbarStyle() -> GtkToolbarStyle
  • getUseDragWindow() Extension method

    Returns whether tool_item has a drag window. See gtk_tool_item_set_use_drag_window().

    Declaration

    Swift

    @inlinable
    func getUseDragWindow() -> Bool
  • getVisibleHorizontal() Extension method

    Returns whether the tool_item is visible on toolbars that are docked horizontally.

    Declaration

    Swift

    @inlinable
    func getVisibleHorizontal() -> Bool
  • getVisibleVertical() Extension method

    Returns whether tool_item is visible when the toolbar is docked vertically. See gtk_tool_item_set_visible_vertical().

    Declaration

    Swift

    @inlinable
    func getVisibleVertical() -> Bool
  • rebuildMenu() Extension method

    Calling this function signals to the toolbar that the overflow menu item for tool_item has changed. If the overflow menu is visible when this function it called, the menu will be rebuilt.

    The function must be called when the tool item changes what it will do in response to the GtkToolItem::create-menu-proxy signal.

    Declaration

    Swift

    @inlinable
    func rebuildMenu()
  • retrieveProxyMenuItem() Extension method

    Returns the GtkMenuItem that was last set by gtk_tool_item_set_proxy_menu_item(), ie. the GtkMenuItem that is going to appear in the overflow menu.

    Declaration

    Swift

    @inlinable
    func retrieveProxyMenuItem() -> WidgetRef!
  • set(expand:) Extension method

    Sets whether tool_item is allocated extra space when there is more room on the toolbar then needed for the items. The effect is that the item gets bigger when the toolbar gets bigger and smaller when the toolbar gets smaller.

    Declaration

    Swift

    @inlinable
    func set(expand: Bool)
  • set(homogeneous:) Extension method

    Sets whether tool_item is to be allocated the same size as other homogeneous items. The effect is that all homogeneous items will have the same width as the widest of the items.

    Declaration

    Swift

    @inlinable
    func set(homogeneous: Bool)
  • set(isImportant:) Extension method

    Sets whether tool_item should be considered important. The GtkToolButton class uses this property to determine whether to show or hide its label when the toolbar style is GTK_TOOLBAR_BOTH_HORIZ. The result is that only tool buttons with the “is_important” property set have labels, an effect known as “priority text”

    Declaration

    Swift

    @inlinable
    func set(isImportant: Bool)
  • Sets the GtkMenuItem used in the toolbar overflow menu. The menu_item_id is used to identify the caller of this function and should also be used with gtk_tool_item_get_proxy_menu_item().

    See also GtkToolItem::create-menu-proxy.

    Declaration

    Swift

    @inlinable
    func setProxyMenuItem(menuItemID: UnsafePointer<gchar>!, menuItem: WidgetRef? = nil)
  • Sets the GtkMenuItem used in the toolbar overflow menu. The menu_item_id is used to identify the caller of this function and should also be used with gtk_tool_item_get_proxy_menu_item().

    See also GtkToolItem::create-menu-proxy.

    Declaration

    Swift

    @inlinable
    func setProxyMenuItem<WidgetT>(menuItemID: UnsafePointer<gchar>!, menuItem: WidgetT?) where WidgetT : WidgetProtocol
  • setTooltip(markup:) Extension method

    Sets the markup text to be displayed as tooltip on the item. See gtk_widget_set_tooltip_markup().

    Declaration

    Swift

    @inlinable
    func setTooltip(markup: UnsafePointer<gchar>!)
  • setTooltip(text:) Extension method

    Sets the text to be displayed as tooltip on the item. See gtk_widget_set_tooltip_text().

    Declaration

    Swift

    @inlinable
    func setTooltip(text: UnsafePointer<gchar>!)
  • set(useDragWindow:) Extension method

    Sets whether tool_item has a drag window. When true the toolitem can be used as a drag source through gtk_drag_source_set(). When tool_item has a drag window it will intercept all events, even those that would otherwise be sent to a child of tool_item.

    Declaration

    Swift

    @inlinable
    func set(useDragWindow: Bool)
  • set(visibleHorizontal:) Extension method

    Sets whether tool_item is visible when the toolbar is docked horizontally.

    Declaration

    Swift

    @inlinable
    func set(visibleHorizontal: Bool)
  • set(visibleVertical:) Extension method

    Sets whether tool_item is visible when the toolbar is docked vertically. Some tool items, such as text entries, are too wide to be useful on a vertically docked toolbar. If visible_vertical is false tool_item will not appear on toolbars that are docked vertically.

    Declaration

    Swift

    @inlinable
    func set(visibleVertical: Bool)
  • toolbarReconfigured() Extension method

    Emits the signal GtkToolItem::toolbar_reconfigured on tool_item. GtkToolbar and other GtkToolShell implementations use this function to notify children, when some aspect of their configuration changes.

    Declaration

    Swift

    @inlinable
    func toolbarReconfigured()
  • ellipsizeMode Extension method

    Returns the ellipsize mode used for tool_item. Custom subclasses of GtkToolItem should call this function to find out how text should be ellipsized.

    Declaration

    Swift

    @inlinable
    var ellipsizeMode: PangoEllipsizeMode { get }
  • expand Extension method

    Returns whether tool_item is allocated extra space. See gtk_tool_item_set_expand().

    Declaration

    Swift

    @inlinable
    var expand: Bool { get nonmutating set }
  • homogeneous Extension method

    Returns whether tool_item is the same size as other homogeneous items. See gtk_tool_item_set_homogeneous().

    Declaration

    Swift

    @inlinable
    var homogeneous: Bool { get nonmutating set }
  • iconSize Extension method

    Returns the icon size used for tool_item. Custom subclasses of GtkToolItem should call this function to find out what size icons they should use.

    Declaration

    Swift

    @inlinable
    var iconSize: GtkIconSize { get }
  • isImportant Extension method

    Returns whether tool_item is considered important. See gtk_tool_item_set_is_important()

    Declaration

    Swift

    @inlinable
    var isImportant: Bool { get nonmutating set }
  • orientation Extension method

    Returns the orientation used for tool_item. Custom subclasses of GtkToolItem should call this function to find out what size icons they should use.

    Declaration

    Swift

    @inlinable
    var orientation: GtkOrientation { get }
  • reliefStyle Extension method

    Returns the relief style of tool_item. See gtk_button_set_relief(). Custom subclasses of GtkToolItem should call this function in the handler of the GtkToolItem::toolbar_reconfigured signal to find out the relief style of buttons.

    Declaration

    Swift

    @inlinable
    var reliefStyle: GtkReliefStyle { get }
  • textAlignment Extension method

    Returns the text alignment used for tool_item. Custom subclasses of GtkToolItem should call this function to find out how text should be aligned.

    Declaration

    Swift

    @inlinable
    var textAlignment: Double { get }
  • textOrientation Extension method

    Returns the text orientation used for tool_item. Custom subclasses of GtkToolItem should call this function to find out how text should be orientated.

    Declaration

    Swift

    @inlinable
    var textOrientation: GtkOrientation { get }
  • textSizeGroup Extension method

    Returns the size group used for labels in tool_item. Custom subclasses of GtkToolItem should call this function and use the size group for labels.

    Declaration

    Swift

    @inlinable
    var textSizeGroup: SizeGroupRef! { get }
  • toolbarStyle Extension method

    Returns the toolbar style used for tool_item. Custom subclasses of GtkToolItem should call this function in the handler of the GtkToolItemtoolbar_reconfigured signal to find out in what style the toolbar is displayed and change themselves accordingly

    Possibilities are:

    • GTK_TOOLBAR_BOTH, meaning the tool item should show both an icon and a label, stacked vertically
    • GTK_TOOLBAR_ICONS, meaning the toolbar shows only icons
    • GTK_TOOLBAR_TEXT, meaning the tool item should only show text
    • GTK_TOOLBAR_BOTH_HORIZ, meaning the tool item should show both an icon and a label, arranged horizontally

    Declaration

    Swift

    @inlinable
    var toolbarStyle: GtkToolbarStyle { get }
  • useDragWindow Extension method

    Returns whether tool_item has a drag window. See gtk_tool_item_set_use_drag_window().

    Declaration

    Swift

    @inlinable
    var useDragWindow: Bool { get nonmutating set }
  • visibleHorizontal Extension method

    Returns whether the tool_item is visible on toolbars that are docked horizontally.

    Declaration

    Swift

    @inlinable
    var visibleHorizontal: Bool { get nonmutating set }
  • visibleVertical Extension method

    Returns whether tool_item is visible when the toolbar is docked vertically. See gtk_tool_item_set_visible_vertical().

    Declaration

    Swift

    @inlinable
    var visibleVertical: Bool { get nonmutating set }
  • parent Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parent: GtkBin { get }