Fix event handler type casting
The old methods were very clunky and not recommended (and didn't properly cast the function types). This changes to useing the recommended way of declaring events and casting the event handlers.
This commit is contained in:
parent
d587bd5bca
commit
a8d9fcb4e0
|
@ -185,7 +185,7 @@ void ENV_VAR_NAME_VALIDATOR::OnChar( wxKeyEvent& aEvent )
|
|||
if( textCtrl )
|
||||
{
|
||||
textCtrl->Connect( textCtrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
|
||||
(wxObjectEventFunction) &ENV_VAR_NAME_VALIDATOR::OnTextChanged );
|
||||
wxCommandEventHandler( ENV_VAR_NAME_VALIDATOR::OnTextChanged ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,16 +88,11 @@ private:
|
|||
|
||||
typedef void ( wxEvtHandler::*kiwayExpressFunction )( KIWAY_EXPRESS& );
|
||||
|
||||
#define wxKiwayExressHandler(func) \
|
||||
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(kiwayExpressFunction, &func)
|
||||
|
||||
/// Typecast an event handler for the KIWAY_EXPRESS event class
|
||||
#define kiwayExpressHandler( func ) wxEVENT_HANDLER_CAST( kiwayExpressFunction, func )
|
||||
|
||||
/// Event table definition for the KIWAY_EXPRESS event class
|
||||
#define EVT_KIWAY_EXPRESS( func ) \
|
||||
DECLARE_EVENT_TABLE_ENTRY( \
|
||||
KIWAY_EXPRESS::wxEVENT_ID, -1, -1, \
|
||||
(wxObjectEventFunction) \
|
||||
(kiwayExpressFunction) & func, \
|
||||
(wxObject*) NULL ),
|
||||
|
||||
wx__DECLARE_EVT0( KIWAY_EXPRESS::wxEVENT_ID, kiwayExpressHandler( func ) )
|
||||
|
||||
#endif // KIWAY_EXPRESS_H_
|
||||
|
|
|
@ -374,8 +374,7 @@ void PCB_EDIT_FRAME::buildActionPluginMenus( ACTION_MENU* actionMenu )
|
|||
item = AddMenuItem( actionMenu, wxID_ANY, ap->GetName(), ap->GetDescription(), bitmap );
|
||||
|
||||
Connect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &
|
||||
PCB_EDIT_FRAME::OnActionPluginMenu );
|
||||
wxCommandEventHandler( PCB_EDIT_FRAME::OnActionPluginMenu ) );
|
||||
|
||||
ACTION_PLUGINS::SetActionMenu( ii, item->GetId() );
|
||||
}
|
||||
|
@ -410,8 +409,7 @@ void PCB_EDIT_FRAME::AddActionPluginTools()
|
|||
wxID_ANY, wxEmptyString, bitmap, ap->GetName() );
|
||||
|
||||
Connect( button->GetId(), wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &
|
||||
PCB_EDIT_FRAME::OnActionPluginButton );
|
||||
wxCommandEventHandler( PCB_EDIT_FRAME::OnActionPluginButton ) );
|
||||
|
||||
// Link action plugin to button
|
||||
ACTION_PLUGINS::SetActionButton( ap, button->GetId() );
|
||||
|
|
Loading…
Reference in New Issue