Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes

YAPET::UI::CheckBoxGroup Class Reference

A group of check boxes. More...

#include <checkboxgroup.h>

Collaboration diagram for YAPET::UI::CheckBoxGroup:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CheckBoxGroup (std::string t, const std::vector< std::string > &it, uint16_t o, int x, int y, int w, int h) throw (UIException)
 Constructor.
int focus () throw (UIException)
 Focus the widget.
int getHeight () const
uint16_t getOptions () const
void refresh () throw (UIException)
void resize (int sx, int sy, int w, int h) throw (UIException)
virtual ~CheckBoxGroup ()

Protected Member Functions

void createWindow () throw (UIException)

Private Types

enum  { BASE_HEIGHT = 2, BASE_WIDTH = 8, MAX_ITEMS = 15 }

Private Member Functions

void addCheckBox (int pos) throw (UIException)
 CheckBoxGroup (const CheckBoxGroup &)
void displayItems () throw (UIException)
int ItemsUsableHeight () const
int ItemsUsableWidth () const
int lastItemPos () const
 Last position of visible item.
const CheckBoxGroupoperator= (const CheckBoxGroup &)
void setCheckMark (int pos) throw (UIException)
 Set/unset check mark.
void setCheckMark (int pos, bool mark) throw (UIException)
 Set/unset check mark.
void setCursor (int pos) throw (UIException)

Private Attributes

int height
std::vector< std::string > items
uint16_t options
int start_x
int start_y
std::string title
 Title of the group.
int width
WINDOW * window

Detailed Description

Displays a group of checkboxes, where each check boc can be individually checked or unchecked. It returns a bit mask representing the checked boxes set to 1 according to their positions on the screen for the caller to find out which check boxes are marked (First checkbox has first bit set (unset), second checkbox has second bit set unset ...).

KEY_UP, 'k', KEY_DOWN, 'j', KEY_TAB are selection movement keys. KEY_ESC, KEY_RESIZE will make it loose focus. KEY_ENTER, KEY_SPACE will mark/unmark check box.

A maximum of 16 check boxes are supported.

Definition at line 74 of file checkboxgroup.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
BASE_HEIGHT 
BASE_WIDTH 
MAX_ITEMS 

Definition at line 76 of file checkboxgroup.h.


Constructor & Destructor Documentation

YAPET::UI::CheckBoxGroup::CheckBoxGroup ( const CheckBoxGroup  )  [inline, private]

Definition at line 107 of file checkboxgroup.h.

CheckBoxGroup::CheckBoxGroup ( std::string  t,
const std::vector< std::string > &  it,
uint16_t  o,
int  x,
int  y,
int  w,
int  h 
) throw (UIException)

Constructor.

Parameters:
t the title of the group
it the check box items
o uint16_t holding the selected checkboxes. May be 0.
x the x start position
y the y start position
w the width of the widget
h the height of the widget

Definition at line 123 of file checkboxgroup.cc.

CheckBoxGroup::~CheckBoxGroup (  )  [virtual]

Definition at line 146 of file checkboxgroup.cc.

References window.


Member Function Documentation

void CheckBoxGroup::addCheckBox ( int  pos  )  throw (UIException) [private]

Definition at line 55 of file checkboxgroup.cc.

Referenced by displayItems().

Here is the caller graph for this function:

void CheckBoxGroup::createWindow (  )  throw (UIException) [protected]

Definition at line 110 of file checkboxgroup.cc.

References YAPET::UI::CHECKBOXGROUP, height, YAPET::UI::Colors::setcolor(), start_x, start_y, width, and window.

Here is the call graph for this function:

void CheckBoxGroup::displayItems (  )  throw (UIException) [private]

Definition at line 94 of file checkboxgroup.cc.

References addCheckBox(), items, ItemsUsableWidth(), lastItemPos(), setCheckMark(), and window.

Referenced by refresh().

Here is the call graph for this function:

Here is the caller graph for this function:

int CheckBoxGroup::focus (  )  throw (UIException)

Focus the widget.

KEY_UP, 'k', KEY_DOWN, 'j', KEY_TAB are selection movement keys. KEY_ESC, KEY_RESIZE will make it loose focus. KEY_ENTER, KEY_SPACE will mark/unmark check box.

Returns:
the key that made the widget loose the focus, either KEY_TAB, KEY_RESIZE, or KEY_ESC

