rtop
Public Member Functions | Protected Attributes | Friends | List of all members
rtop::BrowsePanelData< T > Class Template Reference

derived from SimplePanelData. capable of storing list of item in a ncurses menu object. More...

#include <panel2.h>

Inheritance diagram for rtop::BrowsePanelData< T >:
rtop::SimplePanelData rtop::EditPanelData< T >

Public Member Functions

 BrowsePanelData (int)
 BrowsePanelData<T> constructor. More...
 
std::vector< std::string > contents ()
 returns contents of panel's menu as vector of strings More...
 
int currIndex () const
 returns currently selected item on object_list More...
 
void setHeader (std::string head_str) override
 sets panel header. More...
 
void refreshItemList () override
 intended to be used with browse panels. tears down menu and re-initializes with items in object_list More...
 
void refreshItemList2 (std::vector< InfoProc< std::string >> &, std::string, const std::vector< int > &, int &) override
 called from ProcViewPanel::refresh. tears down menu and reinitializes with data (reference to vector valued ProcDb dict entry) values More...
 
void setSelectionColor (int color_pair) override
 sets color_pair for selected menu item More...
 
void setBasicColor (int color_pair) override
 sets color_pair for unselected menu item More...
 
void Top () override
 sets menu's first item as selected item More...
 
virtual T * currItem () const
 returns copy of currently selected item in object_list More...
 
virtual void selectionOn () override
 sets currently selected menu item's color to selection color_pair and update curr_color to selection color_pair More...
 
virtual void selectionOff () override
 sets currently selected menu item's color to basic color_pair and update curr_color to basic color_pair More...
 
virtual void Down () override
 moves menu item selection down by 1 More...
 
virtual void Up () override
 moves menu item selection up by 1 More...
 
virtual void resolveKey (int) override
 resolves the key input at panel level More...
 
virtual void setHeaderColor (int color_pair) override
 sets color of menu's header item to be header color_pair More...
 
virtual void insertIntoLeftNbr () override
 inserts value of currently selected menu item into menu of left neighbour More...
 
virtual void insertIntoRightNbr () override
 inserts value of currently selected menu item into menu of right neighbour More...
 
virtual void addIntoLeftNbr () override
 mock More...
 
virtual void addIntoRightNbr () override
 mock More...
 
virtual void moveIntoLeftNbr () override
 mock More...
 
virtual void moveIntoRightNbr () override
 mock More...
 
- Public Member Functions inherited from rtop::SimplePanelData
 SimplePanelData (int)
 SimplePanelData constructor. More...
 
int uUid () const
 returns unique identifier of this object More...
 
void setWin (WINDOW *win_in)
 sets reference to ncurses WINDOW associated with panel More...
 
void setPanel (PANEL *panel_in)
 sets reference to ncurses PANEL associated with this panel data structure More...
 
void setDimensions (int h, int w)
 set internal width, height variables corresponding to panel window dimensions More...
 
void setLeftNbr (SimplePanelData *)
 set pointer to left neighbour panel More...
 
void setRightNbr (SimplePanelData *)
 set pointer to right neighbour panel More...
 
SimplePanelDataleftNbr ()
 returns pointer to left neighbour panel More...
 
SimplePanelDatarightNbr ()
 returns pointer to right neighbour panel More...
 
void moveTo (int, int)
 move panel window to desired x,y pos on stdscr. More...
 
virtual void show ()
 refreshes contents of associated BrowsePanel data structure and makes panel visible More...
 
virtual void show2 ()
 makes panel visible More...
 
virtual void hide ()
 hides panel More...
 
WINDOW * window () const
 returns pointer to ncurses WINDOW associated with panel More...
 
virtual void toggleEditMode ()
 mock More...
 
virtual void editModeOn ()
 mock More...
 
virtual void editModeOff ()
 mock More...
 
virtual void setEditingColor (int)
 mock More...
 
virtual void remove ()
 mock More...
 
virtual std::vector< std::string > displayedKeys () const
 mock More...
 
virtual void deleteColumn ()
 mock More...
 
virtual void insertColumn ()
 mock More...
 
virtual void refresh ()
 mock More...
 
virtual void moveLeft ()
 mock More...
 
virtual void moveRight ()
 mock More...
 
virtual void syncColors ()
 mock More...
 

Protected Attributes

std::vector< T * > object_list
 vector of pointers to generic type containing value that goes into menu item. More...
 
ITEM ** item_list
 array of pointers to ITEM (array of ITEM*) for menu initialization More...
 
int size_item_list
 size of object_list More...
 
int capacity
 capacity of object_list. More...
 
MENU * menu
 pointer to MENU More...
 
int selected
 item selected in menu, 0 being header item More...
 
int selection_color
 color_pair id for selected item in menu More...
 
int basic_color
 color_pair id for unselected item in menu More...
 
