A toolbar is created with a call to Gtk.Toolbar.Gtk_New.
A toolbar can contain instances of a subclass of Gtk.Tool_Item.Gtk_Tool_Item. To add a Gtk.Tool_Item.Gtk_Tool_Item 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 Gtk.Tool_Button.Gtk_Tool_Button.
Toolbar items can be visually grouped by adding instances of Gtk.Separator_Tool_Item.Gtk_Separator_Tool_Item to the toolbar. If the GtkToolbar child property "expand" is TRUE and the property Gtk.Separator_Tool_Item.Gtk_Separator_Tool_Item: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 Gtk.Tool_Item.Gtk_Tool_Item 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 Gtk.Toolbar.Gtk_Toolbar:show-arrow to False.
Creating a context menu for the toolbar can be done by connecting to the Gtk.Toolbar.Gtk_Toolbar::popup-context-menu signal.
# CSS nodes
GtkToolbar has a single CSS node with name toolbar.
function "+"
(Widget : access Gtk_Toolbar_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "+"
(Widget : access Gtk_Toolbar_Record'Class)
return Gtk.Orientable.Gtk_Orientable
function "+"
(Widget : access Gtk_Toolbar_Record'Class)
return Gtk.Tool_Shell.Gtk_Tool_Shell
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Toolbar
function "-"
(Interf : Gtk.Orientable.Gtk_Orientable)
return Gtk_Toolbar
function "-"
(Interf : Gtk.Tool_Shell.Gtk_Tool_Shell)
return Gtk_Toolbar
type Cb_GObject_Boolean_Boolean is not null access function
(Self : access Glib.Object.GObject_Record'Class;
Focus_Home : Boolean) return Boolean;
type Cb_GObject_Gint_Gint_Gint_Boolean is not null access function
(Self : access Glib.Object.GObject_Record'Class;
X : Glib.Gint;
Y : Glib.Gint;
Button : Glib.Gint) return Boolean;
type Cb_GObject_Gtk_Orientation_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Orientation : Gtk.Enums.Gtk_Orientation);
type Cb_GObject_Gtk_Toolbar_Style_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class;
Style : Gtk.Enums.Gtk_Toolbar_Style);
type Cb_Gtk_Toolbar_Boolean_Boolean is not null access function
(Self : access Gtk_Toolbar_Record'Class;
Focus_Home : Boolean) return Boolean;
type Cb_Gtk_Toolbar_Gint_Gint_Gint_Boolean is not null access function
(Self : access Gtk_Toolbar_Record'Class;
X : Glib.Gint;
Y : Glib.Gint;
Button : Glib.Gint) return Boolean;
type Cb_Gtk_Toolbar_Gtk_Orientation_Void is not null access procedure
(Self : access Gtk_Toolbar_Record'Class;
Orientation : Gtk.Enums.Gtk_Orientation);
type Cb_Gtk_Toolbar_Gtk_Toolbar_Style_Void is not null access procedure
(Self : access Gtk_Toolbar_Record'Class;
Style : Gtk.Enums.Gtk_Toolbar_Style);
function Get_Drop_Index
(Toolbar : not null access Gtk_Toolbar_Record;
X : Glib.Gint;
Y : Glib.Gint) return Glib.Gint
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 and Y are in Toolbar coordinates. Since: gtk+ 2.4
x coordinate of a point on the toolbar
y coordinate of a point on the toolbar
The position corresponding to the point (X, Y) on the toolbar.
function Get_Ellipsize_Mode
(Self : not null access Gtk_Toolbar_Record)
return Pango.Layout.Pango_Ellipsize_Mode
function Get_Icon_Size
(Toolbar : not null access Gtk_Toolbar_Record)
return Gtk.Enums.Gtk_Icon_Size
Retrieves the icon size for the toolbar. See Gtk.Toolbar.Set_Icon_Size.
the current icon size for the icons on the toolbar.
function Get_Item_Index
(Toolbar : not null access Gtk_Toolbar_Record;
Item : not null access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class)
return Glib.Gint
Returns the position of Item on the toolbar, starting from 0. It is an error if Item is not a child of the toolbar. Since: gtk+ 2.4
a Gtk.Tool_Item.Gtk_Tool_Item that is a child of Toolbar
the position of item on the toolbar.
function Get_N_Items
(Toolbar : not null access Gtk_Toolbar_Record) return Glib.Gint
Returns the number of items on the toolbar. Since: gtk+ 2.4
the number of items on the toolbar
function Get_Nth_Item
(Toolbar : not null access Gtk_Toolbar_Record;
N : Glib.Gint) return Gtk.Tool_Item.Gtk_Tool_Item
Returns the N'th item on Toolbar, or null if the toolbar does not contain an N'th item. Since: gtk+ 2.4
A position on the toolbar
The N'th Gtk.Tool_Item.Gtk_Tool_Item on Toolbar, or null if there isn't an N'th item.
function Get_Orientation
(Self : not null access Gtk_Toolbar_Record)
return Gtk.Enums.Gtk_Orientation
function Get_Relief_Style
(Toolbar : not null access Gtk_Toolbar_Record)
return Gtk.Enums.Gtk_Relief_Style
Returns the relief style of buttons on Toolbar. See Gtk.Button.Set_Relief. Since: gtk+ 2.4
The relief style of buttons on Toolbar.
function Get_Show_Arrow
(Toolbar : not null access Gtk_Toolbar_Record) return Boolean
Returns whether the toolbar has an overflow menu. See Gtk.Toolbar.Set_Show_Arrow. Since: gtk+ 2.4
True if the toolbar has an overflow menu.
function Get_Style
(Toolbar : not null access Gtk_Toolbar_Record)
return Gtk.Enums.Gtk_Toolbar_Style
Retrieves whether the toolbar has text, icons, or both . See Gtk.Toolbar.Set_Style.
the current style of Toolbar
function Get_Text_Alignment
(Self : not null access Gtk_Toolbar_Record) return Gfloat
function Get_Text_Orientation
(Self : not null access Gtk_Toolbar_Record)
return Gtk.Enums.Gtk_Orientation
function Get_Text_Size_Group
(Self : not null access Gtk_Toolbar_Record)
return Gtk.Size_Group.Gtk_Size_Group
function Get_Type return Glib.GType
procedure Gtk_New (Toolbar : out Gtk_Toolbar)
Creates a new toolbar. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
type Gtk_Toolbar is access all Gtk_Toolbar_Record'Class;
function Gtk_Toolbar_New return Gtk_Toolbar
Creates a new toolbar.
type Gtk_Toolbar_Record is new Gtk_Container_Record with null record;
Icon_Size_Property : constant Gtk.Enums.Property_Gtk_Icon_Size;
The size of the icons in a toolbar is normally determined by the toolbar-icon-size setting. When this property is set, it overrides the setting.
This should only be used for special-purpose toolbars, normal application toolbars should respect the user preferences for the size of icons.
Icon_Size_Set_Property : constant Glib.Properties.Property_Boolean;
Is True if the icon-size property has been set.
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Toolbar_Record, Gtk_Toolbar);
package Implements_Gtk_Orientable is new Glib.Types.Implements
(Gtk.Orientable.Gtk_Orientable, Gtk_Toolbar_Record, Gtk_Toolbar);
package Implements_Gtk_Tool_Shell is new Glib.Types.Implements
(Gtk.Tool_Shell.Gtk_Tool_Shell, Gtk_Toolbar_Record, Gtk_Toolbar);
procedure Initialize (Toolbar : not null access Gtk_Toolbar_Record'Class)
Creates a new toolbar. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure Insert
(Toolbar : not null access Gtk_Toolbar_Record;
Item : not null access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class;
Pos : Glib.Gint := -1)
Insert a Gtk.Tool_Item.Gtk_Tool_Item into the toolbar at position Pos. If Pos is 0 the item is prepended to the start of the toolbar. If Pos is negative, the item is appended to the end of the toolbar. Since: gtk+ 2.4
a Gtk.Tool_Item.Gtk_Tool_Item
the position of the new item
procedure On_Focus_Home_Or_End
(Self : not null access Gtk_Toolbar_Record;
Call : Cb_GObject_Boolean_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
A keybinding signal used internally by GTK+. This signal can't be used in application code
Callback parameters: -- @param Focus_Home True if the first item should be focused
procedure On_Focus_Home_Or_End
(Self : not null access Gtk_Toolbar_Record;
Call : Cb_Gtk_Toolbar_Boolean_Boolean;
After : Boolean := False)
A keybinding signal used internally by GTK+. This signal can't be used in application code
Callback parameters: -- @param Focus_Home True if the first item should be focused
procedure On_Orientation_Changed
(Self : not null access Gtk_Toolbar_Record;
Call : Cb_GObject_Gtk_Orientation_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the orientation of the toolbar changes.
procedure On_Orientation_Changed
(Self : not null access Gtk_Toolbar_Record;
Call : Cb_Gtk_Toolbar_Gtk_Orientation_Void;
After : Boolean := False)
Emitted when the orientation of the toolbar changes.
procedure On_Popup_Context_Menu
(Self : not null access Gtk_Toolbar_Record;
Call : Cb_GObject_Gint_Gint_Gint_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
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 and Y. The mouse button number is given by the Button parameter. If the menu was popped up using the keybaord, Button is -1.
Callback parameters: -- @param X the x coordinate of the point where the menu should appear -- @param Y the y coordinate of the point where the menu should appear -- @param Button the mouse button the user pressed, or -1
procedure On_Popup_Context_Menu
(Self : not null access Gtk_Toolbar_Record;
Call : Cb_Gtk_Toolbar_Gint_Gint_Gint_Boolean;
After : Boolean := False)
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 and Y. The mouse button number is given by the Button parameter. If the menu was popped up using the keybaord, Button is -1.
Callback parameters: -- @param X the x coordinate of the point where the menu should appear -- @param Y the y coordinate of the point where the menu should appear -- @param Button the mouse button the user pressed, or -1
procedure On_Style_Changed
(Self : not null access Gtk_Toolbar_Record;
Call : Cb_GObject_Gtk_Toolbar_Style_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the style of the toolbar changes.
procedure On_Style_Changed
(Self : not null access Gtk_Toolbar_Record;
Call : Cb_Gtk_Toolbar_Gtk_Toolbar_Style_Void;
After : Boolean := False)
Emitted when the style of the toolbar changes.
procedure Rebuild_Menu (Self : not null access Gtk_Toolbar_Record)
procedure Set_Drop_Highlight_Item
(Toolbar : not null access Gtk_Toolbar_Record;
Tool_Item : access Gtk.Tool_Item.Gtk_Tool_Item_Record'Class;
Index : Glib.Gint)
Highlights Toolbar to give an idea of what it would look like if Item was added to Toolbar at the position indicated by Index_. If Item is null, highlighting is turned off. In that case Index_ 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. Since: gtk+ 2.4
a Gtk.Tool_Item.Gtk_Tool_Item, or null to turn of highlighting
a position on Toolbar
procedure Set_Icon_Size
(Toolbar : not null access Gtk_Toolbar_Record;
Icon_Size : Gtk.Enums.Gtk_Icon_Size)
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.
The Gtk.Enums.Gtk_Icon_Size that stock icons in the toolbar shall have.
procedure Set_Orientation
(Self : not null access Gtk_Toolbar_Record;
Orientation : Gtk.Enums.Gtk_Orientation)
procedure Set_Show_Arrow
(Toolbar : not null access Gtk_Toolbar_Record;
Show_Arrow : Boolean := True)
Sets whether to show an overflow menu when Toolbar isn't allocated enough size to show all of its items. If True, items which can't fit in Toolbar, and which have a proxy menu item set by Gtk.Tool_Item.Set_Proxy_Menu_Item or Gtk.Tool_Item.Gtk_Tool_Item::create-menu-proxy, will be available in an overflow menu, which can be opened by an added arrow button. If False, Toolbar will request enough size to fit all of its child items without any overflow. Since: gtk+ 2.4
Whether to show an overflow menu
procedure Set_Style
(Toolbar : not null access Gtk_Toolbar_Record;
Style : Gtk.Enums.Gtk_Toolbar_Style)
Alters the view of Toolbar to display either icons only, text only, or both.
the new style for Toolbar.
Show_Arrow_Property : constant Glib.Properties.Property_Boolean;
Signal_Focus_Home_Or_End : constant Glib.Signal_Name := "focus-home-or-end";
A keybinding signal used internally by GTK+. This signal can't be used in application code
Callback parameters: -- @param Focus_Home True if the first item should be focused
Signal_Orientation_Changed : constant Glib.Signal_Name := "orientation-changed";
Emitted when the orientation of the toolbar changes.
Signal_Popup_Context_Menu : constant Glib.Signal_Name := "popup-context-menu";
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 and Y. The mouse button number is given by the Button parameter. If the menu was popped up using the keybaord, Button is -1.
Callback parameters: -- @param X the x coordinate of the point where the menu should appear -- @param Y the y coordinate of the point where the menu should appear -- @param Button the mouse button the user pressed, or -1
Signal_Style_Changed : constant Glib.Signal_Name := "style-changed";
Emitted when the style of the toolbar changes.
Toolbar_Style_Property : constant Gtk.Enums.Property_Gtk_Toolbar_Style;
procedure Unset_Icon_Size (Toolbar : not null access Gtk_Toolbar_Record)
Unsets toolbar icon size set with Gtk.Toolbar.Set_Icon_Size, so that user preferences will be used to determine the icon size.
procedure Unset_Style (Toolbar : not null access Gtk_Toolbar_Record)
Unsets a toolbar style set with Gtk.Toolbar.Set_Style, so that user preferences will be used to determine the toolbar style.