X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1dc17bcafb89b0bde0406e692df79111c197d38e..b09857ae000a60704207d63290be937584805fb0:/interface/wx/grid.h?ds=sidebyside diff --git a/interface/wx/grid.h b/interface/wx/grid.h index de9493045b..1503e01e0f 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: /** @@ -387,10 +395,10 @@ public: its string form and possibly saved internally using its real type by BeginEdit()). If it isn't, it just returns @false, otherwise it must do the following: - # Save the new value internally so that ApplyEdit() could apply it. - # Fill @a newval (which is never @NULL) with the string + - Save the new value internally so that ApplyEdit() could apply it. + - Fill @a newval (which is never @NULL) with the string representation of the new value. - # Return @true + - Return @true Notice that it must @em not modify the grid as the change could still be vetoed. @@ -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(); }; /** @@ -948,6 +968,7 @@ public: wxDC& dc, wxRect& rect) const = 0; }; + /** Common base class for row and column headers renderers. @@ -1678,6 +1699,87 @@ public: virtual bool CanHaveAttributes(); }; + + +enum wxGridTableRequest +{ + wxGRIDTABLE_REQUEST_VIEW_GET_VALUES = 2000, + wxGRIDTABLE_REQUEST_VIEW_SEND_VALUES, + wxGRIDTABLE_NOTIFY_ROWS_INSERTED, + wxGRIDTABLE_NOTIFY_ROWS_APPENDED, + wxGRIDTABLE_NOTIFY_ROWS_DELETED, + wxGRIDTABLE_NOTIFY_COLS_INSERTED, + wxGRIDTABLE_NOTIFY_COLS_APPENDED, + wxGRIDTABLE_NOTIFY_COLS_DELETED +}; + + +/** + @class wxGridTableMessage + + A simple class used to pass messages from the table to the grid. + + @library{wxadv} + @category{grid} +*/ +class wxGridTableMessage +{ +public: + wxGridTableMessage(); + wxGridTableMessage( wxGridTableBase *table, int id, + int comInt1 = -1, + int comInt2 = -1 ); + + void SetTableObject( wxGridTableBase *table ); + wxGridTableBase * GetTableObject() const; + void SetId( int id ); + int GetId(); + void SetCommandInt( int comInt1 ); + int GetCommandInt(); + void SetCommandInt2( int comInt2 ); + int GetCommandInt2(); +}; + + + +/** + @class wxGridStringTable + + Simplest type of data table for a grid for small tables of strings + that are stored in memory +*/ +class wxGridStringTable : public wxGridTableBase +{ +public: + wxGridStringTable(); + wxGridStringTable( int numRows, int numCols ); + + // these are pure virtual in wxGridTableBase + virtual int GetNumberRows(); + virtual int GetNumberCols(); + virtual wxString GetValue( int row, int col ); + virtual void SetValue( int row, int col, const wxString& value ); + + // overridden functions from wxGridTableBase + void Clear(); + bool InsertRows( size_t pos = 0, size_t numRows = 1 ); + bool AppendRows( size_t numRows = 1 ); + bool DeleteRows( size_t pos = 0, size_t numRows = 1 ); + bool InsertCols( size_t pos = 0, size_t numCols = 1 ); + bool AppendCols( size_t numCols = 1 ); + bool DeleteCols( size_t pos = 0, size_t numCols = 1 ); + + void SetRowLabelValue( int row, const wxString& ); + void SetColLabelValue( int col, const wxString& ); + wxString GetRowLabelValue( int row ); + wxString GetColLabelValue( int col ); +}; + + + + + + /** @class wxGridSizesInfo @@ -1742,6 +1844,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 +1999,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. @@ -1991,6 +2096,11 @@ public: bool SetTable(wxGridTableBase* table, bool takeOwnership = false, wxGridSelectionModes selmode = wxGridSelectCells); + /** + Receive and handle a message from the table. + */ + bool ProcessTableMessage(wxGridTableMessage& msg); + //@} @@ -2965,8 +3075,7 @@ public: To show the column later you need to call SetColSize() with non-0 width or ShowCol() to restore the previous column width. - Notice that this method shouldn't be called if the column is already - hidden. + If the column is already hidden, this method doesn't do anything. @param col The column index. @@ -2979,8 +3088,7 @@ public: 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. + If the column is currently shown, this method doesn't do anything. @see HideCol(), SetColSize() */ @@ -3050,6 +3158,8 @@ public: To show the row later you need to call SetRowSize() with non-0 width or ShowRow() to restore its original height. + If the row is already hidden, this method doesn't do anything. + @param col The row index. */ @@ -3061,6 +3171,8 @@ public: The row is shown again with the same height that it had before HideRow() call. + If the row is currently shown, this method doesn't do anything. + @see HideRow(), SetRowSize() */ void ShowRow(int col); @@ -4797,3 +4909,26 @@ public: void SetRow(int row); }; + +wxEventType wxEVT_GRID_CELL_LEFT_CLICK; +wxEventType wxEVT_GRID_CELL_RIGHT_CLICK; +wxEventType wxEVT_GRID_CELL_LEFT_DCLICK; +wxEventType wxEVT_GRID_CELL_RIGHT_DCLICK; +wxEventType wxEVT_GRID_LABEL_LEFT_CLICK; +wxEventType wxEVT_GRID_LABEL_RIGHT_CLICK; +wxEventType wxEVT_GRID_LABEL_LEFT_DCLICK; +wxEventType wxEVT_GRID_LABEL_RIGHT_DCLICK; +wxEventType wxEVT_GRID_ROW_SIZE; +wxEventType wxEVT_GRID_COL_SIZE; +wxEventType wxEVT_GRID_RANGE_SELECT; +wxEventType wxEVT_GRID_CELL_CHANGING; +wxEventType wxEVT_GRID_CELL_CHANGED; +wxEventType wxEVT_GRID_SELECT_CELL; +wxEventType wxEVT_GRID_EDITOR_SHOWN; +wxEventType wxEVT_GRID_EDITOR_HIDDEN; +wxEventType wxEVT_GRID_EDITOR_CREATED; +wxEventType wxEVT_GRID_CELL_BEGIN_DRAG; +wxEventType wxEVT_GRID_COL_MOVE; +wxEventType wxEVT_GRID_COL_SORT; +wxEventType wxEVT_GRID_TABBING; +