int curr_color
 current color_pair (either selection_color or basic_color) More...
 
int header_color
 color_paid id for header color More...
 
std::string header
 panel header. More...
 
- Protected Attributes inherited from rtop::SimplePanelData
int uuid
 
int width
 width and height in panel window in ncurses units. More...
 
int height
 
PANEL * panel
 panel to which the data structure is associated More...
 
WINDOW * win
 window attached to the panel More...
 
SimplePanelDatar_next
 pointer to panel data structures correponding to left/right neighbour of this panel More...
 
SimplePanelDatal_next
 
StateMachine smKeys
 Keys statemachine. More...
 

Friends

class XMLTree
 

Detailed Description

template<class T>
class rtop::BrowsePanelData< T >

derived from SimplePanelData. capable of storing list of item in a ncurses menu object.

enables browsing capability of menu items in up/down direction. also enables object highlighting with different color when the panel is selected also provides API to resolve keys associated with the panels

Definition at line 253 of file panel2.h.

Constructor & Destructor Documentation

◆ BrowsePanelData()

template<class T >
rtop::BrowsePanelData< T >::BrowsePanelData ( int  id)

BrowsePanelData<T> constructor.

Definition at line 336 of file panel2.h.

Member Function Documentation

◆ addIntoLeftNbr()

template<class T >
void rtop::BrowsePanelData< T >::addIntoLeftNbr ( )
overridevirtual

mock

Reimplemented from rtop::SimplePanelData.

Definition at line 378 of file panel2.h.

◆ addIntoRightNbr()

template<class T >
void rtop::BrowsePanelData< T >::addIntoRightNbr ( )
overridevirtual

mock

Reimplemented from rtop::SimplePanelData.

Definition at line 384 of file panel2.h.

◆ contents()

template<class T >
std::vector< std::string > rtop::BrowsePanelData< T >::contents ( )

returns contents of panel's menu as vector of strings

Definition at line 350 of file panel2.h.

◆ currIndex()

template<class T>
int rtop::BrowsePanelData< T >::currIndex ( ) const
inline

returns currently selected item on object_list

Definition at line 284 of file panel2.h.

◆ currItem()

template<class T >
T * rtop::BrowsePanelData< T >::currItem ( ) const
virtual

returns copy of currently selected item in object_list

Definition at line 401 of file panel2.h.

◆ Down()

template<class T >
void rtop::BrowsePanelData< T >::Down ( )
overridevirtual

moves menu item selection down by 1

Reimplemented from rtop::SimplePanelData.

Reimplemented in rtop::EditPanelData< T >.

Definition at line 555 of file panel2.h.

◆ insertIntoLeftNbr()

template<class T >
void rtop::BrowsePanelData< T >::insertIntoLeftNbr ( )
overridevirtual

inserts value of currently selected menu item into menu of left neighbour

Reimplemented from rtop::SimplePanelData.

Reimplemented in rtop::EditPanelData< T >.

Definition at line 363 of file panel2.h.

◆ insertIntoRightNbr()

template<class T >
void rtop::BrowsePanelData< T >::insertIntoRightNbr ( )
overridevirtual

inserts value of currently selected menu item into menu of right neighbour

Reimplemented from rtop::SimplePanelData.

Reimplemented in rtop::EditPanelData< T >.

Definition at line 373 of file panel2.h.

◆ moveIntoLeftNbr()

template<class T >
void rtop::BrowsePanelData< T >::moveIntoLeftNbr ( )
overridevirtual

mock

Reimplemented from rtop::SimplePanelData.

Definition at line 389 of file panel2.h.

◆ moveIntoRightNbr()

template<class T >
void rtop::BrowsePanelData< T >::moveIntoRightNbr ( )
overridevirtual

mock

Reimplemented from rtop::SimplePanelData.

Definition at line 395 of file panel2.h.

◆ refreshItemList()

template<class T >
void rtop::BrowsePanelData< T >::refreshItemList ( )
overridevirtual

intended to be used with browse panels. tears down menu and re-initializes with items in object_list

Reimplemented from rtop::SimplePanelData.

Definition at line 417 of file panel2.h.

◆ refreshItemList2()

template<class T >
void rtop::BrowsePanelData< T >::refreshItemList2 ( std::vector< InfoProc< std::string >> &  data,
std::string  prop_name,
const std::vector< int > &  sorted_indices,
int &  browse_pos 
)
overridevirtual

called from ProcViewPanel::refresh. tears down menu and reinitializes with data (reference to vector valued ProcDb dict entry) values

Reimplemented from rtop::SimplePanelData.

Definition at line 461 of file panel2.h.

◆ resolveKey()

template<class T >
void rtop::BrowsePanelData< T >::resolveKey ( int  ch)
overridevirtual

resolves the key input at panel level

Reimplemented from rtop::SimplePanelData.

Reimplemented in rtop::EditPanelData< T >.

