32 #include "autocreatelistener.h"
45 class WimpMessageListener;
50 class PrePollListener;
51 class PostPollListener;
52 class PostEventListener;
53 class UncaughtHandler;
61 static EventRouter *instance() {
return _instance;}
67 void catch_exceptions(
bool c) {_catch_exceptions = c;}
68 void uncaught_handler(UncaughtHandler *handler) {_uncaught_handler = handler;}
72 friend class Application;
74 friend class Component;
78 void add_autocreate_listener(
const char *template_name, AutoCreateListener *listener);
79 void remove_autocreate_listener(
const char *template_name);
82 void remove_object_listener(
ObjectId handle,
ComponentId component_id,
int action, Listener *listener);
85 void add_window_event_listener(
ObjectId handle,
int event_code, Listener *listener);
86 void remove_window_event_listener(
ObjectId handle,
int event_code, Listener *listener);
87 void add_window_event_listener(
ObjectId handle,
ComponentId component_id,
int event_code, Listener *listener);
88 void remove_window_event_listener(
ObjectId handle,
ComponentId component_id,
int event_code, Listener *listener);
90 void remove_all_listeners(
ObjectId handle);
93 void set_autocreate_listener(std::string template_name, AutoCreateListener *listener);
94 void clear_autocreate_listener(std::string template_name);
96 void add_message_listener(
int type,
int message_id, WimpMessageListener *listener);
97 void remove_message_listener(
int type,
int message_id, WimpMessageListener *listener);
99 void add_null_event_command(Command *command);
100 void remove_null_event_command(Command *command);
102 void set_drag_handler(DragHandler *handler,
int drag_stop_swi = 0);
105 void add_timer(
int elapsed, Timer *timer);
106 void remove_timer(Timer *timer);
109 void route_event(
int event_code);
111 void process_toolbox_event();
114 void process_null_event();
115 void process_redraw_request();
116 void process_open_window_request();
117 void process_close_window_request();
118 void process_pointer_leaving_window();
119 void process_pointer_entering_window();
120 void process_mouse_click();
121 void process_key_pressed();
122 void process_scroll_request();
123 void process_lose_caret();
124 void process_gain_caret();
126 void process_user_message();
127 void process_recorded_message();
128 void process_acknowledge_message();
133 PollBlock _poll_block;
135 bool _catch_exceptions;
136 UncaughtHandler *_uncaught_handler;
138 PrePollListener *_pre_poll_listener;
139 PostPollListener *_post_poll_listener;
140 PostEventListener *_post_event_listener;
144 struct ObjectListenerItem
150 ObjectListenerItem *next;
154 struct WindowEventListenerItem
157 WindowEventListenerItem *next;
162 struct WimpMessageListenerItem
165 WimpMessageListener *listener;
166 WimpMessageListenerItem *next;
171 bool _remove_running;
172 ObjectListenerItem *_running_object_item;
173 WindowEventListenerItem *_running_window_event_item;
174 WimpMessageListenerItem *_running_message_item;
176 std::map<ObjectId, ObjectListenerItem *> _object_listeners;
177 std::map<std::string, AutoCreateListener*> *_autocreate_listeners;
178 std::map<int, WimpMessageListenerItem *> **_message_listeners;
179 std::map<ObjectId, WindowEventListenerItem **> *_window_event_listeners;
182 class NullCommandQueue
185 unsigned int _capacity;
193 void add(Command *command);
194 void remove(Command *command);
197 unsigned int size()
const {
return _size;}
198 } *_null_event_commands;
200 DragHandler *_drag_handler;
206 unsigned int elapsed;
213 ObjectListenerItem *find_first_object_listener(
ObjectId handle,
int action);
214 WindowEventListenerItem *find_window_event_listener(
ObjectId object_id,
int event_code);
215 WindowEventListenerItem *find_window_event_component(WindowEventListenerItem *&item,
ComponentId component_id);
216 void remove_running_window_event_listener(
ObjectId object_id,
int event_code);
218 void add_timer_info(TimerInfo *info);
221 static EventRouter *_instance;
225 inline EventRouter *event_router() {
return EventRouter::instance();}
void(* RawToolboxEventHandler)(IdBlock &id_block, PollBlock &data, Listener *listener)
Function type for handlers of raw (unprocessed) Toolbox events.
Definition: pollinfo.h:86
int ComponentId
Type for underlying toolbox component id.
Definition: handles.h:33
unsigned int ObjectId
Type for underlying toolbox object id.
Definition: handles.h:31