Panda3D
pgItemNotify.cxx
1 // Filename: pgItemNotify.cxx
2 // Created by: drose (18Aug05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "pgItemNotify.h"
16 #include "pgItem.h"
17 
18 ////////////////////////////////////////////////////////////////////
19 // Function: PGItemNotify::Destructor
20 // Access: Public, Virtual
21 // Description:
22 ////////////////////////////////////////////////////////////////////
23 PGItemNotify::
24 ~PGItemNotify() {
25  while (!_items.empty()) {
26  // Disconnect all of the items that are connected to this
27  // object.
28  PGItem *item = (*_items.begin());
29  nassertv(item->get_notify() == this);
30  (*_items.begin())->set_notify(NULL);
31  }
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: PGItemNotify::item_transform_changed
36 // Access: Protected, Virtual
37 // Description: Called whenever a watched PGItem's local transform
38 // has been changed.
39 ////////////////////////////////////////////////////////////////////
40 void PGItemNotify::
41 item_transform_changed(PGItem *) {
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: PGItemNotify::item_frame_changed
46 // Access: Protected, Virtual
47 // Description: Called whenever a watched PGItem's frame
48 // has been changed.
49 ////////////////////////////////////////////////////////////////////
50 void PGItemNotify::
51 item_frame_changed(PGItem *) {
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: PGItemNotify::item_draw_mask_changed
56 // Access: Protected, Virtual
57 // Description: Called whenever a watched PGItem's draw_mask
58 // has been changed.
59 ////////////////////////////////////////////////////////////////////
60 void PGItemNotify::
61 item_draw_mask_changed(PGItem *) {
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: PGItemNotify::item_enter
66 // Access: Protected, Virtual
67 // Description: Called whenever the "enter" event is triggered on a
68 // watched PGItem. See PGItem::enter_region().
69 ////////////////////////////////////////////////////////////////////
70 void PGItemNotify::
71 item_enter(PGItem *, const MouseWatcherParameter &) {
72 }
73 
74 ////////////////////////////////////////////////////////////////////
75 // Function: PGItemNotify::item_exit
76 // Access: Protected, Virtual
77 // Description: Called whenever the "exit" event is triggered on a
78 // watched PGItem. See PGItem::exit_region().
79 ////////////////////////////////////////////////////////////////////
80 void PGItemNotify::
81 item_exit(PGItem *, const MouseWatcherParameter &) {
82 }
83 
84 ////////////////////////////////////////////////////////////////////
85 // Function: PGItemNotify::item_within
86 // Access: Protected, Virtual
87 // Description: Called whenever the "within" event is triggered on a
88 // watched PGItem. See PGItem::within_region().
89 ////////////////////////////////////////////////////////////////////
90 void PGItemNotify::
91 item_within(PGItem *, const MouseWatcherParameter &) {
92 }
93 
94 ////////////////////////////////////////////////////////////////////
95 // Function: PGItemNotify::item_without
96 // Access: Protected, Virtual
97 // Description: Called whenever the "without" event is triggered on a
98 // watched PGItem. See PGItem::without_region().
99 ////////////////////////////////////////////////////////////////////
100 void PGItemNotify::
101 item_without(PGItem *, const MouseWatcherParameter &) {
102 }
103 
104 ////////////////////////////////////////////////////////////////////
105 // Function: PGItemNotify::item_focus_in
106 // Access: Protected, Virtual
107 // Description: Called whenever the "focus_in" event is triggered on a
108 // watched PGItem. See PGItem::focus_in().
109 ////////////////////////////////////////////////////////////////////
110 void PGItemNotify::
111 item_focus_in(PGItem *) {
112 }
113 
114 ////////////////////////////////////////////////////////////////////
115 // Function: PGItemNotify::item_focus_out
116 // Access: Protected, Virtual
117 // Description: Called whenever the "focus_out" event is triggered on a
118 // watched PGItem. See PGItem::focus_out().
119 ////////////////////////////////////////////////////////////////////
120 void PGItemNotify::
121 item_focus_out(PGItem *) {
122 }
123 
124 ////////////////////////////////////////////////////////////////////
125 // Function: PGItemNotify::item_press
126 // Access: Protected, Virtual
127 // Description: Called whenever the "press" event is triggered on a
128 // watched PGItem. See PGItem::press().
129 ////////////////////////////////////////////////////////////////////
130 void PGItemNotify::
131 item_press(PGItem *, const MouseWatcherParameter &) {
132 }
133 
134 ////////////////////////////////////////////////////////////////////
135 // Function: PGItemNotify::item_release
136 // Access: Protected, Virtual
137 // Description: Called whenever the "release" event is triggered on a
138 // watched PGItem. See PGItem::release().
139 ////////////////////////////////////////////////////////////////////
140 void PGItemNotify::
141 item_release(PGItem *, const MouseWatcherParameter &) {
142 }
143 
144 ////////////////////////////////////////////////////////////////////
145 // Function: PGItemNotify::item_keystroke
146 // Access: Protected, Virtual
147 // Description: Called whenever the "keystroke" event is triggered on a
148 // watched PGItem. See PGItem::keystroke().
149 ////////////////////////////////////////////////////////////////////
150 void PGItemNotify::
151 item_keystroke(PGItem *, const MouseWatcherParameter &) {
152 }
153 
154 ////////////////////////////////////////////////////////////////////
155 // Function: PGItemNotify::item_candidate
156 // Access: Protected, Virtual
157 // Description: Called whenever the "candidate" event is triggered on a
158 // watched PGItem. See PGItem::candidate().
159 ////////////////////////////////////////////////////////////////////
160 void PGItemNotify::
161 item_candidate(PGItem *, const MouseWatcherParameter &) {
162 }
163 
164 ////////////////////////////////////////////////////////////////////
165 // Function: PGItemNotify::item_move
166 // Access: Protected, Virtual
167 // Description: Called whenever the "move" event is triggered on a
168 // watched PGItem. See PGItem::move().
169 ////////////////////////////////////////////////////////////////////
170 void PGItemNotify::
171 item_move(PGItem *, const MouseWatcherParameter &) {
172 }
173 
174 ////////////////////////////////////////////////////////////////////
175 // Function: PGItemNotify::add_item
176 // Access: Protected, Virtual
177 // Description: Called by PGItem when a new item is set up to
178 // notify this object.
179 ////////////////////////////////////////////////////////////////////
180 void PGItemNotify::
181 add_item(PGItem *item) {
182  bool inserted = _items.insert(item).second;
183  nassertv(inserted);
184 }
185 
186 ////////////////////////////////////////////////////////////////////
187 // Function: PGItemNotify::remove_item
188 // Access: Protected, Virtual
189 // Description: Called by PGItem when an item is no longer set up
190 // to notify this object.
191 ////////////////////////////////////////////////////////////////////
192 void PGItemNotify::
193 remove_item(PGItem *item) {
194  Items::iterator bi;
195  bi = _items.find(item);
196  nassertv(bi != _items.end());
197  _items.erase(bi);
198 }
This is the base class for all the various kinds of gui widget objects.
Definition: pgItem.h:58
PGItemNotify * get_notify() const
Returns the object which will be notified when the PGItem changes, if any.
Definition: pgItem.I:85
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...