Definition at line 612 of file panel2.h.

◆ selectionOff()

template<class T >
void rtop::BrowsePanelData< T >::selectionOff ( )
overridevirtual

sets currently selected menu item's color to basic color_pair and update curr_color to basic color_pair

Reimplemented from rtop::SimplePanelData.

Reimplemented in rtop::EditPanelData< T >.

Definition at line 542 of file panel2.h.

◆ selectionOn()

template<class T >
void rtop::BrowsePanelData< T >::selectionOn ( )
overridevirtual

sets currently selected menu item's color to selection color_pair and update curr_color to selection color_pair

Reimplemented from rtop::SimplePanelData.

Reimplemented in rtop::EditPanelData< T >.

Definition at line 529 of file panel2.h.

◆ setBasicColor()

template<class T>
void rtop::BrowsePanelData< T >::setBasicColor ( int  color_pair)
inlineoverridevirtual

sets color_pair for unselected menu item

Reimplemented from rtop::SimplePanelData.

Definition at line 294 of file panel2.h.

◆ setHeader()

template<class T>
void rtop::BrowsePanelData< T >::setHeader ( std::string  head_str)
inlineoverridevirtual

sets panel header.

Todo:
: will become redundant once header is implemented in separate panel. remove

Reimplemented from rtop::SimplePanelData.

Definition at line 286 of file panel2.h.

◆ setHeaderColor()

template<class T >
void rtop::BrowsePanelData< T >::setHeaderColor ( int  color_pair)
overridevirtual

sets color of menu's header item to be header color_pair

Reimplemented from rtop::SimplePanelData.

Reimplemented in rtop::EditPanelData< T >.

Definition at line 326 of file panel2.h.

◆ setSelectionColor()

template<class T>
void rtop::BrowsePanelData< T >::setSelectionColor ( int  color_pair)
inlineoverridevirtual

sets color_pair for selected menu item

Reimplemented from rtop::SimplePanelData.

Definition at line 292 of file panel2.h.

◆ Top()

template<class T >
void rtop::BrowsePanelData< T >::Top ( )
overridevirtual

sets menu's first item as selected item

Reimplemented from rtop::SimplePanelData.

Definition at line 593 of file panel2.h.

◆ Up()

template<class T >
void rtop::BrowsePanelData< T >::Up ( )
overridevirtual

moves menu item selection up by 1

Reimplemented from rtop::SimplePanelData.

Reimplemented in rtop::EditPanelData< T >.

Definition at line 574 of file panel2.h.

Friends And Related Function Documentation

◆ XMLTree

template<class T>
friend class XMLTree
friend

Definition at line 321 of file panel2.h.

Member Data Documentation

◆ basic_color

template<class T>
int rtop::BrowsePanelData< T >::basic_color
protected

color_pair id for unselected item in menu

Definition at line 271 of file panel2.h.

◆ capacity

template<class T>
int rtop::BrowsePanelData< T >::capacity
protected

capacity of object_list.

Todo:
: no explanation for using this. rationalize (because we are maintaining a vector of pointers?)

Definition at line 263 of file panel2.h.

◆ curr_color

template<class T>
int rtop::BrowsePanelData< T >::curr_color
protected

current color_pair (either selection_color or basic_color)

Definition at line 273 of file panel2.h.

◆ header

template<class T>
std::string rtop::BrowsePanelData< T >::header
protected

panel header.

Todo:
: header disappers when browsing a menu longer than screen height. add separate panel to hold header

Definition at line 277 of file panel2.h.

◆ header_color

template<class T>
int rtop::BrowsePanelData< T >::header_color
protected

color_paid id for header color

Definition at line 275 of file panel2.h.

◆ item_list

template<class T>
ITEM** rtop::BrowsePanelData< T >::item_list
protected

array of pointers to ITEM (array of ITEM*) for menu initialization

Definition at line 259 of file panel2.h.

◆ menu

template<class T>
MENU* rtop::BrowsePanelData< T >::menu
protected

pointer to MENU

Definition at line 265 of file panel2.h.

◆ object_list

template<class T>
std::vector<T*> rtop::BrowsePanelData< T >::object_list
protected

vector of pointers to generic type containing value that goes into menu item.

Todo:
: inefficient method of accessing data. replace either with linked list or some other mechanism

Definition at line 257 of file panel2.h.

◆ selected

template<class T>
int rtop::BrowsePanelData< T >::selected
protected

item selected in menu, 0 being header item

Definition at line 267 of file panel2.h.

◆ selection_color

template<class T>
int rtop::BrowsePanelData< T >::selection_color
protected

color_pair id for selected item in menu

Definition at line 269 of file panel2.h.

◆ size_item_list

template<class T>
int rtop::BrowsePanelData< T >::size_item_list
protected

size of object_list

Definition at line 261 of file panel2.h.


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