Changed argument of wxPropertyGrid::OnCustomEditorEvent() from wxCommandEvent to wxEvent

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56438 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-10-19 11:48:49 +00:00
parent 9bc1121429
commit 404b9c623a
6 changed files with 47 additions and 21 deletions

View File

@@ -1215,9 +1215,21 @@ public:
// Mostly useful for page switching. // Mostly useful for page switching.
void SwitchState( wxPropertyGridPageState* pNewState ); void SwitchState( wxPropertyGridPageState* pNewState );
/** Pass this function to Connect calls in propertyclass::CreateEditor. /**
When creating custom property editors, connect required editor events to
this function. For instance:
@code
control->Connect(control->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
wxEventHandler(wxPropertyGrid::OnCustomEditorEvent),
NULL, propgrid);
@endcode
@remarks You should never need to call this function directly!
@see wxPGEditor::CreateControls(), wxEvtHandler::Connect()
*/ */
void OnCustomEditorEvent( wxCommandEvent &event ); void OnCustomEditorEvent( wxEvent &event );
long GetInternalFlags() const { return m_iFlags; } long GetInternalFlags() const { return m_iFlags; }
bool HasInternalFlag( long flag ) const bool HasInternalFlag( long flag ) const

View File

@@ -76,16 +76,16 @@ public:
- Primary control shall use id wxPG_SUBID1, and secondary (button) control - Primary control shall use id wxPG_SUBID1, and secondary (button) control
shall use wxPG_SUBID2. shall use wxPG_SUBID2.
- Implementation shoud connect all necessary events to the - Implementation shoud connect all necessary events to the
wxPropertyGrid::OnCustomEditorEvent. For Example: wxPropertyGrid::OnCustomEditorEvent(). For example:
@code @code
// Relays wxEVT_COMMAND_TEXT_UPDATED events of primary editor
// control to the OnEvent.
control->Connect(control->GetId(), wxEVT_COMMAND_TEXT_UPDATED, control->Connect(control->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), wxEventHandler(wxPropertyGrid::OnCustomEditorEvent),
NULL, propgrid); NULL, propgrid);
@endcode @endcode
OnCustomEditorEvent will then forward events, first to OnCustomEditorEvent will then forward events, first to
wxPGEditor::OnEvent() and then to wxPGProperty::OnEvent(). wxPGEditor::OnEvent() and then to wxPGProperty::OnEvent().
@see wxPropertyGrid::OnCustomEditorEvent(), wxEvtHandler::Connect()
*/ */
virtual wxPGWindowList CreateControls( wxPropertyGrid* propgrid, virtual wxPGWindowList CreateControls( wxPropertyGrid* propgrid,
wxPGProperty* property, wxPGProperty* property,

View File

@@ -671,6 +671,22 @@ public:
*/ */
bool IsFrozen() const; bool IsFrozen() const;
/**
When creating custom property editors, connect required editor events to
this function. For instance:
@code
control->Connect(control->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
wxEventHandler(wxPropertyGrid::OnCustomEditorEvent),
NULL, propgrid);
@endcode
@remarks You should never need to call this function directly!
@see wxPGEditor::CreateControls(), wxEvtHandler::Connect()
*/
void OnCustomEditorEvent( wxEvent &event );
/** /**
Redraws given property. Redraws given property.
*/ */

View File

@@ -144,10 +144,10 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP
wxWindowID id = wnd2->GetId(); wxWindowID id = wnd2->GetId();
wnd2->Connect( id, wxEVT_SCROLL_LINEUP, wnd2->Connect( id, wxEVT_SCROLL_LINEUP,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), wxEventHandler(wxPropertyGrid::OnCustomEditorEvent),
NULL, propgrid ); NULL, propgrid );
wnd2->Connect( id, wxEVT_SCROLL_LINEDOWN, wnd2->Connect( id, wxEVT_SCROLL_LINEDOWN,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), wxEventHandler(wxPropertyGrid::OnCustomEditorEvent),
NULL, propgrid ); NULL, propgrid );
// Let's add validator to make sure only numbers can be entered // Let's add validator to make sure only numbers can be entered
@@ -157,7 +157,7 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP
wnd1->SetValidator(validator); wnd1->SetValidator(validator);
wnd1->Connect( wnd1->GetId(), wxEVT_KEY_DOWN, wnd1->Connect( wnd1->GetId(), wxEVT_KEY_DOWN,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), wxEventHandler(wxPropertyGrid::OnCustomEditorEvent),
NULL, propgrid ); NULL, propgrid );
return wxPGWindowList(wnd1, wnd2); return wxPGWindowList(wnd1, wnd2);
@@ -343,7 +343,7 @@ wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgri
// (all relevenat wxTextCtrl, wxComboBox and wxButton events are // (all relevenat wxTextCtrl, wxComboBox and wxButton events are
// already connected) // already connected)
ctrl->Connect( wxPG_SUBID1, wxEVT_DATE_CHANGED, ctrl->Connect( wxPG_SUBID1, wxEVT_DATE_CHANGED,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), wxEventHandler(wxPropertyGrid::OnCustomEditorEvent),
NULL, propgrid ); NULL, propgrid );
#ifdef __WXMSW__ #ifdef __WXMSW__

