#include <listwidget.h>
Classes | |
class | ItemContains |
Used to search for item names. More... | |
Public Types | |
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 () |
SortOrder | getSortOrder () const |
Returns the sort order applied to the list. | |
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) |
bool | searchNext () |
Searches again using the last search term used. | |
bool | searchTerm (const char *t) |
Searches for a term in the list items. | |
void | setList (typename std::list< T > &l) |
Sets a new list of items to display. | |
void | setSortOrder () |
Sorts the list with the currently set sort order. | |
void | setSortOrder (SortOrder so) |
Sorts the list. | |
l_size_type | size () |
virtual | ~ListWidget () |
Private Types | |
typedef std::list< T > ::const_iterator | c_list_it |
typedef std::list< T >::size_type | l_size_type |
typedef std::list< T >::iterator | list_it |
Private Member Functions | |
void | clearWin () throw (UIException) |
void | createWindow (int sx, int sy, int w, int h) throw (UIException) |
void | highlightItemIter (list_it &it) |
ListWidget (const ListWidget &lw) | |
const ListWidget & | operator= (const ListWidget &lw) |
int | pagesize () |
void | scrollDown () |
void | scrollEnd () |
void | scrollHome () |
void | scrollPageDown () |
void | scrollPageUp () |
void | scrollUp () |
int | setBorder () const |
Sets the border depending on the focus. | |
void | showListItems () throw (UIException) |
void | showScrollIndicators () throw (UIException) |
void | showSelected (int old_pos) throw (UIException) |
Highlights the selected item. | |
l_size_type | validateIterator (c_list_it &it) const |
l_size_type | validateIterator (list_it &it) |
Validates the given iterator against the list. | |
Private Attributes | |
int | cur_pos |
The position within the visible items. | |
list_it | cur_search_hit |
Points the current hit of a search. | |
bool | hasfocus |
Indicates whether or not the widget has the focus. | |
int | height |
std::list< T > | itemlist |
Items displayed. | |
std::string | last_search_term |
Holds the last search term. | |
SortOrder | sortorder |
Holds the sort order currently applied. | |
int | start_pos |
Holds the starting position within the list. | |
int | width |
WINDOW * | window |
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. Further, the object need to provide a less-than operator for sorting purpose.
Definition at line 82 of file listwidget.h.
typedef std::list<T>::const_iterator YAPETUI::ListWidget< T >::c_list_it [private] |
Definition at line 173 of file listwidget.h.
typedef std::list<T>::size_type YAPETUI::ListWidget< T >::l_size_type [private] |
Definition at line 170 of file listwidget.h.
typedef std::list<T>::iterator YAPETUI::ListWidget< T >::list_it [private] |
Definition at line 172 of file listwidget.h.
enum YAPETUI::ListWidget::SortOrder |
The sort order that are available for sorting the list items.
Definition at line 90 of file listwidget.h.
YAPETUI::ListWidget< T >::ListWidget | ( | const ListWidget< T > & | lw | ) | [inline, private] |
Definition at line 190 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 508 of file listwidget.h.
virtual YAPETUI::ListWidget< T >::~ListWidget | ( | ) | [inline, virtual] |
Definition at line 529 of file listwidget.h.
void YAPETUI::ListWidget< T >::clearWin | ( | ) | throw (UIException) [inline, private] |
Definition at line 264 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, private] |
Definition at line 467 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 609 of file listwidget.h.
Referenced by MainWindow::run(), and FileOpen::run().
std::list<T>& YAPETUI::ListWidget< T >::getList | ( | ) | [inline] |
Definition at line 585 of file listwidget.h.
const std::list<T>& YAPETUI::ListWidget< T >::getList | ( | ) | const [inline] |
Definition at line 584 of file listwidget.h.
Referenced by MainWindow::addNewRecord(), MainWindow::closeFile(), and MainWindow::saveFile().
int YAPETUI::ListWidget< T >::getListPos | ( | ) | [inline] |
Definition at line 695 of file listwidget.h.
T YAPETUI::ListWidget< T >::getSelectedItem | ( | ) | [inline] |
Definition at line 697 of file listwidget.h.
Referenced by MainWindow::editSelectedRecord(), and FileOpen::run().
SortOrder YAPETUI::ListWidget< T >::getSortOrder | ( | ) | const [inline] |
Returns the current sort order that is applied to the list.
SortOrder
value. Definition at line 714 of file listwidget.h.
Referenced by MainWindow::setSortOrder(), and YAPETUI::ListWidget< YAPET::PartDec >::setSortOrder().
void YAPETUI::ListWidget< T >::highlightItemIter | ( | list_it & | it | ) | [inline, private] |
Definition at line 230 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::searchNext(), and YAPETUI::ListWidget< YAPET::PartDec >::searchTerm().
const ListWidget& YAPETUI::ListWidget< T >::operator= | ( | const ListWidget< T > & | lw | ) | [inline, private] |
Definition at line 191 of file listwidget.h.
int YAPETUI::ListWidget< T >::pagesize | ( | ) | [inline, private] |
Definition at line 262 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::highlightItemIter(), 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 670 of file listwidget.h.
Referenced by MainWindow::deleteSelectedRecord(), MainWindow::refresh(), FileOpen::refresh(), YAPETUI::ListWidget< YAPET::PartDec >::setList(), and MainWindow::setSortOrder().
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 561 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, private] |
Definition at line 391 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollEnd | ( | ) | [inline, private] |
Definition at line 451 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollHome | ( | ) | [inline, private] |
Definition at line 441 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollPageDown | ( | ) | [inline, private] |
Definition at line 422 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollPageUp | ( | ) | [inline, private] |
Definition at line 408 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().
void YAPETUI::ListWidget< T >::scrollUp | ( | ) | [inline, private] |
Definition at line 376 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::deleteSelectedItem(), and YAPETUI::ListWidget< YAPET::PartDec >::focus().
bool YAPETUI::ListWidget< T >::searchNext | ( | ) | [inline] |
Performs a search again using the last search term again.
\c | true if the term was found again, else false |
Definition at line 777 of file listwidget.h.
Referenced by MainWindow::searchNext().
bool YAPETUI::ListWidget< T >::searchTerm | ( | const char * | t | ) | [inline] |
Searches for a given term in the list items.
t | the term to search for |
\c | true if the term was found, else false . |
Definition at line 756 of file listwidget.h.
Referenced by MainWindow::searchTerm().
int YAPETUI::ListWidget< T >::setBorder | ( | ) | const [inline, private] |
Sets the border depending on whether or not the list has the focus.
the | return value of the call to wborder(). |
Definition at line 255 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::clearWin(), YAPETUI::ListWidget< YAPET::PartDec >::createWindow(), 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 544 of file listwidget.h.
Referenced by MainWindow::changePassword(), and FileOpen::run().
void YAPETUI::ListWidget< T >::setSortOrder | ( | ) | [inline] |
Sorts the list using the currently set sort order.
Definition at line 743 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::ListWidget(), YAPETUI::ListWidget< YAPET::PartDec >::replaceCurrentItem(), YAPETUI::ListWidget< YAPET::PartDec >::setList(), and YAPETUI::ListWidget< YAPET::PartDec >::setSortOrder().
void YAPETUI::ListWidget< T >::setSortOrder | ( | SortOrder | so | ) | [inline] |
Sorts the list using the given order. It expects that T
has defined the less than operator.
so | value of the type SortOrder |
Definition at line 724 of file listwidget.h.
Referenced by MainWindow::addNewRecord(), MainWindow::editSelectedRecord(), and MainWindow::setSortOrder().
void YAPETUI::ListWidget< T >::showListItems | ( | ) | throw (UIException) [inline, private] |
Definition at line 296 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::highlightItemIter(), 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(), and YAPETUI::ListWidget< YAPET::PartDec >::scrollUp().
void YAPETUI::ListWidget< T >::showScrollIndicators | ( | ) | throw (UIException) [inline, private] |
Definition at line 275 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, private] |
Highlights the selected item in the list. However, this is depending of the global member hasfocus
. If hasfocus
is false
, the highlight is removed.
old_pos | tells the method the position of the old highlight, so it can be removed. If the value is less than 0 , it does not try to clear the old highlight. |
Definition at line 329 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus(), YAPETUI::ListWidget< YAPET::PartDec >::highlightItemIter(), 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(), and YAPETUI::ListWidget< YAPET::PartDec >::scrollUp().
l_size_type YAPETUI::ListWidget< T >::size | ( | ) | [inline] |
Definition at line 705 of file listwidget.h.
Referenced by MainWindow::bottomRightWinContent(), MainWindow::deleteSelectedRecord(), MainWindow::editSelectedRecord(), MainWindow::searchNext(), and MainWindow::searchTerm().
l_size_type YAPETUI::ListWidget< T >::validateIterator | ( | c_list_it & | it | ) | const [inline, private] |
Definition at line 218 of file listwidget.h.
l_size_type YAPETUI::ListWidget< T >::validateIterator | ( | list_it & | it | ) | [inline, private] |
Indicates whether or not the given iterator is still valid for the list
it | the iterator to be validated against itemlist . |
a | positive value (including zero) to indicate the position of the iterator, a negative value otherwise if the iterator is not valid. |
Definition at line 207 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::highlightItemIter(), and YAPETUI::ListWidget< YAPET::PartDec >::searchNext().
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 153 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 >::highlightItemIter(), 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().
list_it YAPETUI::ListWidget< T >::cur_search_hit [private] |
When the list is searched, this iterator points to the current hit of a search.
Definition at line 181 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::searchNext(), and YAPETUI::ListWidget< YAPET::PartDec >::searchTerm().
bool YAPETUI::ListWidget< T >::hasfocus [private] |
Indicates whether or not this widget has the focus. Determines how the border has to be drawn
Definition at line 135 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus(), YAPETUI::ListWidget< YAPET::PartDec >::setBorder(), and YAPETUI::ListWidget< YAPET::PartDec >::showSelected().
int YAPETUI::ListWidget< T >::height [private] |
std::list<T> YAPETUI::ListWidget< T >::itemlist [private] |
The actual list holding the items displayed by the widget.
Definition at line 169 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 >::searchNext(), YAPETUI::ListWidget< YAPET::PartDec >::searchTerm(), YAPETUI::ListWidget< YAPET::PartDec >::setList(), YAPETUI::ListWidget< YAPET::PartDec >::setSortOrder(), YAPETUI::ListWidget< YAPET::PartDec >::showListItems(), YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators(), YAPETUI::ListWidget< YAPET::PartDec >::showSelected(), YAPETUI::ListWidget< YAPET::PartDec >::size(), and YAPETUI::ListWidget< YAPET::PartDec >::validateIterator().
std::string YAPETUI::ListWidget< T >::last_search_term [private] |
Holds the last search term used.
Definition at line 188 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::searchNext(), and YAPETUI::ListWidget< YAPET::PartDec >::searchTerm().
SortOrder YAPETUI::ListWidget< T >::sortorder [private] |
Holds the sort order that is currently applied to the list.
Definition at line 161 of file listwidget.h.
Referenced by YAPETUI::ListWidget< YAPET::PartDec >::getSortOrder(), YAPETUI::ListWidget< YAPET::PartDec >::replaceCurrentItem(), YAPETUI::ListWidget< YAPET::PartDec >::setList(), and YAPETUI::ListWidget< YAPET::PartDec >::setSortOrder().
int YAPETUI::ListWidget< T >::start_pos [private] |
This holds the position from where we start showing items on the screen.
Definition at line 143 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 >::highlightItemIter(), 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 126 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 124 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 >::setBorder(), YAPETUI::ListWidget< YAPET::PartDec >::showListItems(), YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators(), YAPETUI::ListWidget< YAPET::PartDec >::showSelected(), and YAPETUI::ListWidget< YAPET::PartDec >::~ListWidget().