NCBI C++ ToolKit
|
Search Toolkit Book for CTableImportListCtrl
CTableImportCtrl -. More...
#include <gui/widgets/loaders/table_import_listctrl.hpp>
Public Types | |
enum | eDataViewType { eSingleColumn , eMultiColumn } |
Do we view each record in one column or use all parsed fields? More... | |
Public Member Functions | |
CTableImportListCtrl () | |
ctor More... | |
CTableImportListCtrl (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxLC_REPORT|wxLC_VIRTUAL, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxListCtrlNameStr) | |
ctor More... | |
virtual | ~CTableImportListCtrl () |
dtor More... | |
void | SetViewType (eDataViewType t) |
Set/get view type. More... | |
eDataViewType | GetDataViewType () const |
void | SetDisplayTypeHeader (bool b) |
If true, type information is displayed on first row. More... | |
bool | GetDisplayTypeHeader () const |
void | SetDataSource (CRef< CTableImportDataSource > ds) |
Set/update data source (used to refresh view to match data source column info) More... | |
int | GetColumnImageID (int col, bool checkbox_only=false) const |
Returns image ID for column headers. More... | |
void | DivideColumn (int col) |
Creates a new column by dividing the specified column. More... | |
void | MergeColumns (int col) |
Removes a column by merging the specified column with the column to its right (or does nothing if it is the last column) More... | |
void | UpdateColumnNames () |
Update numbered column names to match current number of columns and sync column names to names in data source that may come from a parsed header row. More... | |
void | SetFixedWidthUseFields (bool b) |
Set to true for lists which display rows divided into fixed length fields but do not allow those field layouts to be updated. More... | |
bool | GetFixedWidthUseFields () const |
void | SynchDataSourceColumnWidths () |
Synch widths of datasource to updated colums. More... | |
void | UpdateColumnWidths () |
Update m_ColumnWidths for use when resizing columns (ignores first col) More... | |
void | UpdateColumnImages (bool checkbox_only=false) |
Update images on column headers. More... | |
vector< int > | GetColumnWidths () |
Get the most-recently set column widths (ignores first col) More... | |
bool | ColumnWidthsUpdated () |
Returns true if current column widths do not match m_ColumnWidths. More... | |
void | WriteWidths (const string &prefix) |
void | SetColumnWidthIgnoreEvent (int col, int width) |
Calls SetColumnWidth after setting m_IgnoreWidthEvent. More... | |
bool | IgnoreWidthEvent () const |
If true, we are setting a width but don't want event handler to to it. More... | |
int | GetFontWidth () const |
Return the width of font used in list (used to calculate column widths in number-of-chars. More... | |
int | GetColumnsCombinedCharWidth () |
Add up the number of characters all the columns together can hold (ignores first column) More... | |
Protected Member Functions | |
wxString | OnGetItemText (long row, long col) const |
Get the requested field (or full row if m_ViewType == eSingleColumn) More... | |
wxListItemAttr * | OnGetItemAttr (long item) const |
Get attribute override for a specified row (allows special appearance for first row) More... | |
virtual int | OnGetItemColumnImage (long, long) const |
Required function if I want to put icons in column headers (but this function indicates what icon to put in list items (so I return -1) More... | |
Static Protected Member Functions | |
static wxString | x_ToWxStringWithTabs (const string &str) |
Convert strings with tab characters to wxStrings with 4 spaces for each tab. More... | |
Protected Attributes | |
eDataViewType | m_ViewType |
Do we show all columns seaprated or show as one field. More... | |
bool | m_FixedWidthUseFields |
If fixed-length columns are not being actively adjusted, this is set to true so that they can be displayed based on most recent parsing into table records rather than free-flowing. More... | |
CRef< CTableImportDataSource > | m_ImportedTableData |
Data table to be rendered in the list. More... | |
wxImageList | m_ImageList |
Holds column icons (shows whether column currently selected or not) More... | |
int | m_FontWidth |
Need font width for calculating how many chars fit in a column. More... | |
vector< int > | m_ColumnWidths |
Widths of columns as updated by UpdateColumnWidths() More... | |
bool | m_IgnoreWidthEvent |
If true, this flag can be used in column-resize event handlers to ignore resize events being generated by the list control itself. More... | |
wxListItemAttr | m_FirstRowAttr |
First row holds type info. More... | |
bool | m_DisplayTypeHeader |
If true, type information will be displayed in first row. More... | |
CTableImportCtrl -.
This class is a specialized version of wxListCtrl designed to show data from a CTableImportDataSource data source. Records from this data source come from a tabular file (such as a CSV file) and record fields may be fixed-lenght or delimited by one or more characters.
Fields are retrieved from the table via OnGetItemText(row,col) which gets the row and field data based on the field position info derived from the tables format (fixed-field or character-delimited).
Definition at line 61 of file table_import_listctrl.hpp.
Do we view each record in one column or use all parsed fields?
Enumerator | |
---|---|
eSingleColumn | |
eMultiColumn |
Definition at line 66 of file table_import_listctrl.hpp.
|
inline |
ctor
Definition at line 70 of file table_import_listctrl.hpp.
CTableImportListCtrl::CTableImportListCtrl | ( | wxWindow * | parent, |
wxWindowID | id = wxID_ANY , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = wxLC_REPORT | wxLC_VIRTUAL , |
||
const wxValidator & | validator = wxDefaultValidator , |
||
const wxString & | name = wxListCtrlNameStr |
||
) |
ctor
Definition at line 46 of file table_import_listctrl.cpp.
References GetDefaultFileArtProvider(), m_FirstRowAttr, m_ImageList, wxFileArtProvider::RegisterFileAlias(), and wxT.
|
inlinevirtual |
dtor
Definition at line 84 of file table_import_listctrl.hpp.
bool CTableImportListCtrl::ColumnWidthsUpdated | ( | ) |
Returns true if current column widths do not match m_ColumnWidths.
Definition at line 574 of file table_import_listctrl.cpp.
References CTableImportDataSource::GetColumns(), i, m_ColumnWidths, m_FontWidth, m_ImportedTableData, and min().
Referenced by CTableFixedWidthPanel::OnCTableImportListctrlColDragging().
void CTableImportListCtrl::DivideColumn | ( | int | col | ) |
Creates a new column by dividing the specified column.
Definition at line 335 of file table_import_listctrl.cpp.
References CTableImportDataSource::GetColumns(), m_FontWidth, m_IgnoreWidthEvent, m_ImportedTableData, NStr::NumericToString(), CTableImportDataSource::RecomputeHeaders(), CTableImportColumn::SetName(), CTableImportColumn::SetWidth(), ToWxString(), and UpdateColumnNames().
Referenced by CTableFixedWidthPanel::OnCtableImportListctrlColLeftClick().
Returns image ID for column headers.
Definition at line 307 of file table_import_listctrl.cpp.
References CTableImportColumn::eSeqIdColumn, CTableImportDataSource::GetColumns(), CRef< C, Locker >::IsNull(), m_ImportedTableData, and ncbi::grid::netcache::search::fields::size.
Referenced by CTableColumnIdPanel::OnCtableImportListctrlColLeftClick(), CAttribTableDelimitersPanel::OnListctrlColLeftClick(), CAttribTableDelimitersPanel::OnMergeColsBtnClick(), CTableColumnIdPanel::OnSkipBtnSelected(), CAttribTableDelimitersPanel::OnSplitColBtnClick(), CTableColumnIdPanel::Show(), UpdateColumnImages(), and CTableColumnIdPanel::x_OnColumnTypeUpdate().
int CTableImportListCtrl::GetColumnsCombinedCharWidth | ( | ) |
Add up the number of characters all the columns together can hold (ignores first column)
Definition at line 488 of file table_import_listctrl.cpp.
References i, m_FontWidth, and min().
Referenced by CTableFixedWidthPanel::OnCtableImportListctrlColEndDrag(), and CTableFixedWidthPanel::OnIdle().
vector< int > CTableImportListCtrl::GetColumnWidths | ( | ) |
Get the most-recently set column widths (ignores first col)
Definition at line 566 of file table_import_listctrl.cpp.
References m_ColumnWidths, and UpdateColumnWidths().
Referenced by CTableFixedWidthPanel::OnCTableImportListctrlColDragging(), CTableFixedWidthPanel::OnCtableImportListctrlColLeftClick(), and CTableFixedWidthPanel::OnIdle().
|
inline |
Definition at line 89 of file table_import_listctrl.hpp.
References m_ViewType.
|
inline |
Definition at line 93 of file table_import_listctrl.hpp.
References m_DisplayTypeHeader.
|
inline |
Definition at line 118 of file table_import_listctrl.hpp.
References m_FixedWidthUseFields.
|
inline |
Return the width of font used in list (used to calculate column widths in number-of-chars.
Font has to be fixed-width for this to be useful
Definition at line 146 of file table_import_listctrl.hpp.
References m_FontWidth.
Referenced by CTableFixedWidthPanel::OnCTableImportListctrlColDragging(), and CTableFixedWidthPanel::OnIdle().
|
inline |
If true, we are setting a width but don't want event handler to to it.
Definition at line 142 of file table_import_listctrl.hpp.
References m_IgnoreWidthEvent.
Referenced by CTableFixedWidthPanel::OnCTableImportListctrlColDragging().
void CTableImportListCtrl::MergeColumns | ( | int | col | ) |
Removes a column by merging the specified column with the column to its right (or does nothing if it is the last column)
Definition at line 394 of file table_import_listctrl.cpp.
References CTableImportDataSource::GetColumns(), CTableImportDataSource::GetColumnWidth(), m_FontWidth, m_IgnoreWidthEvent, m_ImportedTableData, and UpdateColumnNames().
Referenced by CTableFixedWidthPanel::OnCtableImportListctrlColLeftClick().
|
protected |
Get attribute override for a specified row (allows special appearance for first row)
Definition at line 732 of file table_import_listctrl.cpp.
References m_DisplayTypeHeader, m_FirstRowAttr, and NULL.
|
inlineprotectedvirtual |
Required function if I want to put icons in column headers (but this function indicates what icon to put in list items (so I return -1)
Definition at line 162 of file table_import_listctrl.hpp.
|
protected |
Get the requested field (or full row if m_ViewType == eSingleColumn)
Definition at line 631 of file table_import_listctrl.cpp.
References CTableImportDataSource::eDelimitedTable, eSingleColumn, CTableImportColumn::eSkippedColumn, CTableImportDataSource::GetColumn(), CTableImportDataSource::GetField(), CTableImportDataSource::GetFirstImportRow(), CTableImportDataSource::GetNumRows(), CTableImportDataSource::GetRow(), CTableImportRow::GetRowNum(), CTableImportDataSource::GetTableType(), CTableImportColumn::GetType(), CTableImportRow::GetValue(), i, int, CRef< C, Locker >::IsNull(), m_DisplayTypeHeader, m_FixedWidthUseFields, m_FontWidth, m_ImportedTableData, m_ViewType, min(), row, str(), wxT, and x_ToWxStringWithTabs().
Calls SetColumnWidth after setting m_IgnoreWidthEvent.
Definition at line 599 of file table_import_listctrl.cpp.
References m_IgnoreWidthEvent.
Referenced by CTableFixedWidthPanel::OnCTableImportListctrlColDragging(), and CTableFixedWidthPanel::OnIdle().
void CTableImportListCtrl::SetDataSource | ( | CRef< CTableImportDataSource > | ds | ) |
Set/update data source (used to refresh view to match data source column info)
Definition at line 115 of file table_import_listctrl.cpp.
References CTableImportDataSource::eDelimitedTable, f, i, int, log10(), max(), NULL, ncbi::grid::netcache::search::fields::size, ToWxString(), and wxT.
Referenced by CAttribTableDelimitersPanel::OnMergeColsBtnClick(), CAttribTableColumnIdPanel::OnMergeIDColsClick(), CAttribTableDelimitersPanel::OnParseColumnNamesBtnClick(), CAttribTableDelimitersPanel::OnSplitColBtnClick(), CAttribTableColumnIdPanel::OnSplitFirstColClick(), CAttribTableDelimitersPanel::PreviewData(), CTableFormatPanel::PreviewData(), CTableColumnIdPanel::Show(), CAttribTableDelimitersPanel::Show(), CTableDelimitersPanel::Show(), CTableFixedWidthPanel::Show(), CAttribTableDelimitersPanel::UpdateDelimiters(), CTableDelimitersPanel::UpdateDelimiters(), and CAttribTableColumnIdPanel::x_GuessQualifiers().
|
inline |
If true, type information is displayed on first row.
Definition at line 92 of file table_import_listctrl.hpp.
References b, and m_DisplayTypeHeader.
Referenced by CTableColumnIdPanel::CreateControls().
|
inline |
Set to true for lists which display rows divided into fixed length fields but do not allow those field layouts to be updated.
Definition at line 117 of file table_import_listctrl.hpp.
References b, and m_FixedWidthUseFields.
Referenced by CTableColumnIdPanel::CreateControls().
|
inline |
Set/get view type.
Allows us to render the text in a single column even after multiple columns are parsed
Definition at line 88 of file table_import_listctrl.hpp.
References m_ViewType, and t.
Referenced by CTableFixedWidthPanel::LoadSettings(), CTableFormatPanel::LoadSettings(), CAttribTableDelimitersPanel::PreviewData(), CTableColumnIdPanel::Show(), CAttribTableDelimitersPanel::Show(), CTableDelimitersPanel::Show(), CTableFixedWidthPanel::Show(), and CAttribTableColumnIdPanel::x_GuessQualifiers().
void CTableImportListCtrl::SynchDataSourceColumnWidths | ( | ) |
Synch widths of datasource to updated colums.
Definition at line 468 of file table_import_listctrl.cpp.
References CTableImportDataSource::GetColumns(), i, m_FontWidth, m_ImportedTableData, min(), and ncbi::grid::netcache::search::fields::size.
Referenced by CTableFixedWidthPanel::OnCTableImportListctrlColDragging(), and CTableFixedWidthPanel::OnIdle().
Update images on column headers.
Definition at line 534 of file table_import_listctrl.cpp.
References GetColumnImageID(), CTableImportDataSource::GetColumns(), i, m_FontWidth, and m_ImportedTableData.
Referenced by CAttribTableColumnIdPanel::OnCtableImportListctrlColLeftClick(), CAttribTableColumnIdPanel::OnMatchColumnClick(), CAttribTableColumnIdPanel::OnMatchTypeSelected(), CAttribTableColumnIdPanel::OnMergeIDColsClick(), CAttribTableColumnIdPanel::OnSkipBtnSelected(), CAttribTableColumnIdPanel::OnSplitFirstColClick(), CAttribTableDelimitersPanel::Show(), CAttribTableColumnIdPanel::UpdateEditor(), and CAttribTableColumnIdPanel::x_GuessQualifiers().
void CTableImportListCtrl::UpdateColumnNames | ( | ) |
Update numbered column names to match current number of columns and sync column names to names in data source that may come from a parsed header row.
Definition at line 438 of file table_import_listctrl.cpp.
References NStr::fConvErr_NoThrow, CTableImportDataSource::GetColumns(), i, m_ImportedTableData, NStr::NumericToString(), NStr::Split(), NStr::StringToInt(), and ToWxString().
Referenced by DivideColumn(), MergeColumns(), and CTableFixedWidthPanel::OnCTableImportListctrlColDragging().
void CTableImportListCtrl::UpdateColumnWidths | ( | ) |
Update m_ColumnWidths for use when resizing columns (ignores first col)
Definition at line 508 of file table_import_listctrl.cpp.
References CTableImportDataSource::GetColumns(), i, m_ColumnWidths, m_FontWidth, m_ImportedTableData, and min().
Referenced by GetColumnWidths(), CTableFixedWidthPanel::OnCTableImportListctrlColDragging(), CTableFixedWidthPanel::OnCtableImportListctrlColLeftClick(), and CTableFixedWidthPanel::OnIdle().
Definition at line 552 of file table_import_listctrl.cpp.
References _TRACE, i, and NStr::IntToString().
Convert strings with tab characters to wxStrings with 4 spaces for each tab.
Gets around bug/issue in windows where wxListCtrl ignores tabs
Definition at line 609 of file table_import_listctrl.cpp.
References i, result, str(), and ToWxString().
Referenced by OnGetItemText().
|
protected |
Widths of columns as updated by UpdateColumnWidths()
Definition at line 189 of file table_import_listctrl.hpp.
Referenced by ColumnWidthsUpdated(), GetColumnWidths(), and UpdateColumnWidths().
|
protected |
If true, type information will be displayed in first row.
Definition at line 199 of file table_import_listctrl.hpp.
Referenced by GetDisplayTypeHeader(), OnGetItemAttr(), OnGetItemText(), and SetDisplayTypeHeader().
|
protected |
First row holds type info.
Definition at line 196 of file table_import_listctrl.hpp.
Referenced by CTableImportListCtrl(), and OnGetItemAttr().
|
protected |
If fixed-length columns are not being actively adjusted, this is set to true so that they can be displayed based on most recent parsing into table records rather than free-flowing.
Definition at line 177 of file table_import_listctrl.hpp.
Referenced by GetFixedWidthUseFields(), OnGetItemText(), and SetFixedWidthUseFields().
|
protected |
Need font width for calculating how many chars fit in a column.
Definition at line 186 of file table_import_listctrl.hpp.
Referenced by ColumnWidthsUpdated(), DivideColumn(), GetColumnsCombinedCharWidth(), GetFontWidth(), MergeColumns(), OnGetItemText(), SynchDataSourceColumnWidths(), UpdateColumnImages(), and UpdateColumnWidths().
|
protected |
If true, this flag can be used in column-resize event handlers to ignore resize events being generated by the list control itself.
Definition at line 193 of file table_import_listctrl.hpp.
Referenced by DivideColumn(), IgnoreWidthEvent(), MergeColumns(), and SetColumnWidthIgnoreEvent().
|
protected |
Holds column icons (shows whether column currently selected or not)
Definition at line 183 of file table_import_listctrl.hpp.
Referenced by CTableImportListCtrl().
|
protected |
Data table to be rendered in the list.
Definition at line 180 of file table_import_listctrl.hpp.
Referenced by ColumnWidthsUpdated(), DivideColumn(), GetColumnImageID(), MergeColumns(), OnGetItemText(), SynchDataSourceColumnWidths(), UpdateColumnImages(), UpdateColumnNames(), and UpdateColumnWidths().
|
protected |
Do we show all columns seaprated or show as one field.
Definition at line 172 of file table_import_listctrl.hpp.
Referenced by GetDataViewType(), OnGetItemText(), and SetViewType().