fltk::Item Class Reference

Inherits fltk::Widget.

Inherited by FileItem, fltk::RadioItem, and fltk::ToggleItem.

List of all members.

Public Member Functions

void draw ()
int handle (int)
 Item (const char *label, const Symbol *)
 Item (const char *label=0)
 Item (const char *label, int shortcut, Callback *callback=0, void *user_data_=0, int flags=0)
void layout ()

Static Public Member Functions

static void set_style (const Style *, bool menubar)

Static Public Attributes

static NamedStyledefault_style = &::style

Detailed 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().


Constructor & Destructor Documentation

Item::Item ( const char *  l = 0)

Unlike other widgets the constructor does not take any dimensions, since it is assummed the container widget will size this correctly.

Item::Item ( const char *  l,
const Symbol i 
)

This constructor also sets the image(), useful for a browser item.

Item::Item ( const char *  l,
int  s,
Callback cb = 0,
void *  ud = 0,
int  f = 0 
)

This constructor is provided to match the Menu::add() function arguments. See Menu::add() for more details.


Member Function Documentation

void Item::draw ( void  ) [virtual]

The SELECTED flag will cause it to draw using the selected colors.

The current version can also draw check or radio buttons but this functionality may be removed.

Reimplemented from fltk::Widget.

int Item::handle ( int  event) [virtual]

Returns 0 always. Items do not accept any events. Any results of clicking on them is handled by the parent Menu or Browser.

Reimplemented from fltk::Widget.

void Item::layout ( ) [virtual]

Measure the space the draw() will take and set w() and h(). Maybe this should be the default layout() function for Widget?

Reimplemented from fltk::Widget.

void Item::set_style ( const Style style,
bool  menubar 
) [static]

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 of style 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 that style can be deleted. This is the same as setting it to Widget::default_style.


Member Data Documentation

NamedStyle * Item::default_style = &::style [static]

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 call set_style() before drawing any items.

Reimplemented from fltk::Widget.


The documentation for this class was generated from the following files: