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:
@@ -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
|
||||
|
@@ -193,36 +193,5 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewDateRenderer
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewRenderer
|
||||
{
|
||||
public:
|
||||
wxDataViewDateRenderer( const wxString &varianttype = wxT("datetime"),
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
|
||||
int align = wxDVR_DEFAULT_ALIGNMENT );
|
||||
|
||||
bool SetValue( const wxVariant &value );
|
||||
bool GetValue( wxVariant& value ) const;
|
||||
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
||||
virtual wxSize GetSize() const;
|
||||
|
||||
// Implementation only, don't use nor override
|
||||
virtual bool WXOnActivate(const wxRect& cell,
|
||||
wxDataViewModel *model,
|
||||
const wxDataViewItem& item,
|
||||
unsigned int col);
|
||||
|
||||
private:
|
||||
wxDateTime m_date;
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_GENERIC_DVRENDERERS_H_
|
||||
|
||||
|
@@ -235,34 +235,6 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer)
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewDateRenderer
|
||||
// ---------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer
|
||||
{
|
||||
public:
|
||||
wxDataViewDateRenderer( const wxString &varianttype = "datetime",
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
|
||||
int align = wxDVR_DEFAULT_ALIGNMENT );
|
||||
|
||||
bool SetValue( const wxVariant &value );
|
||||
bool GetValue( wxVariant &value ) const;
|
||||
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state );
|
||||
virtual wxSize GetSize() const;
|
||||
virtual bool Activate( const wxRect& cell,
|
||||
wxDataViewModel *model,
|
||||
const wxDataViewItem &item,
|
||||
unsigned int col );
|
||||
|
||||
private:
|
||||
wxDateTime m_date;
|
||||
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateRenderer)
|
||||
};
|
||||
|
||||
// -------------------------------------
|
||||
// wxDataViewChoiceRenderer
|
||||
// -------------------------------------
|
||||
|
Reference in New Issue
Block a user