tod
19-02-2008 19:56:16
Just some helper define for adding events handlers
So instead of:
you can use:
The macro expects event handlers defined in the respective class like this:
Not a big deal, I just played with it and though that it may be useful. It would have been even nicer if the QuickGUI events had some aesthetic names
#define ADD_EVENT(Widget_Par,Event_Par,HandlerType_Par,Handler_Par) \
Widget_Par->addEventHandler <HandlerType_Par> (QuickGUI::Widget::Event_Par,&HandlerType_Par::evt##Widget_Par##Event_Par,dynamic_cast<HandlerType_Par*> (Handler_Par));
So instead of:
LeftButton->addEventHandler <DemoListener> (QuickGUI::Widget::EVENT_MOUSE_BUTTON_DOWN,&DemoListener::evtHandlerLeft,dynamic_cast<DemoListener*> (mFrameListener));
you can use:
ADD_EVENT(LeftButton,EVENT_MOUSE_BUTTON_DOWN,DemoListener,mFrameListener)
The macro expects event handlers defined in the respective class like this:
void DemoListener::evtLeftButtonEVENT_MOUSE_BUTTON_DOWN(const QuickGUI::EventArgs& args)
Not a big deal, I just played with it and though that it may be useful. It would have been even nicer if the QuickGUI events had some aesthetic names