Return wxWindow* from wxDataViewCustomRenderer::CreateEditorCtrl().

There's no reason to limit custom editor controls to wxControl, which
would rule out e.g. composite controls or any custom widgets.
Make appropriate changes to related functions and code too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2011-04-22 18:25:32 +00:00
parent 68dd2c52a4
commit 64c70359a7
5 changed files with 34 additions and 34 deletions

24
include/wx/dvrenderers.h Normal file → Executable file
View File

@ -145,11 +145,11 @@ public:
// in-place editing
virtual bool HasEditorCtrl() const
{ return false; }
virtual wxControl* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
wxRect WXUNUSED(labelRect),
const wxVariant& WXUNUSED(value))
virtual wxWindow* CreateEditorCtrl(wxWindow * WXUNUSED(parent),
wxRect WXUNUSED(labelRect),
const wxVariant& WXUNUSED(value))
{ return NULL; }
virtual bool GetValueFromEditorCtrl(wxControl * WXUNUSED(editor),
virtual bool GetValueFromEditorCtrl(wxWindow * WXUNUSED(editor),
wxVariant& WXUNUSED(value))
{ return false; }
@ -157,7 +157,7 @@ public:
virtual void CancelEditing();
virtual bool FinishEditing();
wxControl *GetEditorCtrl() { return m_editorCtrl; }
wxWindow *GetEditorCtrl() { return m_editorCtrl; }
virtual bool IsCustomRenderer() const { return false; }
@ -168,7 +168,7 @@ protected:
wxString m_variantType;
wxDataViewColumn *m_owner;
wxWeakRef<wxControl> m_editorCtrl;
wxWeakRef<wxWindow> m_editorCtrl;
wxDataViewItem m_item; // for m_editorCtrl
// internal utility:
@ -322,8 +322,8 @@ public:
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual bool HasEditorCtrl() const { return true; }
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
virtual bool Render( wxRect rect, wxDC *dc, int state );
virtual wxSize GetSize() const;
virtual bool SetValue( const wxVariant &value );
@ -347,8 +347,8 @@ public:
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual bool HasEditorCtrl() const { return true; }
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
virtual bool Render( wxRect rect, wxDC *dc, int state );
virtual wxSize GetSize() const;
virtual bool SetValue( const wxVariant &value );
@ -373,8 +373,8 @@ public:
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
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;

View File

@ -67,9 +67,9 @@ public:
// in-place editing
virtual bool HasEditorCtrl() const;
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
protected:
wxString m_text;
@ -177,9 +177,9 @@ public:
virtual wxSize GetSize() const;
virtual bool HasEditorCtrl() const { return true; }
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
virtual wxWindow* CreateEditorCtrl( wxWindow *parent, wxRect labelRect,
const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value );
private:
wxDataViewIconText m_value;

View File

@ -1590,9 +1590,9 @@ public:
}
@endcode
*/
virtual wxControl* CreateEditorCtrl(wxWindow* parent,
wxRect labelRect,
const wxVariant& value);
virtual wxWindow* CreateEditorCtrl(wxWindow* parent,
wxRect labelRect,
const wxVariant& value);
/**
Return the attribute to be used for rendering.
@ -1627,7 +1627,7 @@ public:
}
@endcode
*/
virtual bool GetValueFromEditorCtrl(wxControl* editor,
virtual bool GetValueFromEditorCtrl(wxWindow* editor,
wxVariant& value);
/**

16
src/common/datavcmn.cpp Normal file → Executable file
View File

@ -40,7 +40,7 @@ namespace
class wxDataViewEditorCtrlEvtHandler: public wxEvtHandler
{
public:
wxDataViewEditorCtrlEvtHandler(wxControl *editor, wxDataViewRenderer *owner)
wxDataViewEditorCtrlEvtHandler(wxWindow *editor, wxDataViewRenderer *owner)
{
m_editorCtrl = editor;
m_owner = owner;
@ -59,7 +59,7 @@ protected:
private:
wxDataViewRenderer *m_owner;
wxControl *m_editorCtrl;
wxWindow *m_editorCtrl;
bool m_finished;
bool m_focusOnIdle;
@ -1417,7 +1417,7 @@ wxDataViewSpinRenderer::wxDataViewSpinRenderer( int min, int max, wxDataViewCell
m_max = max;
}
wxControl* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value )
wxWindow* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value )
{
long l = value;
wxSize size = labelRect.GetSize();
@ -1437,7 +1437,7 @@ wxControl* wxDataViewSpinRenderer::CreateEditorCtrl( wxWindow *parent, wxRect la
return sc;
}
bool wxDataViewSpinRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVariant &value )
bool wxDataViewSpinRenderer::GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value )
{
wxSpinCtrl *sc = (wxSpinCtrl*) editor;
long l = sc->GetValue();
@ -1482,7 +1482,7 @@ wxDataViewChoiceRenderer::wxDataViewChoiceRenderer( const wxArrayString& choices
m_choices = choices;
}
wxControl* wxDataViewChoiceRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value )
wxWindow* wxDataViewChoiceRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value )
{
wxChoice* c = new wxChoice
(
@ -1497,7 +1497,7 @@ wxControl* wxDataViewChoiceRenderer::CreateEditorCtrl( wxWindow *parent, wxRect
return c;
}
bool wxDataViewChoiceRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVariant &value )
bool wxDataViewChoiceRenderer::GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value )
{
wxChoice *c = (wxChoice*) editor;
wxString s = c->GetStringSelection();
@ -1538,14 +1538,14 @@ wxDataViewChoiceByIndexRenderer::wxDataViewChoiceByIndexRenderer( const wxArrayS
{
}
wxControl* wxDataViewChoiceByIndexRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value )
wxWindow* wxDataViewChoiceByIndexRenderer::CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value )
{
wxVariant string_value = GetChoice( value.GetLong() );
return wxDataViewChoiceRenderer::CreateEditorCtrl( parent, labelRect, string_value );
}
bool wxDataViewChoiceByIndexRenderer::GetValueFromEditorCtrl( wxControl* editor, wxVariant &value )
bool wxDataViewChoiceByIndexRenderer::GetValueFromEditorCtrl( wxWindow* editor, wxVariant &value )
{
wxVariant string_value;
if (!wxDataViewChoiceRenderer::GetValueFromEditorCtrl( editor, string_value ))

View File

@ -732,7 +732,7 @@ bool wxDataViewTextRenderer::HasEditorCtrl() const
return true;
}
wxControl* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent,
wxWindow* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent,
wxRect labelRect, const wxVariant &value )
{
wxTextCtrl* ctrl = new wxTextCtrl( parent, wxID_ANY, value,
@ -746,7 +746,7 @@ wxControl* wxDataViewTextRenderer::CreateEditorCtrl( wxWindow *parent,
return ctrl;
}
bool wxDataViewTextRenderer::GetValueFromEditorCtrl( wxControl *editor, wxVariant &value )
bool wxDataViewTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVariant &value )
{
wxTextCtrl *text = (wxTextCtrl*) editor;
value = text->GetValue();
@ -1106,7 +1106,7 @@ wxSize wxDataViewIconTextRenderer::GetSize() const
return wxSize(80,20);
}
wxControl* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant& value)
wxWindow* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect labelRect, const wxVariant& value)
{
wxDataViewIconText iconText;
iconText << value;
@ -1132,7 +1132,7 @@ wxControl* wxDataViewIconTextRenderer::CreateEditorCtrl(wxWindow *parent, wxRect
return ctrl;
}
bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxControl *editor, wxVariant& value )
bool wxDataViewIconTextRenderer::GetValueFromEditorCtrl( wxWindow *editor, wxVariant& value )
{
wxTextCtrl *text = (wxTextCtrl*) editor;