Use wxDatePickerCtrl in wxDataViewDateRenderer.

Inline editor is more in line with the behavior of other editors,
requiring double click to edit values was unexpected.

Also merge the two almost-but-not-quite identical implementations in
generic and GTK+ versions.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2011-10-19 16:20:06 +00:00
parent 31af22fa2d
commit 1d3a930e82
6 changed files with 90 additions and 270 deletions

View File

@@ -386,6 +386,37 @@ public:
#endif // generic or Carbon versions
#if defined(wxHAS_GENERIC_DATAVIEWCTRL) || defined(__WXGTK__)
// ----------------------------------------------------------------------------
// wxDataViewDateRenderer
// ----------------------------------------------------------------------------
#if wxUSE_DATEPICKCTRL
class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer
{
public:
wxDataViewDateRenderer(const wxString &varianttype = wxT("datetime"),
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int align = wxDVR_DEFAULT_ALIGNMENT);
virtual bool HasEditorCtrl() const { return true; }
virtual wxWindow *CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant &value);
virtual bool GetValueFromEditorCtrl(wxWindow* editor, wxVariant &value);
virtual bool SetValue(const wxVariant &value);
virtual bool GetValue(wxVariant& value) const;
virtual bool Render( wxRect cell, wxDC *dc, int state );
virtual wxSize GetSize() const;
private:
wxDateTime m_date;
};
#else // !wxUSE_DATEPICKCTRL
typedef wxDataViewTextRenderer wxDataViewDateRenderer;
#endif
#endif // generic or GTK+ versions
// this class is obsolete, its functionality was merged in
// wxDataViewTextRenderer itself now, don't use it any more
#define wxDataViewTextRendererAttr wxDataViewTextRenderer