49 int pRow = 0,
int pCol = 0,
51 int pNumRows = 10,
int pNumCols = 5,
52 int pDefaultColWidth = 12,
53 const std::string& pTitle =
"",
68 virtual long show(
bool pBringToTop =
false,
bool pShowSubwindows =
true)
override;
69 virtual long showModal(
bool pShowSelf =
true,
bool pBringToTop =
true,
bool pShowSubwindows =
true)
override;
71 virtual void draw()
override;
72 virtual void hide(
bool pHideSubwindows =
true)
override;
73 virtual void unhide(
bool pUnhideSubwindows =
true)
override;
74 virtual void erase(
bool pEraseSubwindows =
true)
override;
75 virtual bool move(
int pNewRow,
int pNewCol,
bool pRefresh =
true)
override;
76 virtual void resize(
int pNewHeight,
int pNewWidth,
bool pRefresh =
true)
override;
77 virtual void clear(
bool pRefresh =
false)
override;
78 virtual void bringToTop(
bool pRefresh =
true)
override;
79 virtual bool hasFocus()
const override;
82 virtual void setLastKey(
int pLastKey)
override;
83 virtual void quitNow()
override;
84 virtual void exitNow()
override;
85 virtual bool setKeyFunction(
int pKey,
const std::shared_ptr<cxFunction>& pFunction)
override;
90 virtual void setEnabled(
bool pEnabled)
override;
92 virtual std::string
cxTypeStr()
const override;
119 virtual long showModal(
int pFocusRow,
int pFocusCol,
bool pShowSelf =
true,
bool pBringToTop =
true,
bool pShowSubwindows =
true);
149 std::shared_ptr<cxWindow>
getCell(
int pRow,
int pCol)
const;
158 bool setCell(
int pRow,
int pCol,
const std::shared_ptr<cxWindow>& pWidget);
175 bool setCellValue(
int pRow,
int pCol,
const std::string& pValue);
182 void setColLabel(
int pCol,
const std::string& pLabel);
196 void setRowLabel(
int pRow,
const std::string& pLabel);
293 std::vector<std::vector<std::shared_ptr<cxWindow>>> mCells;
296 std::vector<int> mColWidths;
299 std::vector<std::string> mColLabels;
302 std::vector<std::string> mRowLabels;
316 bool mShowColHeaders;
317 bool mShowRowHeaders;
320 short mHeaderColorPair;
321 short mGridLineColorPair;
324 int mDefaultColWidth;
333 static std::string defaultColLabel(
int pCol);
340 static std::string defaultRowLabel(
int pRow);
348 std::shared_ptr<cxWindow> createDefaultCell(
int pRow,
int pCol);
358 void drawColHeaders();
363 void drawRowHeaders();
368 void drawGridLines();
373 void positionCells();
379 int visibleRows()
const;
385 int visibleCols()
const;
390 int innerTop()
const;
395 int innerLeft()
const;
400 void ensureFocusVisible();
405 void focusNextCell();
410 void focusPrevCell();
420 bool findCellAt(
int pY,
int pX,
int& pRow,
int& pCol)
const;
This is a class representing a grid of data, similar to a spreadsheet, with rows & columns of cells w...
Definition cxGrid.h:31
std::string getCellValue(int pRow, int pCol) const
Gets the value of a cell (as a string). Works for cxInput cells.
Definition cxGrid.cpp:1166
virtual bool setKeyFunction(int pKey, const std::shared_ptr< cxFunction > &pFunction) override
Sets a function to be called when a key is pressed.
Definition cxGrid.cpp:949
virtual cxWindow * getParent() const override
Returns a pointer to the parent window.
Definition cxGrid.cpp:997
virtual void draw() override
Fills the member ncurses window structure with the current.
Definition cxGrid.cpp:464
virtual void removeExitKey(int pKey) override
Removes an exit key.
Definition cxGrid.cpp:969
virtual void addAttr(e_WidgetItems pItem, attr_t pAttr) override
Adds an ncurses attribute to use for one of the items in the.
Definition cxGrid.cpp:1002
virtual void removeAttr(e_WidgetItems pItem, attr_t pAttr) override
Removes an ncurses attribute from one of the item lists.
Definition cxGrid.cpp:1012
virtual void setColor(e_WidgetItems pItem, e_cxColors pColor) override
Sets the color of one of the window items.
Definition cxGrid.cpp:915
void setFocusCell(int pRow, int pCol)
Sets the focus to a specific cell.
Definition cxGrid.cpp:1275
int getNumRows() const
Returns the number of data rows in the grid.
Definition cxGrid.cpp:1053
virtual void removeQuitKey(int pKey) override
Removes a quit key.
Definition cxGrid.cpp:964
void showRowHeaders(bool pShow)
Toggles whether row headers are displayed.
Definition cxGrid.cpp:1304
int getFocusCol() const
Gets the currently focused cell column.
Definition cxGrid.cpp:1270
virtual void unhide(bool pUnhideSubwindows=true) override
Un-hides the window.
Definition cxGrid.cpp:832
void setHeaderColor(e_cxColors pColor)
Sets the color for the column/row header labels.
Definition cxGrid.cpp:1284
bool setCellValue(int pRow, int pCol, const std::string &pValue)
Sets the value of a cell (as a string). Works for cxInput cells.
Definition cxGrid.cpp:1184
virtual void clear(bool pRefresh=false) override
Clears the text from the window.
Definition cxGrid.cpp:870
virtual void hide(bool pHideSubwindows=true) override
Hides the window.
Definition cxGrid.cpp:818
virtual void setLastKey(int pLastKey) override
Sets the last keypress.
Definition cxGrid.cpp:934
virtual void setAttr(e_WidgetItems pItem, attr_t pAttr) override
Sets the ncurses attribute to use for one of the items in the.
Definition cxGrid.cpp:1007
virtual void getAttrs(e_WidgetItems pItem, std::set< attr_t > &pAttrs) const override
Returns the set of ncurses attributes for a given item.
Definition cxGrid.cpp:1022
bool setCell(int pRow, int pCol, const std::shared_ptr< cxWindow > &pWidget)
Sets (adds/replaces) the cell widget at the specified row and column.
Definition cxGrid.cpp:1145
int getRowHeaderWidth() const
Gets the width of the row header column.
Definition cxGrid.cpp:1260
virtual void disableAttrs(WINDOW *pWin, e_WidgetItems pItem) override
Disables the attributes for one of the m*Attrs sets for an ncurses window.
Definition cxGrid.cpp:1032
std::shared_ptr< cxWindow > getCell(int pRow, int pCol) const
Gets the cell widget at the specified row and column.
Definition cxGrid.cpp:1136
void setRowHeaderWidth(int pWidth)
Sets the width of the row header column.
Definition cxGrid.cpp:1252
virtual void erase(bool pEraseSubwindows=true) override
Erases the window.
Definition cxGrid.cpp:838
std::string getColLabel(int pCol) const
Gets a column header label.
Definition cxGrid.cpp:1209
int getNumCols() const
Returns the number of data columns in the grid.
Definition cxGrid.cpp:1058
virtual void clearKeyFunctions() override
Clears the list of external functions fired by hotkeys.
Definition cxGrid.cpp:959
int getFocusRow() const
Gets the currently focused cell row.
Definition cxGrid.cpp:1265
virtual void setEnabled(bool pEnabled) override
Enables or disables the window. If the window is.
Definition cxGrid.cpp:974
virtual bool modalGetsKeypress() const override
Returns whether or not a call to showModal() will wait for a.
Definition cxGrid.cpp:812
virtual void setBorderStyle(eBorderStyle pBorderStyle) override
Sets the border style.
Definition cxGrid.cpp:929
virtual std::string cxTypeStr() const override
Returns the name of the cxWidgets class. This is overridden.
Definition cxGrid.cpp:992
virtual void removeAttrs(e_WidgetItems pItem) override
Removes all attributes for a given window item.
Definition cxGrid.cpp:1017
virtual void bringToTop(bool pRefresh=true) override
Brings the window to the top.
Definition cxGrid.cpp:884
void setNumCols(int pNumCols)
Sets the number of columns in the grid. Adds or removes columns as needed.
Definition cxGrid.cpp:1096
virtual void resize(int pNewHeight, int pNewWidth, bool pRefresh=true) override
Changes the window's width and height. The window's upper-left.
Definition cxGrid.cpp:863
virtual e_cxColors getItemColor(e_WidgetItems pItem) const override
Returns the color of one of the items in a window.
Definition cxGrid.cpp:1037
void setNumRows(int pNumRows)
Sets the number of rows in the grid. Adds or removes rows as needed.
Definition cxGrid.cpp:1063
virtual void clearKeyFunction(int pKey) override
Removes a function pointer for a keypress so that it will no.
Definition cxGrid.cpp:954
int getColWidth(int pCol) const
Gets the width of a specific column.
Definition cxGrid.cpp:1243
virtual void exitNow() override
This is mainly for deriving classes. It tells the object.
Definition cxGrid.cpp:944
bool getShowRowHeaders() const
Returns whether row headers are displayed.
Definition cxGrid.cpp:1309
void setColLabel(int pCol, const std::string &pLabel)
Sets a column header label.
Definition cxGrid.cpp:1201
virtual ~cxGrid()
Destructor.
Definition cxGrid.cpp:133
bool getShowColHeaders() const
Returns whether column headers are displayed.
Definition cxGrid.cpp:1299
virtual void setDisableCursorOnShow(bool pDisableCursorOnShow) override
Sets whether the window should disable the cursor.
Definition cxGrid.cpp:987
cxGrid(cxWindow *pParentWindow=nullptr, int pRow=0, int pCol=0, int pHeight=DEFAULT_HEIGHT, int pWidth=DEFAULT_WIDTH, int pNumRows=10, int pNumCols=5, int pDefaultColWidth=12, const std::string &pTitle="", eBorderStyle pBorderStyle=eBS_SINGLE_LINE)
Constructor.
virtual void enableAttrs(WINDOW *pWin, e_WidgetItems pItem) override
Enables the attributes for one of the m*Attrs sets for an ncurses window.
Definition cxGrid.cpp:1027
virtual long showModal(bool pShowSelf=true, bool pBringToTop=true, bool pShowSubwindows=true) override
Shows the window and waits for input.
Definition cxGrid.cpp:783
void showColHeaders(bool pShow)
Toggles whether column headers are displayed.
Definition cxGrid.cpp:1294
void setRowLabel(int pRow, const std::string &pLabel)
Sets a row header label.
Definition cxGrid.cpp:1218
void setColWidth(int pCol, int pWidth)
Sets the width of a specific column.
Definition cxGrid.cpp:1235
virtual bool move(int pNewRow, int pNewCol, bool pRefresh=true) override
Changes the window's position, based on a new upper-left corner.
Definition cxGrid.cpp:852
std::string getRowLabel(int pRow) const
Gets a row header label.
Definition cxGrid.cpp:1226
virtual void quitNow() override
This is mainly for deriving classes. This causes the object.
Definition cxGrid.cpp:939
virtual bool hasFocus() const override
Returns true if window has focus, false otherwise.
Definition cxGrid.cpp:903
void setGridLineColor(e_cxColors pColor)
Sets the color for the grid lines/separators.
Definition cxGrid.cpp:1289
virtual long show(bool pBringToTop=false, bool pShowSubwindows=true) override
Shows the window.
Definition cxGrid.cpp:479
Represents a text-based window on the screen. Can contain a title, status, and a message to appear wi...
Definition cxWindow.h:195
#define DEFAULT_HEIGHT
Definition cxWindow.h:68
#define DEFAULT_WIDTH
Definition cxWindow.h:69
cxBorderChars.h - Defines border characters to be used in drawing a box (i.e., in cxWindow and all it...
Definition cxApp.cpp:5
e_WidgetItems
Definition cxWidgetItems.h:42
eBorderStyle
Definition cxBorderStyles.h:26
@ eBS_SINGLE_LINE
Definition cxBorderStyles.h:28
e_cxColors
Definition cxColors.h:46