X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/526954c5968baa29218c994ec48e476ae2bd4b9f..b02dd12239c8a59b9a545d9fcb04974f8ad02c6b:/interface/wx/grid.h?ds=inline diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 88c9196d60..18c22a4160 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -178,6 +178,31 @@ public: virtual void SetParameters(const wxString& params); }; +/** + Specifier used to format the data to string for the numbers handled by + wxGridCellFloatRenderer and wxGridCellFloatEditor. + + @since 2.9.3 +*/ +enum wxGridCellFloatFormat +{ + /// Decimal floating point (%f). + wxGRID_FLOAT_FORMAT_FIXED = 0x0010, + + /// Scientific notation (mantise/exponent) using e character (%e). + wxGRID_FLOAT_FORMAT_SCIENTIFIC = 0x0020, + + /// Use the shorter of %e or %f (%g). + wxGRID_FLOAT_FORMAT_COMPACT = 0x0040, + + /// To use in combination with one of the above formats for the upper + /// case version (%F/%E/%G) + wxGRID_FLOAT_FORMAT_UPPER = 0x0080, + + /// The format used by default (wxGRID_FLOAT_FORMAT_FIXED). + wxGRID_FLOAT_FORMAT_DEFAULT = wxGRID_FLOAT_FORMAT_FIXED +}; + /** @class wxGridCellFloatRenderer @@ -201,8 +226,22 @@ public: Minimum number of characters to be shown. @param precision Number of digits after the decimal dot. + @param format + The format used to display the string, must be a combination of + ::wxGridCellFloatFormat enum elements. This parameter is only + available since wxWidgets 2.9.3. */ - wxGridCellFloatRenderer(int width = -1, int precision = -1); + wxGridCellFloatRenderer(int width = -1, int precision = -1, + int format = wxGRID_FLOAT_FORMAT_DEFAULT); + + /** + Returns the specifier used to format the data to string. + + The returned value is a combination of ::wxGridCellFloatFormat elements. + + @since 2.9.3 + */ + int GetFormat() const; /** Returns the precision. @@ -215,7 +254,18 @@ public: int GetWidth() const; /** - Parameters string format is "width[,precision]". + Set the format to use for display the number. + + @param format + Must be a combination of ::wxGridCellFloatFormat enum elements. + + @since 2.9.3 + */ + void SetFormat(int format); + + /** + The parameters string format is "width[,precision[,format]]" where + @c format should be chosen between f|e|g|E|G (f is used by default) */ virtual void SetParameters(const wxString& params); @@ -596,11 +646,17 @@ public: Minimum number of characters to be shown. @param precision Number of digits after the decimal dot. + @param format + The format to use for displaying the number, a combination of + ::wxGridCellFloatFormat enum elements. This parameter is only + available since wxWidgets 2.9.3. */ - wxGridCellFloatEditor(int width = -1, int precision = -1); + wxGridCellFloatEditor(int width = -1, int precision = -1, + int format = wxGRID_FLOAT_FORMAT_DEFAULT); /** - Parameters string format is "width,precision" + The parameters string format is "width[,precision[,format]]" where + @c format should be chosen between f|e|g|E|G (f is used by default) */ virtual void SetParameters(const wxString& params); }; @@ -1401,6 +1457,9 @@ public: /** Delete rows from the table. + Notice that currently deleting a row intersecting a multi-cell (see + SetCellSize()) is not supported and will result in a crash. + @param pos The first row to delete. @param numRows @@ -1630,7 +1689,7 @@ struct wxGridSizesInfo The default table class is called wxGridStringTable and holds an array of strings. An instance of such a class is created by CreateGrid(). - wxGridCellRenderer is the abstract base class for rendereing contents in a + wxGridCellRenderer is the abstract base class for rendering contents in a cell. The following renderers are predefined: - wxGridCellBoolRenderer @@ -1686,7 +1745,20 @@ public: The user won't be able to select any cells or rows in this mode. */ - wxGridSelectColumns + wxGridSelectColumns, + + /** + The selection mode allowing the user to select either the entire + columns or the entire rows but not individual cells nor blocks. + + Notice that while this constant is defined as @code + wxGridSelectColumns | wxGridSelectRows @endcode this doesn't mean + that all the other combinations are valid -- at least currently + they are not. + + @since 2.9.1 + */ + wxGridSelectRowsOrColumns }; /** @@ -2768,7 +2840,7 @@ public: @a resizeExistingRows is @true. If @a height is less than GetRowMinimalAcceptableHeight(), then the - minimal acceptable heihgt is used instead of it. + minimal acceptable height is used instead of it. */ void SetDefaultRowSize(int height, bool resizeExistingRows = false); @@ -2996,7 +3068,7 @@ public: Notice that currently there is no way to make some columns resizable in a grid where columns can't be resized by default as there doesn't seem to be any need for this in practice. There is also no way to make the - column marked as fixed using this method resizeable again because it is + column marked as fixed using this method resizable again because it is supposed that fixed columns are used for static parts of the grid and so should remain fixed during the entire grid lifetime. @@ -3833,6 +3905,31 @@ public: */ bool InsertRows(int pos = 0, int numRows = 1, bool updateLabels = true); + /** + Invalidates the cached attribute for the given cell. + + For efficiency reasons, wxGrid may cache the recently used attributes + (currently it caches only the single most recently used one, in fact) + which can result in the cell appearance not being refreshed even when + the attribute returned by your custom wxGridCellAttrProvider-derived + class has changed. To force the grid to refresh the cell attribute, + this function may be used. Notice that calling it will not result in + actually redrawing the cell, you still need to call + wxWindow::RefreshRect() to invalidate the area occupied by the cell in + the window to do this. Also note that you don't need to call this + function if you store the attributes in wxGrid itself, i.e. use its + SetAttr() and similar methods, it is only useful when using a separate + custom attributes provider. + + @param row + The row of the cell whose attribute needs to be queried again. + @param col + The column of the cell whose attribute needs to be queried again. + + @since 2.9.2 + */ + void RefreshAttr(int row, int col); + /** Sets the cell attributes for all cells in the specified column. @@ -4213,6 +4310,10 @@ public: /** Column at which the event occurred. + + Notice that for a @c wxEVT_GRID_SELECT_CELL event this column is the + column of the newly selected cell while the previously selected cell + can be retrieved using wxGrid::GetGridCursorCol(). */ virtual int GetCol(); @@ -4223,6 +4324,10 @@ public: /** Row at which the event occurred. + + Notice that for a @c wxEVT_GRID_SELECT_CELL event this row is the row + of the newly selected cell while the previously selected cell can be + retrieved using wxGrid::GetGridCursorRow(). */ virtual int GetRow();