gtkmm: Gtk::Toolbar Class Reference

gtkmm 3.1.6

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Related Functions
Gtk::Toolbar Class Reference
Widgets | Container Widgets

Bars of buttons and other widgets. More...

Inheritance diagram for Gtk::Toolbar:
[legend]
Collaboration diagram for Gtk::Toolbar:
[legend]

List of all members.

## Public Member Functions
virtual | ~Toolbar ()
GtkToolbar* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkToolbar* | gobj () const
| Provides access to the underlying C GtkObject.
| Toolbar ()
void | insert (ToolItem& item, int pos)
| Insert a Gtk::ToolItem into the toolbar at position pos.
void | insert (ToolButton& item, int pos, const sigc::slot< void >& clicked_slot)
void | insert (ToggleToolButton& item, int pos, const sigc::slot< void >& toggled_slot)
void | append (ToolItem& item)
void | append (ToolButton& item, const sigc::slot< void >& clicked_slot)
void | append (ToggleToolButton& item, const sigc::slot< void >& toggled_slot)
void | prepend (ToolItem& item)
void | prepend (ToolButton& item, const sigc::slot< void >& clicked_slot)
void | prepend (ToggleToolButton& item, const sigc::slot< void >& toggled_slot)
int | get_item_index (const ToolItem& item) const
| Returns the position of item on the toolbar, starting from 0.
int | get_n_items () const
| Returns the number of items on the toolbar.
ToolItem* | get_nth_item (int n)
| Returns the n'th item on toolbar, or `0` if the toolbar does not contain an n'th item.
const ToolItem* | get_nth_item (int n) const
| Returns the n'th item on toolbar, or `0` if the toolbar does not contain an n'th item.
bool | get_show_arrow () const
| Returns whether the toolbar has an overflow menu.
void | set_show_arrow (bool show_arrow=true)
| Sets whether to show an overflow menu when toolbar doesn't have room for all items on it.
void | set_toolbar_style (ToolbarStyle style)
| Alters the view of toolbar to display either icons only, text only, or both.
ToolbarStyle | get_toolbar_style () const
| Retrieves whether the toolbar has text, icons, or both .
void | unset_toolbar_style ()
| Unsets a toolbar style set with set_style(), so that user preferences will be used to determine the toolbar style.
void | set_icon_size (IconSize icon_size)
| This function sets the size of stock icons in the toolbar.
void | unset_icon_size ()
| Unsets toolbar icon size set with set_icon_size(), so that user preferences will be used to determine the icon size.
IconSize | get_icon_size () const
| Retrieves the icon size for the toolbar.
ReliefStyle | get_relief_style () const
| Returns the relief style of buttons on toolbar.
int | get_drop_index (int x, int y) const
| Returns the position corresponding to the indicated point on toolbar.
void | set_drop_highlight_item (ToolItem& tool_item, int index)
| Highlights toolbar to give an idea of what it would look like if item was added to toolbar at the position indicated by index.
void | unset_drop_highlight_item ()
Glib::SignalProxy1< void, Orientation > | signal_orientation_changed ()
| Emitted when the orientation of the toolbar changes.
Glib::SignalProxy1< void, ToolbarStyle > | signal_toolbar_style_changed ()
| Emitted when the style of the toolbar changes.
Glib::SignalProxy3< bool, int, int, int > | signal_popup_context_menu ()
| Emitted when the user right-clicks the toolbar or uses the keybinding to display a popup menu.
Glib::PropertyProxy< Orientation > | property_orientation ()
| The orientation of the orientable.
Glib::PropertyProxy_ReadOnly < Orientation > | property_orientation () const
| The orientation of the orientable.
Glib::PropertyProxy< ToolbarStyle > | property_toolbar_style ()
| How to draw the toolbar.
Glib::PropertyProxy_ReadOnly < ToolbarStyle > | property_toolbar_style () const
| How to draw the toolbar.
Glib::PropertyProxy< bool > | property_show_arrow ()
| If an arrow should be shown if the toolbar doesn't fit.
Glib::PropertyProxy_ReadOnly < bool > | property_show_arrow () const
| If an arrow should be shown if the toolbar doesn't fit.
Glib::PropertyProxy< IconSize > | property_icon_size ()
| Size of icons in this toolbar.
Glib::PropertyProxy_ReadOnly < IconSize > | property_icon_size () const
| Size of icons in this toolbar.
Glib::PropertyProxy< bool > | property_icon_size_set ()
| Whether the icon-size property has been set.
Glib::PropertyProxy_ReadOnly < bool > | property_icon_size_set () const
| Whether the icon-size property has been set.
## Protected Member Functions
virtual void | on_orientation_changed (Orientation orientation)
virtual void | on_toolbar_style_changed (ToolbarStyle style)
virtual bool | on_popup_context_menu (int x, int y, int button_number)
## Related Functions
(Note that these are not member functions.)
Gtk::Toolbar* | wrap (GtkToolbar* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Bars of buttons and other widgets.

## Constructor & Destructor Documentation

virtual Gtk::Toolbar::~Toolbar | ( |  | ) | `[virtual]`

Gtk::Toolbar::Toolbar | ( |  | ) |

## Member Function Documentation

void Gtk::Toolbar::append | ( | ToolItem& | item | ) |

void Gtk::Toolbar::append | ( | ToolButton& | item,
|  | const sigc::slot< void > & | clicked_slot
| ) |  |

void Gtk::Toolbar::append | ( | ToggleToolButton& | item,
|  | const sigc::slot< void > & | toggled_slot
| ) |  |

int Gtk::Toolbar::get_drop_index | ( | int | x,
|  | int | y
| ) |  | const

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 gtkmm 2.4:

Parameters:

  x | X coordinate of a point on the toolbar.
  y | Y coordinate of a point on the toolbar.

Returns:
  The position corresponding to the point ( x, y) on the toolbar.

IconSize Gtk::Toolbar::get_icon_size | ( |  | ) | const

Retrieves the icon size for the toolbar.

See set_icon_size().

Returns:
  The current icon size for the icons on the toolbar.

Reimplemented from Gtk::ToolShell.

int Gtk::Toolbar::get_item_index | ( | const ToolItem& | item | ) | const

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 gtkmm 2.4:

Parameters:

  item | A Gtk::ToolItem that is a child of toolbar.

Returns:
  The position of item on the toolbar.

int Gtk::Toolbar::get_n_items | ( |  | ) | const

Returns the number of items on the toolbar.

Since gtkmm 2.4:

Returns:
  The number of items on the toolbar.

ToolItem* Gtk::Toolbar::get_nth_item | ( | int | n | ) |

Returns the n'th item on toolbar, or `0` if the toolbar does not contain an n'th item.

Since gtkmm 2.4:

Parameters:

  n | A position on the toolbar.

Returns:
  The n'th Gtk::ToolItem on toolbar, or `0` if there isn't an n'th item.

const ToolItem* Gtk::Toolbar::get_nth_item | ( | int | n | ) | const

Returns the n'th item on toolbar, or `0` if the toolbar does not contain an n'th item.

Since gtkmm 2.4:

Parameters:

  n | A position on the toolbar.

Returns:
  The n'th Gtk::ToolItem on toolbar, or `0` if there isn't an n'th item.

ReliefStyle Gtk::Toolbar::get_relief_style | ( |  | ) | const

Returns the relief style of buttons on toolbar.

See Gtk::Button::set_relief().

Since gtkmm 2.4:

Returns:
  The relief style of buttons on toolbar.

Reimplemented from Gtk::ToolShell.

bool Gtk::Toolbar::get_show_arrow | ( |  | ) | const

Returns whether the toolbar has an overflow menu.

See set_show_arrow().

Since gtkmm 2.4:

Returns:
  `true` if the toolbar has an overflow menu.

ToolbarStyle Gtk::Toolbar::get_toolbar_style | ( |  | ) | const

Retrieves whether the toolbar has text, icons, or both .

See set_style().

Returns:
  The current style of toolbar.

const GtkToolbar* Gtk::Toolbar::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

GtkToolbar* Gtk::Toolbar::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Container.

void Gtk::Toolbar::insert | ( | ToggleToolButton& | item,
|  | int | pos,
|  | const sigc::slot< void > & | toggled_slot
| ) |  |

void Gtk::Toolbar::insert | ( | ToolItem& | item,
|  | int | pos
| ) |  |

Insert a Gtk::ToolItem 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 gtkmm 2.4:

Parameters:

  item | A Gtk::ToolItem.
  pos | The position of the new item.

void Gtk::Toolbar::insert | ( | ToolButton& | item,
|  | int | pos,
|  | const sigc::slot< void > & | clicked_slot
| ) |  |

virtual void Gtk::Toolbar::on_orientation_changed | ( | Orientation | orientation | ) | `[protected, virtual]`

virtual bool Gtk::Toolbar::on_popup_context_menu | ( | int | x,
|  | int | y,
|  | int | button_number
| ) |  | `[protected, virtual]`

virtual void Gtk::Toolbar::on_toolbar_style_changed | ( | ToolbarStyle | style | ) | `[protected, virtual]`

void Gtk::Toolbar::prepend | ( | ToolItem& | item | ) |

void Gtk::Toolbar::prepend | ( | ToolButton& | item,
|  | const sigc::slot< void > & | clicked_slot
| ) |  |

void Gtk::Toolbar::prepend | ( | ToggleToolButton& | item,
|  | const sigc::slot< void > & | toggled_slot
| ) |  |

Glib::PropertyProxy<IconSize> Gtk::Toolbar::property_icon_size | ( |  | ) |

Size of icons in this toolbar.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<IconSize> Gtk::Toolbar::property_icon_size | ( |  | ) | const

Size of icons in this toolbar.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Toolbar::property_icon_size_set | ( |  | ) |

Whether the icon-size property has been set.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Toolbar::property_icon_size_set | ( |  | ) | const

Whether the icon-size property has been set.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Orientation> Gtk::Toolbar::property_orientation | ( |  | ) |

The orientation of the orientable.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Orientation> Gtk::Toolbar::property_orientation | ( |  | ) | const

The orientation of the orientable.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::Toolbar::property_show_arrow | ( |  | ) |

If an arrow should be shown if the toolbar doesn't fit.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gtk::Toolbar::property_show_arrow | ( |  | ) | const

If an arrow should be shown if the toolbar doesn't fit.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<ToolbarStyle> Gtk::Toolbar::property_toolbar_style | ( |  | ) |

How to draw the toolbar.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<ToolbarStyle> Gtk::Toolbar::property_toolbar_style | ( |  | ) | const

How to draw the toolbar.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::Toolbar::set_drop_highlight_item | ( | ToolItem& | tool_item,
|  | int | index
| ) |  |

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 `0`, 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 gtkmm 2.4:

Parameters:

  tool_item | A Gtk::ToolItem, or `0` to turn of highlighting.
  index | A position on toolbar.

void Gtk::Toolbar::set_icon_size | ( | IconSize | 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.

Since gtkmm 2.12:

Parameters:

  icon_size | The Gtk::IconSize that stock icons in the toolbar shall have.

void Gtk::Toolbar::set_show_arrow | ( | bool | show_arrow = `true` | ) |

Sets whether to show an overflow menu when toolbar doesn't have room for all items on it.

If `true`, items that there are not room are available through an overflow menu.

Since gtkmm 2.4:

Parameters:

  show_arrow | Whether to show an overflow menu.

void Gtk::Toolbar::set_toolbar_style | ( | ToolbarStyle | style | ) |

Alters the view of toolbar to display either icons only, text only, or both.

Parameters:

  style | The new style for toolbar.

Glib::SignalProxy1< void,Orientation > Gtk::Toolbar::signal_orientation_changed | ( |  | ) |

Emitted when the orientation of the toolbar changes.

Parameters:

  orientation | The new Orientation of the toolbar.

Prototype:
  `void on_my_orientation_changed(Orientation orientation)`

Glib::SignalProxy3< bool,int,int,int > Gtk::Toolbar::signal_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 keyboard, button is -1.

Parameters:

  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 true if the signal was handled, false if not.

Prototype:
  `bool on_my_popup_context_menu(int x, int y, int button_number)`

Glib::SignalProxy1< void,ToolbarStyle > Gtk::Toolbar::signal_toolbar_style_changed | ( |  | ) |

Emitted when the style of the toolbar changes.

Parameters:

  @style | The new ToolbarStyle of the toolbar.

Prototype:
  `void on_my_toolbar_style_changed(ToolbarStyle style)`

void Gtk::Toolbar::unset_drop_highlight_item | ( |  | ) |

void Gtk::Toolbar::unset_icon_size | ( |  | ) |

Unsets toolbar icon size set with set_icon_size(), so that user preferences will be used to determine the icon size.

Since gtkmm 2.12:

void Gtk::Toolbar::unset_toolbar_style | ( |  | ) |

Unsets a toolbar style set with set_style(), so that user preferences will be used to determine the toolbar style.

## Friends And Related Function Documentation

Gtk::Toolbar* wrap | ( | GtkToolbar * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/toolbar.h