From 404b9c623a3ecc5ae9e256cb60491c4ced77e03c Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Sun, 19 Oct 2008 11:48:49 +0000 Subject: [PATCH] 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 --- include/wx/propgrid/propgrid.h | 16 ++++++++++++++-- interface/wx/propgrid/editors.h | 8 ++++---- interface/wx/propgrid/propgrid.h | 16 ++++++++++++++++ src/propgrid/advprops.cpp | 8 ++++---- src/propgrid/editors.cpp | 14 +++++++------- src/propgrid/propgrid.cpp | 6 ++---- 6 files changed, 47 insertions(+), 21 deletions(-) diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index ac5d71c018..1c2d8de3f2 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -1215,9 +1215,21 @@ public: // Mostly useful for page switching. 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; } bool HasInternalFlag( long flag ) const diff --git a/interface/wx/propgrid/editors.h b/interface/wx/propgrid/editors.h index 7f39b20814..f074085fad 100644 --- a/interface/wx/propgrid/editors.h +++ b/interface/wx/propgrid/editors.h @@ -76,16 +76,16 @@ public: - Primary control shall use id wxPG_SUBID1, and secondary (button) control shall use wxPG_SUBID2. - Implementation shoud connect all necessary events to the - wxPropertyGrid::OnCustomEditorEvent. For Example: + wxPropertyGrid::OnCustomEditorEvent(). For example: @code - // Relays wxEVT_COMMAND_TEXT_UPDATED events of primary editor - // control to the OnEvent. control->Connect(control->GetId(), wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent), NULL, propgrid); @endcode OnCustomEditorEvent will then forward events, first to wxPGEditor::OnEvent() and then to wxPGProperty::OnEvent(). + + @see wxPropertyGrid::OnCustomEditorEvent(), wxEvtHandler::Connect() */ virtual wxPGWindowList CreateControls( wxPropertyGrid* propgrid, wxPGProperty* property, diff --git a/interface/wx/propgrid/propgrid.h b/interface/wx/propgrid/propgrid.h index 4e213ec77f..202dd9c717 100644 --- a/interface/wx/propgrid/propgrid.h +++ b/interface/wx/propgrid/propgrid.h @@ -671,6 +671,22 @@ public: */ 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. */ diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 4a18197dc4..9defd31b6b 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -144,10 +144,10 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP wxWindowID id = wnd2->GetId(); wnd2->Connect( id, wxEVT_SCROLL_LINEUP, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent), NULL, propgrid ); wnd2->Connect( id, wxEVT_SCROLL_LINEDOWN, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent), NULL, propgrid ); // 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->Connect( wnd1->GetId(), wxEVT_KEY_DOWN, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent), NULL, propgrid ); return wxPGWindowList(wnd1, wnd2); @@ -343,7 +343,7 @@ wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgri // (all relevenat wxTextCtrl, wxComboBox and wxButton events are // already connected) ctrl->Connect( wxPG_SUBID1, wxEVT_DATE_CHANGED, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent), NULL, propgrid ); #ifdef __WXMSW__ diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index e1b1e13731..2ef0d70adb 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -872,11 +872,11 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid, // Connect event handling wxWindowID id = cb->GetId(); propGrid->Connect(id, wxEVT_COMMAND_COMBOBOX_SELECTED, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent)); propGrid->Connect(id, wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent)); propGrid->Connect(id, wxEVT_COMMAND_TEXT_ENTER, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent)); #ifdef __WXMSW__ cb->Show(); @@ -1706,9 +1706,9 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos, // Connect event handling id = ed->GetId(); this->Connect(id, wxEVT_COMMAND_TEXT_UPDATED, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent)); this->Connect(id, wxEVT_COMMAND_TEXT_ENTER, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent)); return (wxWindow*) ed; } @@ -1774,7 +1774,7 @@ wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize // Connect event handling id = but->GetId(); this->Connect(id, wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent)); return but; } @@ -1882,7 +1882,7 @@ void wxPGMultiButton::Finalize( wxPropertyGrid* propGrid, const wxPoint& pos ) { wxWindowID id = GetButtonId(i); propGrid->Connect(id, wxEVT_COMMAND_BUTTON_CLICKED, - wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent)); + wxEventHandler(wxPropertyGrid::OnCustomEditorEvent)); } } diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 61bb108e4c..1c364c0862 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -3125,7 +3125,7 @@ bool wxPropertyGrid::ProcessEvent(wxEvent& event) (parent == m_canvas || parent->GetParent() == m_canvas) ) { - OnCustomEditorEvent((wxCommandEvent&)event); + OnCustomEditorEvent(event); return true; } } @@ -3134,9 +3134,7 @@ bool wxPropertyGrid::ProcessEvent(wxEvent& event) // ----------------------------------------------------------------------- -// NB: It may really not be wxCommandEvent - must check if necessary -// (usually not). -void wxPropertyGrid::OnCustomEditorEvent( wxCommandEvent &event ) +void wxPropertyGrid::OnCustomEditorEvent( wxEvent &event ) { wxPGProperty* selected = m_selected; -- 2.45.2