NCBI C++ ToolKit
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
CTableImportListCtrl Class Reference

Search Toolkit Book for CTableImportListCtrl

CTableImportCtrl -. More...

#include <gui/widgets/loaders/table_import_listctrl.hpp>

+ Inheritance diagram for CTableImportListCtrl:
+ Collaboration diagram for CTableImportListCtrl:

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< intGetColumnWidths ()
 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< CTableImportDataSourcem_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< intm_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...
 

Detailed Description

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.

Member Enumeration Documentation

◆ eDataViewType

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.

Constructor & Destructor Documentation

◆ CTableImportListCtrl() [1/2]

CTableImportListCtrl::CTableImportListCtrl ( )
inline

ctor

Definition at line 70 of file table_import_listctrl.hpp.

◆ CTableImportListCtrl() [2/2]

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 
)

◆ ~CTableImportListCtrl()

virtual CTableImportListCtrl::~CTableImportListCtrl ( )
inlinevirtual

dtor

Definition at line 84 of file table_import_listctrl.hpp.

Member Function Documentation

◆ ColumnWidthsUpdated()

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().

◆ DivideColumn()

void CTableImportListCtrl::DivideColumn ( int  col)

◆ GetColumnImageID()

int CTableImportListCtrl::GetColumnImageID ( int  col,
bool  checkbox_only = false 
) const

◆ GetColumnsCombinedCharWidth()

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().

◆ GetColumnWidths()

vector< int > CTableImportListCtrl::GetColumnWidths ( )

◆ GetDataViewType()

eDataViewType CTableImportListCtrl::GetDataViewType ( ) const
inline

Definition at line 89 of file table_import_listctrl.hpp.

References m_ViewType.

◆ GetDisplayTypeHeader()

bool CTableImportListCtrl::GetDisplayTypeHeader ( ) const
inline

Definition at line 93 of file table_import_listctrl.hpp.

References m_DisplayTypeHeader.

◆ GetFixedWidthUseFields()

bool CTableImportListCtrl::GetFixedWidthUseFields ( ) const
inline

Definition at line 118 of file table_import_listctrl.hpp.

References m_FixedWidthUseFields.

◆ GetFontWidth()

int CTableImportListCtrl::GetFontWidth ( ) const
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().

◆ IgnoreWidthEvent()

bool CTableImportListCtrl::IgnoreWidthEvent ( ) const
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().

◆ MergeColumns()

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().

◆ OnGetItemAttr()

wxListItemAttr * CTableImportListCtrl::OnGetItemAttr ( long  item) const
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.

◆ OnGetItemColumnImage()

virtual int CTableImportListCtrl::OnGetItemColumnImage ( long  ,
long   
) const
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.

◆ OnGetItemText()

wxString CTableImportListCtrl::OnGetItemText ( long  row,
long  col 
) const
protected

◆ SetColumnWidthIgnoreEvent()

void CTableImportListCtrl::SetColumnWidthIgnoreEvent ( int  col,
int  width 
)

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().

◆ SetDataSource()

void CTableImportListCtrl::SetDataSource ( CRef< CTableImportDataSource ds)

◆ SetDisplayTypeHeader()

void CTableImportListCtrl::SetDisplayTypeHeader ( bool  b)
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().

◆ SetFixedWidthUseFields()

void CTableImportListCtrl::SetFixedWidthUseFields ( bool  b)
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().

◆ SetViewType()

void CTableImportListCtrl::SetViewType ( eDataViewType  t)
inline

◆ SynchDataSourceColumnWidths()

void CTableImportListCtrl::SynchDataSourceColumnWidths ( )

◆ UpdateColumnImages()

void CTableImportListCtrl::UpdateColumnImages ( bool  checkbox_only = false)

◆ UpdateColumnNames()

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().

◆ UpdateColumnWidths()

void CTableImportListCtrl::UpdateColumnWidths ( )

◆ WriteWidths()

void CTableImportListCtrl::WriteWidths ( const string prefix)

Definition at line 552 of file table_import_listctrl.cpp.

References _TRACE, i, NStr::IntToString(), and prefix.

◆ x_ToWxStringWithTabs()

wxString CTableImportListCtrl::x_ToWxStringWithTabs ( const string str)
staticprotected

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().

Member Data Documentation

◆ m_ColumnWidths

vector<int> CTableImportListCtrl::m_ColumnWidths
protected

Widths of columns as updated by UpdateColumnWidths()

Definition at line 189 of file table_import_listctrl.hpp.

Referenced by ColumnWidthsUpdated(), GetColumnWidths(), and UpdateColumnWidths().

◆ m_DisplayTypeHeader

bool CTableImportListCtrl::m_DisplayTypeHeader
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().

◆ m_FirstRowAttr

wxListItemAttr CTableImportListCtrl::m_FirstRowAttr
protected

First row holds type info.

Definition at line 196 of file table_import_listctrl.hpp.

Referenced by CTableImportListCtrl(), and OnGetItemAttr().

◆ m_FixedWidthUseFields

bool CTableImportListCtrl::m_FixedWidthUseFields
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().

◆ m_FontWidth

int CTableImportListCtrl::m_FontWidth
protected

◆ m_IgnoreWidthEvent

bool CTableImportListCtrl::m_IgnoreWidthEvent
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().

◆ m_ImageList

wxImageList CTableImportListCtrl::m_ImageList
protected

Holds column icons (shows whether column currently selected or not)

Definition at line 183 of file table_import_listctrl.hpp.

Referenced by CTableImportListCtrl().

◆ m_ImportedTableData

CRef<CTableImportDataSource> CTableImportListCtrl::m_ImportedTableData
protected

◆ m_ViewType

eDataViewType CTableImportListCtrl::m_ViewType
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().


The documentation for this class was generated from the following files:
Modified on Fri Jan 05 07:25:45 2024 by modify_doxy.py rev. 669887