NAME
FLTK::Item - Widget designed to be a menu or browser item
Description
This widget is designed to be put into FLTK::Menu and FLTK::Browser widgets and draw plain-text items. All events are ignored, thus causing the menu and browser to set/clear the SELECTED
flag on these widgets. If they are selected they draw in the selection_color()
, otherwise in the color()
.
Functions
clear_style
$item->clear_style( );
-
Reset the style set by calling
set_style( )
.
default_style
my $style = $item->default_style( );
-
The default style sets
FLAT_BOX
. Changing this will mess up the appearance of both menus and browsers. All the rest of the style is blank, and normally it inherits from the current browser or menu, which should callset_style()
before drawing any items. $item->default_style( $style );
-
Set the style.
new
my $self = $item->new( $label );
-
Unlike other widgets the constructor does not take any dimensions, since it is assummed the container widget will size this correctly.
my $self = $item->new( $label, $image );
-
This constructor also sets the
image()
, useful for a browser item. my $self = $item->new( $label, $shortcut, \&callback, $user_data, $flags );
-
This constructor is provided to match the
Menu::add()
function arguments. SeeMenu::add()
for more details.
set_style
-
Modify the parent of the
Item::default_style
to this style. If no style settings have been done to an Item, it will use the textfont, textsize, textcolor, and possibly other settings inherited from this style to draw itself. This is used by menus and browsers to cause all the elements inside them to draw using their settings.The
menubar
flag causes it to mangle the style so that the buttonbox ofstyle
is used as the box, and the highlight_color is used as the selection_color. This is done to replicate the rather inconsistent appearance on Windows of menubars.Use
Item::clear_style()
to put this back so thatstyle
can be deleted. This is the same as setting it toWidget::default_style
. -
Use the style of this
widget
.
Author
Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
License and Legal
Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.org>
This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.
When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.