X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65e4e78efb62104d4d0f9ac32e3fff24f9c14b6e..794bcc2dea743ac907b839f54e451847c9ea4b72:/include/wx/generic/grid.h diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 2420ed4c02..743cd7aae5 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -77,6 +77,7 @@ class WXDLLEXPORT wxGridWindow; class WXDLLEXPORT wxGridTypeRegistry; class WXDLLEXPORT wxCheckBox; +class WXDLLEXPORT wxComboBox; class WXDLLEXPORT wxTextCtrl; class WXDLLEXPORT wxSpinCtrl; @@ -259,11 +260,9 @@ public: // to begin editing. Set the focus to the edit control. virtual void BeginEdit(int row, int col, wxGrid* grid) = 0; - // Complete the editing of the current cell. If saveValue is - // true then send the new value back to the table. Returns true - // if the value has changed. If necessary, the control may be - // destroyed. - virtual bool EndEdit(int row, int col, bool saveValue, wxGrid* grid) = 0; + // Complete the editing of the current cell. Returns true if the value has + // changed. If necessary, the control may be destroyed. + virtual bool EndEdit(int row, int col, wxGrid* grid) = 0; // Reset the value in the control back to its starting value virtual void Reset() = 0; @@ -310,7 +309,7 @@ public: virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, bool saveValue, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); virtual void Reset(); virtual void StartingKey(wxKeyEvent& event); @@ -340,7 +339,7 @@ public: wxEvtHandler* evtHandler); virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, bool saveValue, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); virtual void Reset(); virtual void StartingKey(wxKeyEvent& event); @@ -371,7 +370,7 @@ public: wxEvtHandler* evtHandler); virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, bool saveValue, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); virtual void Reset(); virtual void StartingKey(wxKeyEvent& event); @@ -397,7 +396,7 @@ public: virtual void Show(bool show, wxGridCellAttr *attr = (wxGridCellAttr *)NULL); virtual void BeginEdit(int row, int col, wxGrid* grid); - virtual bool EndEdit(int row, int col, bool saveValue, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); virtual void Reset(); virtual void StartingClick(); @@ -409,6 +408,33 @@ private: bool m_startValue; }; +// the editor for string data allowing to choose from the list of strings +class WXDLLEXPORT wxGridCellChoiceEditor : public wxGridCellEditor +{ +public: + // if !allowOthers, user can't type a string not in choices array + wxGridCellChoiceEditor(size_t count, const wxChar* choices[], + bool allowOthers = FALSE); + + virtual void Create(wxWindow* parent, + wxWindowID id, + wxEvtHandler* evtHandler); + + virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr); + + virtual void BeginEdit(int row, int col, wxGrid* grid); + virtual bool EndEdit(int row, int col, wxGrid* grid); + + virtual void Reset(); + +protected: + wxComboBox *Combo() const { return (wxComboBox *)m_control; } + +private: + wxString m_startValue; + wxArrayString m_choices; + bool m_allowOthers; +}; // ---------------------------------------------------------------------------- // wxGridCellAttr: this class can be used to alter the cells appearance in // the grid by changing their colour/font/... from default. An object of this @@ -477,8 +503,8 @@ public: const wxColour& GetBackgroundColour() const; const wxFont& GetFont() const; void GetAlignment(int *hAlign, int *vAlign) const; - wxGridCellRenderer *GetRenderer(wxGridCellRenderer* def) const; - wxGridCellEditor *GetEditor(wxGridCellEditor* def) const; + wxGridCellRenderer *GetRenderer(wxGrid* grid, int row, int col) const; + wxGridCellEditor *GetEditor(wxGrid* grid, int row, int col) const; bool IsReadOnly() const { return m_isReadOnly; } @@ -874,6 +900,7 @@ public: bool DeleteCols( int pos = 0, int numCols = 1, bool updateLabels=TRUE ); void DrawGridCellArea( wxDC& dc ); + void DrawGridSpace( wxDC& dc ); void DrawCellBorder( wxDC& dc, const wxGridCellCoords& ); void DrawAllGridLines( wxDC& dc, const wxRegion & reg ); void DrawCell( wxDC& dc, const wxGridCellCoords& ); @@ -930,7 +957,6 @@ public: void ShowCellEditControl(); void HideCellEditControl(); - void SetEditControlValue( const wxString& s = wxEmptyString ); void SaveEditControlValue(); @@ -1006,13 +1032,17 @@ public: void SetRowLabelValue( int row, const wxString& ); void SetColLabelValue( int col, const wxString& ); void SetGridLineColour( const wxColour& ); - + void EnableDragRowSize( bool enable = TRUE ); void DisableDragRowSize() { EnableDragRowSize( FALSE ); } bool CanDragRowSize() { return m_canDragRowSize; } void EnableDragColSize( bool enable = TRUE ); void DisableDragColSize() { EnableDragColSize( FALSE ); } bool CanDragColSize() { return m_canDragColSize; } + void EnableDragGridSize(bool enable = TRUE); + void DisableDragGridSize() { EnableDragGridSize(FALSE); } + bool CanDragGridSize() { return m_canDragGridSize; } + // this sets the specified attribute for all cells in this row/col void SetRowAttr(int row, wxGridCellAttr *attr); @@ -1502,6 +1532,7 @@ protected: bool m_canDragRowSize; bool m_canDragColSize; + bool m_canDragGridSize; int m_dragLastPos; int m_dragRowOrCol; bool m_isDragging;