NCBI C++ ToolKit
|
Search Toolkit Book for CSelectionControl
#include <gui/widgets/wx/selection_control.hpp>
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< TIndex > | TIndexVector |
typedef vector< TItemHandle > | TItemHandleVector |
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, bool > | TItemEntry |
typedef vector< TItemEntry > | TEntryVector |
typedef map< TItemHandle, int > | TItemToIndexMap |
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 |
Definition at line 48 of file selection_control.hpp.
|
protected |
Definition at line 148 of file selection_control.hpp.
typedef int CSelectionControl::TIndex |
Definition at line 51 of file selection_control.hpp.
typedef vector<TIndex> CSelectionControl::TIndexVector |
Definition at line 53 of file selection_control.hpp.
|
protected |
Definition at line 147 of file selection_control.hpp.
typedef void* CSelectionControl::TItemHandle |
Definition at line 52 of file selection_control.hpp.
typedef vector<TItemHandle> CSelectionControl::TItemHandleVector |
Definition at line 54 of file selection_control.hpp.
|
protected |
Definition at line 149 of file selection_control.hpp.
Enumerator | |
---|---|
fDefaultState | |
fItemSelected | |
fItemFocused | |
fWidgetFocused |
Definition at line 56 of file selection_control.hpp.
Enumerator | |
---|---|
fDefaultStyle | |
fSingleSelection |
Definition at line 63 of file selection_control.hpp.
CSelectionControl::CSelectionControl | ( | ) |
Definition at line 46 of file selection_control.cpp.
|
inlinevirtual |
Definition at line 69 of file selection_control.hpp.
|
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().
|
virtual |
Definition at line 115 of file selection_control.cpp.
References m_FocusedIndex.
Referenced by CMapControl::x_HorzMoveSelectionBy(), x_MoveSelectionBy(), and x_SelectFocusedItem().
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().
|
virtual |
Definition at line 145 of file selection_control.cpp.
References m_SelectedCount.
|
virtual |
Reimplemented in CMapControl.
Definition at line 128 of file selection_control.cpp.
References _ASSERT, count, fSingleSelection, GetStyle(), i, m_Entries, m_SelectedCount, and x_GetItemsCount().
Referenced by CMapControl::GetSelectedIndex(), and CRunToolDlg::x_CreateToolItems().
|
virtual |
Definition at line 151 of file selection_control.cpp.
References _ASSERT, count, i, m_Entries, m_SelectedCount, x_DebugValid(), and x_GetItemsCount().
Referenced by CMapControl::x_DoDefaultActionOnSelected(), and x_SelectSingleItem().
|
virtual |
Low-level worker functions - implementation dependend.
Definition at line 58 of file selection_control.cpp.
References m_Style.
Referenced by GetSelectedIndex().
Definition at line 107 of file selection_control.cpp.
References m_FocusedIndex, and x_AssertIndexValid().
Referenced by GetItemState(), and SetItemState().
Definition at line 121 of file selection_control.cpp.
References m_Entries, and x_AssertIndexValid().
Referenced by GetItemState(), SetItemState(), x_DeleteItem(), x_InvertSingleItem(), x_SelectFocusedItem(), x_SelectItems(), x_SelectSingleItem(), and x_SelectTo().
|
inline |
Definition at line 93 of file selection_control.hpp.
References x_MoveSelectionBy().
Referenced by CMapControl::OnMouseWheel().
|
protected |
Definition at line 502 of file selection_control.cpp.
References CGUIEvent::eSelectIncState, ncbi::grid::netcache::search::fields::key, CGUIEvent::wxGetSelectState(), x_GetItemsCount(), x_MoveSelectionBy(), x_SelectAll(), x_SelectFocusedItem(), and x_SelectTo().
Referenced by CMapControl::OnKeyDown().
|
protected |
Event handling.
Definition at line 473 of file selection_control.cpp.
References CGUIEvent::eSelectExtState, CGUIEvent::eSelectIncState, CGUIEvent::eSelectState, fSingleSelection, m_Style, CGUIEvent::wxGetSelectState(), x_GetIndexByWindowPos(), x_InvertSingleItem(), x_SelectAll(), x_SelectSingleItem(), and x_SelectTo().
Referenced by CMapControl::OnMouseDown().
Definition at line 202 of file selection_control.cpp.
References x_SelectAll().
Definition at line 186 of file selection_control.cpp.
References x_AssertIndexValid(), x_SelectItem(), and x_UpdateItemsRange().
Referenced by CGroupMapWidget::Init(), SetItemState(), and CRunToolDlg::x_CreateToolItems().
|
virtual |
Definition at line 196 of file selection_control.cpp.
References x_SelectItems().
Definition at line 87 of file selection_control.cpp.
References fItemFocused, fItemSelected, FocusItem(), IsItemFocused(), IsItemSelected(), SelectItem(), and x_AssertIndexValid().
|
virtual |
Definition at line 64 of file selection_control.cpp.
References m_Style.
Referenced by CGroupMapWidget::CGroupMapWidget().
Protected API -.
TODO move up
Definition at line 323 of file selection_control.cpp.
References _ASSERT, and m_Entries.
Referenced by CMapControl::DeleteItem(), CMapControl::GetItem(), GetItemState(), IsItemFocused(), IsItemSelected(), SelectItem(), SetItemState(), x_DeleteItem(), CMapControl::x_GetItem(), x_InvertSingleItem(), CMapControl::x_MakeVisible(), and x_SelectItem().
|
protected |
Definition at line 308 of file selection_control.cpp.
References map_checker< Container >::clear(), m_AnchorIndex, m_Entries, m_FocusedIndex, m_ItemToIndex, and m_SelectedCount.
Referenced by x_DeleteAllItems().
|
protected |
Definition at line 600 of file selection_control.cpp.
References _ASSERT, i, m_Entries, m_ItemToIndex, m_SelectedCount, and map_checker< Container >::size().
Referenced by FocusItem(), GetSelectedIndexes(), x_DeleteItem(), x_InvertSingleItem(), x_SelectAll(), x_SelectFocusedItem(), x_SelectItems(), x_SelectSingleItem(), and x_SelectTo().
|
protected |
Definition at line 301 of file selection_control.cpp.
References x_Clear(), and x_UpdateItemsRange().
Referenced by CMapControl::DeleteAllItems().
Definition at line 271 of file selection_control.cpp.
References count, map_checker< Container >::erase(), IsItemSelected(), m_AnchorIndex, m_Entries, m_FocusedIndex, m_ItemToIndex, m_SelectedCount, max(), x_AssertIndexValid(), x_DebugValid(), x_GetItemsCount(), and x_UpdateItemsRange().
Referenced by CMapControl::DeleteItem().
|
protectedpure virtual |
Implemented in CMapControl.
Referenced by OnMouseDown().
|
protected |
Definition at line 223 of file selection_control.cpp.
References m_Entries.
Referenced by FocusItem(), GetSelectedIndex(), GetSelectedIndexes(), OnKeyDown(), x_DeleteItem(), x_InsertItem(), x_InsertItems(), x_MoveSelectionBy(), x_SelectAll(), x_SelectItems(), and x_SelectTo().
|
protected |
Definition at line 255 of file selection_control.cpp.
References m_Entries, max(), x_GetItemsCount(), x_UpdateItemsRange(), and x_UpdateItemToIndex().
Referenced by CMapControl::AddItem(), and CMapControl::InsertItem().
|
protected |
Definition at line 229 of file selection_control.cpp.
References _ASSERT, i, m_Entries, max(), min(), x_GetItemsCount(), x_UpdateItemsRange(), and x_UpdateItemToIndex().
|
protectedvirtual |
Definition at line 375 of file selection_control.cpp.
References IsItemSelected(), m_AnchorIndex, m_FocusedIndex, m_SelectedCount, x_AssertIndexValid(), x_DebugValid(), x_SelectItem(), and x_UpdateItems().
Referenced by OnMouseDown(), and x_SelectFocusedItem().
|
protectedpure virtual |
Implemented in CMapControl.
Referenced by x_SelectTo().
|
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().
Definition at line 208 of file selection_control.cpp.
References count, i, m_Entries, m_SelectedCount, x_DebugValid(), x_GetItemsCount(), and x_UpdateItemsRange().
Referenced by OnKeyDown(), OnMouseDown(), and SelectAll().
|
protected |
Definition at line 578 of file selection_control.cpp.
References GetFocusedIndex(), IsItemSelected(), x_DebugValid(), and x_InvertSingleItem().
Referenced by OnKeyDown().
Definition at line 331 of file selection_control.cpp.
References m_Entries, m_SelectedCount, x_AssertIndexValid(), and x_SendSelectionEvent().
Referenced by SelectItem(), x_InvertSingleItem(), x_SelectItems(), x_SelectSingleItem(), and x_SelectTo().
|
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().
|
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().
|
protected |
Definition at line 554 of file selection_control.cpp.
References CGUIEvent::eSelectExtState, CGUIEvent::eSelectIncState, CGUIEvent::eSelectState, FocusItem(), fSingleSelection, m_Style, x_DebugValid(), x_MakeVisible(), x_SelectSingleItem(), and x_SelectTo().
|
protectedvirtual |
Definition at line 436 of file selection_control.cpp.
References count, i, IsItemSelected(), m_AnchorIndex, m_FocusedIndex, max(), min(), x_DebugValid(), x_GetItemsCount(), x_SelectItem(), and x_UpdateItems().
Referenced by OnKeyDown(), OnMouseDown(), CMapControl::x_HorzMoveSelectionBy(), x_MoveSelectionBy(), and x_SelectTo().
|
protectedpure virtual |
Implemented in CMapControl.
Referenced by x_SelectItem().
|
protected |
|
protectedpure virtual |
Implemented in CMapControl.
Referenced by FocusItem(), x_InvertSingleItem(), x_SelectItems(), x_SelectSingleItem(), and x_SelectTo().
|
protectedpure virtual |
Implemented in CMapControl.
Referenced by SelectItem(), x_DeleteAllItems(), x_DeleteItem(), x_InsertItem(), x_InsertItems(), x_SelectAll(), and x_SelectItems().
|
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().
|
protected |
Definition at line 158 of file selection_control.hpp.
Referenced by x_Clear(), x_DeleteItem(), x_InvertSingleItem(), x_SelectSingleItem(), and x_SelectTo().
|
protected |
Definition at line 151 of file selection_control.hpp.
Referenced by GetSelectedIndex(), GetSelectedIndexes(), IsItemSelected(), x_AssertIndexValid(), x_Clear(), x_DebugValid(), x_DeleteItem(), x_GetItemsCount(), x_InsertItem(), x_InsertItems(), x_SelectAll(), x_SelectItem(), and x_UpdateItemToIndex().
|
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().
|
protected |
Definition at line 152 of file selection_control.hpp.
Referenced by x_Clear(), x_DebugValid(), x_DeleteItem(), and x_UpdateItemToIndex().
|
protected |
Definition at line 155 of file selection_control.hpp.
Referenced by GetSelectedCount(), GetSelectedIndex(), GetSelectedIndexes(), x_Clear(), x_DebugValid(), x_DeleteItem(), x_InvertSingleItem(), x_SelectAll(), x_SelectItem(), x_SelectItems(), and x_SelectSingleItem().
|
protected |
number of selected items
Definition at line 156 of file selection_control.hpp.
|
protected |
Definition at line 154 of file selection_control.hpp.
Referenced by GetStyle(), OnMouseDown(), SetStyle(), and x_SelectTo().