sptk2 logo
SPTK Home Page
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
sptk::CListView Class Reference

List view widget. More...

#include <CListView.h>

Inheritance diagram for sptk::CListView:
sptk::CControl sptk::CLayoutClient sptk::CDBListView sptk::CDBDropDownListView

Public Member Functions

 CListView (const char *label=nullptr, int layoutSize=20, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
 Constructor in SPTK style. More...
 
 ~CListView () override
 Destructor.
 
int handle (int) override
 Overwritten handle()
 
void resize (int x, int y, int w, int h) override
 Resizes the control and inside widgets. More...
 
virtual void removeRow (uint32_t index)
 Removes row. More...
 
virtual void addRow (CPackedStrings *row)
 Adds new row. More...
 
virtual void addRow (int ident, const Strings &row)
 Adds new row. More...
 
virtual void insertRow (uint32_t position, const Strings &row, int ident)
 Inserts new row. More...
 
virtual void updateRow (uint32_t position, CPackedStrings *row)
 Updates a row. More...
 
virtual void updateRow (uint32_t position, const Strings &row, int ident=0)
 Updates a row. Optional row argument may be defined inside row parameter. More...
 
virtual void clear ()
 Removes all the rows.
 
virtual uint32_t size () const
 Returns the row count.
 
virtual int top () const
 Returns the scroll position.
 
virtual void top (int index)
 Sets the scroll position. More...
 
int selected (int index) const
 
void show (int index)
 
void show () override
 
void hide (int index)
 
void hide () override
 
int visible (int index) const
 
int visible () const
 
std::string textValue () const
 
void textValue (const std::string &text)
 
void dataMode (CListViewDataMode dm)
 
CListViewDataMode dataMode () const
 
Variant data () const override
 
void data (const Variant &v) override
 
CPackedStringsrow (uint32_t index) const
 
const CSelectionselection () const
 
CPackedStringsselectedRow () const
 
int selectedIndex () const
 
bool selectRow (uint32_t index, bool sel=true)
 
bool displayed (uint32_t index) const
 
virtual void displayRow (uint32_t index)
 
void redrawRow (uint32_t index)
 
void columns (const CColumnList &columns)
 Sets a new column list. More...
 
CColumnListcolumns ()
 Returns column list.
 
CColumncolumn (uint32_t col)
 Returns column informartion. More...
 
CColumncolumn (const char *colname)
 Returns column informartion. More...
 
void addColumn (const CColumn &column)
 Adds a new column as a copy of column. More...
 
void addColumn (const String &colname, VariantDataType type, uint32_t cwidth=100, bool cvisible=true)
 Adds a new column as a copy of column. More...
 
CControlKind kind () const override
 SPTK RTTI information. More...
 
bool autoRowHeight () const
 Returns auto row height mode as true/false.
 
void autoRowHeight (bool arh)
 Sets auto row height mode as true/false.
 
Fl_Font textFont () const override
 Returns text font type. More...
 
void textFont (Fl_Font f) override
 Sets text font type. More...
 
uchar textSize () const override
 
void textSize (uchar s) override
 Sets text font size. More...
 
Fl_Color textColor () const override
 Returns text color. More...
 
void textColor (Fl_Color n) override
 Sets text color. More...
 
bool showGrid () const
 Returns show grid mode.
 
void showGrid (bool flag)
 Sets show grid mode.
 
bool showStripes () const
 Returns show stripes.
 
void showStripes (bool flag)
 Sets show stripes mode.
 
bool showSelection () const
 Returns show selection mode.
 
void showSelection (bool flag)
 Sets show selection mode.
 
bool multiSelect () const
 Returns multiple selection enabled or disabled.
 
void multiSelect (bool ms)
 Sets multiple selection enabled or disabled.
 
void getSelections (std::vector< uint64_t > &selection) const
 Returns a selected rows ID list.
 
void setSelections (const std::vector< uint64_t > &selection)
 Sets a selected rows ID list.
 
CPackedStringsfindCaption (const String &caption)
 Finds an item with the caption (a string in the first column). More...
 
CPackedStringsfindKey (int keyValue)
 Finds an item with the key (an integer associated with the item - argument()). More...
 
uint32_t fullWidth () const
 Returns maximum width of all items including the header row.
 
uint32_t fullHeight () const
 Returns summary height of all items including the header row.
 
virtual int findString (const std::string &str, bool select=true, uint32_t startRow=0, uint32_t endRow=0)
 Finds a string in the sort column of list view defined with sortColumn() More...
 
String sortColumnName () const
 Returns sort column name.
 
void sortColumn (int column, bool sortNow)
 Sets the sort column. More...
 
int sortColumn () const
 Returns the sort column number.
 
bool sortAscending () const
 Returns the sort direction - ascending/descending.
 
void sortAscending (bool ascending, bool sortNow)
 Sets the sort direction - ascending/descending. More...
 
void sort ()
 Sorts ListView rows using existing information about sort column and direction.
 
void fill (DataSource &ds, const String &keyFieldName="", uint32_t recordsLimit=0, uint32_t recordsEstimated=0, CRefreshKind refreshKind=CRefreshKind::LV_REFRESH_FULL)
 Fills the list view with the data from datasource. More...
 
void loadList (const xdoc::SNode &node)
 Fills the list with the data from XML node. More...
 
void saveList (const xdoc::SNode &node) const
 Saves the list data into XML node. More...
 
bool preferredSize (int &w, int &h) override
 Computes the optimal widgets size. More...
 
uint32_t headerHeight () const
 Returns header height.
 
void headerHeight (uint32_t hh)
 Sets the header height, 0 to hide headers.
 
uint32_t activeRow () const
 Returns the currently active row.
 
bool capitalizeColumnNames () const
 Returns true if column names are auto-capitilized.
 
void capitalizeColumnNames (bool ccn)
 Defines if column names should be auto-capitilized. More...
 
void terminateFill ()
 Terminate the current fill() operation (if in progress)
 
String className () const override
 Returns widget class name (internal SPTK RTTI). More...
 
void imageCollection (Strings &iconNames)
 Sets the images that may be referred from items. More...
 
- Public Member Functions inherited from sptk::CControl
 CControl (const char *label, int layoutSize=20, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
 Constructor in SPTK style. More...
 
void resize (int x, int y, int w, int h) override
 Resizes the control and inside widgets. More...
 
void draw () override
 Draws the control.
 
virtual int tag () const
 Returns the control's user data tag.
 
virtual void tag (int t)
 Sets the control's user data tag.
 
virtual Fl_Font textFont () const
 Returns the control's text font. More...
 
virtual void textFont (Fl_Font)
 Sets the control's text font. More...
 
virtual uchar textSize () const
 Returns the control's text font size. More...
 
virtual void textSize (uchar)
 Sets the control's text font size. More...
 
virtual Fl_Color textColor () const
 Returns the control's text color. More...
 
virtual void textColor (Fl_Color)
 Sets the control's text color. More...
 
virtual Fl_Color labelColor () const
 Returns the control's label color.
 
virtual void labelColor (Fl_Color)
 Sets the control's label color.
 
virtual Fl_Color color () const
 Returns the control's background color.
 
virtual void color (Fl_Color)
 Sets the control's background color.
 
uint32_t flags () const
 Returns the control's flags.
 
void flags (uint32_t flags)
 Sets the control's flags.
 
Fl_Widget * control () const
 Returns main widget inside the container.
 
const Stringlabel () const override
 Returns control's label. More...
 
void label (const String &) override
 Sets control's label. More...
 
Fl_Menu_ * menu () const
 Returns control's menu.
 
void menu (const Fl_Menu_Item *)
 Sets control's menu.
 
Fl_Font labelFont () const
 Returns control's label font.
 
void labelSize (Fl_Font f)
 Sets control's label font.
 
uchar labelSize () const
 Returns control's label font size.
 
void labelSize (uchar)
 Sets control's label font size.
 
uint32_t labelWidth () const
 Returns control's label width.
 
void labelWidth (uint32_t)
 Sets control's label width.
 
void hint (const String &str)
 Sets control's hint (tooltip) More...
 
String hint () const
 Returns control's hint (tooltip)
 
virtual int maxLength () const
 Returns control's max input length, if applicable. More...
 
virtual void maxLength (int)
 Sets control's max input length, if applicable. More...
 
virtual const StringfieldName () const
 Returns control's field name for universal data connection.
 
virtual void fieldName (const String &)
 Sets control's field name for universal data connection.
 
virtual CControlKind kind () const =0
 Returns control's kind (internal SPTK RTTI). More...
 
String className () const override
 Returns control's class name (internal SPTK RTTI). More...
 
virtual void reset ()
 Sets the control to empty text (for the input entries) More...
 
virtual void load (Query *)
 Loads control data from query fields. More...
 
virtual void save (Query *)
 Saves control data to query params. More...
 
void load (const xdoc::SNode &node, CLayoutXMLmode xmlMode) override
 Loads control data from XML. More...
 
void load (const xdoc::SNode &node) override
 Loads control data from XML. More...
 
void save (const xdoc::SNode &node, CLayoutXMLmode xmlMode) const override
 Saves control data to XML. More...
 
virtual void save (const xdoc::SNode &node) const
 Saves control data to XML. More...
 
virtual bool valid () const =0
 Returns true if the control state is valid, and the data is inside the limits (if applicable) More...
 
virtual Variant data () const
 The universal data connector. More...
 
virtual void data (const Variant &v)
 The universal data connector, sets control data. More...
 
void fireEvent (CEvent ev, int32_t arg)
 Fires the event generated by this control.
 
const CEventInfoevent () const
 Returns the last event fired by this control.
 
CEvent eventType () const
 Returns the event type for the last fired by this control.
 
int eventArgument () const
 Returns the event argument for the last fired by this control.
 
CControloperator= (const String &str)
 Control data assignment.
 
CControloperator= (const char *str)
 Control data assignment.
 
CControloperator= (int32_t v)
 Control data assignment.
 
CControloperator= (uint32_t v)
 Control data assignment.
 
CControloperator= (int64_t v)
 Control data assignment.
 
CControloperator= (float v)
 Control data assignment.
 
CControloperator= (double v)
 Control data assignment.
 
CControloperator= (const DateTime &dt)
 Control data assignment.
 
CControloperator= (const Field &fld)
 Control data assignment.
 
 operator String () const
 Control data conversion.
 
 operator int32_t () const
 Control data conversion.
 
 operator uint32_t () const
 Control data conversion.
 
 operator int64_t () const
 Control data conversion.
 
 operator uint64_t () const
 Control data conversion.
 
 operator float () const
 Control data conversion.
 
 operator double () const
 Control data conversion.
 
 operator DateTime () const
 Control data conversion.
 
- Public Member Functions inherited from sptk::CLayoutClient
 CLayoutClient (Fl_Widget *widget, int layoutSize, CLayoutAlign ca)
 
virtual ~CLayoutClient ()
 
CLayoutAlign layoutAlign () const
 
void layoutAlign (CLayoutAlign al)
 
int layoutSize () const
 
void layoutSize (int ls)
 
virtual void label (const String &l)
 
virtual const Stringlabel () const
 
void name (const char *aname)
 
void name (const String &aname)
 
const Stringname () const
 
virtual bool preferredSize (int &w, int &h)
 
virtual bool computeSize (int &w, int &h)
 
virtual String className () const
 
Fl_Widget * widget () const
 
virtual void load (const xdoc::SNode &node, CLayoutXMLmode xmlMode)
 
virtual void load (const std::shared_ptr< xdoc::Node > &node)
 
virtual void save (const std::shared_ptr< xdoc::Node > &node, CLayoutXMLmode xmlMode) const
 

Protected Member Functions

int columnAt (int x)
 Computes which column contains x-coordinate. More...
 
int find_item (int y)
 Finds an item in vertical position y. More...
 
void bbox (int &X, int &Y, int &W, int &H) const
 Returns the actual size of the drawing area (internal) More...
 
int hposition () const
 Returns horizontal position of the scroll.
 
void hposition (int hpos)
 Sets horizontal position of the scroll. More...
 
int find_id (int id) const
 Finds item with ID. More...
 
virtual int get_focus ()
 Get focus callback (internal)
 
virtual bool item_selected (uint32_t index) const
 Returns true if item is selected. More...
 
virtual void item_select (uint32_t index, bool select)
 Selects or deselects the item. More...
 
virtual int item_compute_height_all ()
 Recomputes all items height.
 
virtual int item_compute_height (CPackedStrings *rowData)
 Recomputes items height. More...
 
virtual int item_height (uint32_t index) const
 Recomputes items height. More...
 
virtual int item_width (uint32_t index) const
 Returns item width. More...
 
virtual void item_draw (uint32_t index, const CPackedStrings *rowData, int x, int y, int w, int h, int focusMode, int verticalAlign, bool paintBackground) const
 Draws a row in coordinates (internal) More...
 
virtual void item_clicked (int mouse_btn)
 
virtual Fl_Color item_color (int column, const CPackedStrings &rowData) const
 The function that allows to overwrite the default text color for the cell. More...
 
virtual void header_draw (int x, int y, int hh) const
 Draws header (internal) More...
 
virtual void header_clicked (int x)
 Header clicked mouse callback. More...
 
virtual bool header_drag_position (int x)
 Returns true if x is the drag-sensitive area.
 
virtual void header_dragged (int x)
 Header dragged to position x notification. More...
 
virtual void header_released (int x)
 Header released in position x notification. More...
 
void redraw_line (uint32_t index)
 Request to redraw line index. More...
 
void redraw_lines ()
 Redraw all the lines.
 
void draw () override
 General draw function. Draws everything.
 
void key_changed (uint32_t index)
 Internal callback if selected another item with the different user _data (key).
 
void load (Query *) override
 Loads the key value from the query. More...
 
void save (Query *) override
 Saves the key value from the query. More...
 
void load (const xdoc::SNode &node, CLayoutXMLmode xmlMode) override
 Loads control data from XML. More...
 
void save (const xdoc::SNode &node, CLayoutXMLmode xmlMode) const override
 Saves control data to XML. More...
 
bool valid () const override
 True if the data is valid. More...
 
virtual uint32_t cellBorderWidth () const
 Returns the cell border width.
 
bool select (uint32_t index, bool sel=true, int docallbacks=false)
 Selects the row. Internal. More...
 
bool select_only (uint32_t index, bool docallbacks=false)
 Selects the only row. Internal. More...
 
bool activate_row (uint32_t index)
 Selects the row. Executes the callbacks. Internal. More...
 
bool select_first ()
 Selects the first row. Executes the callbacks. Internal. More...
 
bool select_last ()
 Selects the last row. Executes the callbacks. Internal. More...
 
bool select_next ()
 Selects the next row. Executes the callbacks. Internal. More...
 
bool select_prior ()
 Selects the prior row. Executes the callbacks. Internal. More...
 
bool select_next_page ()
 Selects the next page row. Executes the callbacks. Internal. More...
 
bool select_prior_page ()
 Selects the prior page row. Executes the callbacks. Internal. More...
 
- Protected Member Functions inherited from sptk::CControl
bool containsFocus () const
 Does the control contain focus?
 
void notifyFocus (bool gotFocus=true)
 Internal focus notification on focus change.
 
virtual void onEnter ()
 Internal focus notification on focus change.
 
virtual void onExit ()
 Internal focus notification on focus change. More...
 
uint32_t labelHeight () const
 Computes the label height based on the labelFont() and labelWidth()
 
int handle (int) override
 Special handle() method.
 
- Protected Member Functions inherited from sptk::CLayoutClient
int lastPreferredH () const
 
int lastPreferredW () const
 
void lastPreferredH (int height)
 
void lastPreferredW (int width)
 

Static Protected Member Functions

static void scrollbar_callback (Fl_Widget *s, void *)
 Internal vertical scrollback callback.
 
static void hscrollbar_callback (Fl_Widget *s, void *)
 Internal horizontal scrollback callback.
 
static void scrollbar_width (int b)
 Changes the default scrollbar width for the class. More...
 
static int scrollbar_width ()
 Returns the default scrollbar width for the class.
 
- Static Protected Member Functions inherited from sptk::CControl
static void internalCallback (Fl_Widget *internalWidget, void *data)
 Internal callback function.
 

Protected Attributes

bool m_capitalizeColumnNames {false}
 
bool m_multipleSelection {false}
 
int m_horizPosition {0}
 
int m_realHorizPosition {0}
 
int m_maxWidth {0}
 
int m_redraw1 {0}
 
int m_redraw2 {0}
 
uint32_t m_top {0}
 
int m_currentTextFont {0}
 
int m_currentTextSize {0}
 
Strings m_iconNames
 
CListViewDataMode m_dataMode {CListViewDataMode::LV_DATA_UNDEFINED}
 Data mode Defines the kind of data to work through data() method. More...
 
int m_mousePressedX {0}
 
CSelection m_selection
 
std::string m_searchPhrase
 
uint32_t m_activeRow {0}
 
uint32_t m_headerHeight {0}
 
CListViewRows m_rows
 
CColumnList m_columnList
 
int m_draggingColumn {0}
 
int m_draggingStarted {0}
 
Fl_Font m_textFont {0}
 
uchar m_textSize {0}
 
Fl_Color m_textColor {0}
 
bool m_showStripes {false}
 
bool m_showGrid {false}
 
bool m_showSelection {false}
 
bool m_autoRowHeight {false}
 
CScrollBar scrollbar {0, 0, 0, 0}
 Vertical scrollback.
 
CScrollBar hscrollbar {0, 0, 0, 0}
 Horizontal scrollbar.
 
- Protected Attributes inherited from sptk::CControl
bool m_limited {false}
 
uint32_t m_labelWidth {0}
 
Fl_Color m_labelColor
 
Fl_Color m_textColor
 
Fl_Font m_textFont
 
uchar m_textSize {0}
 
String m_fieldName
 
String m_hint
 
Fl_Widget * m_control {nullptr}
 
int m_tag {0}
 
uint32_t m_controlFlags {0}
 Control's special flags (a bit combination of InputEntryFlags). More...
 
Fl_Menu_Button * m_menuButton {nullptr}
 
CEventInfo m_event
 
bool m_hasFocus {false}
 
- Protected Attributes inherited from sptk::CLayoutClient
Fl_Widget * m_widget
 
String m_name
 
String m_label
 
CLayoutAlign m_layoutAlign
 

Static Protected Attributes

static int m_scrollbarWidth
 

Friends

class CInternalComboBoxPanel
 
class CDBDropDownList
 

Additional Inherited Members

- Static Public Member Functions inherited from sptk::CControl
static CControlKind controlNameToType (const String &typeName, int &maxLength, const String &values="")
 Converts control name to control kind.
 
static void defaultControlMenuCopy (Fl_Widget *, void *)
 Default callback function to support CControl default menu item 'Copy'.
 
static void defaultControlMenuCut (Fl_Widget *, void *)
 Default callback function to support CControl default menu item 'Delete'.
 
static void defaultControlMenuPaste (Fl_Widget *, void *)
 Default callback function to support CControl default menu item 'Paste'.
 
static void defaultControlMenuClear (Fl_Widget *, void *)
 Default callback function to support CControl default menu item 'Clear'.
 
- Static Public Attributes inherited from sptk::CControl
static const Fl_Menu_Item defaultControlMenu []
 CControl default menu.
 

Detailed Description

List view widget.

Class CListView is the list of multicolumn rows. It allows to sort rows by column, supports type-in incremental search etc.

Constructor & Destructor Documentation

◆ CListView()

sptk::CListView::CListView ( const char *  label = nullptr,
int  layoutSize = 20,
CLayoutAlign  layoutAlign = CLayoutAlign::TOP 
)

Constructor in SPTK style.

Parameters
labelconst char *, label
layoutSizeint, widget align in layout
layoutAlignCLayoutAlign, widget align in layout

Member Function Documentation

◆ activate_row()

bool sptk::CListView::activate_row ( uint32_t  index)
protected

Selects the row. Executes the callbacks. Internal.

Parameters
indexint, row number
Returns
true if success

◆ addColumn() [1/2]

void sptk::CListView::addColumn ( const CColumn column)
inline

Adds a new column as a copy of column.

Parameters
columnconst CColumn&, new column information

◆ addColumn() [2/2]

void sptk::CListView::addColumn ( const String colname,
VariantDataType  type,
uint32_t  cwidth = 100,
bool  cvisible = true 
)
inline

Adds a new column as a copy of column.

Parameters
colnameconst char *, column name
typeVariantType, column data type
cwidthuint32_t, column width
cvisiblebool, is the column visible?

◆ addRow() [1/2]

virtual void sptk::CListView::addRow ( CPackedStrings row)
virtual

Adds new row.

Optional row ID may be defined inside row parameter.

Parameters
rowRow data

◆ addRow() [2/2]

virtual void sptk::CListView::addRow ( int  ident,
const Strings row 
)
virtual

Adds new row.

Optional row ID may be defined inside row parameter, or through ident parameter.

Parameters
identint, row argument (key value)
rowconst Strings&, row data

◆ bbox()

void sptk::CListView::bbox ( int &  X,
int &  Y,
int &  W,
int &  H 
) const
protected

Returns the actual size of the drawing area (internal)

Parameters
Xint, output, x-xoordinate
Yint, output, y-xoordinate
Wint, output, width
Hint, output, height

◆ capitalizeColumnNames()

void sptk::CListView::capitalizeColumnNames ( bool  ccn)
inline

Defines if column names should be auto-capitilized.

Parameters
ccnbool, true if column names should be auto-capitilized

◆ className()

String sptk::CListView::className ( ) const
inlineoverridevirtual

Returns widget class name (internal SPTK RTTI).

Reimplemented from sptk::CControl.

◆ column() [1/2]

CColumn & sptk::CListView::column ( const char *  colname)

Returns column informartion.

Parameters
colnameconst char *, column name

◆ column() [2/2]

CColumn & sptk::CListView::column ( uint32_t  col)
inline

Returns column informartion.

Parameters
coluint32_t, column number 0..columnCount() -1

◆ columnAt()

int sptk::CListView::columnAt ( int  x)
protected

Computes which column contains x-coordinate.

Parameters
xint, coordinate
Returns
column number

◆ columns()

void sptk::CListView::columns ( const CColumnList columns)

Sets a new column list.

Parameters
columnsconst CColumnList&, new column list

◆ data() [1/2]

Variant sptk::CListView::data ( ) const
overridevirtual

The universal data connector,

Returns
control data

Reimplemented from sptk::CControl.

◆ data() [2/2]

void sptk::CListView::data ( const Variant v)
overridevirtual

The universal data connector, selects row with user data

Parameters
vconst CVariant, user data value to find and select

Reimplemented from sptk::CControl.

◆ dataMode() [1/2]

CListViewDataMode sptk::CListView::dataMode ( ) const
inline

Returns data mode as LV_DATA_KEY, LV_DATA_INDEX, LV_DATA_CAPTION. Defines which information list view is working with in data() method - key value, item index, or item caption.

See also
CListViewDataMode for more information

◆ dataMode() [2/2]

void sptk::CListView::dataMode ( CListViewDataMode  dm)
inline

Sets data mode for the data() methods as LV_DATA_KEY, LV_DATA_INDEX, LV_DATA_CAPTION. Defines which information list view is working with in data() method - key value, item index, or item caption.

See also
CListViewDataMode for more information

Referenced by sptk::CBaseListBox::dataMode().

◆ displayed()

bool sptk::CListView::displayed ( uint32_t  index) const

Returns true if the row is currently visible in the scroll area

Parameters
indexint, row number

◆ displayRow()

virtual void sptk::CListView::displayRow ( uint32_t  index)
virtual

Makes the row visible in the scroll area

Parameters
indexint, row number

◆ fill()

void sptk::CListView::fill ( DataSource ds,
const String keyFieldName = "",
uint32_t  recordsLimit = 0,
uint32_t  recordsEstimated = 0,
CRefreshKind  refreshKind = CRefreshKind::LV_REFRESH_FULL 
)

Fills the list view with the data from datasource.

Uses all available datasource information about column and data types.

Parameters
dsCDataSource&, the datasource
keyFieldNamestd::string, field used to fill in key values
recordsLimituint32_t, maximum records to retrieve
recordsEstimateduint32_t, records estimated (to use the fill progression event)
refreshKindCRefreshKind, type of refresh - full or just changed records
See also
CRefreshKind
CDataSource

◆ find_id()

int sptk::CListView::find_id ( int  id) const
protected

Finds item with ID.

Parameters
idint, item id
Returns
row number, or -1 if not found

◆ find_item()

int sptk::CListView::find_item ( int  y)
protected

Finds an item in vertical position y.

Parameters
yint, vertical position
Returns
row number, or -1 if not found

◆ findCaption()

CPackedStrings * sptk::CListView::findCaption ( const String caption)

Finds an item with the caption (a string in the first column).

Parameters
captionstd::string, the caption to find and select.
Returns
an item, or NULL if item caption is not found

Referenced by sptk::CBaseListBox::findCaption().

◆ findKey()

CPackedStrings * sptk::CListView::findKey ( int  keyValue)

Finds an item with the key (an integer associated with the item - argument()).

Parameters
keyValueint, the caption to find and select.
Returns
an item, or NULL if item caption is not found

Referenced by sptk::CBaseListBox::findKey().

◆ findString()

virtual int sptk::CListView::findString ( const std::string &  str,
bool  select = true,
uint32_t  startRow = 0,
uint32_t  endRow = 0 
)
virtual

Finds a string in the sort column of list view defined with sortColumn()

Parameters
strstd::string, string to find
selectbool, true if we want to select the found row
startRowuint32_t, the row number to start
endRowuint32_t, the row number to finish
Returns
the row number, or -1 if not found

◆ header_clicked()

virtual void sptk::CListView::header_clicked ( int  x)
protectedvirtual

Header clicked mouse callback.

Parameters
xint, x-coordinate

◆ header_dragged()

virtual void sptk::CListView::header_dragged ( int  x)
protectedvirtual

Header dragged to position x notification.

Parameters
xint, x-coordinate

◆ header_draw()

virtual void sptk::CListView::header_draw ( int  x,
int  y,
int  hh 
) const
protectedvirtual

Draws header (internal)

Parameters
xint, x-coordinate
yint, y-coordinate
hhint, header height

◆ header_released()

virtual void sptk::CListView::header_released ( int  x)
protectedvirtual

Header released in position x notification.

Parameters
xint, x-coordinate

◆ hide() [1/2]

void sptk::CListView::hide ( )
inlineoverride

Hides the list view widget

◆ hide() [2/2]

void sptk::CListView::hide ( int  index)

Switch the visibility flag for the row index

Parameters
indexint, row number

◆ hposition()

void sptk::CListView::hposition ( int  hpos)
protected

Sets horizontal position of the scroll.

Parameters
hposint, new horizontal position

◆ imageCollection()

void sptk::CListView::imageCollection ( Strings iconNames)

Sets the images that may be referred from items.

Parameters
iconNamesStrings&, a list of icon names

◆ insertRow()

virtual void sptk::CListView::insertRow ( uint32_t  position,
const Strings row,
int  ident 
)
virtual

Inserts new row.

Optional row argument may be defined inside row parameter, or through ident parameter.

Parameters
positionuint32_t, insert position
rowconst Strings&, row data
identint, row argument (key value)

◆ item_clicked()

virtual void sptk::CListView::item_clicked ( int  mouse_btn)
protectedvirtual

Internal mouse callback

Reimplemented in sptk::CDBDropDownListView.

◆ item_color()

virtual Fl_Color sptk::CListView::item_color ( int  column,
const CPackedStrings rowData 
) const
protectedvirtual

The function that allows to overwrite the default text color for the cell.

Parameters
columnint, the column number
rowDataconst CPackedStrings&, row
Returns
textColor()

◆ item_compute_height()

virtual int sptk::CListView::item_compute_height ( CPackedStrings rowData)
protectedvirtual

Recomputes items height.

Parameters
rowDataCPackedStrings *, item pointer
Returns
item height

◆ item_draw()

virtual void sptk::CListView::item_draw ( uint32_t  index,
const CPackedStrings rowData,
int  x,
int  y,
int  w,
int  h,
int  focusMode,
int  verticalAlign,
bool  paintBackground 
) const
protectedvirtual

Draws a row in coordinates (internal)

Parameters
indexuint32_t, row number
rowDataconst CPackedStrings *, row pointer
xint, x-coordinate
yint, y-coordinate
wint, width
hint, height
focusModeint, focus flag
verticalAlignint, vertical align
paintBackgroundbool, true if the item should paint the background
Returns
item width

◆ item_height()

virtual int sptk::CListView::item_height ( uint32_t  index) const
protectedvirtual

Recomputes items height.

Parameters
indexuint32_t, row number
Returns
item height

◆ item_select()

virtual void sptk::CListView::item_select ( uint32_t  index,
bool  select 
)
protectedvirtual

Selects or deselects the item.

Parameters
indexuint32_t, item index
selectbool, select or deselect

◆ item_selected()

virtual bool sptk::CListView::item_selected ( uint32_t  index) const
protectedvirtual

Returns true if item is selected.

Parameters
indexuint32_t, item index

◆ item_width()

virtual int sptk::CListView::item_width ( uint32_t  index) const
protectedvirtual

Returns item width.

Parameters
indexuint32_t, row number
Returns
item width

◆ kind()

CControlKind sptk::CListView::kind ( ) const
inlineoverridevirtual

SPTK RTTI information.

Returns
control type as CControlKind
See also
CControlKind

Implements sptk::CControl.

References LISTBOX.

◆ load() [1/2]

void sptk::CListView::load ( const xdoc::SNode &  node,
CLayoutXMLmode  xmlMode 
)
overrideprotectedvirtual

Loads control data from XML.

Layout information may also include widget size and position, as well as visible() and active() states

Parameters
nodexml::Node*, the XML node
xmlModeCLayoutXMLmode, the mode defining how the layout and/or data should be stored

Reimplemented from sptk::CControl.

◆ load() [2/2]

void sptk::CListView::load ( Query )
overrideprotectedvirtual

Loads the key value from the query.

Reimplemented from sptk::CControl.

◆ loadList()

void sptk::CListView::loadList ( const xdoc::SNode &  node)

Fills the list with the data from XML node.

The XML node should contain the columns information, and optional list items

Parameters
nodeconst xml::Node&, the node to load list from

◆ preferredSize()

bool sptk::CListView::preferredSize ( int &  w,
int &  h 
)
overridevirtual

Computes the optimal widgets size.

Parameters
wint&, input - width offered by the program, output - width required by widget
hint&, input - height offered by the program, output - height required by widget
Returns
true if the size is stable (doesn't depend on input sizes)

Reimplemented from sptk::CLayoutClient.

◆ redraw_line()

void sptk::CListView::redraw_line ( uint32_t  index)
protected

Request to redraw line index.

Parameters
indexuint32_t, row number

◆ redrawRow()

void sptk::CListView::redrawRow ( uint32_t  index)
inline

Requests to redraw just one row

Parameters
indexint, row number

◆ removeRow()

virtual void sptk::CListView::removeRow ( uint32_t  index)
virtual

Removes row.

Parameters
indexRow number

◆ resize()

void sptk::CListView::resize ( int  x,
int  y,
int  w,
int  h 
)
override

Resizes the control and inside widgets.

Parameters
xint, x-position
yint, y-position
wint, width
hint, height

◆ row()

CPackedStrings * sptk::CListView::row ( uint32_t  index) const

Returns row pointer

Parameters
indexint, row number
Returns
row pointer

◆ save() [1/2]

void sptk::CListView::save ( const xdoc::SNode &  node,
CLayoutXMLmode  xmlMode 
) const
overrideprotected

Saves control data to XML.

Layout information may also include widget size and position, as well as visible() and active() states

Parameters
nodexml::Node*, the XML node
xmlModeCLayoutXMLmode, the mode defining how the layout and/or data should be stored

◆ save() [2/2]

void sptk::CListView::save ( Query )
overrideprotectedvirtual

Saves the key value from the query.

Reimplemented from sptk::CControl.

◆ saveList()

void sptk::CListView::saveList ( const xdoc::SNode &  node) const

Saves the list data into XML node.

The XML node should contain the columns information, and optional list items

Parameters
nodeconst xml::Node&, the node to save list into

◆ scrollbar_width()

static void sptk::CListView::scrollbar_width ( int  b)
staticprotected

Changes the default scrollbar width for the class.

Parameters
bint, new scrollbar width

◆ select()

bool sptk::CListView::select ( uint32_t  index,
bool  sel = true,
int  docallbacks = false 
)
protected

Selects the row. Internal.

Parameters
indexint, row number
selbool, true if select
docallbacksbool, true if we want to call callbacks
Returns
true if success

◆ select_first()

bool sptk::CListView::select_first ( )
protected

Selects the first row. Executes the callbacks. Internal.

Returns
true if success

◆ select_last()

bool sptk::CListView::select_last ( )
protected

Selects the last row. Executes the callbacks. Internal.

Returns
true if success

◆ select_next()

bool sptk::CListView::select_next ( )
protected

Selects the next row. Executes the callbacks. Internal.

Returns
true if success

◆ select_next_page()

bool sptk::CListView::select_next_page ( )
protected

Selects the next page row. Executes the callbacks. Internal.

Returns
true if success

◆ select_only()

bool sptk::CListView::select_only ( uint32_t  index,
bool  docallbacks = false 
)
protected

Selects the only row. Internal.

Parameters
indexint, row number
docallbacksbool, true if we want to call callbacks
Returns
true if success

◆ select_prior()

bool sptk::CListView::select_prior ( )
protected

Selects the prior row. Executes the callbacks. Internal.

Returns
true if success

◆ select_prior_page()

bool sptk::CListView::select_prior_page ( )
protected

Selects the prior page row. Executes the callbacks. Internal.

Returns
true if success

◆ selected()

int sptk::CListView::selected ( int  index) const

Is row number index selected?

Parameters
indexint, row number

◆ selectedIndex()

int sptk::CListView::selectedIndex ( ) const

Returns the row number for the selected row

◆ selectedRow()

CPackedStrings * sptk::CListView::selectedRow ( ) const

Returns currently selected row, or the last selected row in case of multiple selection. Returns 0L if there is no selection.

◆ selection()

const CSelection & sptk::CListView::selection ( ) const
inline

Returns selection list

◆ selectRow()

bool sptk::CListView::selectRow ( uint32_t  index,
bool  sel = true 
)
inline

Selects a row

Parameters
indexint, row number
selbool, true if select
Returns
true if success

◆ show() [1/2]

void sptk::CListView::show ( )
inlineoverride

Show widget

◆ show() [2/2]

void sptk::CListView::show ( int  index)

Switch the visibility flag for the row index

Parameters
indexint, row number

◆ sortAscending()

void sptk::CListView::sortAscending ( bool  ascending,
bool  sortNow 
)

Sets the sort direction - ascending/descending.

Parameters
ascendingbool, sort direction - ascending/descending
sortNowbool, true if you want to sort immediatedly

◆ sortColumn()

void sptk::CListView::sortColumn ( int  column,
bool  sortNow 
)

Sets the sort column.

Parameters
columnint, sort column number
sortNowbool, true if you want to sort immediatedly

◆ textColor() [1/2]

Fl_Color sptk::CListView::textColor ( ) const
inlineoverridevirtual

Returns text color.

Reimplemented from sptk::CControl.

◆ textColor() [2/2]

void sptk::CListView::textColor ( Fl_Color  n)
inlineoverridevirtual

Sets text color.

Reimplemented from sptk::CControl.

◆ textFont() [1/2]

Fl_Font sptk::CListView::textFont ( ) const
inlineoverridevirtual

Returns text font type.

Reimplemented from sptk::CControl.

◆ textFont() [2/2]

void sptk::CListView::textFont ( Fl_Font  f)
inlineoverridevirtual

Sets text font type.

Reimplemented from sptk::CControl.

◆ textSize() [1/2]

uchar sptk::CListView::textSize ( ) const
inlineoverridevirtual

Returns text font size

Reimplemented from sptk::CControl.

◆ textSize() [2/2]

void sptk::CListView::textSize ( uchar  s)
inlineoverridevirtual

Sets text font size.

Reimplemented from sptk::CControl.

◆ textValue() [1/2]

std::string sptk::CListView::textValue ( ) const

Returns the value the selected row and sort column cell

◆ textValue() [2/2]

void sptk::CListView::textValue ( const std::string &  text)

Selects the row where cell in the sort column is tv

Parameters
textCString, text to find and select

◆ top()

virtual void sptk::CListView::top ( int  index)
virtual

Sets the scroll position.

Parameters
indexint, top row number

◆ updateRow() [1/2]

virtual void sptk::CListView::updateRow ( uint32_t  position,
const Strings row,
int  ident = 0 
)
virtual

Updates a row. Optional row argument may be defined inside row parameter.

Parameters
positionuint32_t, insert position
rowconst Strings&, row data
identint, row argument (key value)

◆ updateRow() [2/2]

virtual void sptk::CListView::updateRow ( uint32_t  position,
CPackedStrings row 
)
virtual

Updates a row.

Optional row ID may be defined inside row parameter.

Parameters
positionuint32_t, insert position
rowCPackedStrings *, row data

◆ valid()

bool sptk::CListView::valid ( ) const
inlineoverrideprotectedvirtual

True if the data is valid.

Implements sptk::CControl.

◆ visible() [1/2]

int sptk::CListView::visible ( ) const
inline

Is the widget visible?

◆ visible() [2/2]

int sptk::CListView::visible ( int  index) const

Is the row visible?

Parameters
indexint, row number

Member Data Documentation

◆ m_activeRow

uint32_t sptk::CListView::m_activeRow {0}
protected

The row where the focus is or should be

◆ m_autoRowHeight

bool sptk::CListView::m_autoRowHeight {false}
protected

Auto row height on/off

◆ m_capitalizeColumnNames

bool sptk::CListView::m_capitalizeColumnNames {false}
protected

Should the column headers to be capitilized?

◆ m_columnList

CColumnList sptk::CListView::m_columnList
protected

The list of columns

◆ m_currentTextFont

int sptk::CListView::m_currentTextFont {0}
protected

Text font, currently used to draw the list view

◆ m_currentTextSize

int sptk::CListView::m_currentTextSize {0}
protected

Text size, currently used to draw the list view

◆ m_dataMode

CListViewDataMode sptk::CListView::m_dataMode {CListViewDataMode::LV_DATA_UNDEFINED}
protected

Data mode Defines the kind of data to work through data() method.

See also
CListViewDataMode for more information

◆ m_draggingColumn

int sptk::CListView::m_draggingColumn {0}
protected

Dragged column

◆ m_draggingStarted

int sptk::CListView::m_draggingStarted {0}
protected

Dragging column started

◆ m_headerHeight

uint32_t sptk::CListView::m_headerHeight {0}
protected

The height of the header area

◆ m_horizPosition

int sptk::CListView::m_horizPosition {0}
protected

The horizontal position - to be

◆ m_iconNames

Strings sptk::CListView::m_iconNames
protected

Icon names that may be referred from items (icon size is 16)

◆ m_maxWidth

int sptk::CListView::m_maxWidth {0}
protected

The maximum required width for the columns

◆ m_mousePressedX

int sptk::CListView::m_mousePressedX {0}
protected

The mouse pressed position

◆ m_multipleSelection

bool sptk::CListView::m_multipleSelection {false}
protected

Is multiple selection allowed?

◆ m_realHorizPosition

int sptk::CListView::m_realHorizPosition {0}
protected

The horizontal position - existing

◆ m_redraw1

int sptk::CListView::m_redraw1 {0}
protected

The minimal update pointer

◆ m_redraw2

int sptk::CListView::m_redraw2 {0}
protected

The minimal update pointer

◆ m_rows

CListViewRows sptk::CListView::m_rows
protected

The list of rows

◆ m_scrollbarWidth

int sptk::CListView::m_scrollbarWidth
staticprotected

Scrollbar width for this class of object

◆ m_searchPhrase

std::string sptk::CListView::m_searchPhrase
protected

Type-in search buffer

◆ m_selection

CSelection sptk::CListView::m_selection
protected

The list of currently selected items

◆ m_showGrid

bool sptk::CListView::m_showGrid {false}
protected

Show/hide cell grid. Grid is an alternative to stripes.

◆ m_showSelection

bool sptk::CListView::m_showSelection {false}
protected

Show/hide selection

◆ m_showStripes

bool sptk::CListView::m_showStripes {false}
protected

Show/hide horizontal stripes. Stripes is an alternative to cell grid.

◆ m_textColor

Fl_Color sptk::CListView::m_textColor {0}
protected

The text font color

◆ m_textFont

Fl_Font sptk::CListView::m_textFont {0}
protected

The text font type

◆ m_textSize

uchar sptk::CListView::m_textSize {0}
protected

The text font size

◆ m_top

uint32_t sptk::CListView::m_top {0}
protected

The scrolling position


The documentation for this class was generated from the following file:

Fri Oct 14 2022 09:58:37: SPTK 5.4.1