#include <listwidget.h>
Public Member Functions | |
void | deleteSelectedItem () |
virtual int | focus () throw (UIException) |
Sets the focus to this widget. | |
std::list< T > & | getList () |
const std::list< T > & | getList () const |
int | getListPos () |
T | getSelectedItem () |
ListWidget (std::list< T > l, int sx, int sy, int w, int h) throw (UIException) | |
Constructor. | |
void | refresh () throw (UIException) |
void | replaceCurrentItem (T &item) |
Replace the item at the current position selected. | |
void | resize (int sx, int sy, int w, int h) throw (UIException) |
void | setList (typename std::list< T > &l) |
Sets a new list of items to display. | |
l_size_type | size () |
virtual | ~ListWidget () |
Protected Types | |
typedef std::list< T >::size_type | l_size_type |
Protected Member Functions | |
void | clearWin () throw (UIException) |
void | createWindow (int sx, int sy, int w, int h) throw (UIException) |
ListWidget (const ListWidget &lw) | |
const ListWidget & | operator= (const ListWidget &lw) |
int | pagesize () |
void | scrollDown () |
void | scrollEnd () |
void | scrollHome () |
void | scrollPageDown () |
void | scrollPageUp () |
void | scrollUp () |
void | showListItems () throw (UIException) |
void | showScrollIndicators () throw (UIException) |
void | showSelected (int old_pos) throw (UIException) |
Protected Attributes | |
std::list< T > | itemlist |
Private Attributes | |
int | cur_pos |
The position within the visible items. | |
int | height |
int | start_pos |
Holds the starting position within the list. | |
int | width |
WINDOW * | window |
This template shows a list of items on the screen and allows the user to select one of it. If the list is larger than the available screen height, it allows to scroll.
The objects stored in the std::list
are expected to have a method c_str()
which should return the name or whatever of the item. This string is displayed on the screen
Definition at line 69 of file listwidget.h.
typedef std::list<T>::size_type YAPETUI::ListWidget< T >::l_size_type [protected] |
Definition at line 94 of file listwidget.h.
YAPETUI::ListWidget< T >::ListWidget | ( | const ListWidget< T > & | lw | ) | [inline, protected] |
Definition at line 96 of file listwidget.h.
YAPETUI::ListWidget< T >::ListWidget | ( | std::list< T > | l, | |
int | sx, | |||
int | sy, | |||
int | w, | |||
int | h | |||
) | throw (UIException) [inline] |
Initializes the widget, but does not show it.
l | the list holding the items to be displayed. The items of the list are expected to have a method called c_str() for getting their names. Empty lists are allowed. | |
sx | the horizontal start position of the widget on the screen. | |
sy | the vertical start position of the widget on the screen. | |
w | the width of the widget. | |
h | the height of the widget. |
Definition at line 321 of file listwidget.h.
virtual YAPETUI::ListWidget< T >::~ListWidget | ( | ) | [inline, virtual] |
Definition at line 337 of file listwidget.h.
void YAPETUI::ListWidget< T >::clearWin | ( | ) | throw (UIException) [inline, protected] |
Definition at line 101 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::showListItems().
void YAPETUI::ListWidget< T >::createWindow | ( | int | sx, | |
int | sy, | |||
int | w, | |||
int | h | |||
) | throw (UIException) [inline, protected] |
Definition at line 282 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::ListWidget(), and YAPETUI::ListWidget< YAPET::PartDec >::resize().
void YAPETUI::ListWidget< T >::deleteSelectedItem | ( | ) | [inline] |
virtual int YAPETUI::ListWidget< T >::focus | ( | ) | throw (UIException) [inline, virtual] |
Focus the widget and shows it on the screen. The widget handles the following key strokes:
KEY_UP
KEY_DOWN
KEY_HOME
KEY_A1
KEY_END
KEY_C1
KEY_NPAGE
KEY_C3
KEY_PPAGE
KEY_A3
KEY_REFRESH
Every other key stroke make it loosing the focus.
Definition at line 413 of file listwidget.h.
Referenced by MainWindow::run().
std::list<T>& YAPETUI::ListWidget< T >::getList | ( | ) | [inline] |
Definition at line 389 of file listwidget.h.
const std::list<T>& YAPETUI::ListWidget< T >::getList | ( | ) | const [inline] |
Definition at line 388 of file listwidget.h.
Referenced by MainWindow::addNewRecord(), MainWindow::closeFile(), and MainWindow::saveFile().
int YAPETUI::ListWidget< T >::getListPos | ( | ) | [inline] |
Definition at line 495 of file listwidget.h.
T YAPETUI::ListWidget< T >::getSelectedItem | ( | ) | [inline] |
const ListWidget& YAPETUI::ListWidget< T >::operator= | ( | const ListWidget< T > & | lw | ) | [inline, protected] |
Definition at line 97 of file listwidget.h.
int YAPETUI::ListWidget< T >::pagesize | ( | ) | [inline, protected] |
Definition at line 99 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::scrollDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollEnd(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageUp(), YAPETUI::ListWidget< YAPET::PartDec >::showListItems(), and YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators().
void YAPETUI::ListWidget< T >::refresh | ( | ) | throw (UIException) [inline] |
Definition at line 470 of file listwidget.h.
Referenced by MainWindow::deleteSelectedRecord(), and MainWindow::refresh().
void YAPETUI::ListWidget< T >::replaceCurrentItem | ( | T & | item | ) | [inline] |
Replaces the item at the current position of the list selected by the user.
item | the new item. |
Definition at line 366 of file listwidget.h.
Referenced by MainWindow::editSelectedRecord().
void YAPETUI::ListWidget< T >::resize | ( | int | sx, | |
int | sy, | |||
int | w, | |||
int | h | |||
) | throw (UIException) [inline] |
void YAPETUI::ListWidget< T >::scrollDown | ( | ) | [inline, protected] |
Definition at line 206 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollEnd | ( | ) | [inline, protected] |
Definition at line 266 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollHome | ( | ) | [inline, protected] |
Definition at line 256 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollPageDown | ( | ) | [inline, protected] |
Definition at line 237 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollPageUp | ( | ) | [inline, protected] |
Definition at line 223 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollUp | ( | ) | [inline, protected] |
Definition at line 191 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::deleteSelectedItem(), and YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::setList | ( | typename std::list< T > & | l | ) | [inline] |
Sets a new list of items to display.
l | the list holding the items to be displayed. The items of the list are expected to have a method called c_str() for getting their names. Empty lists are allowed. |
Definition at line 351 of file listwidget.h.
Referenced by MainWindow::changePassword(), and MainWindow::openFile().
void YAPETUI::ListWidget< T >::showListItems | ( | ) | throw (UIException) [inline, protected] |
Definition at line 133 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::refresh(), YAPETUI::ListWidget< YAPET::PartDec >::scrollDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollEnd(), YAPETUI::ListWidget< YAPET::PartDec >::scrollHome(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageUp(), YAPETUI::ListWidget< YAPET::PartDec >::scrollUp(), and YAPETUI::ListWidget< YAPET::PartDec >::setList().
void YAPETUI::ListWidget< T >::showScrollIndicators | ( | ) | throw (UIException) [inline, protected] |
Definition at line 112 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus(), and YAPETUI::ListWidget< YAPET::PartDec >::showListItems().
void YAPETUI::ListWidget< T >::showSelected | ( | int | old_pos | ) | throw (UIException) [inline, protected] |
Definition at line 155 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::refresh(), YAPETUI::ListWidget< YAPET::PartDec >::scrollDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollEnd(), YAPETUI::ListWidget< YAPET::PartDec >::scrollHome(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageUp(), YAPETUI::ListWidget< YAPET::PartDec >::scrollUp(), and YAPETUI::ListWidget< YAPET::PartDec >::setList().
l_size_type YAPETUI::ListWidget< T >::size | ( | ) | [inline] |
Definition at line 505 of file listwidget.h.
Referenced by MainWindow::bottomRightWinContent(), and MainWindow::editSelectedRecord().
int YAPETUI::ListWidget< T >::cur_pos [private] |
Holds the position within the visible items. By adding cur_pos
+
start_pos
the item actually selected by the user as offset from the beginning of the list is yielded.
Definition at line 90 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::deleteSelectedItem(), YAPETUI::ListWidget< YAPET::PartDec >::getListPos(), YAPETUI::ListWidget< YAPET::PartDec >::getSelectedItem(), YAPETUI::ListWidget< YAPET::PartDec >::replaceCurrentItem(), YAPETUI::ListWidget< YAPET::PartDec >::scrollDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollEnd(), YAPETUI::ListWidget< YAPET::PartDec >::scrollHome(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageUp(), YAPETUI::ListWidget< YAPET::PartDec >::scrollUp(), YAPETUI::ListWidget< YAPET::PartDec >::setList(), YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators(), and YAPETUI::ListWidget< YAPET::PartDec >::showSelected().
int YAPETUI::ListWidget< T >::height [private] |
std::list<T> YAPETUI::ListWidget< T >::itemlist [protected] |
Definition at line 93 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::deleteSelectedItem(), YAPETUI::ListWidget< YAPET::PartDec >::getList(), YAPETUI::ListWidget< YAPET::PartDec >::getSelectedItem(), YAPETUI::ListWidget< YAPET::PartDec >::replaceCurrentItem(), YAPETUI::ListWidget< YAPET::PartDec >::scrollDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollEnd(), YAPETUI::ListWidget< YAPET::PartDec >::scrollHome(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageUp(), YAPETUI::ListWidget< YAPET::PartDec >::scrollUp(), YAPETUI::ListWidget< YAPET::PartDec >::setList(), YAPETUI::ListWidget< YAPET::PartDec >::showListItems(), YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators(), YAPETUI::ListWidget< YAPET::PartDec >::showSelected(), and YAPETUI::ListWidget< YAPET::PartDec >::size().
int YAPETUI::ListWidget< T >::start_pos [private] |
This holds the position from where we start showing items on the screen.
Definition at line 82 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::deleteSelectedItem(), YAPETUI::ListWidget< YAPET::PartDec >::getListPos(), YAPETUI::ListWidget< YAPET::PartDec >::getSelectedItem(), YAPETUI::ListWidget< YAPET::PartDec >::replaceCurrentItem(), YAPETUI::ListWidget< YAPET::PartDec >::scrollDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollEnd(), YAPETUI::ListWidget< YAPET::PartDec >::scrollHome(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageDown(), YAPETUI::ListWidget< YAPET::PartDec >::scrollPageUp(), YAPETUI::ListWidget< YAPET::PartDec >::scrollUp(), YAPETUI::ListWidget< YAPET::PartDec >::setList(), YAPETUI::ListWidget< YAPET::PartDec >::showListItems(), and YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators().
int YAPETUI::ListWidget< T >::width [private] |
Definition at line 73 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::createWindow(), YAPETUI::ListWidget< YAPET::PartDec >::ListWidget(), YAPETUI::ListWidget< YAPET::PartDec >::showListItems(), YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators(), and YAPETUI::ListWidget< YAPET::PartDec >::showSelected().
WINDOW* YAPETUI::ListWidget< T >::window [private] |
Definition at line 71 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::clearWin(), YAPETUI::ListWidget< YAPET::PartDec >::createWindow(), YAPETUI::ListWidget< YAPET::PartDec >::focus(), YAPETUI::ListWidget< YAPET::PartDec >::refresh(), YAPETUI::ListWidget< YAPET::PartDec >::resize(), YAPETUI::ListWidget< YAPET::PartDec >::showListItems(), YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators(), YAPETUI::ListWidget< YAPET::PartDec >::showSelected(), and YAPETUI::ListWidget< YAPET::PartDec >::~ListWidget().