CustomListCtrl Class Reference

Used as base class for all ListCtrls throughout SL Provides generic functionality, such as column tooltips, possiblity to prohibit column resizing and selection modifiers. More...

#include <customlistctrl.h>

Collaboration diagram for CustomListCtrl:
Collaboration graph
[legend]

Data Structures

struct  SortOrderItem

Public Member Functions

 CustomListCtrl (wxWindow *parent, wxWindowID id, const wxPoint &pt, const wxSize &sz, long style, wxString name, unsigned int column_count, bool highlight=true, UserActions::ActionType hlaction=UserActions::ActHighlight)
virtual ~CustomListCtrl ()
void OnSelected (wxListEvent &event)
void OnDeselected (wxListEvent &event)
void InsertColumn (long i, wxListItem item, wxString tip, bool=true)
void AddColumn (long i, int width, const wxString &label, const wxString &tip, bool=true)
virtual void OnTimer (wxTimerEvent &event)
 this event is triggered when delay timer (set in mousemotion) ended
void OnStartResizeCol (wxListEvent &event)
 prohibits resizin if so set in columnInfo
virtual void OnEndResizeCol (wxListEvent &event)
 we use this to automatically save column width after resizin
virtual void OnMouseMotion (wxMouseEvent &event)
 starts timer, sets tooltiptext
void CancelTooltipTimer ()
 stop timer (before displaying popup f.e.)
bool PopupMenu (wxMenu *menu, const wxPoint &pos=wxDefaultPosition)
 Override to have tooltip timer cancelled automatically.
void noOp (wxMouseEvent &event)
 does nothing
virtual bool SetColumnWidth (int col, int width)
 automatically get saved column width if already saved, otherwise use parameter and save new width
virtual void HighlightItem (long item)=0
 all that needs to be implemented in child class for UpdateHighlights to work
void HighlightItemUser (long item, const wxString &name)
void UpdateHighlights ()
void SetHighLightAction (UserActions::ActionType action)
void SelectNone ()
void MarkDirtySort ()
 marks the items in the control to be sorted
Single Selection methods

using these funcs in a multi selection list is meaingless at best, harmful in the worst case

Todo:
insert debug asserts to catch that
long GetSelectedIndex ()
void SetSelectedIndex (const long newindex)
long GetSelectedData ()
long GetIndexFromData (const unsigned long data)
void SetSelectionRestorePoint ()
 call this before example before sorting, inserting, etc
void ResetSelection ()
void RestoreSelection ()
 and this afterwards
Multi Selection methods

using these funcs in a single selection list is meaingless at best, harmful in the worst case

Todo:
insert debug asserts to catch that
void SelectAll ()
void SelectInverse ()

Protected Types

typedef UserActions::ActionType ActionType
typedef std::pair< wxString, bool > colInfo
typedef std::vector< colInfocolInfoVec
typedef std::map< unsigned int,
unsigned int > 
ColumnMap
 maps outward column index to internal
typedef std::map< int,
SortOrderItem
SortOrder

Protected Member Functions

int getColumnFromPosition (wxPoint pos)
 primarily used to get coulumn index in mousevents (from cur. mouse pos)
virtual void SetTipWindowText (const long item_hit, const wxPoint &position)

Protected Attributes

wxTimer m_tiptimer
 used to display tooltips for a certain amount of time
wxString m_tiptext
 always set to the currrently displayed tooltip text
unsigned int m_columnCount
long m_selected
 curently selected data
long m_selected_index
 index of curently selected data
long m_prev_selected
 previously selected data
long m_prev_selected_index
 index of previously selected data
colInfoVec m_colinfovec
 stores info about the columns (wxString name,bool isResizable) - pairs
wxPoint m_last_mouse_pos
wxString m_name
 used as label for saving column widths
bool m_highlight
 controls if highlighting should be considered
ActionType m_highlightAction
 which action should be considered?
const wxColour m_bg_color
bool m_dirty_sort
 list should be sorted
ColumnMap m_column_map
SortOrder m_sortorder

Static Protected Attributes

static const unsigned int m_tooltip_delay = 1000
 global Tooltip thingies (ms)
static const unsigned int m_tooltip_duration = 2000

Detailed Description

Used as base class for all ListCtrls throughout SL Provides generic functionality, such as column tooltips, possiblity to prohibit column resizing and selection modifiers.


Some of the provided functionality only makes sense for single-select lists (see grouping)
Note: Tooltips are a bitch and anyone shoudl feel to revise them (koshi)

Definition at line 34 of file customlistctrl.h.


Member Typedef Documentation

Definition at line 37 of file customlistctrl.h.

typedef std::pair<wxString,bool> CustomListCtrl::colInfo [protected]

Definition at line 49 of file customlistctrl.h.

typedef std::vector<colInfo> CustomListCtrl::colInfoVec [protected]

Definition at line 50 of file customlistctrl.h.

typedef std::map<unsigned int,unsigned int> CustomListCtrl::ColumnMap [protected]

maps outward column index to internal

Definition at line 53 of file customlistctrl.h.

typedef std::map<int,SortOrderItem> CustomListCtrl::SortOrder [protected]

Definition at line 100 of file customlistctrl.h.


Constructor & Destructor Documentation

CustomListCtrl::CustomListCtrl ( wxWindow *  parent,
wxWindowID  id,
const wxPoint pt,
const wxSize sz,
long  style,
wxString  name,
unsigned int  column_count,
bool  highlight = true,
UserActions::ActionType  hlaction = UserActions::ActHighlight 
)

Definition at line 30 of file customlistctrl.cpp.

virtual CustomListCtrl::~CustomListCtrl (  )  [inline, virtual]

Definition at line 108 of file customlistctrl.h.


Member Function Documentation

void CustomListCtrl::AddColumn ( long  i,
int  width,
const wxString label,
const wxString tip,
bool  modifiable = true 
)

Definition at line 76 of file customlistctrl.cpp.

void CustomListCtrl::CancelTooltipTimer (  ) 

stop timer (before displaying popup f.e.)

Definition at line 344 of file customlistctrl.cpp.

int CustomListCtrl::getColumnFromPosition ( wxPoint  pos  )  [protected]

primarily used to get coulumn index in mousevents (from cur. mouse pos)

Definition at line 257 of file customlistctrl.cpp.

long CustomListCtrl::GetIndexFromData ( const unsigned long  data  ) 

Definition at line 115 of file customlistctrl.cpp.

long CustomListCtrl::GetSelectedData (  ) 

Definition at line 161 of file customlistctrl.cpp.

long CustomListCtrl::GetSelectedIndex (  ) 

Definition at line 125 of file customlistctrl.cpp.

virtual void CustomListCtrl::HighlightItem ( long  item  )  [pure virtual]

all that needs to be implemented in child class for UpdateHighlights to work

void CustomListCtrl::HighlightItemUser ( long  item,
const wxString name 
)

Definition at line 324 of file customlistctrl.cpp.

void CustomListCtrl::InsertColumn ( long  i,
wxListItem  item,
wxString  tip,
bool  modifiable = true 
)

intermediate function to add info to m_colinfovec after calling base class function

Definition at line 62 of file customlistctrl.cpp.

void CustomListCtrl::MarkDirtySort (  ) 

marks the items in the control to be sorted

Definition at line 339 of file customlistctrl.cpp.

void CustomListCtrl::noOp ( wxMouseEvent &  event  ) 

does nothing

Definition at line 298 of file customlistctrl.cpp.

void CustomListCtrl::OnDeselected ( wxListEvent &  event  ) 

Definition at line 110 of file customlistctrl.cpp.

void CustomListCtrl::OnEndResizeCol ( wxListEvent &  event  )  [virtual]

we use this to automatically save column width after resizin

Definition at line 275 of file customlistctrl.cpp.

void CustomListCtrl::OnMouseMotion ( wxMouseEvent &  event  )  [virtual]

starts timer, sets tooltiptext

Definition at line 195 of file customlistctrl.cpp.

void CustomListCtrl::OnSelected ( wxListEvent &  event  ) 

Definition at line 102 of file customlistctrl.cpp.

void CustomListCtrl::OnStartResizeCol ( wxListEvent &  event  ) 

prohibits resizin if so set in columnInfo

Definition at line 269 of file customlistctrl.cpp.

void CustomListCtrl::OnTimer ( wxTimerEvent &  event  )  [virtual]

this event is triggered when delay timer (set in mousemotion) ended

Definition at line 166 of file customlistctrl.cpp.

bool CustomListCtrl::PopupMenu ( wxMenu *  menu,
const wxPoint pos = wxDefaultPosition 
)

Override to have tooltip timer cancelled automatically.

Definition at line 349 of file customlistctrl.cpp.

void CustomListCtrl::ResetSelection (  ) 

Definition at line 97 of file customlistctrl.cpp.

void CustomListCtrl::RestoreSelection (  ) 

and this afterwards

Definition at line 89 of file customlistctrl.cpp.

void CustomListCtrl::SelectAll (  ) 

Definition at line 130 of file customlistctrl.cpp.

void CustomListCtrl::SelectInverse (  ) 

Definition at line 146 of file customlistctrl.cpp.

void CustomListCtrl::SelectNone (  ) 

sets selected index to -1

Definition at line 138 of file customlistctrl.cpp.

bool CustomListCtrl::SetColumnWidth ( int  col,
int  width 
) [virtual]

automatically get saved column width if already saved, otherwise use parameter and save new width

Definition at line 285 of file customlistctrl.cpp.

void CustomListCtrl::SetHighLightAction ( UserActions::ActionType  action  ) 

Definition at line 334 of file customlistctrl.cpp.

void CustomListCtrl::SetSelectedIndex ( const long  newindex  ) 

Definition at line 156 of file customlistctrl.cpp.

void CustomListCtrl::SetSelectionRestorePoint (  ) 

call this before example before sorting, inserting, etc

Definition at line 83 of file customlistctrl.cpp.

void CustomListCtrl::SetTipWindowText ( const long  item_hit,
const wxPoint position 
) [protected, virtual]

Definition at line 243 of file customlistctrl.cpp.

void CustomListCtrl::UpdateHighlights (  ) 

Definition at line 310 of file customlistctrl.cpp.


Field Documentation

const wxColour CustomListCtrl::m_bg_color [protected]

Definition at line 87 of file customlistctrl.h.

stores info about the columns (wxString name,bool isResizable) - pairs

Definition at line 72 of file customlistctrl.h.

Definition at line 94 of file customlistctrl.h.

unsigned int CustomListCtrl::m_columnCount [protected]

Definition at line 47 of file customlistctrl.h.

bool CustomListCtrl::m_dirty_sort [protected]

list should be sorted

Definition at line 90 of file customlistctrl.h.

bool CustomListCtrl::m_highlight [protected]

controls if highlighting should be considered

Definition at line 82 of file customlistctrl.h.

which action should be considered?

Definition at line 85 of file customlistctrl.h.

Definition at line 76 of file customlistctrl.h.

used as label for saving column widths

Definition at line 79 of file customlistctrl.h.

previously selected data

Definition at line 66 of file customlistctrl.h.

index of previously selected data

Definition at line 68 of file customlistctrl.h.

long CustomListCtrl::m_selected [protected]

curently selected data

Definition at line 62 of file customlistctrl.h.

index of curently selected data

Definition at line 64 of file customlistctrl.h.

Definition at line 101 of file customlistctrl.h.

always set to the currrently displayed tooltip text

Definition at line 41 of file customlistctrl.h.

wxTimer CustomListCtrl::m_tiptimer [protected]

used to display tooltips for a certain amount of time

Definition at line 39 of file customlistctrl.h.

const unsigned int CustomListCtrl::m_tooltip_delay = 1000 [static, protected]

global Tooltip thingies (ms)

Definition at line 57 of file customlistctrl.h.

const unsigned int CustomListCtrl::m_tooltip_duration = 2000 [static, protected]

Definition at line 58 of file customlistctrl.h.


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

Generated on Thu Dec 29 00:11:43 2011 for SpringLobby by doxygen 1.6.3