YAPETUI::ListWidget< T > Class Template Reference

A widget showing a list of items for selecting one. More...

#include <listwidget.h>

List of all members.

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 ()
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 ListWidgetoperator= (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


Detailed Description

template<class T>
class YAPETUI::ListWidget< T >

Todo:
Making focus clearly visible.

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.


Member Typedef Documentation

template<class T>
typedef std::list<T>::size_type YAPETUI::ListWidget< T >::l_size_type [protected]

Definition at line 94 of file listwidget.h.


Constructor & Destructor Documentation

template<class T>
YAPETUI::ListWidget< T >::ListWidget ( const ListWidget< T > &  lw  )  [inline, protected]

Definition at line 96 of file listwidget.h.

template<class T>
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.

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

template<class T>
virtual YAPETUI::ListWidget< T >::~ListWidget (  )  [inline, virtual]

Definition at line 337 of file listwidget.h.


Member Function Documentation

template<class T>
void YAPETUI::ListWidget< T >::clearWin (  )  throw (UIException) [inline, protected]

Definition at line 101 of file listwidget.h.

Referenced by YAPETUI::ListWidget< YAPET::PartDec >::showListItems().

template<class T>
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().

template<class T>
void YAPETUI::ListWidget< T >::deleteSelectedItem (  )  [inline]

Definition at line 375 of file listwidget.h.

Referenced by MainWindow::deleteSelectedRecord().

template<class T>
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:

Every other key stroke make it loosing the focus.

Returns:
the key stroke that made it loose the focus.

Definition at line 413 of file listwidget.h.

Referenced by MainWindow::run().

template<class T>
std::list<T>& YAPETUI::ListWidget< T >::getList (  )  [inline]

Definition at line 389 of file listwidget.h.

template<class T>
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().

template<class T>
int YAPETUI::ListWidget< T >::getListPos (  )  [inline]

Definition at line 495 of file listwidget.h.

template<class T>
T YAPETUI::ListWidget< T >::getSelectedItem (  )  [inline]

Definition at line 497 of file listwidget.h.

Referenced by MainWindow::editSelectedRecord().

template<class T>
const ListWidget& YAPETUI::ListWidget< T >::operator= ( const ListWidget< T > &  lw  )  [inline, protected]

Definition at line 97 of file listwidget.h.

template<class T>
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().

template<class T>
void YAPETUI::ListWidget< T >::refresh (  )  throw (UIException) [inline]

Definition at line 470 of file listwidget.h.

Referenced by MainWindow::deleteSelectedRecord(), and MainWindow::refresh().

template<class T>
void YAPETUI::ListWidget< T >::replaceCurrentItem ( T &  item  )  [inline]

Replaces the item at the current position of the list selected by the user.

Parameters:
item the new item.

Definition at line 366 of file listwidget.h.

Referenced by MainWindow::editSelectedRecord().

template<class T>
void YAPETUI::ListWidget< T >::resize ( int  sx,
int  sy,
int  w,
int  h 
) throw (UIException) [inline]

Definition at line 479 of file listwidget.h.

Referenced by MainWindow::resize().

template<class T>
void YAPETUI::ListWidget< T >::scrollDown (  )  [inline, protected]

Definition at line 206 of file listwidget.h.

Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().

template<class T>
void YAPETUI::ListWidget< T >::scrollEnd (  )  [inline, protected]

Definition at line 266 of file listwidget.h.

Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().

template<class T>
void YAPETUI::ListWidget< T >::scrollHome (  )  [inline, protected]

Definition at line 256 of file listwidget.h.

Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().

template<class T>
void YAPETUI::ListWidget< T >::scrollPageDown (  )  [inline, protected]

Definition at line 237 of file listwidget.h.

Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().

template<class T>
void YAPETUI::ListWidget< T >::scrollPageUp (  )  [inline, protected]

Definition at line 223 of file listwidget.h.

Referenced by YAPETUI::ListWidget< YAPET::PartDec >::focus().

template<class T>
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().

template<class T>
void YAPETUI::ListWidget< T >::setList ( typename std::list< T > &  l  )  [inline]

Sets a new list of items to display.

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

template<class T>
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().

template<class T>
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().

template<class T>
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().

template<class T>
l_size_type YAPETUI::ListWidget< T >::size (  )  [inline]

Definition at line 505 of file listwidget.h.

Referenced by MainWindow::bottomRightWinContent(), and MainWindow::editSelectedRecord().


Member Data Documentation

template<class T>
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().

template<class T>
int YAPETUI::ListWidget< T >::height [private]

Definition at line 74 of file listwidget.h.

Referenced by YAPETUI::ListWidget< YAPET::PartDec >::createWindow(), YAPETUI::ListWidget< YAPET::PartDec >::ListWidget(), YAPETUI::ListWidget< YAPET::PartDec >::pagesize(), and YAPETUI::ListWidget< YAPET::PartDec >::showScrollIndicators().

template<class T>
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().

template<class T>
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().

template<class T>
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().

template<class T>
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().


The documentation for this class was generated from the following file:
Generated on Wed Feb 27 16:15:42 2008 for YAPET by  doxygen 1.5.4