fltk::StringHierarchy Class Reference

Inherits fltk::List.

Inherited by fltk::StringList.

List of all members.


Detailed Description

This subclass of List allows a Menu or Browser to display strings that are generated at run time. This is the most efficient way to make hundreds of thousands of items.

Typically you will create a subclass with the children() and label() functions overridden, and make a single static instance of this class. It can be used by several menus, but the Menu* argument to children() and label() is used to differentiate them.


Public Member Functions

virtual Widgetchild (const Menu *, const int *indexes, int level)
virtual int children (const Menu *, const int *indexes, int level)=0
Widgetgenerated_item ()
virtual const char * label (const Menu *, const int *indexes, int level)=0


Member Function Documentation

Widget * StringHierarchy::generated_item  )  [inline]
 

Inside label() this points at the widget that will have the label set. This allows you to mess with the flags, font, user_data, etc of the widget. This widget is reused every time a new label is needed, so be sure to set everything on each call and do not assumme they have been put back to the default values.

If your items vary in vertical size, you must do generated_item()->h(0) in label(). This is unfortunate but it speeds up the common case where they all have the same height.

Convesely, setting w() will avoid the need to call measure() if the width is needed and you happen to know it.


Fri Apr 2 15:19:55 2010. FLTK ©2007 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.