A ToolPalette is similar to a Toolbar but can contain a grid of items, categorized into groups. The user may hide or expand each group. As in a toolbar, the items may be displayed as only icons, as only text, or as icons with text.
The ToolPalette's items might be dragged or simply activated. For instance, the user might drag objects to a canvas to create new items there. Or the user might click an item to activate a certain brush size in a drawing application.
ToolItemGroups should be added to the tool palette via the base class's Gtk::Container::add() method, for instance like so:
Gtk::ToolItemGroup* group_brushes = Gtk::manage(new Gtk::ToolItemGroup("Brushes")); m_ToolPalette.add(*group_brushes);
Gtk::ToolItems can then be added to the group. For instance, like so:
Gtk::ToolButton* button = Gtk::manage(new Gtk::ToolButton(icon, "Big")); button->set_tooltip_text("Big Brush); group_brushes->insert(*button);
You might then handle the ToolButton's clicked signal. Alternatively, you could allow the item to be dragged to another widget, by calling Gtk::ToolPalette::add_drag_dest() and then using Gtk::ToolPalette::get_drag_item() in the other widget's drag_data_received signal handler.