NAME
Gtk2::Ex::ToolItem::CheckButton -- toolitem with Gtk2::CheckButton
SYNOPSIS
use App::MathImage::Gtk2::Ex::ToolItem::CheckButton;
my $toolitem = App::MathImage::Gtk2::Ex::ToolItem::CheckButton->new
(label => 'Foo',
active => 1); # initial state
WIDGET HIERARCHY
App::MathImage::Gtk2::Ex::ToolItem::CheckButton
is a subclass of Gtk2::ToolItem
,
Gtk2::Widget
Gtk2::Container
Gtk2::Bin
Gtk2::ToolItem
App::MathImage::Gtk2::Ex::ToolItem::CheckButton
and implements interfaces
Gtk2::Buildable (in Gtk 2.12 up)
DESCRIPTION
This is a ToolItem subclass holding a Gtk2::CheckButton
widget, and overflowing to a Gtk2::CheckMenuItem
in the toolbar overflow menu (when necessary).
+-------------+
| +-+ |
| |X| Label |
| +-+ |
+-------------+
It's similar to Gtk2::ToggleToolButton
, but the display is a CheckButton with a check box to tick instead of a ToggleButton style pushed in/out shadow. A shadow is good for a small icon, but for a word or two of text the check box makes it clearer there's something to click.
The CheckButton child can be accessed with $toolitem->get_child
in the usual way if desired, perhaps to set specific properties. See "BUILDABLE" below for doing the same from Gtk2::Builder
.
FUNCTIONS
App::MathImage::Gtk2::Ex::ToolItem::CheckButton->new (key=>value,...)
-
Create and return a new toolitem widget. Optional key/value pairs set initial properties as per
Glib::Object->new
.$toolitem = App::MathImage::Gtk2::Ex::ToolItem::CheckButton->new (label => 'Foo');
PROPERTIES
active
(boolean, default false)-
Whether the button is checked or not.
label
(string, default empty "")-
The label text to show in the item and in the overflow menu.
The usual widget sensitive
property automatically propagates to the overflow menu item.
The tooltip-text
property (new in Gtk 2.12) is propagated to the overflow menu item. It also works to put a tooltip on just the CheckButton child, which is not propagated.
BUILDABLE
App::MathImage::Gtk2::Ex::ToolItem::CheckButton
can be constructed with Gtk2::Builder
(new in Gtk 2.12). The class name is App__MathImage__Gtk2__Ex__ToolItem__CheckButton
and properties and signal handlers can be set in the usual way.
There's two "internal child" widgets available,
checkbutton Gtk2::CheckButton child
overflow_menuitem for the toolbar overflow
These can be used to set desired properties (those not otherwise offered from the ToolItem itself). Here's a sample fragment,
<object class="Gtk2__Ex__ToolItem__CheckButton" id="toolitem">
<child internal-child="checkbutton">
<object class="Gtk2__CheckButton" id="my_checkbutton">
<property name="yalign">0</property>
</object>
</child>
</object>
The internal-child
means <child>
is not creating a new child object, but accessing one already built. The id="my_checkbutton"
part is the name to refer to the child elsewhere in the Builder specification and any later $builder->get_object
. That id
setting must be present even if never used.
The overflow_menuitem
child has the effect of creating the overflow item, where normally that would be deferred until the toolbar needs an overflow (which might be never). But it can be used to apply property settings, similar to what might be done in code on a $toolitem->retrieve_proxy_menu_item
.
BUGS
As of Perl-Gtk 1.223 the Gtk2::Buildable
interface from Perl code doesn't chain up to the parent buildable methods, so some of GtkWidget specifics may be lost, such as the <accessibility>
tags.
SEE ALSO
Gtk2::ToggleToolButton, Gtk2::CheckButton, Gtk2::Ex::ToolItem::OverflowToDialog, Gtk2::Ex::ToolItem::ComboEnum
HOME PAGE
http://user42.tuxfamily.org/math-image/index.html
LICENSE
Copyright 2011 Kevin Ryde
Math-Image is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Math-Image is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Math-Image. If not, see http://www.gnu.org/licenses/.