Panda3D
Loading...
Searching...
No Matches
pgMouseWatcherRegion.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pgMouseWatcherRegion.cxx
10 * @author drose
11 * @date 2001-07-02
12 */
13
15#include "pgItem.h"
16
17#include "string_utils.h"
18
19int PGMouseWatcherRegion::_next_index = 0;
20TypeHandle PGMouseWatcherRegion::_type_handle;
21
22/**
23 *
24 */
25PGMouseWatcherRegion::
26PGMouseWatcherRegion(PGItem *item) :
27#ifndef CPPPARSER
28 MouseWatcherRegion("pg" + format_string(_next_index++), 0, 0, 0, 0),
29#endif
30 _item(item)
31{
32}
33
34/**
35 *
36 */
37PGMouseWatcherRegion::
38~PGMouseWatcherRegion() {
39}
40
41
42/**
43 * This is a callback hook function, called whenever the mouse enters the
44 * region. The mouse is only considered to be "entered" in one region at a
45 * time; in the case of nested regions, it exits the outer region before
46 * entering the inner one.
47 */
50 if (_item != nullptr) {
51 _item->enter_region(param);
52 }
53}
54
55/**
56 * This is a callback hook function, called whenever the mouse exits the
57 * region. The mouse is only considered to be "entered" in one region at a
58 * time; in the case of nested regions, it exits the outer region before
59 * entering the inner one.
60 */
63 if (_item != nullptr) {
64 _item->exit_region(param);
65 }
66}
67
68/**
69 * This is a callback hook function, called whenever the mouse moves within
70 * the boundaries of the region, even if it is also within the boundaries of a
71 * nested region. This is different from "enter", which is only called
72 * whenever the mouse is within only that region.
73 */
76 if (_item != nullptr) {
77 _item->within_region(param);
78 }
79}
80
81/**
82 * This is a callback hook function, called whenever the mouse moves
83 * completely outside the boundaries of the region. See within_region().
84 */
87 if (_item != nullptr) {
88 _item->without_region(param);
89 }
90}
91
92/**
93 * This is a callback hook function, called whenever a mouse or keyboard
94 * button is depressed while the mouse is within the region.
95 */
97press(const MouseWatcherParameter &param) {
98 if (_item != nullptr) {
99 _item->press(param, false);
100 }
101}
102
103/**
104 * This is a callback hook function, called whenever a mouse or keyboard
105 * button previously depressed with press() is released.
106 */
108release(const MouseWatcherParameter &param) {
109 if (_item != nullptr) {
110 _item->release(param, false);
111 }
112}
113
114/**
115 * This is a callback hook function, called whenever the user presses a key.
116 */
118keystroke(const MouseWatcherParameter &param) {
119 if (_item != nullptr) {
120 _item->keystroke(param, false);
121 }
122}
123
124/**
125 * This is a callback hook function, called whenever the user selects an
126 * option from the IME menu.
127 */
129candidate(const MouseWatcherParameter &param) {
130 if (_item != nullptr) {
131 _item->candidate(param, false);
132 }
133}
134
135/**
136 * This is a callback hook function, called whenever the user moves the mouse
137 * within the region
138 */
140move(const MouseWatcherParameter &param) {
141 if (_item != nullptr) {
142 _item->move(param);
143 }
144}
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.
This is the base class for all the various kinds of gui widget objects.
Definition pgItem.h:53
virtual void press(const MouseWatcherParameter &param, bool background)
This is a callback hook function, called whenever a mouse or keyboard button is depressed while the m...
Definition pgItem.cxx:674
virtual void release(const MouseWatcherParameter &param, bool background)
This is a callback hook function, called whenever a mouse or keyboard button previously depressed wit...
Definition pgItem.cxx:703
virtual void without_region(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the mouse moves completely outside the boundaries o...
Definition pgItem.cxx:610
virtual void keystroke(const MouseWatcherParameter &param, bool background)
This is a callback hook function, called whenever the user presses a key.
Definition pgItem.cxx:726
virtual void exit_region(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the mouse exits the region.
Definition pgItem.cxx:562
virtual void move(const MouseWatcherParameter &param)
This is a callback hook function, called whenever a mouse is moved while within the region.
Definition pgItem.cxx:770
virtual void within_region(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the mouse moves within the boundaries of the region...
Definition pgItem.cxx:588
virtual void candidate(const MouseWatcherParameter &param, bool background)
This is a callback hook function, called whenever the user highlights an option in the IME window.
Definition pgItem.cxx:750
virtual void enter_region(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the mouse enters the region.
Definition pgItem.cxx:538
virtual void keystroke(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the user presses a key.
virtual void move(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the user moves the mouse within the region.
virtual void release(const MouseWatcherParameter &param)
This is a callback hook function, called whenever a mouse or keyboard button previously depressed wit...
virtual void enter_region(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the mouse enters the region.
virtual void candidate(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the user selects an option from the IME menu.
virtual void within_region(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the mouse moves within the boundaries of the region...
virtual void exit_region(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the mouse exits the region.
virtual void without_region(const MouseWatcherParameter &param)
This is a callback hook function, called whenever the mouse moves completely outside the boundaries o...
virtual void press(const MouseWatcherParameter &param)
This is a callback hook function, called whenever a mouse or keyboard button is depressed while the m...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.