Implemented the same simple API for creating customized

in-place editing controls for GTK+ and the generic
   version and demonstrate its use in the sample using
   a wxSpinCtrl.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45518 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-04-17 12:08:10 +00:00
parent 29825f5fc4
commit 1e510b1e2d
7 changed files with 335 additions and 143 deletions

View File

@@ -25,30 +25,6 @@ class WXDLLIMPEXP_ADV wxDataViewCtrl;
class WXDLLIMPEXP_ADV wxDataViewMainWindow;
class WXDLLIMPEXP_ADV wxDataViewHeaderWindow;
//-----------------------------------------------------------------------------
// wxDataViewEditorCtrlEvtHandler
//-----------------------------------------------------------------------------
class wxDataViewEditorCtrlEvtHandler: public wxEvtHandler
{
public:
wxDataViewEditorCtrlEvtHandler( wxControl *editor, wxDataViewRenderer *owner );
void AcceptChangesAndFinish();
protected:
void OnChar( wxKeyEvent &event );
void OnKillFocus( wxFocusEvent &event );
private:
wxDataViewRenderer *m_owner;
wxControl *m_editorCtrl;
bool m_finished;
private:
DECLARE_EVENT_TABLE()
};
// ---------------------------------------------------------
// wxDataViewRenderer
// ---------------------------------------------------------
@@ -102,24 +78,10 @@ public:
// Create DC on request
virtual wxDC *GetDC();
// in-place editing
virtual bool HasEditorCtrl()
{ return false; }
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value )
{ return NULL; }
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value )
{ return false; }
virtual bool StartEditing( unsigned int row, wxRect labelRect );
virtual void CancelEditing();
virtual bool FinishEditing();
private:
wxDC *m_dc;
int m_align;
wxDataViewCellMode m_mode;
wxControl *m_editorCtrl;
unsigned int m_row; // for m_editorCtrl
protected:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
@@ -406,7 +368,7 @@ public: // utility functions not part of the API
// updates the header window after a change in a column setting
void OnColumnChange();
wxDataViewMainWindow* GetMainWindow() { return m_clientArea; }
wxWindow *GetMainWindow() { return (wxWindow*) m_clientArea; }
private:
wxDataViewListModelNotifier *m_notifier;