ToolbarProtocol
public protocol ToolbarProtocol : ContainerProtocol, OrientableProtocol, ToolShellProtocol
A toolbar is created with a call to gtk_toolbar_new()
.
A toolbar can contain instances of a subclass of GtkToolItem
. To add
a GtkToolItem
to the a toolbar, use gtk_toolbar_insert()
. To remove
an item from the toolbar use gtk_container_remove()
. To add a button
to the toolbar, add an instance of GtkToolButton
.
Toolbar items can be visually grouped by adding instances of
GtkSeparatorToolItem
to the toolbar. If the GtkToolbar child property
“expand” is TRUE
and the property GtkSeparatorToolItem:draw
is set to
FALSE
, the effect is to force all following items to the end of the toolbar.
By default, a toolbar can be shrunk, upon which it will add an arrow button
to show an overflow menu offering access to any GtkToolItem
child that has
a proxy menu item. To disable this and request enough size for all children,
call gtk_toolbar_set_show_arrow()
to set GtkToolbar:show-arrow
to false
.
Creating a context menu for the toolbar can be done by connecting to
the GtkToolbar::popup-context-menu
signal.
CSS nodes
GtkToolbar has a single CSS node with name toolbar.
The ToolbarProtocol
protocol exposes the methods and properties of an underlying GtkToolbar
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 Toolbar
.
Alternatively, use ToolbarRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkToolbar
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
toolbar_ptr
Default implementationTyped pointer to the underlying
GtkToolbar
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkToolbar
instance.Declaration
Swift
var toolbar_ptr: UnsafeMutablePointer<GtkToolbar>! { get }
-
Required Initialiser for types conforming to
ToolbarProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
ToolbarPropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: ToolbarPropertyName, 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 Toolbar property
Declaration
Swift
@inlinable func get(property: ToolbarPropertyName) -> 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 Toolbar property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: ToolbarPropertyName, value v: GLibObject.Value)
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
connect(signal:
Extension methodflags: handler: ) Connect a Swift signal handler to the given, typed
ToolbarSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolbarSignalName, 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 byuserData
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(signal:
Extension methodflags: data: destroyData: signalHandler: ) Connect a C signal handler to the given, typed
ToolbarSignalName
signalDeclaration
Swift
@discardableResult @inlinable func connect(signal s: ToolbarSignalName, 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 byuserData
signalHandler
The C function to be called on the given signal
Return Value
The signal handler ID (always greater than 0 for successful connections)
-
onFocusHomeOrEnd(flags:
Extension methodhandler: ) A keybinding signal used internally by GTK+. This signal can’t be used in application code
Note
This represents the underlyingfocus-home-or-end
signalDeclaration
Swift
@discardableResult @inlinable func onFocusHomeOrEnd(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ focusHome: Bool) -> Bool) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
focusHome
true
if the first item should be focusedhandler
true
if the signal was handled,false
if not Run the given callback whenever thefocusHomeOrEnd
signal is emitted -
focusHomeOrEndSignal
Extension methodTyped
focus-home-or-end
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var focusHomeOrEndSignal: ToolbarSignalName { get }
-
onOrientationChanged(flags:
Extension methodhandler: ) Emitted when the orientation of the toolbar changes.
Note
This represents the underlyingorientation-changed
signalDeclaration
Swift
@discardableResult @inlinable func onOrientationChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ orientation: Orientation) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
orientation
the new
GtkOrientation
of the toolbarhandler
The signal handler to call Run the given callback whenever the
orientationChanged
signal is emitted -
orientationChangedSignal
Extension methodTyped
orientation-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var orientationChangedSignal: ToolbarSignalName { get }
-
onPopupContextMenu(flags:
Extension methodhandler: ) Emitted when the user right-clicks the toolbar or uses the keybinding to display a popup menu.
Application developers should handle this signal if they want to display a context menu on the toolbar. The context-menu should appear at the coordinates given by
x
andy
. The mouse button number is given by thebutton
parameter. If the menu was popped up using the keybaord,button
is -1.Note
This represents the underlyingpopup-context-menu
signalDeclaration
Swift
@discardableResult @inlinable func onPopupContextMenu(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ x: Int, _ y: Int, _ button: Int) -> Bool) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
x
the x coordinate of the point where the menu should appear
y
the y coordinate of the point where the menu should appear
button
the mouse button the user pressed, or -1
handler
return
true
if the signal was handled,false
if not Run the given callback whenever thepopupContextMenu
signal is emitted -
popupContextMenuSignal
Extension methodTyped
popup-context-menu
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var popupContextMenuSignal: ToolbarSignalName { get }
-
onStyleChanged(flags:
Extension methodhandler: ) Emitted when the style of the toolbar changes.
Note
This represents the underlyingstyle-changed
signalDeclaration
Swift
@discardableResult @inlinable func onStyleChanged(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ style: ToolbarStyle) -> Void) -> Int
Parameters
flags
Flags
unownedSelf
Reference to instance of self
style
the new
GtkToolbarStyle
of the toolbarhandler
The signal handler to call Run the given callback whenever the
styleChanged
signal is emitted -
styleChangedSignal
Extension methodTyped
style-changed
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var styleChangedSignal: ToolbarSignalName { get }
-
onNotifyIconSize(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::icon-size
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconSize(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ 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
notifyIconSize
signal is emitted -
notifyIconSizeSignal
Extension methodTyped
notify::icon-size
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyIconSizeSignal: ToolbarSignalName { get }
-
onNotifyIconSizeSet(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::icon-size-set
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyIconSizeSet(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ 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
notifyIconSizeSet
signal is emitted -
notifyIconSizeSetSignal
Extension methodTyped
notify::icon-size-set
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyIconSizeSetSignal: ToolbarSignalName { get }
-
onNotifyShowArrow(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::show-arrow
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyShowArrow(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ 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
notifyShowArrow
signal is emitted -
notifyShowArrowSignal
Extension methodTyped
notify::show-arrow
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyShowArrowSignal: ToolbarSignalName { get }
-
onNotifyToolbarStyle(flags:
Extension methodhandler: ) 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 tog_object_set_property()
results innotify
being emitted, even if the new value is the same as the old. If they did passG_PARAM_EXPLICIT_NOTIFY
, then this signal is emitted only when they explicitly callg_object_notify()
org_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 underlyingnotify::toolbar-style
signalDeclaration
Swift
@discardableResult @inlinable func onNotifyToolbarStyle(flags: ConnectFlags = ConnectFlags(0), handler: @escaping (_ unownedSelf: ToolbarRef, _ 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
notifyToolbarStyle
signal is emitted -
notifyToolbarStyleSignal
Extension methodTyped
notify::toolbar-style
signal for using theconnect(signal:)
methodsDeclaration
Swift
static var notifyToolbarStyleSignal: ToolbarSignalName { get }
-
getDropIndex(x:
Extension methody: ) Returns the position corresponding to the indicated point on
toolbar
. This is useful when dragging items to the toolbar: this function returns the position a new item should be inserted.x
andy
are intoolbar
coordinates.Declaration
Swift
@inlinable func getDropIndex(x: Int, y: Int) -> Int
-
getIconSize()
Extension methodRetrieves the icon size for the toolbar. See
gtk_toolbar_set_icon_size()
.Declaration
Swift
@inlinable func getIconSize() -> GtkIconSize
-
getItemIndex(item:
Extension method) Returns the position of
item
on the toolbar, starting from 0. It is an error ifitem
is not a child of the toolbar.Declaration
Swift
@inlinable func getItemIndex<ToolItemT>(item: ToolItemT) -> Int where ToolItemT : ToolItemProtocol
-
getNItems()
Extension methodReturns the number of items on the toolbar.
Declaration
Swift
@inlinable func getNItems() -> Int
-
getNthItem(n:
Extension method) Returns the
n
‘th item ontoolbar
, ornil
if the toolbar does not contain ann
'th item.Declaration
Swift
@inlinable func getNthItem(n: Int) -> ToolItemRef!
-
getReliefStyle()
Extension methodReturns the relief style of buttons on
toolbar
. Seegtk_button_set_relief()
.Declaration
Swift
@inlinable func getReliefStyle() -> GtkReliefStyle
-
getShowArrow()
Extension methodReturns whether the toolbar has an overflow menu. See
gtk_toolbar_set_show_arrow()
.Declaration
Swift
@inlinable func getShowArrow() -> Bool
-
getStyle()
Extension methodRetrieves whether the toolbar has text, icons, or both . See
gtk_toolbar_set_style()
.Declaration
Swift
@inlinable func getStyle() -> GtkToolbarStyle
-
insert(item:
Extension methodpos: ) Insert a
GtkToolItem
into the toolbar at positionpos
. Ifpos
is 0 the item is prepended to the start of the toolbar. Ifpos
is negative, the item is appended to the end of the toolbar.Declaration
Swift
@inlinable func insert<ToolItemT>(item: ToolItemT, pos: Int) where ToolItemT : ToolItemProtocol
-
setDropHighlightItem(toolItem:
Extension methodindex: ) Highlights
toolbar
to give an idea of what it would look like ifitem
was added totoolbar
at the position indicated byindex_
. Ifitem
isnil
, highlighting is turned off. In that caseindex_
is ignored.The
tool_item
passed to this function must not be part of any widget hierarchy. When an item is set as drop highlight item it can not added to any widget hierarchy or used as highlight item for another toolbar.Declaration
Swift
@inlinable func setDropHighlightItem(toolItem: ToolItemRef? = nil, index: Int)
-
setDropHighlightItem(toolItem:
Extension methodindex: ) Highlights
toolbar
to give an idea of what it would look like ifitem
was added totoolbar
at the position indicated byindex_
. Ifitem
isnil
, highlighting is turned off. In that caseindex_
is ignored.The
tool_item
passed to this function must not be part of any widget hierarchy. When an item is set as drop highlight item it can not added to any widget hierarchy or used as highlight item for another toolbar.Declaration
Swift
@inlinable func setDropHighlightItem<ToolItemT>(toolItem: ToolItemT?, index: Int) where ToolItemT : ToolItemProtocol
-
set(iconSize:
Extension method) This function sets the size of stock icons in the toolbar. You can call it both before you add the icons and after they’ve been added. The size you set will override user preferences for the default icon size.
This should only be used for special-purpose toolbars, normal application toolbars should respect the user preferences for the size of icons.
Declaration
Swift
@inlinable func set(iconSize: GtkIconSize)
-
set(showArrow:
Extension method) Sets whether to show an overflow menu when
toolbar
isn’t allocated enough size to show all of its items. Iftrue
, items which can’t fit intoolbar
, and which have a proxy menu item set bygtk_tool_item_set_proxy_menu_item()
orGtkToolItem::create-menu-proxy
, will be available in an overflow menu, which can be opened by an added arrow button. Iffalse
,toolbar
will request enough size to fit all of its child items without any overflow.Declaration
Swift
@inlinable func set(showArrow: Bool)
-
set(style:
Extension method) Alters the view of
toolbar
to display either icons only, text only, or both.Declaration
Swift
@inlinable func set(style: GtkToolbarStyle)
-
unsetIconSize()
Extension methodUnsets toolbar icon size set with
gtk_toolbar_set_icon_size()
, so that user preferences will be used to determine the icon size.Declaration
Swift
@inlinable func unsetIconSize()
-
unsetStyle()
Extension methodUnsets a toolbar style set with
gtk_toolbar_set_style()
, so that user preferences will be used to determine the toolbar style.Declaration
Swift
@inlinable func unsetStyle()
-
iconSize
Extension methodRetrieves the icon size for the toolbar. See
gtk_toolbar_set_icon_size()
.Declaration
Swift
@inlinable var iconSize: GtkIconSize { get nonmutating set }
-
nItems
Extension methodReturns the number of items on the toolbar.
Declaration
Swift
@inlinable var nItems: Int { get }
-
reliefStyle
Extension methodReturns the relief style of buttons on
toolbar
. Seegtk_button_set_relief()
.Declaration
Swift
@inlinable var reliefStyle: GtkReliefStyle { get }
-
showArrow
Extension methodReturns whether the toolbar has an overflow menu. See
gtk_toolbar_set_show_arrow()
.Declaration
Swift
@inlinable var showArrow: Bool { get nonmutating set }
-
style
Extension methodRetrieves whether the toolbar has text, icons, or both . See
gtk_toolbar_set_style()
.Declaration
Swift
@inlinable var style: GtkToolbarStyle { get nonmutating set }
-
container
Extension methodUndocumented
Declaration
Swift
@inlinable var container: GtkContainer { get }