fltk::StatusBarGroup Class Reference

Inherits fltk::Group.

List of all members.

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 NamedStyledefault_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


Detailed Description

This class permits to create and handle a statusbar with minimum efforts.
It features automatic positionning and resizing adapting to parent Group/Window.
Only height matters when constructing a StatusBarGroup.
You can use the set() API's to easily print formatted text at one of the three standard position : left, center right.
You can also setup an optional custom box to the incorporated texts with child_box(), by default FLAT_BOX is used.
The StatusBarGroup widget can also be visually created in Fluid2.

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); 

Member Enumeration Documentation

Enumerator:
SBAR_LEFT  statusbar text left-aligned
SBAR_CENTER  statusbar text centered
SBAR_RIGHT  statusbar text right-aligned (default)


Member Function Documentation

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

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


Wed Jun 17 08:58:25 2009. 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.