15 #ifndef MOUSEWATCHER_H
16 #define MOUSEWATCHER_H
18 #include "pandabase.h"
20 #include "mouseWatcherRegion.h"
21 #include "mouseWatcherGroup.h"
24 #include "pointerTo.h"
25 #include "eventHandler.h"
26 #include "modifierButtons.h"
27 #include "buttonHandle.h"
28 #include "buttonEventList.h"
29 #include "pointerEvent.h"
30 #include "pointerEventList.h"
31 #include "linmath_events.h"
33 #include "clockObject.h"
35 #include "displayRegion.h"
75 INLINE
bool has_mouse()
const;
76 INLINE
bool is_mouse_open()
const;
77 INLINE
const LPoint2 &get_mouse()
const;
78 INLINE PN_stdfloat get_mouse_x()
const;
79 INLINE PN_stdfloat get_mouse_y()
const;
81 INLINE
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top);
82 INLINE
void set_frame(
const LVecBase4 &frame);
83 INLINE
const LVecBase4 &get_frame()
const;
85 INLINE
bool is_over_region()
const;
86 INLINE
bool is_over_region(PN_stdfloat x, PN_stdfloat y)
const;
87 INLINE
bool is_over_region(
const LPoint2 &pos)
const;
95 INLINE
void set_button_down_pattern(
const string &pattern);
96 INLINE
const string &get_button_down_pattern()
const;
98 INLINE
void set_button_up_pattern(
const string &pattern);
99 INLINE
const string &get_button_up_pattern()
const;
101 INLINE
void set_button_repeat_pattern(
const string &pattern);
102 INLINE
const string &get_button_repeat_pattern()
const;
104 INLINE
void set_enter_pattern(
const string &pattern);
105 INLINE
const string &get_enter_pattern()
const;
107 INLINE
void set_leave_pattern(
const string &pattern);
108 INLINE
const string &get_leave_pattern()
const;
110 INLINE
void set_within_pattern(
const string &pattern);
111 INLINE
const string &get_within_pattern()
const;
113 INLINE
void set_without_pattern(
const string &pattern);
114 INLINE
const string &get_without_pattern()
const;
116 INLINE
void set_geometry(
PandaNode *node);
117 INLINE
bool has_geometry()
const;
119 INLINE
void clear_geometry();
128 INLINE
void clear_display_region();
130 INLINE
bool has_display_region()
const;
135 int get_num_groups()
const;
137 MAKE_SEQ(get_groups, get_num_groups, get_group);
139 INLINE
void set_inactivity_timeout(
double timeout);
140 INLINE
bool has_inactivity_timeout()
const;
141 INLINE
double get_inactivity_timeout()
const;
142 INLINE
void clear_inactivity_timeout();
144 INLINE
void set_inactivity_timeout_event(
const string &event);
145 INLINE
const string &get_inactivity_timeout_event()
const;
148 INLINE
int num_trail_recent()
const;
149 void set_trail_log_duration(
double duration);
151 void clear_trail_node();
152 INLINE
void clear_trail_log();
154 void note_activity();
157 virtual void output(ostream &out)
const;
158 virtual void write(ostream &out,
int indent_level = 0)
const;
161 void get_over_regions(
Regions ®ions,
const LPoint2 &pos)
const;
164 void set_current_regions(
Regions ®ions);
165 void clear_current_regions();
168 virtual void do_show_regions(
const NodePath &render2d,
169 const string &bin_name,
int draw_order);
170 virtual void do_hide_regions();
173 static void intersect_regions(
Regions &only_a,
178 static bool remove_region_from(
Regions ®ions,
180 static bool has_region_in(
const Regions ®ions,
183 void throw_event_pattern(
const string &pattern,
190 void keystroke(
int keycode);
191 void candidate(
const wstring &candidate,
size_t highlight_start,
192 size_t highlight_end,
size_t cursor_pos);
207 void discard_excess_trail_log();
208 void update_trail_node();
221 int _internal_suppress;
222 int _external_suppress;
230 int _num_trail_recent;
231 double _trail_log_duration;
239 bool _enter_multiple;
240 bool _implicit_click;
242 string _button_down_pattern;
243 string _button_up_pattern;
244 string _button_repeat_pattern;
245 string _enter_pattern;
246 string _leave_pattern;
247 string _within_pattern;
248 string _without_pattern;
257 bool _has_inactivity_timeout;
258 double _inactivity_timeout;
259 string _inactivity_timeout_event;
260 double _last_activity;
262 enum InactivityState {
265 IS_active_to_inactive,
266 IS_inactive_to_active,
268 InactivityState _inactivity_state;
272 string _show_regions_bin_name;
273 int _show_regions_draw_order;
285 int _pixel_size_input;
287 int _button_events_input;
288 int _pointer_events_input;
291 int _pixel_xy_output;
292 int _pixel_size_output;
294 int _button_events_output;
305 static void init_type() {
306 DataNode::init_type();
307 register_type(_type_handle,
"MouseWatcher",
308 DataNode::get_class_type());
311 return get_class_type();
313 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
319 #include "mouseWatcher.I"
This TFormer maintains a list of rectangular regions on the screen that are considered special mouse ...
A basic node of the scene graph or data graph.
The fundamental type of node for the data graph.
This represents a collection of MouseWatcherRegions that may be managed as a group.
A class to monitor events from the C++ side of things.
bool remove_region(MouseWatcherRegion *region)
Removes the indicated region from the group.
Records a set of pointer events that happened recently.
A handy class object for storing simple values (like integers or strings) passed along with an Event ...
A dynamic array with an unlimited number of bits.
This is the class that defines a rectangular region on the screen for the MouseWatcher.
This represents a collection of MouseWatcherRegions that may be managed as a group.
This is the base class for all two-component vectors and points.
This is the base class for all three-component vectors and points.
A thread; that is, a lightweight process.
A rectangular subregion within a window for rendering into.
This is a two-component point in space.
TypeHandle is the identifier used to differentiate C++ class types.
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
A node that holds Geom objects, renderable pieces of geometry.
Encapsulates the data generated from (or sent into) any particular DataNode.
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...