From: Robin Dunn Date: Sat, 22 Dec 2012 07:59:58 +0000 (+0000) Subject: Interface fixes for wxGrid classes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/42dd5e3b25a134af21f06a21175f105f7c3199eb Interface fixes for wxGrid classes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 4fe4b1686b..a223c4f569 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -129,7 +129,7 @@ class WXDLLIMPEXP_ADV wxGridCellWorker : public wxClientDataContainer, public wx public: wxGridCellWorker() { } - // interpret renderer parameters: arbitrary string whose interpretatin is + // interpret renderer parameters: arbitrary string whose interpretation is // left to the derived classes virtual void SetParameters(const wxString& params); diff --git a/interface/wx/grid.h b/interface/wx/grid.h index de9493045b..a614af5b0e 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -23,9 +23,11 @@ wxGridCellFloatRenderer, wxGridCellNumberRenderer, wxGridCellStringRenderer */ -class wxGridCellRenderer +class wxGridCellRenderer : public wxClientDataContainer, public wxRefCounter { public: + wxGridCellRenderer(); + /** This function must be implemented in derived classes to return a copy of itself. @@ -50,6 +52,12 @@ public: */ virtual wxSize GetBestSize(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, int row, int col) = 0; + +protected: + /** + The destructor is private because only DecRef() can delete us. + */ + virtual ~wxGridCellRenderer(); }; /** @@ -343,7 +351,7 @@ public: wxGridCellFloatEditor, wxGridCellNumberEditor, wxGridCellTextEditor */ -class wxGridCellEditor +class wxGridCellEditor : public wxClientDataContainer, public wxRefCounter { public: /** @@ -424,7 +432,7 @@ public: Draws the part of the cell not occupied by the control: the base class version just fills it with background colour from the attribute. */ - virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr* attr); + virtual void PaintBackground(wxDC& dc, const wxRect& rectCell, wxGridCellAttr& attr); /** Reset the value in the control back to its starting value. @@ -454,6 +462,11 @@ public: */ virtual void StartingKey(wxKeyEvent& event); + /** + Returns the value currently in the editor control. + */ + virtual wxString GetValue() const = 0; + protected: /** @@ -716,7 +729,7 @@ protected: @library{wxadv} @category{grid} */ -class wxGridCellAttr +class wxGridCellAttr : public wxClientDataContainer, public wxRefCounter { public: /** @@ -912,6 +925,13 @@ public: Sets the text colour. */ void SetTextColour(const wxColour& colText); + +protected: + + /** + The destructor is private because only DecRef() can delete us. + */ + virtual ~wxGridCellAttr(); }; /** @@ -1742,6 +1762,53 @@ struct wxGridSizesInfo }; + +/** + 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 +}; + + + /** @class wxGrid @@ -1850,50 +1917,6 @@ public: 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.