NAME
App::MathImage::Gtk2::Ex::ToolItem::OverflowToDialog -- toolitem overflowing to a dialog
SYNOPSIS
use App::MathImage::Gtk2::Ex::ToolItem::OverflowToDialog;
my $toolitem = App::MathImage::Gtk2::Ex::ToolItem::OverflowToDialog->new;
$toolitem->add ($child_widget);
WIDGET HIERARCHY
App::MathImage::Gtk2::Ex::ToolItem::OverflowToDialog
is a subclass of Gtk2::ToolItem
,
Gtk2::Widget
Gtk2::Container
Gtk2::Bin
Gtk2::ToolItem
App::MathImage::Gtk2::Ex::ToolItem::OverflowToDialog
DESCRIPTION
This ToolItem displays a given child widget in the usual way, and makes an overflow menu item to display it in a dialog if the toolbar is full.
Overflowing to a separate dialog for each toolitem widget is probably fantastic from a user interface point of view, but if you don't have any better ideas then it at least ensures the user can always access the item.
Check boxes, toggles, etc can be done directly in an overflow menu. See the usual Gtk2::ToggleToolButton, Gtk2::RadioToolButton, etc, or specifics like Gtk2::Ex::ToolItem::ComboEnum.
Implementation
The dialog works by reparenting the child widget to the dialog, and then putting it back in the toolitem when the dialog is closed or destroyed.
In the current code, when the dialog is open and the toolbar becomes big enough again to show the toolitem, the dialog is not immediately popped down. It may be difficult to be sure the child would be visible again, and if the toolbar size is jumping about then it might shortly be gone again, which could be very annoying for the user to lose the dialog.
Due to the reparenting, the child widget isn't in the usual $toolitem->get_child
(or get_children
, foreach
, etc). Perhaps this will change, but for now use the child-widget
property to get the child.
Use this child-widget
property to get the current child. When the child is reparented to the overflow dialog it doesn't appear in the otherwise usual $toolitem->get_child
or $toolitem->get_children
.
FUNCTIONS
App::MathImage::Gtk2::Ex::ToolItem::OverflowToDialog->new (key=>value,...)
-
Create and return a new toolitem widget. Optional key/value pairs set initial properties as per
Glib::Object->new
.
PROPERTIES
child-widget
(Gtk2::Widget
, defaultundef
)-
The child widget to show in the toolitem or dialog.
The usual
Gtk2::Container
child
property sets the child too. But it's write-only and can only store into an empty ToolItem, whereaschild-widget
is read/write and setting it replaces an existing child widget.The usual container
$toolitem->add($widget)
sets the child widget too, but again only into an empty ToolItem. overflow-mnemonic
(string, defaultundef
)-
A mnemonic string to show in the overflow menu item. It should have "_" undescores like "_Foo" with the "_F" meaning the "F" can be pressed to select the item. (Double underscore "__" is a literal underscore.)
The ToolItem sensitive
property is propagated to the overflow menu item and the dialog's child area. (The dialog close button remains sensitive.) Setting insensitive just on the child widget works too, but will leave the menu item sensitive. It's probably better to make the whole toolitem insensitive so the menu item is disabled too.
The ToolItem tooltip-text
property (new in Gtk 2.12) is copied to the dialog's child area. A tooltip can also be put just on the child widget too.