+
+ DECLARE_NO_COPY_CLASS(wxGridCellTextEditor)
+};
+
+// the editor for numeric (long) data
+class WXDLLIMPEXP_ADV 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); }
+
+ // added GetValue so we can get the value which is in the control
+ virtual wxString GetValue() const;
+
+protected:
+#if wxUSE_SPINCTRL
+ wxSpinCtrl *Spin() const { return (wxSpinCtrl *)m_control; }
+#endif
+
+ // if HasRange(), we use wxSpinCtrl - otherwise wxTextCtrl
+ bool HasRange() const
+ {
+#if wxUSE_SPINCTRL
+ return m_min != m_max;
+#else
+ return false;
+#endif
+ }
+
+ // string representation of m_valueOld
+ wxString GetString() const
+ { return wxString::Format(_T("%ld"), m_valueOld); }
+
+private:
+ int m_min,
+ m_max;
+
+ long m_valueOld;
+
+ DECLARE_NO_COPY_CLASS(wxGridCellNumberEditor)
+};
+
+// the editor for floating point numbers (double) data
+class WXDLLIMPEXP_ADV 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(m_width, m_precision); }
+
+ // 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;
+
+ DECLARE_NO_COPY_CLASS(wxGridCellFloatEditor)
+};
+
+#endif // wxUSE_TEXTCTRL
+
+#if wxUSE_CHECKBOX
+
+// the editor for boolean data
+class WXDLLIMPEXP_ADV wxGridCellBoolEditor : public wxGridCellEditor
+{
+public:
+ wxGridCellBoolEditor() { }
+
+ virtual void Create(wxWindow* parent,
+ wxWindowID id,
+ wxEvtHandler* evtHandler);
+
+ virtual void SetSize(const wxRect& rect);
+ virtual void Show(bool show, wxGridCellAttr *attr = 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 void StartingKey(wxKeyEvent& event);
+
+ virtual wxGridCellEditor *Clone() const
+ { return new wxGridCellBoolEditor; }
+
+ // added GetValue so we can get the value which is in the control, see
+ // also UseStringValues()
+ virtual wxString GetValue() const;
+
+ // set the string values returned by GetValue() for the true and false
+ // states, respectively
+ static void UseStringValues(const wxString& valueTrue = _T("1"),
+ const wxString& valueFalse = wxEmptyString);
+
+ // return true if the given string is equal to the string representation of
+ // true value which we currently use
+ static bool IsTrueValue(const wxString& value);
+
+protected:
+ wxCheckBox *CBox() const { return (wxCheckBox *)m_control; }
+
+private:
+ bool m_startValue;
+
+ static wxString ms_stringValues[2];
+
+ DECLARE_NO_COPY_CLASS(wxGridCellBoolEditor)
+};
+
+#endif // wxUSE_CHECKBOX
+
+#if wxUSE_COMBOBOX
+
+// the editor for string data allowing to choose from the list of strings
+class WXDLLIMPEXP_ADV 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);
+ wxGridCellChoiceEditor(const wxArrayString& 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();
+
+ // parameters string format is "item1[,item2[...,itemN]]"
+ virtual void SetParameters(const wxString& params);
+
+ virtual wxGridCellEditor *Clone() const;
+
+ // added GetValue so we can get the value which is in the control
+ virtual wxString GetValue() const;
+
+protected:
+ wxComboBox *Combo() const { return (wxComboBox *)m_control; }
+
+// DJC - (MAPTEK) you at least need access to m_choices if you
+// wish to override this class
+protected:
+ wxString m_startValue;
+ wxArrayString m_choices;
+ bool m_allowOthers;
+
+ DECLARE_NO_COPY_CLASS(wxGridCellChoiceEditor)