Definition at line 192 of file checkboxgroup.cc.

References KEY_ESC, KEY_REFRESH, KEY_SPACE, KEY_TAB, lastItemPos(), options, refresh(), YAPET::UI::BaseWindow::refreshAll(), setCheckMark(), visibleCursor(), and window.

Referenced by PWGenDialog::run().

Here is the call graph for this function:

Here is the caller graph for this function:

int YAPET::UI::CheckBoxGroup::getHeight (  )  const [inline]

Definition at line 185 of file checkboxgroup.h.

References BASE_HEIGHT, and items.

uint16_t YAPET::UI::CheckBoxGroup::getOptions (  )  const [inline]

Definition at line 189 of file checkboxgroup.h.

References options.

Referenced by PWGenDialog::run(), and PWGenDialog::~PWGenDialog().

Here is the caller graph for this function:

int CheckBoxGroup::ItemsUsableHeight (  )  const [inline, private]

Definition at line 43 of file checkboxgroup.cc.

References height.

Referenced by lastItemPos().

Here is the caller graph for this function:

int CheckBoxGroup::ItemsUsableWidth (  )  const [inline, private]

Definition at line 38 of file checkboxgroup.cc.

References width.

Referenced by displayItems().

Here is the caller graph for this function:

int CheckBoxGroup::lastItemPos (  )  const [inline, private]

The last (maximum) position of visible item

Definition at line 48 of file checkboxgroup.cc.

References items, ItemsUsableHeight(), and MAX_ITEMS.

Referenced by displayItems(), and focus().

Here is the call graph for this function:

Here is the caller graph for this function:

const CheckBoxGroup& YAPET::UI::CheckBoxGroup::operator= ( const CheckBoxGroup  )  [inline, private]

Definition at line 108 of file checkboxgroup.h.

void CheckBoxGroup::refresh (  )  throw (UIException)

Definition at line 152 of file checkboxgroup.cc.

References box(), YAPET::UI::CHECKBOXGROUP, YAPET::UI::CHECKBOXGROUP_TITLE, displayItems(), YAPET::UI::MESSAGEBOX, YAPET::UI::Colors::setcolor(), title, and window.

Referenced by focus(), and PWGenDialog::refresh().

Here is the call graph for this function:

Here is the caller graph for this function:

void CheckBoxGroup::resize ( int  sx,
int  sy,
int  w,
int  h 
) throw (UIException)

Definition at line 257 of file checkboxgroup.cc.

void CheckBoxGroup::setCheckMark ( int  pos  )  throw (UIException) [private]

Automatically set/unset the check mark on the given position depending on the value of options.

Parameters:
pos the position (0 .. 15) check box

Definition at line 79 of file checkboxgroup.cc.

void CheckBoxGroup::setCheckMark ( int  pos,
bool  mark 
) throw (UIException) [private]

Set/unset check mark on the given position.

Parameters:
pos the position (0 .. 15) check box
mark set (true) / unset (false) mark.

Definition at line 67 of file checkboxgroup.cc.

Referenced by displayItems(), and focus().

Here is the caller graph for this function:

void CheckBoxGroup::setCursor ( int  pos  )  throw (UIException) [private]

Definition at line 85 of file checkboxgroup.cc.


Member Data Documentation

Definition at line 105 of file checkboxgroup.h.

Referenced by createWindow(), and ItemsUsableHeight().

std::vector<std::string> YAPET::UI::CheckBoxGroup::items [private]

@ brief the items

The list of items. If there are more as 16 [sizeof(uint16_t)] items, only the first 16 are displayed.

Definition at line 98 of file checkboxgroup.h.

Referenced by displayItems(), getHeight(), and lastItemPos().

Definition at line 100 of file checkboxgroup.h.

Referenced by focus(), and getOptions().

Definition at line 102 of file checkboxgroup.h.

Referenced by createWindow().

Definition at line 103 of file checkboxgroup.h.

Referenced by createWindow().

std::string YAPET::UI::CheckBoxGroup::title [private]

Title of the group

Definition at line 90 of file checkboxgroup.h.

Referenced by refresh().

Definition at line 104 of file checkboxgroup.h.

Referenced by createWindow(), and ItemsUsableWidth().

Definition at line 83 of file checkboxgroup.h.

Referenced by createWindow(), displayItems(), focus(), refresh(), and ~CheckBoxGroup().


The documentation for this class was generated from the following files: