NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CSelectionControl Class Referenceabstract

Search Toolkit Book for CSelectionControl

#include <gui/widgets/wx/selection_control.hpp>

+ Inheritance diagram for CSelectionControl:
+ Collaboration diagram for CSelectionControl:

Public Types

enum  EItemState { fDefaultState = 0x00 , fItemSelected = 0x01 , fItemFocused = 0x02 , fWidgetFocused = 0x04 }
 
enum  EStyle { fDefaultStyle = 0x00 , fSingleSelection = 0x01 }
 
typedef int TIndex
 
typedef void * TItemHandle
 
typedef vector< TIndexTIndexVector
 
typedef vector< TItemHandleTItemHandleVector
 

Public Member Functions

 CSelectionControl ()
 
virtual ~CSelectionControl ()
 
virtual int GetStyle () const
 Low-level worker functions - implementation dependend. More...
 
virtual void SetStyle (int style)
 
virtual int GetItemState (TIndex index) const
 Items state and selection. More...
 
virtual void SetItemState (TIndex index, int state)
 
virtual bool IsItemFocused (TIndex index) const
 
virtual TIndex GetFocusedIndex () const
 
virtual bool IsItemSelected (TIndex index) const
 
virtual TIndex GetSelectedIndex () const
 
virtual TIndex GetSelectedCount () const
 
virtual void GetSelectedIndexes (TIndexVector &indexes) const
 
virtual void FocusItem (TIndex index)
 
virtual void SelectItem (TIndex index, bool select=true)
 
virtual void SelectItems (TIndexVector &indexes, bool select=true)
 
virtual void SelectAll (bool select=true)
 
void MoveSelectionBy (int shift, CGUIEvent::EGUIState state)
 

Protected Types

typedef pair< TItemHandle, boolTItemEntry
 
typedef vector< TItemEntryTEntryVector
 
typedef map< TItemHandle, intTItemToIndexMap
 

Protected Member Functions

bool x_AssertIndexValid (TIndex index) const
 Protected API -. More...
 
TIndex x_GetItemsCount () const
 
void x_SetItems (const TItemHandleVector &items, bool b_update, bool keep_selection=false)
 
bool x_InsertItem (TIndex index, const TItemHandle &item, bool update)
 
void x_InsertItems (const TItemHandleVector &items, const TIndexVector &indices, bool update)
 
bool x_DeleteItem (TIndex index, bool update=true)
 
void x_DeleteAllItems ()
 
void x_Clear ()
 
virtual void x_SelectItem (TIndex index, bool select)
 
virtual void x_SendSelectionEvent (TIndex index)=0
 
virtual void x_SelectSingleItem (TIndex index)
 handles selection of a single item from UI More...
 
virtual void x_InvertSingleItem (TIndex index)
 
virtual void x_SelectItems (const TIndexVector &vIndexes, bool reset_others=false)
 Select items with given indices. More...
 
virtual void x_SelectAll (bool select=true)
 
virtual void x_SelectTo (TIndex index)
 
void OnMouseDown (wxMouseEvent &event)
 Event handling. More...
 
void OnKeyDown (wxKeyEvent &event)
 
void x_SelectTo (int index, CGUIEvent::EGUIState state)
 
void x_MoveSelectionBy (int shift, CGUIEvent::EGUIState state)
 
void x_SelectFocusedItem (bool deselect_en)
 
void x_UpdateItemToIndex ()
 
void x_DebugValid () const
 
virtual void x_UpdateItems (TIndexVector &indexes)=0
 
virtual void x_UpdateItemsRange (TIndex start, TIndex end)=0
 
virtual int x_GetIndexByWindowPos (int win_x, int win_y, bool clip=false)=0
 
virtual void x_MakeVisible (TIndex index)=0
 

Protected Attributes

TEntryVector m_Entries
 
TItemToIndexMap m_ItemToIndex
 
int m_Style
 
TIndex m_SelectedCount
 
TIndex m_SingleSelected
 number of selected items More...
 
TIndex m_FocusedIndex
 index of the selected itme (valid only in fSingleSelection mode) More...
 
TIndex m_AnchorIndex
 

Detailed Description

Definition at line 48 of file selection_control.hpp.

Member Typedef Documentation

◆ TEntryVector

typedef vector<TItemEntry> CSelectionControl::TEntryVector
protected

Definition at line 148 of file selection_control.hpp.

◆ TIndex

Definition at line 51 of file selection_control.hpp.

◆ TIndexVector

Definition at line 53 of file selection_control.hpp.

◆ TItemEntry

Definition at line 147 of file selection_control.hpp.

◆ TItemHandle

Definition at line 52 of file selection_control.hpp.

◆ TItemHandleVector

Definition at line 54 of file selection_control.hpp.

◆ TItemToIndexMap

Definition at line 149 of file selection_control.hpp.

Member Enumeration Documentation

◆ EItemState

Enumerator
fDefaultState 
fItemSelected 
fItemFocused 
fWidgetFocused 

Definition at line 56 of file selection_control.hpp.

◆ EStyle

Enumerator
fDefaultStyle 
fSingleSelection 

Definition at line 63 of file selection_control.hpp.

Constructor & Destructor Documentation

◆ CSelectionControl()

CSelectionControl::CSelectionControl ( )

Definition at line 46 of file selection_control.cpp.

◆ ~CSelectionControl()

virtual CSelectionControl::~CSelectionControl ( )
inlinevirtual

Definition at line 69 of file selection_control.hpp.

Member Function Documentation

◆ FocusItem()

void CSelectionControl::FocusItem ( TIndex  index)
virtual

Definition at line 166 of file selection_control.cpp.

References _ASSERT, m_FocusedIndex, x_DebugValid(), x_GetItemsCount(), and x_UpdateItems().

Referenced by SetItemState(), and x_SelectTo().

◆ GetFocusedIndex()

CSelectionControl::TIndex CSelectionControl::GetFocusedIndex ( ) const
virtual

◆ GetItemState()

int CSelectionControl::GetItemState ( TIndex  index) const
virtual

Items state and selection.

Definition at line 70 of file selection_control.cpp.

References fItemFocused, fItemSelected, IsItemFocused(), IsItemSelected(), and x_AssertIndexValid().

Referenced by CMapControl::x_DrawItemsRange().

◆ GetSelectedCount()

CSelectionControl::TIndex CSelectionControl::GetSelectedCount ( ) const
virtual

Definition at line 145 of file selection_control.cpp.

References m_SelectedCount.

◆ GetSelectedIndex()

CSelectionControl::TIndex CSelectionControl::GetSelectedIndex ( ) const
virtual

◆ GetSelectedIndexes()

void CSelectionControl::GetSelectedIndexes ( TIndexVector indexes) const
virtual

◆ GetStyle()

int CSelectionControl::GetStyle ( ) const
virtual

Low-level worker functions - implementation dependend.

Definition at line 58 of file selection_control.cpp.

References m_Style.

Referenced by GetSelectedIndex().

◆ IsItemFocused()

bool CSelectionControl::IsItemFocused ( TIndex  index) const
virtual

Definition at line 107 of file selection_control.cpp.

References m_FocusedIndex, and x_AssertIndexValid().

Referenced by GetItemState(), and SetItemState().

◆ IsItemSelected()

bool CSelectionControl::IsItemSelected ( TIndex  index) const
virtual

◆ MoveSelectionBy()

void CSelectionControl::MoveSelectionBy ( int  shift,
CGUIEvent::EGUIState  state 
)
inline

Definition at line 93 of file selection_control.hpp.

References x_MoveSelectionBy().

Referenced by CMapControl::OnMouseWheel().

◆ OnKeyDown()

void CSelectionControl::OnKeyDown ( wxKeyEvent &  event)
protected

◆ OnMouseDown()

void CSelectionControl::OnMouseDown ( wxMouseEvent &  event)
protected

◆ SelectAll()

void CSelectionControl::SelectAll ( bool  select = true)
virtual

Definition at line 202 of file selection_control.cpp.

References x_SelectAll().

◆ SelectItem()

void CSelectionControl::SelectItem ( TIndex  index,
bool  select = true 
)
virtual

◆ SelectItems()

void CSelectionControl::SelectItems ( TIndexVector indexes,
bool  select = true 
)
virtual

Definition at line 196 of file selection_control.cpp.

References x_SelectItems().

◆ SetItemState()

void CSelectionControl::SetItemState ( TIndex  index,
int  state 
)
virtual

◆ SetStyle()

void CSelectionControl::SetStyle ( int  style)
virtual

Definition at line 64 of file selection_control.cpp.

References m_Style.

Referenced by CGroupMapWidget::CGroupMapWidget().

◆ x_AssertIndexValid()

bool CSelectionControl::x_AssertIndexValid ( TIndex  index) const
protected

◆ x_Clear()

void CSelectionControl::x_Clear ( void  )
protected

◆ x_DebugValid()

void CSelectionControl::x_DebugValid ( ) const
protected

◆ x_DeleteAllItems()

void CSelectionControl::x_DeleteAllItems ( )
protected

Definition at line 301 of file selection_control.cpp.

References x_Clear(), and x_UpdateItemsRange().

Referenced by CMapControl::DeleteAllItems().

◆ x_DeleteItem()

bool CSelectionControl::x_DeleteItem ( TIndex  index,
bool  update = true 
)
protected

◆ x_GetIndexByWindowPos()

virtual int CSelectionControl::x_GetIndexByWindowPos ( int  win_x,
int  win_y,
bool  clip = false 
)
protectedpure virtual

Implemented in CMapControl.

Referenced by OnMouseDown().

◆ x_GetItemsCount()

CSelectionControl::TIndex CSelectionControl::x_GetItemsCount ( ) const
protected

◆ x_InsertItem()

bool CSelectionControl::x_InsertItem ( TIndex  index,
const TItemHandle item,
bool  update 
)
protected

◆ x_InsertItems()

void CSelectionControl::x_InsertItems ( const TItemHandleVector items,
const TIndexVector indices,
bool  update 
)
protected

◆ x_InvertSingleItem()

void CSelectionControl::x_InvertSingleItem ( TIndex  index)
protectedvirtual

◆ x_MakeVisible()

virtual void CSelectionControl::x_MakeVisible ( TIndex  index)
protectedpure virtual

Implemented in CMapControl.

Referenced by x_SelectTo().

◆ x_MoveSelectionBy()

void CSelectionControl::x_MoveSelectionBy ( int  shift,
CGUIEvent::EGUIState  state 
)
protected

Definition at line 537 of file selection_control.cpp.

References count, GetFocusedIndex(), max(), min(), x_GetItemsCount(), and x_SelectTo().

Referenced by MoveSelectionBy(), and OnKeyDown().

◆ x_SelectAll()

void CSelectionControl::x_SelectAll ( bool  select = true)
protectedvirtual

◆ x_SelectFocusedItem()

void CSelectionControl::x_SelectFocusedItem ( bool  deselect_en)
protected

Definition at line 578 of file selection_control.cpp.

References GetFocusedIndex(), IsItemSelected(), x_DebugValid(), and x_InvertSingleItem().

Referenced by OnKeyDown().

◆ x_SelectItem()

void CSelectionControl::x_SelectItem ( TIndex  index,
bool  select 
)
protectedvirtual

◆ x_SelectItems()

void CSelectionControl::x_SelectItems ( const TIndexVector indexes,
bool  reset_others = false 
)
protectedvirtual

Select items with given indices.

If "invert_others" == "true" - deselects all other items.

Definition at line 400 of file selection_control.cpp.

References i, IsItemSelected(), ITERATE, m_SelectedCount, x_DebugValid(), x_GetItemsCount(), x_SelectItem(), x_UpdateItems(), and x_UpdateItemsRange().

Referenced by SelectItems().

◆ x_SelectSingleItem()

void CSelectionControl::x_SelectSingleItem ( TIndex  index)
protectedvirtual

handles selection of a single item from UI

Definition at line 347 of file selection_control.cpp.

References GetSelectedIndexes(), i, IsItemSelected(), m_AnchorIndex, m_FocusedIndex, m_SelectedCount, x_DebugValid(), x_SelectItem(), and x_UpdateItems().

Referenced by OnMouseDown(), and x_SelectTo().

◆ x_SelectTo() [1/2]

void CSelectionControl::x_SelectTo ( int  index,
CGUIEvent::EGUIState  state 
)
protected

◆ x_SelectTo() [2/2]

void CSelectionControl::x_SelectTo ( TIndex  index)
protectedvirtual

◆ x_SendSelectionEvent()

virtual void CSelectionControl::x_SendSelectionEvent ( TIndex  index)
protectedpure virtual

Implemented in CMapControl.

Referenced by x_SelectItem().

◆ x_SetItems()

void CSelectionControl::x_SetItems ( const TItemHandleVector items,
bool  b_update,
bool  keep_selection = false 
)
protected

◆ x_UpdateItems()

virtual void CSelectionControl::x_UpdateItems ( TIndexVector indexes)
protectedpure virtual

◆ x_UpdateItemsRange()

virtual void CSelectionControl::x_UpdateItemsRange ( TIndex  start,
TIndex  end 
)
protectedpure virtual

◆ x_UpdateItemToIndex()

void CSelectionControl::x_UpdateItemToIndex ( )
protected

Definition at line 591 of file selection_control.cpp.

References map_checker< Container >::clear(), i, m_Entries, and m_ItemToIndex.

Referenced by x_InsertItem(), and x_InsertItems().

Member Data Documentation

◆ m_AnchorIndex

TIndex CSelectionControl::m_AnchorIndex
protected

◆ m_Entries

TEntryVector CSelectionControl::m_Entries
protected

◆ m_FocusedIndex

TIndex CSelectionControl::m_FocusedIndex
protected

index of the selected itme (valid only in fSingleSelection mode)

Definition at line 157 of file selection_control.hpp.

Referenced by FocusItem(), GetFocusedIndex(), IsItemFocused(), x_Clear(), x_DeleteItem(), x_InvertSingleItem(), x_SelectSingleItem(), and x_SelectTo().

◆ m_ItemToIndex

TItemToIndexMap CSelectionControl::m_ItemToIndex
protected

Definition at line 152 of file selection_control.hpp.

Referenced by x_Clear(), x_DebugValid(), x_DeleteItem(), and x_UpdateItemToIndex().

◆ m_SelectedCount

TIndex CSelectionControl::m_SelectedCount
protected

◆ m_SingleSelected

TIndex CSelectionControl::m_SingleSelected
protected

number of selected items

Definition at line 156 of file selection_control.hpp.

◆ m_Style

int CSelectionControl::m_Style
protected

Definition at line 154 of file selection_control.hpp.

Referenced by GetStyle(), OnMouseDown(), SetStyle(), and x_SelectTo().


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:57:01 2024 by modify_doxy.py rev. 669887