Nana C++ Library An open-source C++ framework project The Programmer's Guide |
||||||||||||||||||||||||||||||||||||||
Events Description Nana.GUI provides some raw events, such as click, mouse_move and so on. The most of these events can work with all widgets implemented by Nana.GUI, but some of them are individual, like unload for root widget, elapse for timer. Every widget has an interface for registering an event, it named make_event. template<typename Event, typename Function> event_handle make_event(Function) const; template<typename Event, typename Class, typename Concept> event_handle make_event(Class& object, void (Concept::*mf)(const nana::gui::eventinfo&)); template<typename Event, typename Class, typename Concept> event_handle make_event(Class& object, void(Concept::*mf)()); These template function calls with explicitly specified the first template parameter, the Event is a type defined by Nana.GUI in nana::gui::events. The events are
The user-defined event function may have a parameter that type is const nana::gui::eventinfo& for quering the event information, such as mouse position. void foo(); void foo_with_parameter(const nana::gui::eventinfo&); class user_def_functor { public: void operator()(const nana::gui::eventinfo&); //user-defined function must have the parameter. }; nana::gui::button().make_event<nana::gui::events::click>(foo); nana::gui::button().make_event<nana::gui::events::click>(foo_with_parameter); nana::gui::button().make_event<nana::gui::events::click>(user_def_functor()); make_event returns a handle for uninstalling the associated user-defined event function and Nana.GUI destroyes the user-defined event function automatically when the widget is beginning to destroy. This just describes these general-purpose events, but some widgets like nana::gui::treebox provides some high-level events, such as expanding a node, these details are only described in the reference of corresponding widget. File None. Notes None. See also None. Move to The Nana Programmer's Guide Main Page |
||||||||||||||||||||||||||||||||||||||