61class EXPCL_PANDA_TFORM MouseWatcher :
public DataNode,
public MouseWatcherBase {
63 explicit MouseWatcher(
const std::string &name =
"");
74 INLINE
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top);
75 INLINE
void set_frame(
const LVecBase4 &frame);
76 INLINE
const LVecBase4 &
get_frame()
const;
141 INLINE
size_t num_trail_recent()
const;
150 virtual void output(std::ostream &out)
const;
151 virtual void write(std::ostream &out,
int indent_level = 0)
const;
154 void get_over_regions(Regions ®ions,
const LPoint2 &pos)
const;
157 void set_current_regions(Regions ®ions);
158 void clear_current_regions();
160 virtual void do_show_regions(
const NodePath &render2d,
161 const std::string &bin_name,
int draw_order);
162 virtual void do_hide_regions();
164 static void intersect_regions(Regions &only_a,
167 const Regions ®ions_a,
168 const Regions ®ions_b);
169 static bool remove_region_from(Regions ®ions,
171 static bool has_region_in(
const Regions ®ions,
174 void throw_event_pattern(
const std::string &pattern,
181 void keystroke(
int keycode);
182 void candidate(
const std::wstring &candidate,
size_t highlight_start,
183 size_t highlight_end,
size_t cursor_pos);
194 void set_mouse(
const LVecBase2 &xy,
const LVecBase2 &pixel_xy);
198 void discard_excess_trail_log();
199 void update_trail_node();
202 LVecBase2 &f, LVecBase2 &p,
212 int _internal_suppress;
213 int _external_suppress;
215 LPoint2 _mouse_pixel;
221 size_t _num_trail_recent;
222 double _trail_log_duration;
225 Regions _current_regions;
230 bool _enter_multiple;
231 bool _implicit_click;
233 std::string _button_down_pattern;
234 std::string _button_up_pattern;
235 std::string _button_repeat_pattern;
236 std::string _enter_pattern;
237 std::string _leave_pattern;
238 std::string _within_pattern;
239 std::string _without_pattern;
241 PT(PandaNode) _geometry;
248 bool _has_inactivity_timeout;
249 double _inactivity_timeout;
250 std::string _inactivity_timeout_event;
251 double _last_activity;
253 enum InactivityState {
256 IS_active_to_inactive,
257 IS_inactive_to_active,
259 InactivityState _inactivity_state;
262 std::string _show_regions_bin_name;
263 int _show_regions_draw_order;
274 int _pixel_size_input;
276 int _button_events_input;
277 int _pointer_events_input;
280 int _pixel_xy_output;
281 int _pixel_size_output;
283 int _button_events_output;
285 PT(EventStoreVec2) _pixel_xy;
286 PT(EventStoreVec2) _xy;
287 PT(EventStoreVec2) _pixel_size;
294 static void init_type() {
295 DataNode::init_type();
297 DataNode::get_class_type());
299 virtual TypeHandle get_type()
const {
300 return get_class_type();
302 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
305 static TypeHandle _type_handle;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A dynamic array with an unlimited number of bits.
This object supervises the traversal of the data graph and the moving of data from one DataNode to it...
Encapsulates the data generated from (or sent into) any particular DataNode.
A rectangular subregion within a window for rendering into.
A class to monitor events from the C++ side of things.
A node that holds Geom objects, renderable pieces of geometry.
bool remove_region(MouseWatcherRegion *region)
Removes the indicated region from the group.
This represents a collection of MouseWatcherRegions that may be managed as a group.
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...
This is the class that defines a rectangular region on the screen for the MouseWatcher.
void set_enter_pattern(const std::string &pattern)
Sets the pattern string that indicates how the event names are generated when the mouse enters a regi...
void set_button_down_pattern(const std::string &pattern)
Sets the pattern string that indicates how the event names are generated when a button is depressed.
const std::string & get_within_pattern() const
Returns the string that indicates how event names are generated when the mouse wanders over a region.
bool add_group(MouseWatcherGroup *group)
Adds the indicated group of regions to the set of regions the MouseWatcher will monitor each frame.
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets the frame of the MouseWatcher.
bool remove_group(MouseWatcherGroup *group)
Removes the indicated group from the set of extra groups associated with the MouseWatcher.
void set_trail_log_duration(double duration)
If the duration is nonzero, causes the MouseWatcher to log the mouse's trail.
get_group
Returns the nth group added to the MouseWatcher via add_group().
const std::string & get_button_up_pattern() const
Returns the string that indicates how event names are generated when a button is released.
bool is_mouse_open() const
Returns true if the mouse is within the window and not over some particular MouseWatcherRegion that i...
bool has_geometry() const
Returns true if a software mouse pointer has been setup via set_geometry(), or false otherwise.
void clear_geometry()
Stops the use of the software cursor set up via set_geometry().
const std::string & get_without_pattern() const
Returns the string that indicates how event names are generated when the mouse wanders out of a regio...
bool replace_group(MouseWatcherGroup *old_group, MouseWatcherGroup *new_group)
Atomically removes old_group from the MouseWatcher, and replaces it with new_group.
void set_inactivity_timeout_event(const std::string &event)
Specifies the event string that will be generated when the inactivity timeout counter expires.
bool has_inactivity_timeout() const
Returns true if an inactivity timeout has been set, false otherwise.
void clear_inactivity_timeout()
Removes the inactivity timeout and restores the MouseWatcher to its default behavior of allowing a ke...
bool has_display_region() const
Returns true if the MouseWatcher has been constrained to a particular region of the screen via set_di...
void clear_trail_node()
If you have previously fetched the trail node using get_trail_node, then the MouseWatcher is continua...
void note_activity()
Can be used in conjunction with the inactivity timeout to inform the MouseWatcher that the user has j...
const std::string & get_leave_pattern() const
Returns the string that indicates how event names are generated when the mouse leaves a region.
PN_stdfloat get_mouse_x() const
It is only valid to call this if has_mouse() returns true.
void set_leave_pattern(const std::string &pattern)
Sets the pattern string that indicates how the event names are generated when the mouse leaves a regi...
bool is_button_down(ButtonHandle button) const
Returns true if the indicated button is currently being held down, false otherwise.
void set_modifier_buttons(const ModifierButtons &mods)
Sets the buttons that should be monitored as modifier buttons for generating events to the MouseWatch...
void set_within_pattern(const std::string &pattern)
Sets the pattern string that indicates how the event names are generated when the mouse wanders over ...
void set_inactivity_timeout(double timeout)
Sets an inactivity timeout on the mouse activity.
const std::string & get_enter_pattern() const
Returns the string that indicates how event names are generated when the mouse enters a region.
const LPoint2 & get_mouse() const
It is only valid to call this if has_mouse() returns true.
void set_button_repeat_pattern(const std::string &pattern)
Sets the pattern string that indicates how the event names are generated when a button is continuousl...
double get_inactivity_timeout() const
Returns the inactivity timeout that has been set.
const std::string & get_inactivity_timeout_event() const
Returns the event string that will be generated when the inactivity timeout counter expires.
MouseWatcherRegion * get_over_region() const
Returns the smallest region the mouse is currently over, or NULL if it is over no region.
DisplayRegion * get_display_region() const
Returns the display region the MouseWatcher is constrained to by set_display_region(),...
void set_geometry(PandaNode *node)
Sets the node that will be transformed each frame by the mouse's coordinates.
void set_without_pattern(const std::string &pattern)
Sets the pattern string that indicates how the event names are generated when the mouse wanders out o...
bool has_mouse() const
Returns true if the mouse is anywhere within the window, false otherwise.
const std::string & get_button_repeat_pattern() const
Returns the string that indicates how event names are names are generated when a button is continuous...
bool is_over_region() const
Returns true if the mouse is over any rectangular region, false otherwise.
EventHandler * get_extra_handler() const
As an optimization for the C++ Gui, an extra handler can be registered with a mouseWatcher so that ev...
PandaNode * get_geometry() const
Returns the node that has been set as the software mouse pointer, or NULL if no node has been set.
get_num_groups
Returns the number of separate groups added to the MouseWatcher via add_group().
const std::string & get_button_down_pattern() const
Returns the string that indicates how event names are generated when a button is depressed.
PN_stdfloat get_mouse_y() const
It is only valid to call this if has_mouse() returns true.
void clear_trail_log()
Clears the mouse trail log.
void clear_display_region()
Removes the display region constraint from the MouseWatcher, and restores it to the default behavior ...
const LVecBase4 & get_frame() const
Returns the frame of the MouseWatcher.
ModifierButtons get_modifier_buttons() const
Returns the set of buttons that are being monitored as modifier buttons, as well as their current sta...
void set_extra_handler(EventHandler *eh)
As an optimization for the C++ Gui, an extra handler can be registered with a mouseWatcher so that ev...
void set_display_region(DisplayRegion *dr)
Constrains the MouseWatcher to watching the mouse within a particular indicated region of the screen.
void set_button_up_pattern(const std::string &pattern)
Sets the pattern string that indicates how the event names are generated when a button is released.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Records a set of pointer events that happened recently.
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...