Here's some typical code you can use to create a status bar:
Sample implementation:
my_status_bar = new StatusBarGroup(24); my_status_bar->child_box(StatusBarGroup::SBAR_RIGHT, THIN_DOWN_BOX); //... more code ... // sets a right-aligned formatted text : my_status_bar->set(StatusBarGroup::SBAR_RIGHT, "%d items", count); // sets a centered text : my_status_bar->set("Hi", StatusBarGroup::SBAR_CENTER); //... more code ... // using a null or 0-len text removes the text box : my_status_bar->set(0, StatusBarGroup::SBAR_CENTER);
Public Types | |
| enum | Position { SBAR_LEFT, SBAR_CENTER, SBAR_RIGHT } |
Public Member Functions | |
| void | child_box (Box *b, Position i) |
| set a default box to text at particular position inside the status bar | |
| void | child_box (Box *b) |
| set a default box to all texts inside the status bar | |
| void | hide () |
| void | layout () |
| void | set (Position pos, const char *format,...) |
| sets the label at a particular pos, automatically handles alloc + drawing, variable parmeter format | |
| void | set (const char *t, Position pos=SBAR_RIGHT) |
| sets the label at a particular pos, automatically handles alloc + drawing | |
| void | show () |
| StatusBarGroup (int H=24) | |
| statusbar default constructor | |
| StatusBarGroup (int x, int y, int w, int h, const char *l=0, bool begin=false) | |
Static Public Attributes | |
| static NamedStyle * | default_style |
Protected Member Functions | |
| void | draw_label (Position pos, const char *label) |
| draw a label on a particular (left,middle, right) Position | |
| void | update_box (InvisibleBox *b, Position pos) |
| adapt box position and size according to Position pos and statusbar dimensions | |
| void StatusBarGroup::set | ( | StatusBarGroup::Position | pos, | |
| const char * | format, | |||
| ... | ||||
| ) |
sets the label at a particular pos, automatically handles alloc + drawing, variable parmeter format
set a formatable (printf-like) text in the status bar at a given Position 'pos' alignment spec.
References fltk::args().
| void StatusBarGroup::set | ( | const char * | t, | |
| StatusBarGroup::Position | pos = SBAR_RIGHT | |||
| ) |
sets the label at a particular pos, automatically handles alloc + drawing
set a simple string in the status bar at a given Position 'pos' alignment spec.
References fltk::Widget::align(), fltk::ALIGN_INSIDE, fltk::ALIGN_LEFT, fltk::Widget::copy_label(), fltk::Group::current(), fltk::Widget::redraw(), and update_box().
©2007 Bill Spitzak and others.