cgv
|
interface for all classes that want to receive events More...
#include <event_handler.h>
Public Member Functions | |
event_handler () | |
default construction | |
bool | grab_focus () |
grab the focus in all parent nodes | |
virtual bool | handle (event &e)=0 |
overload and implement this method to handle events | |
virtual void | stream_help (std::ostream &os)=0 |
overload to stream help information to the given output stream | |
bool | add_key_control (const std::string &property, const std::string &options, cgv::base::group_ptr group=cgv::base::group_ptr()) |
add a key control for the given property with the given options. | |
![]() | |
traverse_policy (int _policy=TP_ALL+TP_STOP_ON_SUCCESS, bool _active=true, int _focus=-1) | |
construct default traverse policy that visits everything | |
int | get_policy () const |
return the policy without the stop on success flag | |
bool | stop_on_success () const |
return whether to stop on success | |
bool | stop_on_failure () const |
return whether to stop on failure | |
void | set_policy (int _policy) |
set a new policy, always add stop on success flag if needed | |
int | get_focused_child () const |
return the focused child or -1 if none is focused | |
void | set_focused_child (int _focused_child) |
set the focused child | |
bool | get_active () const |
return whether the current node is active | |
void | set_active (bool _active) |
set the active flag of the current node | |
Additional Inherited Members | |
![]() | |
TraversePolicy | policy |
bool | active |
int | focus |
interface for all classes that want to receive events
Definition at line 14 of file event_handler.h.
cgv::gui::event_handler::event_handler | ( | ) |
default construction
Definition at line 11 of file event_handler.cxx.
bool cgv::gui::event_handler::add_key_control | ( | const std::string & | property, |
const std::string & | options, | ||
cgv::base::group_ptr | group = cgv::base::group_ptr() |
||
) |
add a key control for the given property with the given options.
grab the focus in all parent nodes
This should be called in classes derived from cgv::base::group and event_handler. The group argument should be the this pointer cast to cgv::base_group. If group is not given, a dynamic_cast is performed on the this pointer.
Definition at line 22 of file event_handler.cxx.
References cgv::base::group::append_child(), cgv::data::ref_ptr< T, is_ref_counted >::empty(), cgv::base::base::find_member_ptr(), and cgv::base::base::on_set().
bool cgv::gui::event_handler::grab_focus | ( | ) |
grab the focus in all parent nodes
Definition at line 16 of file event_handler.cxx.
References cgv::base::grab_focus().
|
pure virtual |
overload and implement this method to handle events
e | to be handled event (use e.get_kind() to check event type) |
Implemented in cgv::app::overlay, vr_test, vr_emulator, cgv::app::gizmo, cgv::gui::key_control< T >, and cgv::gui::key_control< bool >.
Referenced by cgv::gui::vr_server::dispatch(), and cgv::gui::vr_server::grab_focus().
|
pure virtual |
overload to stream help information to the given output stream
Implemented in cgv::gui::key_control< T >, cgv::gui::key_control< bool >, cgv::app::navigator, cgv::app::overlay, vr_test, vr_emulator, and cgv::app::gizmo.