X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2328f4686384a1f51f3635a5a1a4269996610d54..1b7751aaa9a86d76a850b9267bc0c201e3cea30f:/interface/wx/grid.h?ds=sidebyside diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 0b15c437fb..2bdabe866a 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -395,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. @@ -625,15 +625,26 @@ class wxGridCellTextEditor : public wxGridCellEditor { public: /** - Default constructor. + Text cell editor constructor. + + @param maxChars + Maximum width of text (this parameter is supported starting since + wxWidgets 2.9.5). */ - wxGridCellTextEditor(); + explicit wxGridCellTextEditor(size_t maxChars = 0); /** The parameters string format is "n" where n is a number representing the maximum width. */ virtual void SetParameters(const wxString& params); + + /** + Set validator to validate user input. + + @since 2.9.5 + */ + virtual void SetValidator(const wxValidator& validator); }; /** @@ -968,6 +979,7 @@ public: wxDC& dc, wxRect& rect) const = 0; }; + /** Common base class for row and column headers renderers. @@ -1698,6 +1710,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 @@ -2014,6 +2107,11 @@ public: bool SetTable(wxGridTableBase* table, bool takeOwnership = false, wxGridSelectionModes selmode = wxGridSelectCells); + /** + Receive and handle a message from the table. + */ + bool ProcessTableMessage(wxGridTableMessage& msg); + //@} @@ -4620,6 +4718,13 @@ public: type. @event{EVT_GRID_COL_SIZE(func)} Same as EVT_GRID_CMD_COL_SIZE() but uses `wxID_ANY` id. + @event{EVT_GRID_COL_AUTO_SIZE(func)} + This event is sent when a column must be resized to its best size, e.g. + when the user double clicks the column divider. The default + implementation simply resizes the column to fit the column label (but + not its contents as this could be too slow for big grids). This macro + corresponds to @c wxEVT_GRID_COL_AUTO_SIZE event type and is new since + wxWidgets 2.9.5. @event{EVT_GRID_ROW_SIZE(func)} Same as EVT_GRID_CMD_ROW_SIZE() but uses `wxID_ANY` id. @endEventTable @@ -4822,3 +4927,27 @@ 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_COL_AUTO_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; +