1 #ifndef GUI_WIDGETS_WX___TABLE_LIST_CTRL__HPP
2 #define GUI_WIDGETS_WX___TABLE_LIST_CTRL__HPP
49 #include <wx/listctrl.h>
50 #include <wx/imaglist.h>
53 #include <wx/tipwin.h>
139 const wxPoint& pos = wxDefaultPosition,
140 const wxSize&
size = wxDefaultSize,
141 long style = wxLC_REPORT | wxLC_VIRTUAL,
142 const wxValidator& validator = wxDefaultValidator,
143 const wxString& name = wxListCtrlNameStr
151 void SetModel(
IwxTableModel* data_model,
bool own =
false );
158 wxVariant GetValueVisibleAt(
int row,
int col )
const;
159 const wxString GetTypeVisibleAt(
int row,
int col )
const;
161 void EnableHeader(
bool flag );
166 void ExportTableControlToCSV();
168 #ifndef wxHAS_LISTCTRL_COLUMN_ORDER
170 int GetColumnOrder(
int col )
const;
171 int GetColumnIndexFromOrder(
int order )
const;
174 wxArrayInt GetColumnsOrder()
const;
177 bool SetColumnsOrder(
const wxArrayInt& orders );
180 bool SetColumnOrder(
int col,
int order );
182 int GetNumColumnsVisible()
const;
183 int GetNumColumnsHidden()
const;
185 int ColumnVisibleToIndex(
int col )
const;
186 int ColumnIndexToVisible(
int col )
const;
188 int ColumnHiddenToIndex(
int col )
const;
189 int ColumnIndexToHidden(
int col )
const;
191 int ColumnIndexToModel(
int col )
const;
192 int ColumnModelToIndex(
int col )
const;
194 int ColumnVisibleToModel(
int col )
const;
195 int ColumnModelToVisible(
int col )
const;
197 bool IsColumnVisibleByIndex(
int col )
const;
199 wxString GetColumnNameByModel(
int col )
const;
200 wxString GetColumnNameByIndex(
int col )
const;
201 wxString GetColumnNameVisible(
int col )
const;
202 wxString GetColumnNameHidden(
int col )
const;
204 wxString GetColumnTitleByModel(
int col )
const;
205 wxString GetColumnTitleByIndex(
int col )
const;
206 wxString GetColumnTitleVisible(
int col )
const;
207 wxString GetColumnTitleHidden(
int col )
const;
209 int GetModelIndexByName( wxString name )
const;
210 int GetColumnIndexByName( wxString name )
const;
211 int GetColumnVisibleByName( wxString name )
const;
212 int GetColumnHiddenByName( wxString name )
const;
214 wxListColumnFormat GetColumnAlign(
int col_ix )
const;
215 void SetColumnAlign(
int col_ix, wxListColumnFormat aAlign );
219 void AddColumn(
int model_ix,
bool hidden =
false );
221 void RemoveColumn(
int col_ix,
bool hide =
false );
222 void MoveColumn(
int col_ix,
int aTargetColIx );
224 void HideColumn(
int col_ix ){ RemoveColumn( col_ix,
true ); }
225 void ShowColumn(
int col_ix );
227 void RemoveAllColumns();
229 void CreateAllColumnsFromModel();
233 int RowVisibleToData(
int aRow )
const;
234 int RowDataToVisible(
int aRow )
const;
243 void ApplyFiltering(
bool preserve_state =
true );
257 void SetSorterByIndex(
int col );
259 _ASSERT( col < m_Columns.size() );
263 void SetSorterByColumns();
266 void SetSortedState( ESortedState sorted );
270 void UpdateSortIcons();
271 void ClearSortIcons();
274 void ResetSorting() { m_SortedCols.clear(); m_Sorted = eNoSort; InvalidateSorting(); }
275 void ApplySorting(
bool preserve_state =
true );
276 void ShiftSorting(
int col = -1 );
280 void CreateDefaultSorters();
285 int GetFocusRow()
const;
286 void SetFocusRow(
int row );
287 int GetFocusColumn()
const;
290 void OnFocusChanged( wxListEvent& event );
295 bool IsCellSelectedAt(
int row,
int WXUNUSED(col) )
const;
296 long GetLastSelected()
const;
299 void ClearSelection();
301 wxArrayInt GetDataRowsSelected()
const;
302 void GetDataRowsSelected( vector<int>& rows )
const;
303 void SetDataRowsSelected(
const vector<int>& rows );
327 virtual void EditingFinished();
349 CAnyRef<ITableCellEditor> GetDefaultEditor( const type_info& aType ) const;
350 void SetDefaultEditor( const type_info& aType, CAnyRef<ITableCellEditor> aEditor );
373 bool ShowHorzLines()
const;
374 void SetShowHorzLines(
bool show );
375 bool ShowVertLines()
const {
return (GetWindowStyleFlag() & wxLC_VRULES) != 0; }
378 void SetShowGrid(
bool aShow ){ SetShowHorzLines( aShow ); SetShowVertLines( aShow ); }
388 wxColor GetBackgroundColor() {
return GetBackgroundColour(); }
401 virtual void AppendMenuItems( wxMenu& aMenu );
404 void OnSelectionChanged( wxListEvent& event );
405 virtual void x_OnSelectionChanged(
bool on,
int start_row,
int end_row = -1 );
409 void OnColumnClick( wxListEvent &anEvt );
410 void OnColumnRightClick( wxListEvent &anEvt );
411 void OnColumnBeginDrag( wxListEvent &anEvt );
412 void OnColumnEndDrag( wxListEvent &anEvt );
414 void OnKeyDown( wxKeyEvent &anEvt );
416 void OnSelectAll( wxCommandEvent &anEvt );
418 void OnContextMenu( wxContextMenuEvent& anEvent );
420 void OnCopy( wxCommandEvent &anEvt );
421 void OnCopyUpdate( wxUpdateUIEvent &anEvt );
422 virtual void x_OnCopy();
424 void OnDebugEvent( wxListEvent &anEvt );
425 void OnMouseMove( wxMouseEvent &anEvt );
426 void OnLeftDown( wxMouseEvent &anEvt );
428 void OnTimer(wxTimerEvent& event);
430 void OnPaint( wxPaintEvent& anEvt );
433 void InternalOnPopupMenu( wxCommandEvent& event );
434 int DoGetPopupMenuSelectionFromUser( wxMenu& menu,
const wxPoint& pos );
435 int x_FindRow(
const wxPoint &pt)
const;
436 int x_FindColumn(
const wxPoint &pt)
const;
437 void x_ShowTooltip(
bool show);
439 int ShowHeaderContextMenu(
const wxPoint& pos );
448 void x_SaveViewState( SViewState*
state );
449 void x_RestoreViewState( SViewState*
state );
455 wxListColumnFormat GetAlignByType( wxString aColType );
459 virtual wxString OnGetItemText(
long aRow,
long aCol )
const;
460 virtual int OnGetItemImage(
long aRow )
const;
461 virtual int OnGetItemColumnImage(
long aRow,
long aCol )
const;
462 virtual wxListItemAttr* OnGetItemAttr(
long aRow )
const;
517 DECLARE_EVENT_TABLE()
class CRegistryReadView provides a nested hierarchical view at a particular key.
CIRef< IwxStringFormat > m_Formatter
CIRef< IRowSorter > m_Sorter
CTableListColumn & operator=(const CTableListColumn &column)
CTableListColumn(int aModelIndex)
CwxTableListCtrl - generic wxListCtrl-based Table Control.
void SetContextMenuEventPropagation(bool flag)
wxString m_ToolTipText
Test to put in tooltip.
void SetShowVertLines(bool show)
const vector< TSortedCol > & GetSortedCols() const
wxColor GetBackgroundColor() const
int m_TipStartX
Start/stop x value of cell to which tooltip belongs.
void SetFocusColumn(int WXUNUSED(col))
WX_DECLARE_STRING_HASH_MAP(IwxVariantSorter *, TSorterMap)
WX_DECLARE_STRING_HASH_MAP(int, TAliasMap)
wxColor GetSecondBackgroundColor() const
CFixGenericListCtrl m_FixGenericListCtrl
void SetShowGrid(bool aShow)
void SetSecondBackgroundColor(wxColor aColor)
IwxTableModel * m_DataModel
const wxString GetTypeFromModelAt(int row, int col) const
TSorterMap m_DefaultSorters
vector< CTableListColumn > m_Columns
void SetForegroundColor(wxColor aColor)
bool ShowVertLines() const
bool mf_ImageListInstalled
int m_CurrentCol
Last column user clicked on (tooltips are only on selected/clicked itmes)
ESortedState GetSortedState() const
void AddSorterIndex(size_t col, ESortedState state)
void SetBackgroundColor(wxColor aColor)
pair< int, ESortedState > TSortedCol
int m_CurrentRow
Last row user clicked on.
vector< int > m_VisibleRows
void HideColumn(int col_ix)
CIRef< IRowSorter > m_Sorter
bool ShouldPropagateContextMenu() const
vector< TSortedCol > m_SortedCols
int GetNumRowsVisible() const
wxColor GetForegroundColor() const
wxVariant GetValueFromModelAt(int row, int col) const
virtual void TableChanged(const CwxTableModelNotice &aNotice)=0
GUI command routing and handling framework.
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const char * column
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define NCBI_GUIWIDGETS_WX_EXPORT
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines: CTimeFormat - storage class for time format.
#define row(bind, expected)