Item Class Reference

Inherits Widget.

Inherited by FileItem, RadioItem, and ToggleItem.

List of all members.

Public Member Functions

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

Static Public Member Functions

void set_style (const Style *, bool menubar)
void set_style (const Widget *w, bool f)
void clear_style ()

Static Public Attributes

NamedStyledefault_style


Detailed Description

This widget is designed to be put into Menu and 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. Focusbox is also drawn if FOCUSED is on.

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

Reimplemented from Widget.

int Item::handle int   )  [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 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 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 [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 Widget.


The documentation for this class was generated from the following files:
Sun Jan 7 00:55:17 2007. FLTK ©2006 Bill Spitzak and others.
Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.