37 return _has_mouse && (_internal_suppress & MouseWatcherRegion::SF_mouse_position) == 0;
50 static LPoint2 bogus_mouse(0.0f, 0.0f);
51 nassertr(_has_mouse, bogus_mouse);
65 nassertr(_has_mouse, 0.0f);
78 nassertr(_has_mouse, 0.0f);
89 set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
166 return _preferred_region;
188 return _inactivity_state != IS_inactive && _current_buttons_down.
get_bit(button.
get_index());
207 _button_down_pattern = pattern;
219 return _button_down_pattern;
231 _button_up_pattern = pattern;
243 return _button_up_pattern;
263 _button_repeat_pattern = pattern;
276 return _button_repeat_pattern;
291 _enter_pattern = pattern;
305 return _enter_pattern;
320 _leave_pattern = pattern;
334 return _leave_pattern;
349 _within_pattern = pattern;
363 return _within_pattern;
378 _without_pattern = pattern;
393 return _without_pattern;
419 return !_geometry.is_null();
508 _display_region = dr;
509 _button_down_display_region = NULL;
521 _display_region = NULL;
522 _button_down_display_region = NULL;
534 return _display_region;
567 _has_inactivity_timeout =
true;
568 _inactivity_timeout = timeout;
580 return _has_inactivity_timeout;
592 nassertr(_has_inactivity_timeout, 0.0);
593 return _inactivity_timeout;
605 _has_inactivity_timeout =
false;
606 _inactivity_timeout = 0.0;
619 _inactivity_timeout_event = event;
631 return _inactivity_timeout_event;
640 INLINE
void MouseWatcher::
644 if (_enter_multiple) {
645 enter_region(region, param);
655 INLINE
void MouseWatcher::
657 if (_enter_multiple) {
658 exit_region(region, param);
689 get_trail_log()
const {
701 INLINE
int MouseWatcher::
702 num_trail_recent()
const {
703 return _num_trail_recent;
bool get_bit(int index) const
Returns true if the nth bit is set, false if it is cleared.
void set_modifier_buttons(const ModifierButtons &mods)
Sets the buttons that should be monitored as modifier buttons for generating events to the MouseWatch...
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.
virtual void without_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse moves completely outside the boundaries o...
bool has_geometry() const
Returns true if a software mouse pointer has been setup via set_geometry(), or false otherwise...
PandaNode * get_geometry() const
Returns the node that has been set as the software mouse pointer, or NULL if no node has been set...
EventHandler * get_extra_handler() const
As an optimization for the C++ Gui, an extra handler can be registered with a mouseWatcher so that ev...
A class to monitor events from the C++ side of things.
bool is_over_region() const
Returns true if the mouse is over any rectangular region, false otherwise.
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_inactivity_timeout(double timeout)
Sets an inactivity timeout on the mouse activity.
void set_inactivity_timeout_event(const string &event)
Specifies the event string that will be generated when the inactivity timeout counter expires...
void set_button_up_pattern(const string &pattern)
Sets the pattern string that indicates how the event names are generated when a button is released...
Records a set of pointer events that happened recently.
const string & get_button_down_pattern() const
Returns the string that indicates how event names are generated when a button is depressed.
double get_inactivity_timeout() const
Returns the inactivity timeout that has been set.
void clear_inactivity_timeout()
Removes the inactivity timeout and restores the MouseWatcher to its default behavior of allowing a ke...
void set_button_down_pattern(const string &pattern)
Sets the pattern string that indicates how the event names are generated when a button is depressed...
virtual void within_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse moves within the boundaries of the region...
const string & get_button_repeat_pattern() const
Returns the string that indicates how event names are names are generated when a button is continuous...
const LVecBase4 & get_frame() const
Returns the frame of the MouseWatcher.
PN_stdfloat get_mouse_y() const
It is only valid to call this if has_mouse() returns true.
bool is_button_down(ButtonHandle button) const
Returns true if the indicated button is currently being held down, false otherwise.
void set_display_region(DisplayRegion *dr)
Constrains the MouseWatcher to watching the mouse within a particular indicated region of the screen...
void set_enter_pattern(const string &pattern)
Sets the pattern string that indicates how the event names are generated when the mouse enters a regi...
const LPoint2 & get_mouse() const
It is only valid to call this if has_mouse() returns true.
This is the class that defines a rectangular region on the screen for the MouseWatcher.
DisplayRegion * get_display_region() const
Returns the display region the MouseWatcher is constrained to by set_display_region(), or NULL if it is not constrained.
void clear_geometry()
Stops the use of the software cursor set up via set_geometry().
PN_stdfloat get_mouse_x() const
It is only valid to call this if has_mouse() returns true.
void set_button_repeat_pattern(const string &pattern)
Sets the pattern string that indicates how the event names are generated when a button is continuousl...
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets the frame of the MouseWatcher.
This is the base class for all three-component vectors and points.
const string & get_without_pattern() const
Returns the string that indicates how event names are generated when the mouse wanders out of a regio...
MouseWatcherRegion * get_over_region() const
Returns the smallest region the mouse is currently over, or NULL if it is over no region...
void note_activity()
Can be used in conjunction with the inactivity timeout to inform the MouseWatcher that the user has j...
const string & get_within_pattern() const
Returns the string that indicates how event names are generated when the mouse wanders over a region...
void clear_trail_log()
Clears the mouse trail log.
const string & get_leave_pattern() const
Returns the string that indicates how event names are generated when the mouse leaves a region...
void set_leave_pattern(const string &pattern)
Sets the pattern string that indicates how the event names are generated when the mouse leaves a regi...
A rectangular subregion within a window for rendering into.
void set_without_pattern(const string &pattern)
Sets the pattern string that indicates how the event names are generated when the mouse wanders out o...
const string & get_inactivity_timeout_event() const
Returns the event string that will be generated when the inactivity timeout counter expires...
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...
bool has_mouse() const
Returns true if the mouse is anywhere within the window, false otherwise.
This is a two-component point in space.
bool has_inactivity_timeout() const
Returns true if an inactivity timeout has been set, false otherwise.
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...
const string & get_enter_pattern() const
Returns the string that indicates how event names are generated when the mouse enters a region...
void set_geometry(PandaNode *node)
Sets the node that will be transformed each frame by the mouse's coordinates.
void set_within_pattern(const string &pattern)
Sets the pattern string that indicates how the event names are generated when the mouse wanders over ...
bool is_mouse_open() const
Returns true if the mouse is within the window and not over some particular MouseWatcherRegion that i...
void clear_display_region()
Removes the display region constraint from the MouseWatcher, and restores it to the default behavior ...
const string & get_button_up_pattern() const
Returns the string that indicates how event names are generated when a button is released.
bool has_display_region() const
Returns true if the MouseWatcher has been constrained to a particular region of the screen via set_di...