Logo Search packages:      
Sourcecode: yapet version File versions  Download package

YAPETUI::ListWidget< T > Class Template Reference

#include <listwidget.h>

List of all members.


Detailed Description

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

A widget showing a list of items for selecting one.

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. Further, the object need to provide a less-than operator for sorting purpose.

Definition at line 83 of file listwidget.h.


Public Types

enum  SortOrder { ASCENDING, DESCENDING }
 The sort order available. More...

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

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

Classes

class  ItemContains
 Used to search for item names. More...

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

Generated by  Doxygen 1.6.0   Back to index