NAME
App::MathImage::Gtk2::Ex::ComboBox::EnumValues -- combobox for values of a Glib::Enum
SYNOPSIS
use App::MathImage::Gtk2::Ex::ComboBox::EnumValues;
my $combo = App::MathImage::Gtk2::Ex::ComboBox::EnumValues->new
(enum_type => 'Glib::UserDirectory',
active_nick => 'home'); # initial selection
WIDGET HIERARCHY
App::MathImage::Gtk2::Ex::ComboBox::EnumValues is a subclass of Gtk2::ComboBox,
Gtk2::Widget
Gtk2::Container
Gtk2::Bin
Gtk2::ComboBox
App::MathImage::Gtk2::Ex::ComboBox::EnumValues
DESCRIPTION
App::MathImage::Gtk2::Ex::ComboBox::EnumValues displays the values of a Glib::Enum. The active-nick property is the user's selection. The usual ComboBox active property row number works too, but the nick is normally the useful bit.
The text shown for each entry is per App::MathImage::Glib::Ex::EnumBits::to_text(), so a particular enum class can control how its values appear or the default is a sensible word split and capitalization.
FUNCTIONS
$combobox = App::MathImage::Gtk2::Ex::ComboBox::EnumValues->new (key=>value,...)-
Create and return a new
EnumValuescombobox object. Optional key/value pairs set initial properties perGlib::Object->new.my $combo = App::MathImage::Gtk2::Ex::ComboBox::EnumValues->new (enum_type => 'Gtk2::TextDirection', active => 0); # the first row
PROPERTIES
enum-type(type, defaultundef)-
The enum type to display and select from. Until this is set the ComboBox is empty.
When changing
enum-typeif the current selectedactive-nickalso exists in the new type then it remains selected, possibly on a different row. If theactive-nickdoesn't exist in the new type then the combobox changes to nothing selected. active-nick(string or undef, 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 combobox or no
enum-typehas been set thenactive-nickisundef.There's no default for
active-nick, just as there's no default for the ComboBoxactive, so when creating an EnumValues combobox it's usual to set the desired initial value, either by nick or perhaps justactiverow 0 for the first value.
SIGNALS
nick-to-text(parameters: combobox, nick -- return: string)-
Emitted to turn an enum nick into a text display string. The default is the
to_textofGlib::Ex::EnumBits.
OTHER NOTES
The enum-type property is a Glib::Param::GType in Glib-Perl 1.240 and up where that ParamSpec is available, or a plain string otherwise. At the Perl level both are strings, but the GType spec checks a setting really is a Glib::Enum sub-type.