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

@@ -233,6 +233,30 @@ private:
void InitStatics(); // BAD
};
//-----------------------------------------------------------------------------
// 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()
};
// ---------------------------------------------------------
// wxDataViewRendererBase
// ---------------------------------------------------------
@@ -281,9 +305,25 @@ public:
virtual void SetAlignment( int align ) = 0;
virtual int GetAlignment() const = 0;
// 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();
wxControl *GetEditorCtrl() { return m_editorCtrl; }
protected:
wxString m_variantType;
wxDataViewColumn *m_owner;
wxControl *m_editorCtrl;
unsigned int m_row; // for m_editorCtrl
// internal utility:
const wxDataViewCtrl* GetView() const;