A GTable represents a graphical editable 2D table, like a mediocre facsimile of an Excel spreadsheet. More...
#include "gtable.h"
Public Types | |
enum | ColumnHeaderStyle { COLUMN_HEADER_NONE, COLUMN_HEADER_EXCEL, COLUMN_HEADER_NUMERIC } |
Styles of column header labels that can be shown. More... | |
enum | TextPosition { TEXT_BESIDE_ICON, TEXT_UNDER_ICON, TEXT_ONLY } |
The places where an interactor can place its text relative to its icon. More... | |
Public Member Functions | |
GTable(int rows=0, int columns=0, double width=0, double height=0, QWidget* parent=nullptr) | |
Constructs a new table with the given dimensions and (optional) size. More... | |
~GTable() override | |
void | addActionListener() (deprecated) |
Adds an event listener to be notified when this interactor is clicked or generally interacted with. More... | |
void | autofitColumnWidths() |
Changes widths of all columns to be perfectly large enough to fit their contents. More... | |
void | clear() |
Sets all cells in the table to store an empty string value. More... | |
void | clearCell(int row, int column) |
Sets the given cell to store an empty string value. More... | |
void | clearCellFormatting(int row, int column) |
Removes any formatting that has been applied to the given cell. More... | |
void | clearFormatting() |
Removes any per-cell/column/row formatting that has been applied to the table. More... | |
void | clearSelection() |
Deselects any currently selected cell. More... | |
bool | eventsEnabled() const override |
Returns true if this interactor is currently accepting events. More... | |
void | fill(string text) |
Sets every cell in the table to have the given value. More... | |
string | get(int row, int column) const |
Returns the text stored in the given cell. More... | |
string | getAccelerator() const |
Returns a string representing a hotkey for this interactor, or an empty string if no accelerator has been set. More... | |
string | getActionCommand() const |
Returns an action command for this interactor, which is a semi-unique string you can use to identify it when events occur. More... | |
string | getBackground() const |
Returns the background color of the interactor as a string. More... | |
int | getBackgroundInt() const |
Returns the background color of the interactor as an RGB integer. More... | |
GRectangle | getBounds() const |
Returns a rectangle representing the x/y position and size of this interactor. More... | |
string | getColor() const |
Returns the foreground/text color of the interactor as a string. More... | |
int | getColorInt() const |
Returns the foreground/text color of the interactor as an RGB integer. More... | |
ColumnHeaderStyle | getColumnHeaderStyle() const |
Returns the column headers to use the given style. More... | |
double | getColumnWidth(int column) const |
Returns the width of the given column index in pixels. More... | |
GContainer * | getContainer() const |
Returns a pointer to the onscreen container holding this interactor. More... | |
string | getFont() const |
Returns the font of this interactor's text as a font string such as "Helvetica-12-Bold". More... | |
string | getForeground() const |
Returns the foreground/text color of the interactor as a string. More... | |
int | getForegroundInt() const |
Returns the foreground/text color of the interactor as an RGB integer. More... | |
double | getHeight() const |
Returns the current onscreen height of this interactor in pixels. More... | |
string | getIcon() const |
Returns the file name of the icon associated with this interactor, or an empty string if no icon has been set. More... | |
int | getID() const |
Returns a globally unique identifier for this interactor, which is set when the interactor is constructed. More... | |
_Internal_QWidget* | getInternalWidget() const override |
Returns a direct pointer to the internal Qt widget being wrapped by this interactor. More... | |
GPoint | getLocation() const |
Returns an (x, y) point representing the onscreen location of the top-left corner of this interactor within its containing window. More... | |
double | getMinimumHeight() const |
Returns the minimum height in pixels that this interactor will permit itself to be resized to. More... | |
GDimension | getMinimumSize() const |
Returns a GDimension structure representing the minimum size in pixels that this interactor will permit itself to be resized to. More... | |
double | getMinimumWidth() const |
Returns the minimum width in pixels that this interactor will permit itself to be resized to. More... | |
string | getName() const |
Returns a string representing a unique name for this interactor. More... | |
double | getPreferredHeight() const |
Returns the height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars. More... | |
GDimension | getPreferredSize() const |
Returns a GDimension structure storing the width and height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars. More... | |
double | getPreferredWidth() const |
Returns the height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars. More... | |
double | getRowHeight(int row) const |
Returns the height of the given row index in pixels. More... | |
GTableIndex | getSelectedCell() const |
Returns the row and column of the cell that is currently selected. More... | |
void | getSelectedCell(int &row, int &column) const |
Returns the row and column of the cell that is currently selected by filling the given reference parameters. More... | |
string | getSelectedCellValue() const |
Returns the text in the cell that is currently selected. More... | |
int | getSelectedColumn() const |
Returns the column of the cell that is currently selected, or -1 if no cell is currently selected. More... | |
int | getSelectedRow() const |
Returns the row of the cell that is currently selected, or -1 if no cell is currently selected. More... | |
GDimension | getSize() const |
Returns a GDimension structure storing the current onscreen width and height of this interactor in pixels. More... | |
string | getType() const override |
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox". More... | |
QWidget* | getWidget() const override |
Returns a direct pointer to the internal Qt widget being wrapped by this interactor. More... | |
double | getWidth() const |
Returns the current onscreen width of this interactor in pixels. More... | |
double | getX() const |
Returns the x-coordinate of the top-left pixel of this interactor within its onscreen window. More... | |
double | getY() const |
Returns the y-coordinate of the top-left pixel of this interactor within its onscreen window. More... | |
bool | hasSelectedCell() const |
Returns true if a cell is currently selected. More... | |
int | height() const |
Returns the number of rows in the table. More... | |
bool | inBounds(double x, double y) const |
Returns true if the given x/y pixel is within the bounds of this interactor. More... | |
bool | inBounds(int x, int y) const |
Returns true if the given x/y pixel is within the bounds of this interactor. More... | |
bool | inTableBounds(int row, int column) const |
Returns true if the given 0-based row/column index is within the bounds of the table. More... | |
bool | isEditable() const |
Returns whether cells of the table can be edited. More... | |
bool | isEnabled() const |
Returns true if this interactor is currently enabled. More... | |
bool | isVisible() const |
Returns true if the interactor is visible on the screen. More... | |
int | numCols() const |
Returns the number of columns in the table. More... | |
int | numRows() const |
Returns the number of rows in the table. More... | |
void | removeActionListener() |
Removes the action listener from this interactor so that it will no longer call it when events occur. More... | |
void | removeClickListener() |
Removes the click listener from this interactor so that it will no longer call it when events occur. More... | |
void | removeDoubleClickListener() |
Removes the double-click listener from this interactor so that it will no longer call it when events occur. More... | |
void | removeKeyListener() |
Removes the key listener from this interactor so that it will no longer call it when key events occur. More... | |
void | removeMouseListener() |
Removes the mouse listener from this interactor so that it will no longer call it when events occur. More... | |
void | removeTableListener() |
Removes the table listener from this button so that it will no longer call it when events occur. More... | |
void | requestFocus() override |
Transfers keyboard focus to this interactor. More... | |
void | resize(int numRows, int numCols) |
Modifies the table to have the given number of rows and columns. More... | |
bool | rowColumnHeadersVisible() const |
Returns whether row and column headers are shown in the table. More... | |
void | select(int row, int column) |
Sets the given cell to become currently selected, replacing any previous selection. More... | |
void | set(int row, int column, string text) |
Modifies the value in the given cell to store the given text. More... | |
void | setAccelerator(string accelerator) |
Sets an accelerator hotkey for this interactor, such as "Ctrl-S". More... | |
void | setActionCommand(string actionCommand) |
Sets the action command for this interactor. More... | |
void | setActionListener(GEventListener func) |
Sets an action listener on this interactor so that it will be called when it is interacted with in its primary way. More... | |
void | setActionListener(GEventListenerVoid func) |
Sets an action listener on this interactor so that it will be called when it is interacted with in its primary way. More... | |
void | setBackground(int rgb) override |
Sets the background color that appears behind each cell. More... | |
void | setBackground(string color) override |
Sets the background color that appears behind each cell. More... | |
void | setBounds(double x, double y, double width, double height) |
Sets the size and location of the widget. More... | |
void | setBounds(const GRectangle &size) |
Sets the size and location of the widget. More... | |
void | setCellAlignment(int row, int column, HorizontalAlignment alignment) |
Sets the horizontal alignment of the given cell. More... | |
void | setCellBackground(int row, int column, int color) |
Sets the background color of the given cell to the given color. More... | |
void | setCellBackground(int row, int column, string color) |
Sets the background color of the given cell to the given color. More... | |
void | setCellFont(int row, int column, string font) |
Sets the text font of the given cell to the given RGB color. More... | |
void | setCellForeground(int row, int column, int color) |
Sets the foreground/text color of the given cell to the given color. More... | |
void | setCellForeground(int row, int column, string color) |
Sets the foreground/text color of the given cell to the given color. More... | |
void | setClickListener(GEventListener func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is clicked on it. More... | |
void | setClickListener(GEventListenerVoid func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is clicked on it. More... | |
void | setColor(int rgb) override |
Sets the color used for the text of each cell. More... | |
void | setColor(string color) override |
Sets the color used for the text of each cell. More... | |
void | setColumnAlignment(int column, HorizontalAlignment alignment) |
Sets the horizontal alignment of the given column. More... | |
void | setColumnBackground(int column, int color) |
Sets the background color of the given column to the given color. More... | |
void | setColumnBackground(int column, string color) |
Sets the background color of the given column to the given color. More... | |
void | setColumnFont(int column, string font) |
Sets the text font of the given column to the given RGB color. More... | |
void | setColumnForeground(int column, int color) |
Sets the foreground/text color of the given column to the given color. More... | |
void | setColumnForeground(int column, string color) |
Sets the foreground/text color of the given column to the given color. More... | |
void | setColumnHeaderStyle(ColumnHeaderStyle style) |
Sets the column headers to use the given style. More... | |
void | setColumnWidth(int column, double width) |
Sets the given column index to have the given width in pixels. More... | |
void | setDoubleClickListener(GEventListener func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is double-clicked on it. More... | |
void | setDoubleClickListener(GEventListenerVoid func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is double-clicked on it. More... | |
void | setEditable(bool editable) |
Sets whether cells of the table can be edited. More... | |
void | setEditorValue(int row, int column, string text) |
Modifies the value in the cell that is currently being edited to store the given text. More... | |
void | setEnabled(bool value) |
Sets whether this interactor is currently enabled. More... | |
void | setEventsEnabled(bool eventsEnabled) |
Sets whether the object is currently allowing itself to fire events. More... | |
void | setFont(const QFont &font) override |
Sets the font used to display each cell's text. More... | |
void | setFont(string font) override |
Sets the font used to display each cell's text. More... | |
void | setForeground(int rgb) override |
Sets the color used for the text of each cell. More... | |
void | setForeground(string color) override |
Sets the color used for the text of each cell. More... | |
void | setHeight(double height) |
Sets the onscreen height of the interactor in pixels. More... | |
void | setHorizontalAlignment(HorizontalAlignment alignment) |
Sets the horizontal alignment of the text in all cells in the table. More... | |
void | setIcon(const QIcon &icon) |
Sets the icon associated with this interactor. More... | |
void | setIcon(const QPixmap &icon) |
Sets the icon associated with this interactor. More... | |
void | setIcon(string filename, bool retainIconSize=true) |
Sets the file name of the icon associated with this interactor, or an empty string if no icon has been set. More... | |
void | setKeyListener(GEventListener func) |
Sets a key listener on this interactor so that it will be called when the user presses any key. More... | |
void | setKeyListener(GEventListenerVoid func) |
Sets a key listener on this interactor so that it will be called when the user presses any key. More... | |
void | setLocation(double x, double y) |
Sets the onscreen x/y-coordinate of the top-left corner of the interactor relative to its window. More... | |
void | setMinimumSize(double width, double height) |
Sets the minimum size in pixels that this interactor will permit itself to be resized to. More... | |
void | setMinimumSize(const GDimension &size) |
Sets the minimum size in pixels that this interactor will permit itself to be resized to. More... | |
void | setMouseListener(GEventListener func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is moved or clicked on it. More... | |
void | setMouseListener(GEventListenerVoid func) |
Sets a mouse listener on this interactor so that it will be called when the mouse is moved or clicked on it. More... | |
void | setName(string name) |
Sets a string representing a unique name for this interactor. More... | |
void | setPreferredHeight(double height) |
Sets the height in pixels that this interactor would prefer to be. More... | |
void | setPreferredSize(double width, double height) |
Sets the width and height in pixels that this interactor would prefer to be. More... | |
void | setPreferredSize(const GDimension &size) |
Sets the size in pixels that this interactor would prefer to be. More... | |
void | setPreferredWidth(double width) |
Sets the width in pixels that this interactor would prefer to be. More... | |
void | setRowAlignment(int row, HorizontalAlignment alignment) |
Sets the horizontal alignment of the given row. More... | |
void | setRowBackground(int row, int rgb) |
Sets the background color of the given row to the given RGB color. More... | |
void | setRowBackground(int row, string color) |
Sets the background color of the given row to the given color. More... | |
void | setRowColumnHeadersVisible(bool visible) |
Sets whether row and column headers should be shown in the table. More... | |
void | setRowFont(int row, string font) |
Sets the text font of the given row to the given font. More... | |
void | setRowForeground(int row, int rgb) |
Sets the foreground/text color of the given row to the given color. More... | |
void | setRowForeground(int row, string color) |
Sets the foreground/text color of the given row to the given color. More... | |
void | setRowHeight(int row, double width) |
Sets the given row index to have the given height in pixels. More... | |
void | setSelectedCellValue(string text) |
Sets the text in the cell that is currently selected. More... | |
void | setSize(double width, double height) |
Sets the onscreen width and height of the interactor in pixels. More... | |
void | setSize(const GDimension &size) |
Sets the onscreen width and height of the interactor in pixels. More... | |
void | setTableListener(GEventListener func) |
Sets the given function to be called when events occur in this table. More... | |
void | setTableListener(GEventListenerVoid func) |
Sets the given function to be called when events occur in this table. More... | |
void | setTooltip(string tooltipText) |
Sets a "tooltip" that will appear if the user hovers their mouse over the interactor. More... | |
void | setVisible(bool visible) |
Returns true if the interactor is visible on the screen. More... | |
void | setWidth(double width) |
Sets the onscreen width of the interactor in pixels. More... | |
void | setX(double x) |
Sets the onscreen x-coordinate of the top-left corner of the interactor relative to its window. More... | |
void | setY(double y) |
Sets the onscreen y-coordinate of the top-left corner of the interactor relative to its window. More... | |
string | toString() const |
Returns a string representation of this observable object's state. More... | |
int | width() const |
Returns the number of columns in the table. More... | |
Protected Member Functions | |
void | clearEventListeners() |
Removes all event listeners from this object. More... | |
void | ensureThreadSafety(string memberName="") |
Ensures that we are currently in the Qt GUI thread. More... | |
void | fireEvent(GEvent &event) |
Sends out the given event to any attached listeners. More... | |
void | fireGEvent(QEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QCloseEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QKeyEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QMouseEvent *event, EventType eventType, string eventName, string actionCommand="") |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QResizeEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QTimerEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QWheelEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
void | fireGEvent(QWindowStateChangeEvent *event, EventType eventType, string eventName) |
Creates an event of the given type, then sends it out to any attached listeners. More... | |
bool | hasEventListener(string eventName) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(int eventMask) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(const GEvent &event) const |
Returns true if the observable object has a listener for the given type of event. More... | |
bool | isAcceptingEvent(string eventType) const |
Returns true if the observable object has a listener for the given type of event. More... | |
void | removeEventListener(string eventName) |
Removes any event listener from this observable object that would respond to the given type of event, such as "click" or "keydown". More... | |
void | removeEventListeners(std::initializer_list< string > eventNames) |
Removes any event listener from this observable object that would respond to the given types of events, such as "click" or "keydown". More... | |
void | setEventListener(string eventName, GEventListener func) |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown". More... | |
void | setEventListener(string eventName, GEventListenerVoid func) |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown". More... | |
void | setEventListeners(std::initializer_list< string > eventNames, GEventListener func) |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown". More... | |
void | setEventListeners(std::initializer_list< string > eventNames, GEventListenerVoid func) |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown". More... | |
A GTable represents a graphical editable 2D table, like a mediocre facsimile of an Excel spreadsheet.
After creating a GTable, you can listen for table events to be notified when the user types a new value into a table cell by calling setTableListener.
An editable table has a semi-complex editing model where the user can begin modifying a cell by highlighting it and typing, which replaces the existing value, or by double-clicking it, which edits the existing value. You can also press F2 on a cell to edit it, equivalent to a double-click. During editing, you can press Esc to cancel editing, or Tab or Enter to complete editing and move to the next cell.
All row/column indexes in this class are 0-based.
enum ColumnHeaderStyle |
Styles of column header labels that can be shown.
The "Excel" style is to use column names A-Z, then AA-AZ, BA-BZ, ..., ZA-ZZ, then AAA, AAB, and so on. The "numeric" style is to use simple numbers like 1, 2, 3, ... The "none" style means not to use any column headers at all.
Enumerator | |
---|---|
COLUMN_HEADER_NONE | |
COLUMN_HEADER_EXCEL | |
COLUMN_HEADER_NUMERIC |
|
inherited |
GTable | ( | int | rows = 0 , |
int | columns = 0 , |
||
double | width = 0 , |
||
double | height = 0 , |
||
QWidget* | parent = nullptr |
||
) |
Constructs a new table with the given dimensions and (optional) size.
If x, y, width, or height are omitted, they are set automatically by the layout manager of the GWindow into which the table is placed. This is often what you want.
ErrorException | if the number of rows, columns, width, or height is negative. |
|
override |
|
virtualinherited |
Adds an event listener to be notified when this interactor is clicked or generally interacted with.
|
virtual |
Changes widths of all columns to be perfectly large enough to fit their contents.
|
virtual |
Sets all cells in the table to store an empty string value.
|
virtual |
Sets the given cell to store an empty string value.
ErrorException | if the given row/column index is out of bounds |
|
virtual |
Removes any formatting that has been applied to the given cell.
|
protectedvirtualinherited |
Removes all event listeners from this object.
|
virtual |
Removes any per-cell/column/row formatting that has been applied to the table.
|
virtual |
Deselects any currently selected cell.
If no cell is selected, calling this has no effect.
|
protectedvirtualinherited |
Ensures that we are currently in the Qt GUI thread.
|
overridevirtualinherited |
Returns true if this interactor is currently accepting events.
Initially true. An interactor must be visible and added to an onscreen window to receive events.
Reimplemented from GObservable.
|
virtual |
Sets every cell in the table to have the given value.
|
protectedvirtualinherited |
Sends out the given event to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
protectedvirtualinherited |
Creates an event of the given type, then sends it out to any attached listeners.
|
virtual |
Returns the text stored in the given cell.
ErrorException | if the given row or column are out of bounds |
|
virtualinherited |
Returns a string representing a hotkey for this interactor, or an empty string if no accelerator has been set.
Reimplemented in GButton.
|
virtualinherited |
Returns an action command for this interactor, which is a semi-unique string you can use to identify it when events occur.
For example, for buttons, the default action command is the button's text.
Reimplemented in GChooser, GRadioButton, GButton, and GCheckBox.
|
virtualinherited |
Returns the background color of the interactor as a string.
Reimplemented in GCanvas.
|
virtualinherited |
Returns the background color of the interactor as an RGB integer.
Reimplemented in GCanvas.
|
virtualinherited |
Returns a rectangle representing the x/y position and size of this interactor.
|
virtualinherited |
Returns the foreground/text color of the interactor as a string.
Equivalent to getForeground.
|
virtualinherited |
Returns the foreground/text color of the interactor as an RGB integer.
Equivalent to getForegroundInt.
|
virtual |
Returns the column headers to use the given style.
Default is none, but can be set to Excel style or numeric instead.
|
virtual |
Returns the width of the given column index in pixels.
When a table is constructed, all columns initially have equal width.
ErrorException | if the given column index is out of bounds |
|
virtualinherited |
Returns a pointer to the onscreen container holding this interactor.
When an interactor is created, its container is initially null. This will become non-null automatically if you add the interactor to a window or other layout container. Interactors must be added to a container or window to receive events or to become visible on the screen.
|
virtualinherited |
Returns the font of this interactor's text as a font string such as "Helvetica-12-Bold".
Reimplemented in GCanvas.
|
virtualinherited |
Returns the foreground/text color of the interactor as a string.
Equivalent to getColor.
|
virtualinherited |
Returns the foreground/text color of the interactor as an RGB integer.
Equivalent to getColorInt.
|
virtualinherited |
Returns the current onscreen height of this interactor in pixels.
|
virtualinherited |
Returns the file name of the icon associated with this interactor, or an empty string if no icon has been set.
Not all types of interactors support icons.
|
virtualinherited |
Returns a globally unique identifier for this interactor, which is set when the interactor is constructed.
These IDs can be useful for debugging to help identify interactors uniquely.
|
overridevirtual |
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
This must be overridden by all interactor subclasses. Students/clients generally should not need to call this.
Implements GInteractor.
|
virtualinherited |
Returns an (x, y) point representing the onscreen location of the top-left corner of this interactor within its containing window.
|
virtualinherited |
Returns the minimum height in pixels that this interactor will permit itself to be resized to.
|
virtualinherited |
Returns a GDimension structure representing the minimum size in pixels that this interactor will permit itself to be resized to.
|
virtualinherited |
Returns the minimum width in pixels that this interactor will permit itself to be resized to.
|
virtualinherited |
Returns a string representing a unique name for this interactor.
The default name string uses the interactor's type and its ID to make a string like "GButton_14", but you can override this by calling setName.
|
virtualinherited |
Returns the height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars.
|
virtualinherited |
Returns a GDimension structure storing the width and height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars.
Reimplemented in GContainer.
|
virtualinherited |
Returns the height in pixels that this interactor would prefer to be, which would exactly fit its contents with no stretching or scrollbars.
|
virtual |
Returns the height of the given row index in pixels.
When a table is constructed, all rows initially have equal height.
ErrorException | if the given row index is out of bounds |
|
virtual |
Returns the row and column of the cell that is currently selected.
Sets both row and column to -1 if no cell is currently selected.
|
virtual |
Returns the row and column of the cell that is currently selected by filling the given reference parameters.
Sets both row and column to -1 if no cell is currently selected.
|
virtual |
Returns the text in the cell that is currently selected.
If no cell is currently selected, returns an empty string.
|
virtual |
Returns the column of the cell that is currently selected, or -1 if no cell is currently selected.
|
virtual |
Returns the row of the cell that is currently selected, or -1 if no cell is currently selected.
|
virtualinherited |
Returns a GDimension structure storing the current onscreen width and height of this interactor in pixels.
|
overridevirtual |
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox".
All subclasses of GInteractor must implement this method.
Implements GInteractor.
|
overridevirtual |
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
This must be overridden by all interactor subclasses. Students/clients generally should not need to call this.
Implements GInteractor.
|
virtualinherited |
Returns the current onscreen width of this interactor in pixels.
|
virtualinherited |
Returns the x-coordinate of the top-left pixel of this interactor within its onscreen window.
|
virtualinherited |
Returns the y-coordinate of the top-left pixel of this interactor within its onscreen window.
|
protectedvirtualinherited |
Returns true if the observable object has a listener for the given type of event.
|
virtual |
Returns true if a cell is currently selected.
|
virtual |
Returns the number of rows in the table.
Equivalent to numRows().
|
virtualinherited |
Returns true if the given x/y pixel is within the bounds of this interactor.
|
virtualinherited |
Returns true if the given x/y pixel is within the bounds of this interactor.
|
virtual |
Returns true if the given 0-based row/column index is within the bounds of the table.
In other words, whether the index is between (0, 0) and (numRows-1, numCols-1) inclusive.
|
protectedvirtualinherited |
Returns true if the observable object has a listener for the given type of event.
See gevent.h for event types and masks.
|
protectedvirtualinherited |
Returns true if the observable object has a listener for the given type of event.
|
protectedvirtualinherited |
Returns true if the observable object has a listener for the given type of event.
|
virtual |
Returns whether cells of the table can be edited.
Defaults to true when a table is initially created.
|
virtualinherited |
Returns true if this interactor is currently enabled.
Most interactors begin as enabled but can be disabled to stop them from being able to be clicked on or otherwise emit events.
|
virtualinherited |
Returns true if the interactor is visible on the screen.
Interactors will not be visible until they are added to an onscreen window or container.
|
virtual |
Returns the number of columns in the table.
Equivalent to width().
|
virtual |
Returns the number of rows in the table.
Equivalent to height().
|
virtualinherited |
Removes the action listener from this interactor so that it will no longer call it when events occur.
|
virtualinherited |
Removes the click listener from this interactor so that it will no longer call it when events occur.
|
virtualinherited |
Removes the double-click listener from this interactor so that it will no longer call it when events occur.
|
protectedvirtualinherited |
Removes any event listener from this observable object that would respond to the given type of event, such as "click" or "keydown".
|
protectedvirtualinherited |
Removes any event listener from this observable object that would respond to the given types of events, such as "click" or "keydown".
|
virtualinherited |
Removes the key listener from this interactor so that it will no longer call it when key events occur.
|
virtualinherited |
Removes the mouse listener from this interactor so that it will no longer call it when events occur.
|
virtual |
Removes the table listener from this button so that it will no longer call it when events occur.
|
overridevirtual |
Transfers keyboard focus to this interactor.
Reimplemented from GInteractor.
|
virtual |
Modifies the table to have the given number of rows and columns.
Any existing data is retained, and any new cells are empty.
ErrorException | if numRows or numCols is negative |
|
virtual |
Returns whether row and column headers are shown in the table.
Initially false.
|
virtual |
Sets the given cell to become currently selected, replacing any previous selection.
Note that the user can click a different cell to select it afterward. To indicate that you do not want to select any cell, call clearSelection.
ErrorException | if the given row or column are out of bounds |
|
virtual |
Modifies the value in the given cell to store the given text.
ErrorException | if the given row or column are out of bounds |
|
virtualinherited |
Sets an accelerator hotkey for this interactor, such as "Ctrl-S".
Not all interactor types support accelerators.
accelerator | a hotkey such as "Ctrl-S" |
Reimplemented in GButton.
|
virtualinherited |
Sets the action command for this interactor.
The action command is meant to be a semi-unique string you can use to identify the interactor when events occur. For example, for buttons, the default action command is the button's text, but you can change it to a different string if you prefer. The main usage of this feature is if you want to use the same function as an event listener for many interactors, you can use the action command to help distinguish which interactor generates each event.
|
virtualinherited |
Sets an action listener on this interactor so that it will be called when it is interacted with in its primary way.
For example, if this interactor is a button, this will fire when it is clicked. Any existing action listener will be replaced.
|
virtualinherited |
Sets an action listener on this interactor so that it will be called when it is interacted with in its primary way.
For example, if this interactor is a button, this will fire when it is clicked. Any existing action listener will be replaced.
|
overridevirtual |
Sets the background color that appears behind each cell.
See gcolor.h for more detail about colors.
Reimplemented from GInteractor.
|
overridevirtual |
Sets the background color that appears behind each cell.
See gcolor.h for more detail about colors.
Reimplemented from GInteractor.
|
virtualinherited |
Sets the size and location of the widget.
In general you should avoid explicitly sizing and positioning widgets in this way; instead, use containers and regions to help you lay out widgets at the proper sizes.
Reimplemented in GLabel.
|
virtualinherited |
Sets the size and location of the widget.
In general you should avoid explicitly sizing and positioning widgets in this way; instead, use containers and regions to help you lay out widgets at the proper sizes.
Reimplemented in GLabel.
|
virtual |
Sets the horizontal alignment of the given cell.
The row/column is specified by a 0-based row/column index from the top/left of the table.
ErrorException | if the given row/column index is out of bounds |
|
virtual |
Sets the background color of the given cell to the given color.
The row/column is specified by a 0-based row/column index from the top/left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row/column index is out of bounds |
|
virtual |
Sets the background color of the given cell to the given color.
The row/column is specified by a 0-based row/column index from the top/left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row/column index is out of bounds |
|
virtual |
Sets the text font of the given cell to the given RGB color.
The row/column is specified by a 0-based row/column index from the top/left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row/column index is out of bounds |
|
virtual |
Sets the foreground/text color of the given cell to the given color.
The row/column is specified by a 0-based row/column index from the top/left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row/column index is out of bounds |
|
virtual |
Sets the foreground/text color of the given cell to the given color.
The row/column is specified by a 0-based row/column index from the top/left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row/column index is out of bounds |
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is clicked on it.
Any existing click listener will be replaced.
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is clicked on it.
Any existing click listener will be replaced.
|
overridevirtual |
Sets the color used for the text of each cell.
Equivalent to setForeground. See gcolor.h for more detail about colors.
Reimplemented from GInteractor.
|
overridevirtual |
Sets the color used for the text of each cell.
Equivalent to setForeground. See gcolor.h for more detail about colors.
Reimplemented from GInteractor.
|
virtual |
Sets the horizontal alignment of the given column.
The column is specified by a 0-based column index from the left of the table.
ErrorException | if the given column index is out of bounds |
|
virtual |
Sets the background color of the given column to the given color.
The column is specified by a 0-based column index from the left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given column index is out of bounds |
|
virtual |
Sets the background color of the given column to the given color.
The column is specified by a 0-based column index from the left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given column index is out of bounds |
|
virtual |
Sets the text font of the given column to the given RGB color.
The column is specified by a 0-based column index from the left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given column index is out of bounds |
|
virtual |
Sets the foreground/text color of the given column to the given color.
The column is specified by a 0-based column index from the left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given column index is out of bounds |
|
virtual |
Sets the foreground/text color of the given column to the given color.
The column is specified by a 0-based column index from the left of the table. See gcolor.h for more detail about colors.
ErrorException | if the given column index is out of bounds |
|
virtual |
Sets the column headers to use the given style.
Default is none, but can be set to Excel style or numeric instead.
|
virtual |
Sets the given column index to have the given width in pixels.
ErrorException | if the given column index is out of bounds or if the width is negative |
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is double-clicked on it.
Any existing double-click listener will be replaced.
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is double-clicked on it.
Any existing double-click listener will be replaced.
|
virtual |
Sets whether cells of the table can be edited.
Initially true.
|
virtual |
Modifies the value in the cell that is currently being edited to store the given text.
This does not modify the value in the table cell but merely the value in the editor widget.
ErrorException | if the given row or column are out of bounds |
|
virtualinherited |
Sets whether this interactor is currently enabled.
Most interactors begin as enabled but can be disabled to stop them from being able to be clicked on or otherwise emit events.
|
protectedvirtualinherited |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown".
Any prior listener for that type of event is replaced.
|
protectedvirtualinherited |
Adds an event listener from this observable object to respond to the given type of event, such as "click" or "keydown".
Any prior listener for that type of event is replaced.
|
protectedvirtualinherited |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown".
Any prior listener for those types of event are replaced.
|
protectedvirtualinherited |
Adds an event listener from this observable object to respond to the given types of events, such as "click" or "keydown".
Any prior listener for those types of event are replaced.
|
virtualinherited |
Sets whether the object is currently allowing itself to fire events.
Initially this is true.
|
overridevirtual |
Sets the font used to display each cell's text.
Reimplemented from GInteractor.
|
overridevirtual |
Sets the font used to display each cell's text.
See gfont.h for more detail about fonts.
Reimplemented from GInteractor.
|
overridevirtual |
Sets the color used for the text of each cell.
Equivalent to setColor. See gcolor.h for more detail about colors.
Reimplemented from GInteractor.
|
overridevirtual |
Sets the color used for the text of each cell.
Equivalent to setColor. See gcolor.h for more detail about colors.
Reimplemented from GInteractor.
|
virtualinherited |
Sets the onscreen height of the interactor in pixels.
ErrorException | if height is negative |
Reimplemented in GLabel.
|
virtual |
Sets the horizontal alignment of the text in all cells in the table.
The alignment can be LEFT, CENTER, or RIGHT and is initially LEFT.
|
virtualinherited |
|
virtualinherited |
|
virtualinherited |
Sets the file name of the icon associated with this interactor, or an empty string if no icon has been set.
Not all types of interactors support icons.
filename | icon file path to use |
retainIconSize | true if icon should stay at its existing pixel size (default), or false if it should be resized to fit the interactor |
|
virtualinherited |
Sets a key listener on this interactor so that it will be called when the user presses any key.
Any existing key listener will be replaced.
Reimplemented in GCanvas.
|
virtualinherited |
Sets a key listener on this interactor so that it will be called when the user presses any key.
Any existing key listener will be replaced.
Reimplemented in GCanvas.
|
virtualinherited |
Sets the onscreen x/y-coordinate of the top-left corner of the interactor relative to its window.
Generally clients should not call this and should instead use containers and layout regions to position interactors.
Reimplemented in GLabel.
|
virtualinherited |
Sets the minimum size in pixels that this interactor will permit itself to be resized to.
ErrorException | if width or height is negative |
|
virtualinherited |
Sets the minimum size in pixels that this interactor will permit itself to be resized to.
ErrorException | if width or height is negative |
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is moved or clicked on it.
Any existing mouse listener will be replaced.
Reimplemented in GBrowserPane, and GTextArea.
|
virtualinherited |
Sets a mouse listener on this interactor so that it will be called when the mouse is moved or clicked on it.
Any existing mouse listener will be replaced.
Reimplemented in GBrowserPane, and GTextArea.
|
virtualinherited |
Sets a string representing a unique name for this interactor.
The default name string uses the interactor's type and its ID to make a string like "GButton_14", but you can override this by calling setName.
name | a string such as "GButton_14" |
|
virtualinherited |
Sets the height in pixels that this interactor would prefer to be.
Normally clients do not need to call this method; the interactor can figure out its own preferred size. But calling it can help you to hint to the container/layout system if you want a given interactor to "prefer" to make itself larger or smaller for the purposes of your particular program.
|
virtualinherited |
Sets the width and height in pixels that this interactor would prefer to be.
Normally clients do not need to call this method; the interactor can figure out its own preferred size. But calling it can help you to hint to the container/layout system if you want a given interactor to "prefer" to make itself larger or smaller for the purposes of your particular program.
|
virtualinherited |
Sets the size in pixels that this interactor would prefer to be.
Normally clients do not need to call this method; the interactor can figure out its own preferred size.
|
virtualinherited |
Sets the width in pixels that this interactor would prefer to be.
Normally clients do not need to call this method; the interactor can figure out its own preferred size.
|
virtual |
Sets the horizontal alignment of the given row.
The row is specified by a 0-based row index from the top of the table.
ErrorException | if the given row index is out of bounds |
|
virtual |
Sets the background color of the given row to the given RGB color.
The row is specified by a 0-based row index from the top of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row index is out of bounds |
|
virtual |
Sets the background color of the given row to the given color.
The row is specified by a 0-based row index from the top of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row index is out of bounds |
|
virtual |
Sets whether row and column headers should be shown in the table.
Initially false.
|
virtual |
Sets the text font of the given row to the given font.
The row is specified by a 0-based row index from the top of the table. See gfont.h for more detail about fonts.
ErrorException | if the given row index is out of bounds |
|
virtual |
Sets the foreground/text color of the given row to the given color.
The row is specified by a 0-based row index from the top of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row index is out of bounds |
|
virtual |
Sets the foreground/text color of the given row to the given color.
The row is specified by a 0-based row index from the top of the table. See gcolor.h for more detail about colors.
ErrorException | if the given row index is out of bounds |
|
virtual |
Sets the given row index to have the given height in pixels.
ErrorException | if the given row index is out of bounds or if the height is negative |
|
virtual |
Sets the text in the cell that is currently selected.
If no cell is currently selected, does nothing.
|
virtualinherited |
Sets the onscreen width and height of the interactor in pixels.
ErrorException | if width or height is negative |
Reimplemented in GLabel.
|
virtualinherited |
Sets the onscreen width and height of the interactor in pixels.
ErrorException | if width or height is negative |
Reimplemented in GLabel.
|
virtual |
Sets the given function to be called when events occur in this table.
Any existing table listener will be replaced.
|
virtual |
Sets the given function to be called when events occur in this table.
Any existing table listener will be replaced.
|
virtualinherited |
Sets a "tooltip" that will appear if the user hovers their mouse over the interactor.
Set an empty string to clear the tooltip.
|
virtualinherited |
Returns true if the interactor is visible on the screen.
Interactors will not be visible until they are added to an onscreen window or container. If you call setVisible on an interactor that is not in any onscreen container, it will have no effect.
Reimplemented in GLabel.
|
virtualinherited |
Sets the onscreen width of the interactor in pixels.
ErrorException | if width is negative |
Reimplemented in GLabel.
|
virtualinherited |
Sets the onscreen x-coordinate of the top-left corner of the interactor relative to its window.
Generally clients should not call this and should instead use containers and layout regions to position interactors.
Reimplemented in GLabel.
|
virtualinherited |
Sets the onscreen y-coordinate of the top-left corner of the interactor relative to its window.
Generally clients should not call this and should instead use containers and layout regions to position interactors.
Reimplemented in GLabel.
|
virtualinherited |
Returns a string representation of this observable object's state.
Primarily used for debugging purposes.
|
virtual |
Returns the number of columns in the table.
Equivalent to numCols().