/**
The parameters string format is "width[,precision[,format]]" where
- @c format should be choosen beween f|e|g|E|G (f is used by default)
+ @c format should be chosen between f|e|g|E|G (f is used by default)
*/
virtual void SetParameters(const wxString& params);
/**
The parameters string format is "width[,precision[,format]]" where
- @c format should be choosen beween f|e|g|E|G (f is used by default)
+ @c format should be chosen between f|e|g|E|G (f is used by default)
*/
virtual void SetParameters(const wxString& params);
};
//@}
};
+/**
+ Represents coordinates of a grid cell.
+
+ An object of this class is simply a (row, column) pair.
+ */
+class wxGridCellCoords
+{
+public:
+ /**
+ Default constructor initializes the object to invalid state.
+
+ Initially the row and column are both invalid (-1) and so operator!()
+ for an uninitialized wxGridCellCoords returns false.
+ */
+ wxGridCellCoords();
+
+ /**
+ Constructor taking a row and a column.
+ */
+ wxGridCellCoords(int row, int col);
+
+ /**
+ Return the row of the coordinate.
+ */
+ int GetRow() const;
+
+ /**
+ Set the row of the coordinate.
+ */
+ void SetRow(int n);
+
+ /**
+ Return the column of the coordinate.
+ */
+ int GetCol() const;
+
+ /**
+ Set the column of the coordinate.
+ */
+ void SetCol(int n);
+
+ /**
+ Set the row and column of the coordinate.
+ */
+ void Set(int row, int col);
+
+ /**
+ Assignment operator for coordinate types.
+ */
+ wxGridCellCoords& operator=(const wxGridCellCoords& other);
+
+ /**
+ Equality operator.
+ */
+ bool operator==(const wxGridCellCoords& other) const;
+
+ /**
+ Inequality operator.
+ */
+ bool operator!=(const wxGridCellCoords& other) const;
+
+ /**
+ Checks whether the coordinates are invalid.
+
+ Returns false only if both row and column are -1. Notice that if either
+ row or column (but not both) are -1, this method returns true even if
+ the object is invalid. This is done because objects in such state
+ should actually never exist, i.e. either both coordinates should be -1
+ or none of them should be -1.
+ */
+ bool operator!() const;
+};
/**
@class wxGridTableBase
CellSpan_Main
};
+ /**
+ Rendering styles supported by wxGrid::Render() method.
+
+ @since 2.9.4
+ */
+ enum wxGridRenderStyle
+ {
+ /// Draw grid row header labels.
+ wxGRID_DRAW_ROWS_HEADER = 0x001,
+
+ /// Draw grid column header labels.
+ wxGRID_DRAW_COLS_HEADER = 0x002,
+
+ /// Draw grid cell border lines.
+ wxGRID_DRAW_CELL_LINES = 0x004,
+
+ /**
+ Draw a bounding rectangle around the rendered cell area.
+
+ Useful where row or column headers are not drawn or where there is
+ multi row or column cell clipping and therefore no cell border at
+ the rendered outer boundary.
+ */
+ wxGRID_DRAW_BOX_RECT = 0x008,
+
+ /**
+ Draw the grid cell selection highlight if a selection is present.
+
+ At present the highlight colour drawn depends on whether the grid
+ window loses focus before drawing begins.
+ */
+ wxGRID_DRAW_SELECTION = 0x010,
+
+ /**
+ The default render style.
+
+ Includes all except wxGRID_DRAW_SELECTION.
+ */
+ wxGRID_DRAW_DEFAULT = wxGRID_DRAW_ROWS_HEADER |
+ wxGRID_DRAW_COLS_HEADER |
+ wxGRID_DRAW_CELL_LINES |
+ wxGRID_DRAW_BOX_RECT
+ };
+
+ /**
+ Constants defining different support built-in TAB handling behaviours.
+
+ The elements of this enum determine what happens when TAB is pressed
+ when the cursor is in the rightmost column (or Shift-TAB is pressed
+ when the cursor is in the leftmost one).
+
+ @see SetTabBehaviour(), @c wxEVT_GRID_TABBING
+
+ @since 2.9.5
+ */
+ enum TabBehaviour
+ {
+ /// Do nothing, this is default.
+ Tab_Stop,
+
+ /// Move to the beginning of the next (or the end of the previous) row.
+ Tab_Wrap,
+
+ /// Move to the next (or the previous) control after the grid.
+ Tab_Leave
+ };
+
/**
@name Constructors and Initialization
*/
*/
void AutoSizeRows(bool setAsMin = true);
+ /**
+ Returns @true if the cell value can overflow.
+
+ A cell can overflow if the next cell in the row is empty.
+ */
+ bool GetCellOverflow(int row, int col) const;
+
/**
Returns the current height of the column labels.
*/
*/
bool IsColShown(int col) const;
+ /**
+ Returns @true if the cells can overflow by default.
+ */
+ bool GetDefaultCellOverflow() const;
+
/**
Returns the default height for column labels.
*/
*/
bool IsRowShown(int row) const;
+ /**
+ Sets the overflow permission of the cell.
+ */
+ void SetCellOverflow(int row, int col, bool allow);
+
/**
Sets the height of the column labels.
Hides the specified column.
To show the column later you need to call SetColSize() with non-0
- width or ShowCol().
+ width or ShowCol() to restore the previous column width.
+
+ Notice that this method shouldn't be called if the column is already
+ hidden.
@param col
The column index.
/**
Shows the previously hidden column by resizing it to non-0 size.
+ The column is shown again with the same width that it had before
+ HideCol() call.
+
+ Notice that this method shouldn't be called if the column is not
+ currently hidden.
+
@see HideCol(), SetColSize()
*/
void ShowCol(int col);
+ /**
+ Sets the default overflow permission of the cells.
+ */
+ void SetDefaultCellOverflow( bool allow );
+
/**
Sets the default width for columns in the grid.
Hides the specified row.
To show the row later you need to call SetRowSize() with non-0
- width or ShowRow().
+ width or ShowRow() to restore its original height.
@param col
The row index.
void HideRow(int col);
/**
- Shows the previously hidden row by resizing it to non-0 size.
+ Shows the previously hidden row.
+
+ The row is shown again with the same height that it had before
+ HideRow() call.
@see HideRow(), SetRowSize()
*/
*/
void SetGridCursor(const wxGridCellCoords& coords);
+ /**
+ Set the grid's behaviour when the user presses the TAB key.
+
+ Pressing the TAB key moves the grid cursor right in the current row, if
+ there is a cell at the right and, similarly, Shift-TAB moves the cursor
+ to the left in the current row if it's not in the first column.
+
+ What happens if the cursor can't be moved because it it's already at
+ the beginning or end of the row can be configured using this function,
+ see wxGrid::TabBehaviour documentation for the detailed description.
+
+ IF none of the standard behaviours is appropriate, you can always
+ handle @c wxEVT_GRID_TABBING event directly to implement a custom
+ TAB-handling logic.
+
+ @since 2.9.5
+ */
+ void SetTabBehaviour(TabBehaviour behaviour);
+
//@}
*/
void RefreshAttr(int row, int col);
+ /**
+ Draws part or all of a wxGrid on a wxDC for printing or display.
+
+ Pagination can be accomplished by using sequential Render() calls
+ with appropriate values in wxGridCellCoords topLeft and bottomRight.
+
+ @param dc
+ The wxDC to be drawn on.
+ @param pos
+ The position on the wxDC where rendering should begin. If not
+ specified drawing will begin at the wxDC MaxX() and MaxY().
+ @param size
+ The size of the area on the wxDC that the rendered wxGrid should
+ occupy. If not specified the drawing will be scaled to fit the
+ available dc width or height. The wxGrid's aspect ratio is
+ maintained whether or not size is specified.
+ @param topLeft
+ The top left cell of the block to be drawn. Defaults to ( 0, 0 ).
+ @param bottomRight
+ The bottom right cell of the block to be drawn. Defaults to row and
+ column counts.
+ @param style
+ A combination of values from wxGridRenderStyle.
+
+ @since 2.9.4
+ */
+ void Render( wxDC& dc,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxGridCellCoords& topLeft = wxGridCellCoords( -1, -1 ),
+ const wxGridCellCoords& bottomRight = wxGridCellCoords( -1, -1 ),
+ int style = wxGRID_DRAW_DEFAULT );
+
/**
Sets the cell attributes for all cells in the specified column.
and updates the column to indicate the new sort order and refreshes
itself.
This event macro corresponds to @c wxEVT_GRID_COL_SORT event type.
+ @event{EVT_GRID_TABBING(func)}
+ This event is generated when the user presses TAB or Shift-TAB in the
+ grid. It can be used to customize the simple default TAB handling
+ logic, e.g. to go to the next non-empty cell instead of just the next
+ cell. See also wxGrid::SetTabBehaviour(). This event is new since
+ wxWidgets 2.9.5.
@endEventTable
@library{wxadv}