View File

@@ -872,11 +872,11 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
// Connect event handling // Connect event handling
wxWindowID id = cb->GetId(); wxWindowID id = cb->GetId();
propGrid->Connect(id, wxEVT_COMMAND_COMBOBOX_SELECTED, propGrid->Connect(id, wxEVT_COMMAND_COMBOBOX_SELECTED,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); wxEventHandler(wxPropertyGrid::OnCustomEditorEvent));
propGrid->Connect(id, wxEVT_COMMAND_TEXT_UPDATED, propGrid->Connect(id, wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); wxEventHandler(wxPropertyGrid::OnCustomEditorEvent));
propGrid->Connect(id, wxEVT_COMMAND_TEXT_ENTER, propGrid->Connect(id, wxEVT_COMMAND_TEXT_ENTER,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); wxEventHandler(wxPropertyGrid::OnCustomEditorEvent));
#ifdef __WXMSW__ #ifdef __WXMSW__
cb->Show(); cb->Show();
@@ -1706,9 +1706,9 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
// Connect event handling // Connect event handling
id = ed->GetId(); id = ed->GetId();
this->Connect(id, wxEVT_COMMAND_TEXT_UPDATED, this->Connect(id, wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); wxEventHandler(wxPropertyGrid::OnCustomEditorEvent));
this->Connect(id, wxEVT_COMMAND_TEXT_ENTER, this->Connect(id, wxEVT_COMMAND_TEXT_ENTER,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); wxEventHandler(wxPropertyGrid::OnCustomEditorEvent));
return (wxWindow*) ed; return (wxWindow*) ed;
} }
@@ -1774,7 +1774,7 @@ wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize
// Connect event handling // Connect event handling
id = but->GetId(); id = but->GetId();
this->Connect(id, wxEVT_COMMAND_BUTTON_CLICKED, this->Connect(id, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); wxEventHandler(wxPropertyGrid::OnCustomEditorEvent));
return but; return but;
} }
@@ -1882,7 +1882,7 @@ void wxPGMultiButton::Finalize( wxPropertyGrid* propGrid, const wxPoint& pos )
{ {
wxWindowID id = GetButtonId(i); wxWindowID id = GetButtonId(i);
propGrid->Connect(id, wxEVT_COMMAND_BUTTON_CLICKED, propGrid->Connect(id, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); wxEventHandler(wxPropertyGrid::OnCustomEditorEvent));
} }
} }

View File

@@ -3125,7 +3125,7 @@ bool wxPropertyGrid::ProcessEvent(wxEvent& event)
(parent == m_canvas || (parent == m_canvas ||
parent->GetParent() == m_canvas) ) parent->GetParent() == m_canvas) )
{ {
OnCustomEditorEvent((wxCommandEvent&)event); OnCustomEditorEvent(event);
return true; return true;
} }
} }
@@ -3134,9 +3134,7 @@ bool wxPropertyGrid::ProcessEvent(wxEvent& event)
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// NB: It may really not be wxCommandEvent - must check if necessary void wxPropertyGrid::OnCustomEditorEvent( wxEvent &event )
// (usually not).
void wxPropertyGrid::OnCustomEditorEvent( wxCommandEvent &event )
{ {
wxPGProperty* selected = m_selected; wxPGProperty* selected = m_selected;