DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxGridCellEditorEvtHandler)
- DECLARE_NO_COPY_CLASS(wxGridCellEditorEvtHandler)
+ wxDECLARE_NO_COPY_CLASS(wxGridCellEditorEvtHandler);
};
class WXDLLIMPEXP_ADV wxGridCellTextEditor : public wxGridCellEditor
{
public:
- wxGridCellTextEditor();
+ wxEXPLICIT wxGridCellTextEditor(size_t maxChars = 0);
virtual void Create(wxWindow* parent,
wxWindowID id,
wxEvtHandler* evtHandler);
virtual void SetSize(const wxRect& rect);
- virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
+ virtual void PaintBackground(wxDC& dc,
+ const wxRect& rectCell,
+ const wxGridCellAttr& attr);
virtual bool IsAcceptedKey(wxKeyEvent& event);
virtual void BeginEdit(int row, int col, wxGrid* grid);
- virtual bool EndEdit(const wxString& oldval, wxString *newval);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
virtual void ApplyEdit(int row, int col, wxGrid* grid);
virtual void Reset();
// parameters string format is "max_width"
virtual void SetParameters(const wxString& params);
+ virtual void SetValidator(const wxValidator& validator);
- virtual wxGridCellEditor *Clone() const
- { return new wxGridCellTextEditor; }
+ virtual wxGridCellEditor *Clone() const;
// added GetValue so we can get the value which is in the control
virtual wxString GetValue() const;
void DoReset(const wxString& startValue);
private:
- size_t m_maxChars; // max number of chars allowed
- wxString m_value;
+ size_t m_maxChars; // max number of chars allowed
+ wxScopedPtr<wxValidator> m_validator;
+ wxString m_value;
- DECLARE_NO_COPY_CLASS(wxGridCellTextEditor)
+ wxDECLARE_NO_COPY_CLASS(wxGridCellTextEditor);
};
// the editor for numeric (long) data
virtual bool IsAcceptedKey(wxKeyEvent& event);
virtual void BeginEdit(int row, int col, wxGrid* grid);
- virtual bool EndEdit(const wxString& oldval, wxString *newval);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
virtual void ApplyEdit(int row, int col, wxGrid* grid);
virtual void Reset();
// string representation of our value
wxString GetString() const
- { return wxString::Format(_T("%ld"), m_value); }
+ { return wxString::Format(wxT("%ld"), m_value); }
private:
int m_min,
long m_value;
- DECLARE_NO_COPY_CLASS(wxGridCellNumberEditor)
+ wxDECLARE_NO_COPY_CLASS(wxGridCellNumberEditor);
+};
+
+
+enum wxGridCellFloatFormat
+{
+ // Decimal floating point (%f)
+ wxGRID_FLOAT_FORMAT_FIXED = 0x0010,
+
+ // Scientific notation (mantise/exponent) using e character (%e)
+ wxGRID_FLOAT_FORMAT_SCIENTIFIC = 0x0020,
+
+ // Use the shorter of %e or %f (%g)
+ wxGRID_FLOAT_FORMAT_COMPACT = 0x0040,
+
+ // To use in combination with one of the above formats (%F/%E/%G)
+ wxGRID_FLOAT_FORMAT_UPPER = 0x0080,
+
+ // Format used by default.
+ wxGRID_FLOAT_FORMAT_DEFAULT = wxGRID_FLOAT_FORMAT_FIXED,
+
+ // A mask to extract format from the combination of flags.
+ wxGRID_FLOAT_FORMAT_MASK = wxGRID_FLOAT_FORMAT_FIXED |
+ wxGRID_FLOAT_FORMAT_SCIENTIFIC |
+ wxGRID_FLOAT_FORMAT_COMPACT |
+ wxGRID_FLOAT_FORMAT_UPPER
};
// the editor for floating point numbers (double) data
class WXDLLIMPEXP_ADV wxGridCellFloatEditor : public wxGridCellTextEditor
{
public:
- wxGridCellFloatEditor(int width = -1, int precision = -1);
+ wxGridCellFloatEditor(int width = -1,
+ int precision = -1,
+ int format = wxGRID_FLOAT_FORMAT_DEFAULT);
virtual void Create(wxWindow* parent,
wxWindowID id,
virtual bool IsAcceptedKey(wxKeyEvent& event);
virtual void BeginEdit(int row, int col, wxGrid* grid);
- virtual bool EndEdit(const wxString& oldval, wxString *newval);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
virtual void ApplyEdit(int row, int col, wxGrid* grid);
virtual void Reset();
virtual wxGridCellEditor *Clone() const
{ return new wxGridCellFloatEditor(m_width, m_precision); }
- // parameters string format is "width,precision"
+ // parameters string format is "width[,precision[,format]]"
+ // format to choose beween f|e|g|E|G (f is used by default)
virtual void SetParameters(const wxString& params);
protected:
// string representation of our value
- wxString GetString() const;
+ wxString GetString();
private:
int m_width,
m_precision;
double m_value;
- DECLARE_NO_COPY_CLASS(wxGridCellFloatEditor)
+ int m_style;
+ wxString m_format;
+
+ wxDECLARE_NO_COPY_CLASS(wxGridCellFloatEditor);
};
#endif // wxUSE_TEXTCTRL
virtual bool IsAcceptedKey(wxKeyEvent& event);
virtual void BeginEdit(int row, int col, wxGrid* grid);
- virtual bool EndEdit(const wxString& oldval, wxString *newval);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
virtual void ApplyEdit(int row, int col, wxGrid* grid);
virtual void Reset();
// set the string values returned by GetValue() for the true and false
// states, respectively
- static void UseStringValues(const wxString& valueTrue = _T("1"),
+ static void UseStringValues(const wxString& valueTrue = wxT("1"),
const wxString& valueFalse = wxEmptyString);
// return true if the given string is equal to the string representation of
static wxString ms_stringValues[2];
- DECLARE_NO_COPY_CLASS(wxGridCellBoolEditor)
+ wxDECLARE_NO_COPY_CLASS(wxGridCellBoolEditor);
};
#endif // wxUSE_CHECKBOX
wxWindowID id,
wxEvtHandler* evtHandler);
- virtual void PaintBackground(const wxRect& rectCell, wxGridCellAttr *attr);
+ virtual void SetSize(const wxRect& rect);
+
+ virtual void PaintBackground(wxDC& dc,
+ const wxRect& rectCell,
+ const wxGridCellAttr& attr);
virtual void BeginEdit(int row, int col, wxGrid* grid);
- virtual bool EndEdit(const wxString& oldval, wxString *newval);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
virtual void ApplyEdit(int row, int col, wxGrid* grid);
virtual void Reset();
wxArrayString m_choices;
bool m_allowOthers;
- DECLARE_NO_COPY_CLASS(wxGridCellChoiceEditor)
+ wxDECLARE_NO_COPY_CLASS(wxGridCellChoiceEditor);
};
#endif // wxUSE_COMBOBOX
virtual wxGridCellEditor* Clone() const;
virtual void BeginEdit(int row, int col, wxGrid* grid);
- virtual bool EndEdit(const wxString& oldval, wxString *newval);
+ virtual bool EndEdit(int row, int col, const wxGrid* grid,
+ const wxString& oldval, wxString *newval);
virtual void ApplyEdit(int row, int col, wxGrid* grid);
private:
long m_index;
- DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
+ wxDECLARE_NO_COPY_CLASS(wxGridCellEnumEditor);
};
#endif // wxUSE_COMBOBOX
virtual wxGridCellEditor *Clone() const
{ return new wxGridCellAutoWrapStringEditor; }
- DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
+ wxDECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor);
};
#endif // wxUSE_GRID
+
#endif // _WX_GENERIC_GRID_EDITORS_H_