+// the editor for numeric (long) data
+class WXDLLEXPORT wxGridCellNumberEditor : public wxGridCellTextEditor
+{
+public:
+ // allows to specify the range - if min == max == -1, no range checking is
+ // done
+ wxGridCellNumberEditor(int min = -1, int max = -1);
+
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, wxGrid* grid);
+
+ virtual void Reset();
+ virtual void StartingKey(wxKeyEvent& event);
+
+ // parameters string format is "min,max"
+ virtual void SetParameters(const wxString& params);
+
+ virtual wxGridCellEditor *Clone() const
+ { return new wxGridCellNumberEditor(m_min, m_max); }
+
+protected:
+ wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; }
+
+ // if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl
+ bool HasRange() const { return m_min != m_max; }
+
+ // string representation of m_valueOld
+ wxString GetString() const
+ { return wxString::Format(_T("%ld"), m_valueOld); }
+
+private:
+ int m_min,
+ m_max;
+
+ long m_valueOld;
+};
+
+// the editor for floating point numbers (double) data
+class WXDLLEXPORT wxGridCellFloatEditor : public wxGridCellTextEditor
+{
+public:
+ wxGridCellFloatEditor(int width = -1, int precision = -1);
+
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, wxGrid* grid);
+
+ virtual void Reset();
+ virtual void StartingKey(wxKeyEvent& event);
+
+ virtual wxGridCellEditor *Clone() const
+ { return new wxGridCellFloatEditor; }
+
+ // parameters string format is "width,precision"
+ virtual void SetParameters(const wxString& params);
+
+protected:
+ // string representation of m_valueOld
+ wxString GetString() const;
+
+private:
+ int m_width,
+ m_precision;
+ double m_valueOld;
+};
+
+// the editor for boolean data
+class WXDLLEXPORT wxGridCellBoolEditor : public wxGridCellEditor
+{
+public:
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual void SetSize(const wxRect& rect);
+ virtual void Show(bool show, wxGridCellAttr *attr = (wxGridCellAttr *)NULL);
+
+ virtual bool IsAcceptedKey(wxKeyEvent& event);
+ virtual void BeginEdit(int row, int col, wxGrid* grid);
+ virtual bool EndEdit(int row, int col, wxGrid* grid);
+
+ virtual void Reset();
+ virtual void StartingClick();
+
+ virtual wxGridCellEditor *Clone() const
+ { return new wxGridCellBoolEditor; }
+
+protected:
+ wxCheckBox *CBox() const { return (wxCheckBox *)m_control; }
+
+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 = 0,
+ const wxString choices[] = NULL,
+ 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();
+
+ // parameters string format is "item1[,item2[...,itemN]]"
+ virtual void SetParameters(const wxString& params);
+
+ virtual wxGridCellEditor *Clone() const;
+
+protected:
+ wxComboBox *Combo() const { return (wxComboBox *)m_control; }
+
+private:
+ wxString m_startValue;
+ wxArrayString m_choices;
+ bool m_allowOthers;
+};
+