Doxygen Fl_Multi_Label example code added. (STR #3400)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12445 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2017-09-11 21:27:53 +00:00
parent 3d90148065
commit 3fe7b8c396
1 changed files with 25 additions and 1 deletions

View File

@ -43,7 +43,31 @@ struct Fl_Menu_Item;
When assigning a label element to one of labela or labelb, they should be explicitly cast
to (const char*) if they are not of that type already.
\see Fl_Label and Fl_Labeltype
Example Use: Fl_Menu_Bar
\code
Fl_Pixmap *image = new Fl_Pixmap(..); // image for menu item; can be any Fl_Image based widget
Fl_Menu_Bar *menu = new Fl_Menu_Bar(..); // can be any Fl_Menu_ oriented widget (Fl_Choice, Fl_Menu_Button..)
// Create a menu item
int i = menu->add("File/New", ..);
Fl_Menu_Item *item = (Fl_Menu_Item*)&(menu->menu()[i]);
// Create a multi label, assign it an image + text
Fl_Multi_Label *ml = new Fl_Multi_Label;
// Left side of label is an image
ml->typea = FL_IMAGE_LABEL;
ml->labela = (const char*)image;
// Right side of label is label text
ml->typeb = FL_NORMAL_LABEL;
ml->labelb = item->label();
// Assign the multilabel to the menu item
ml->label(item);
\endcode
\see Fl_Label and Fl_Labeltype and examples/howto-menu-with-images.cxx
*/
struct FL_EXPORT Fl_Multi_Label {
/** Holds the "leftmost" of the two elements in the composite label.