29#include <FL/Fl_Group.H>
31#include <sptk5/CSmallPixmapIDs.h>
32#include <sptk5/DataSource.h>
34#include <sptk5/PackedStrings.h>
35#include <sptk5/gui/CColumn.h>
36#include <sptk5/gui/CControl.h>
37#include <sptk5/gui/CDataControl.h>
38#include <sptk5/gui/CListViewRows.h>
39#include <sptk5/gui/CListViewSelection.h>
40#include <sptk5/gui/CScrollBar.h>
41#include <sptk5/sptk.h>
67class CInternalComboBoxPanel;
109 friend class CInternalComboBoxPanel;
121 bool m_fillInProgress {
false};
126 bool m_fillTerminated {
false};
132 bool m_capitalizeColumnNames {
false};
137 bool m_multipleSelection {
false};
142 int m_horizPosition {0};
147 int m_realHorizPosition {0};
177 int m_currentTextFont {0};
182 int m_currentTextSize {0};
199 int m_mousePressedX {0};
214 uint32_t m_activeRow {0};
219 uint32_t m_headerHeight {0};
234 int m_draggingColumn {0};
239 int m_draggingStarted {0};
244 Fl_Font m_textFont {0};
249 uchar m_textSize {0};
254 Fl_Color m_textColor {0};
259 bool m_showStripes {
false};
264 bool m_showGrid {
false};
269 bool m_showSelection {
false};
274 bool m_autoRowHeight {
false};
297 void bbox(
int& X,
int& Y,
int& W,
int& H)
const;
324 return m_horizPosition;
409 int verticalAlign,
bool paintBackground)
const;
466 damage(FL_DAMAGE_SCROLL);
488#ifdef __COMPATIBILITY_MODE__
497 CListView(
int,
int,
int,
int,
const char* = 0);
520 void resize(
int x,
int y,
int w,
int h)
override;
584 return m_rows.
size();
599 virtual void top(
int index);
646 return (
int) Fl_Widget::visible();
726 return select(index, sel,
true);
801 bool select(uint32_t index,
bool sel =
true,
int docallbacks =
false);
875 return m_columnList[col];
890 m_columnList.push_back(column);
902 m_columnList.push_back(
CColumn(colname, type, (
short) cwidth, cvisible));
920 return m_autoRowHeight;
994 return m_showStripes;
1007 return m_showSelection;
1015 m_showSelection = flag;
1023 return m_multipleSelection;
1031 m_multipleSelection = ms;
1076 virtual int findString(
const std::string& str,
bool select =
true, uint32_t startRow = 0, uint32_t endRow = 0);
1131 void fill(
DataSource& ds,
const String& keyFieldName =
"", uint32_t recordsLimit = 0, uint32_t recordsEstimated = 0,
1163 return m_headerHeight;
1171 m_headerHeight = hh;
1187 return m_capitalizeColumnNames;
1196 m_capitalizeColumnNames = ccn;
1204 m_fillTerminated =
true;
Definition: CColumn.h:178
Class CColumn represents a column descriptor for CListView.
Definition: CColumn.h:45
Base class for most of SPTK widgets.
Definition: CControl.h:222
Drop-down window with CListView widget inside.
Definition: CDropDownBox.h:95
Definition: CListViewRows.h:48
uint32_t size() const
Definition: CListViewRows.h:186
bool sortAscending() const
Definition: CListViewRows.h:217
List view widget.
Definition: CListView.h:108
void save(const xdoc::SNode &node, CLayoutXMLmode xmlMode) const override
Saves control data to XML.
virtual void insertRow(uint32_t position, const Strings &row, int ident)
Inserts new row.
int columnAt(int x)
Computes which column contains x-coordinate.
int find_id(int id) const
Finds item with ID.
bool select_next()
Selects the next row. Executes the callbacks. Internal.
void resize(int x, int y, int w, int h) override
Resizes the control and inside widgets.
int handle(int) override
Overwritten handle()
bool displayed(uint32_t index) const
virtual void addRow(CPackedStrings *row)
Adds new row.
virtual void item_clicked(int mouse_btn)
bool preferredSize(int &w, int &h) override
Computes the optimal widgets size.
int selected(int index) const
virtual void item_select(uint32_t index, bool select)
Selects or deselects the item.
static void scrollbar_width(int b)
Changes the default scrollbar width for the class.
void load(const xdoc::SNode &node, CLayoutXMLmode xmlMode) override
Loads control data from XML.
virtual void header_draw(int x, int y, int hh) const
Draws header (internal)
void key_changed(uint32_t index)
Internal callback if selected another item with the different user _data (key).
int sortColumn() const
Returns the sort column number.
static int m_scrollbarWidth
Definition: CListView.h:172
void sortColumn(int column, bool sortNow)
Sets the sort column.
CColumnList & columns()
Returns column list.
Definition: CListView.h:864
bool select(uint32_t index, bool sel=true, int docallbacks=false)
Selects the row. Internal.
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()
void load(Query *) override
Loads the key value from the query.
bool select_next_page()
Selects the next page row. Executes the callbacks. Internal.
Fl_Font textFont() const override
Returns text font type.
Definition: CListView.h:931
CColumn & column(uint32_t col)
Returns column informartion.
Definition: CListView.h:873
CPackedStrings * findCaption(const String &caption)
Finds an item with the caption (a string in the first column).
virtual int top() const
Returns the scroll position.
Definition: CListView.h:590
void bbox(int &X, int &Y, int &W, int &H) const
Returns the actual size of the drawing area (internal)
CPackedStrings * selectedRow() const
void addColumn(const CColumn &column)
Adds a new column as a copy of column.
Definition: CListView.h:888
int selectedIndex() const
CListViewRows m_rows
Definition: CListView.h:224
uint32_t headerHeight() const
Returns header height.
Definition: CListView.h:1161
void autoRowHeight(bool arh)
Sets auto row height mode as true/false.
CPackedStrings * findKey(int keyValue)
Finds an item with the key (an integer associated with the item - argument()).
bool select_first()
Selects the first row. Executes the callbacks. Internal.
uint32_t fullHeight() const
Returns summary height of all items including the header row.
void redraw_lines()
Redraw all the lines.
Definition: CListView.h:464
void saveList(const xdoc::SNode &node) const
Saves the list data into XML node.
void show() override
Definition: CListView.h:616
void draw() override
General draw function. Draws everything.
virtual void addRow(int ident, const Strings &row)
Adds new row.
void addColumn(const String &colname, VariantDataType type, uint32_t cwidth=100, bool cvisible=true)
Adds a new column as a copy of column.
Definition: CListView.h:900
bool valid() const override
True if the data is valid.
Definition: CListView.h:784
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.
void terminateFill()
Terminate the current fill() operation (if in progress)
Definition: CListView.h:1202
void redrawRow(uint32_t index)
Definition: CListView.h:745
void sort()
Sorts ListView rows using existing information about sort column and direction.
Definition: CListView.h:1114
virtual int get_focus()
Get focus callback (internal)
CColumnList m_columnList
Definition: CListView.h:229
virtual Fl_Color item_color(int column, const CPackedStrings &rowData) const
The function that allows to overwrite the default text color for the cell.
bool activate_row(uint32_t index)
Selects the row. Executes the callbacks. Internal.
virtual int item_width(uint32_t index) const
Returns item width.
void save(Query *) override
Saves the key value from the query.
static void hscrollbar_callback(Fl_Widget *s, void *)
Internal horizontal scrollback callback.
uchar textSize() const override
Definition: CListView.h:947
void getSelections(std::vector< uint64_t > &selection) const
Returns a selected rows ID list.
virtual uint32_t cellBorderWidth() const
Returns the cell border width.
virtual bool header_drag_position(int x)
Returns true if x is the drag-sensitive area.
void hide() override
Definition: CListView.h:630
void capitalizeColumnNames(bool ccn)
Defines if column names should be auto-capitilized.
Definition: CListView.h:1194
bool showSelection() const
Returns show selection mode.
Definition: CListView.h:1005
bool select_prior()
Selects the prior row. Executes the callbacks. Internal.
CListViewDataMode dataMode() const
Definition: CListView.h:675
void textValue(const std::string &text)
virtual uint32_t size() const
Returns the row count.
Definition: CListView.h:582
Fl_Color textColor() const override
Returns text color.
Definition: CListView.h:963
void setSelections(const std::vector< uint64_t > &selection)
Sets a selected rows ID list.
virtual void header_dragged(int x)
Header dragged to position x notification.
bool sortAscending() const
Returns the sort direction - ascending/descending.
Definition: CListView.h:1098
static int scrollbar_width()
Returns the default scrollbar width for the class.
void multiSelect(bool ms)
Sets multiple selection enabled or disabled.
Definition: CListView.h:1029
bool autoRowHeight() const
Returns auto row height mode as true/false.
Definition: CListView.h:918
CSelection m_selection
Definition: CListView.h:204
CColumn & column(const char *colname)
Returns column informartion.
bool select_prior_page()
Selects the prior page row. Executes the callbacks. Internal.
virtual int item_height(uint32_t index) const
Recomputes items height.
void textSize(uchar s) override
Sets text font size.
Definition: CListView.h:955
bool selectRow(uint32_t index, bool sel=true)
Definition: CListView.h:724
bool capitalizeColumnNames() const
Returns true if column names are auto-capitilized.
Definition: CListView.h:1185
void dataMode(CListViewDataMode dm)
Definition: CListView.h:665
virtual void header_clicked(int x)
Header clicked mouse callback.
std::string m_searchPhrase
Definition: CListView.h:209
String sortColumnName() const
Returns sort column name.
String className() const override
Returns widget class name (internal SPTK RTTI).
Definition: CListView.h:1210
virtual void removeRow(uint32_t index)
Removes row.
int visible(int index) const
uint32_t activeRow() const
Returns the currently active row.
Definition: CListView.h:1177
int hposition() const
Returns horizontal position of the scroll.
Definition: CListView.h:322
void headerHeight(uint32_t hh)
Sets the header height, 0 to hide headers.
Definition: CListView.h:1169
virtual void updateRow(uint32_t position, CPackedStrings *row)
Updates a row.
void hposition(int hpos)
Sets horizontal position of the scroll.
int find_item(int y)
Finds an item in vertical position y.
bool showStripes() const
Returns show stripes.
Definition: CListView.h:992
bool select_last()
Selects the last row. Executes the callbacks. Internal.
void loadList(const xdoc::SNode &node)
Fills the list with the data from XML node.
CPackedStrings * row(uint32_t index) const
void data(const Variant &v) override
Variant data() const override
virtual void clear()
Removes all the rows.
void textFont(Fl_Font f) override
Sets text font type.
Definition: CListView.h:939
virtual void header_released(int x)
Header released in position x notification.
std::string textValue() const
void showSelection(bool flag)
Sets show selection mode.
Definition: CListView.h:1013
int visible() const
Definition: CListView.h:644
virtual int item_compute_height(CPackedStrings *rowData)
Recomputes items height.
~CListView() override
Destructor.
Definition: CListView.h:503
virtual int item_compute_height_all()
Recomputes all items height.
void showStripes(bool flag)
Sets show stripes mode.
bool showGrid() const
Returns show grid mode.
Definition: CListView.h:979
void showGrid(bool flag)
Sets show grid mode.
bool select_only(uint32_t index, bool docallbacks=false)
Selects the only row. Internal.
uint32_t fullWidth() const
Returns maximum width of all items including the header row.
void textColor(Fl_Color n) override
Sets text color.
Definition: CListView.h:971
void imageCollection(Strings &iconNames)
Sets the images that may be referred from items.
static void scrollbar_callback(Fl_Widget *s, void *)
Internal vertical scrollback callback.
virtual void displayRow(uint32_t index)
void columns(const CColumnList &columns)
Sets a new column list.
virtual bool item_selected(uint32_t index) const
Returns true if item is selected.
CControlKind kind() const override
SPTK RTTI information.
Definition: CListView.h:910
const CSelection & selection() const
Definition: CListView.h:702
Strings m_iconNames
Definition: CListView.h:187
CListView(const char *label=nullptr, int layoutSize=20, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
Constructor in SPTK style.
virtual void updateRow(uint32_t position, const Strings &row, int ident=0)
Updates a row. Optional row argument may be defined inside row parameter.
void redraw_line(uint32_t index)
Request to redraw line index.
bool multiSelect() const
Returns multiple selection enabled or disabled.
Definition: CListView.h:1021
virtual void top(int index)
Sets the scroll position.
void sortAscending(bool ascending, bool sortNow)
Sets the sort direction - ascending/descending.
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)
Packed strings list.
Definition: PackedStrings.h:58
List view & friend items selection.
Definition: CListViewSelection.h:50
Definition: DataSource.h:49
Definition: Variant.h:372
CControlKind
Control kind is the constant to report the internal SPTK RTTI.
Definition: CControl.h:50
CLayoutAlign
Definition: CLayoutClient.h:44
CLayoutXMLmode
Definition: CLayoutClient.h:57
CListViewDataMode
The data mode for the data() methods.
Definition: CListView.h:76
CRefreshKind
The refersh kind.
Definition: CListView.h:54
VariantDataType
Definition: VariantData.h:44