A group of check boxes. More...
#include <checkboxgroup.h>

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 CheckBoxGroup & | operator= (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 |
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.
anonymous enum [private] |
Definition at line 76 of file checkboxgroup.h.
| 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.
| 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.
| void CheckBoxGroup::addCheckBox | ( | int | pos | ) | throw (UIException) [private] |
Definition at line 55 of file checkboxgroup.cc.
Referenced by displayItems().

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

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


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


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

| int CheckBoxGroup::ItemsUsableHeight | ( | ) | const [inline, private] |
Definition at line 43 of file checkboxgroup.cc.
References height.
Referenced by lastItemPos().

| int CheckBoxGroup::ItemsUsableWidth | ( | ) | const [inline, private] |
Definition at line 38 of file checkboxgroup.cc.
References width.
Referenced by displayItems().

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


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


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

| void CheckBoxGroup::setCursor | ( | int | pos | ) | throw (UIException) [private] |
Definition at line 85 of file checkboxgroup.cc.
int YAPET::UI::CheckBoxGroup::height [private] |
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().
uint16_t YAPET::UI::CheckBoxGroup::options [private] |
Definition at line 100 of file checkboxgroup.h.
Referenced by focus(), and getOptions().
int YAPET::UI::CheckBoxGroup::start_x [private] |
Definition at line 102 of file checkboxgroup.h.
Referenced by createWindow().
int YAPET::UI::CheckBoxGroup::start_y [private] |
Definition at line 103 of file checkboxgroup.h.
Referenced by createWindow().
std::string YAPET::UI::CheckBoxGroup::title [private] |
int YAPET::UI::CheckBoxGroup::width [private] |
Definition at line 104 of file checkboxgroup.h.
Referenced by createWindow(), and ItemsUsableWidth().
WINDOW* YAPET::UI::CheckBoxGroup::window [private] |
Definition at line 83 of file checkboxgroup.h.
Referenced by createWindow(), displayItems(), focus(), refresh(), and ~CheckBoxGroup().
1.7.1