NAME
App::MathImage::Gtk2::Ex::Menu::EnumRadio -- menu of enum value radio items
SYNOPSIS
use App::MathImage::Gtk2::Ex::Menu::EnumRadio;
my $menu = App::MathImage::Gtk2::Ex::Menu::EnumRadio->new
(enum_type => 'Glib::UserDirectory',
active_nick => 'home'); # initial selection
WIDGET HIERARCHY
App::MathImage::Gtk2::Ex::Menu::EnumRadio
is a subclass of Gtk2::Menu
,
Gtk2::Widget
Gtk2::Container
Gtk2::MenuShell
Gtk2::Menu
App::MathImage::Gtk2::Ex::Menu::EnumRadio
DESCRIPTION
App::MathImage::Gtk2::Ex::Menu::EnumRadio
displays the values of a Glib::Enum
in a radio group. The active-nick
property is the user's selection.
The text shown for each entry is per to_display
of Glib::Ex::EnumBits, so an enum class can arrange how its values appear, or the default is a sensible word split and capitalization.
(There's a secret experimental might change in the future nick-to-display
signal for per-instance control of the display. A signal is a good way to express a callback, but some care may be needed to get it connected early enough, or for the calls to be later than when enum-type
is set, since that property will often be set before making signal connections.)
FUNCTIONS
-
Create and return a new
EnumRadio
menu object. Optional key/value pairs set initial properties perGlib::Object->new
.my $menu = App::MathImage::Gtk2::Ex::Menu::EnumRadio->new (enum_type => 'Gtk2::TextDirection', active_nick => 'ltr');
PROPERTIES
enum-type
(type name, defaultundef
)-
The enum type to display and select from. Until this is set the Menu is empty.
When changing
enum-type
if the current selectedactive-nick
also exists in the new type then it remains selected, possibly on a different row. If theactive-nick
doesn't exist in the new type then the menu changes to nothing selected.This property is a
Glib::Param::GType
in Glib 2.10 and Glib-Perl 1.240 where that ParamSpec is available, or a plain string otherwise. At the Perl level a GType is a string anyway, but a GType pspec checks a setting really is aGlib::Enum
sub-type. active-nick
(string orundef
, defaultundef
)-
The nick of the selected enum value. The nick is the usual way an enum value appears at the Perl level.
If there's no active row in the menu or no
enum-type
has been set thenactive-nick
isundef
.There's no default for
active-nick
, so when creating an Enum menu it's usual to set the desired initial selection, either by nick or perhaps justactive
row 0 for the first value.
BUGS
There's no way to set mnemonics for each enum value. A semi-automatic way to pick sensible ones might be good.
SEE ALSO
Gtk2::Menu, Glib::Ex::EnumBits
HOME PAGE
http://user42.tuxfamily.org/math-image/index.html
LICENSE
Copyright 2010 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/.