Panda3D

pgItemNotify.cxx

00001 // Filename: pgItemNotify.cxx
00002 // Created by:  drose (18Aug05)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "pgItemNotify.h"
00016 #include "pgItem.h"
00017 
00018 ////////////////////////////////////////////////////////////////////
00019 //     Function: PGItemNotify::Destructor
00020 //       Access: Public, Virtual
00021 //  Description: 
00022 ////////////////////////////////////////////////////////////////////
00023 PGItemNotify::
00024 ~PGItemNotify() {
00025   while (!_items.empty()) {
00026     // Disconnect all of the items that are connected to this
00027     // object.
00028     PGItem *item = (*_items.begin());
00029     nassertv(item->get_notify() == this);
00030     (*_items.begin())->set_notify(NULL);
00031   }
00032 }
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //     Function: PGItemNotify::item_transform_changed
00036 //       Access: Protected, Virtual
00037 //  Description: Called whenever a watched PGItem's local transform
00038 //               has been changed.
00039 ////////////////////////////////////////////////////////////////////
00040 void PGItemNotify::
00041 item_transform_changed(PGItem *) {
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: PGItemNotify::item_frame_changed
00046 //       Access: Protected, Virtual
00047 //  Description: Called whenever a watched PGItem's frame
00048 //               has been changed.
00049 ////////////////////////////////////////////////////////////////////
00050 void PGItemNotify::
00051 item_frame_changed(PGItem *) {
00052 }
00053 
00054 ////////////////////////////////////////////////////////////////////
00055 //     Function: PGItemNotify::item_draw_mask_changed
00056 //       Access: Protected, Virtual
00057 //  Description: Called whenever a watched PGItem's draw_mask
00058 //               has been changed.
00059 ////////////////////////////////////////////////////////////////////
00060 void PGItemNotify::
00061 item_draw_mask_changed(PGItem *) {
00062 }
00063 
00064 ////////////////////////////////////////////////////////////////////
00065 //     Function: PGItemNotify::item_enter
00066 //       Access: Protected, Virtual
00067 //  Description: Called whenever the "enter" event is triggered on a
00068 //               watched PGItem.  See PGItem::enter_region().
00069 ////////////////////////////////////////////////////////////////////
00070 void PGItemNotify::
00071 item_enter(PGItem *, const MouseWatcherParameter &) {
00072 }
00073 
00074 ////////////////////////////////////////////////////////////////////
00075 //     Function: PGItemNotify::item_exit
00076 //       Access: Protected, Virtual
00077 //  Description: Called whenever the "exit" event is triggered on a
00078 //               watched PGItem.  See PGItem::exit_region().
00079 ////////////////////////////////////////////////////////////////////
00080 void PGItemNotify::
00081 item_exit(PGItem *, const MouseWatcherParameter &) {
00082 }
00083 
00084 ////////////////////////////////////////////////////////////////////
00085 //     Function: PGItemNotify::item_within
00086 //       Access: Protected, Virtual
00087 //  Description: Called whenever the "within" event is triggered on a
00088 //               watched PGItem.  See PGItem::within_region().
00089 ////////////////////////////////////////////////////////////////////
00090 void PGItemNotify::
00091 item_within(PGItem *, const MouseWatcherParameter &) {
00092 }
00093 
00094 ////////////////////////////////////////////////////////////////////
00095 //     Function: PGItemNotify::item_without
00096 //       Access: Protected, Virtual
00097 //  Description: Called whenever the "without" event is triggered on a
00098 //               watched PGItem.  See PGItem::without_region().
00099 ////////////////////////////////////////////////////////////////////
00100 void PGItemNotify::
00101 item_without(PGItem *, const MouseWatcherParameter &) {
00102 }
00103 
00104 ////////////////////////////////////////////////////////////////////
00105 //     Function: PGItemNotify::item_focus_in
00106 //       Access: Protected, Virtual
00107 //  Description: Called whenever the "focus_in" event is triggered on a
00108 //               watched PGItem.  See PGItem::focus_in().
00109 ////////////////////////////////////////////////////////////////////
00110 void PGItemNotify::
00111 item_focus_in(PGItem *) {
00112 }
00113 
00114 ////////////////////////////////////////////////////////////////////
00115 //     Function: PGItemNotify::item_focus_out
00116 //       Access: Protected, Virtual
00117 //  Description: Called whenever the "focus_out" event is triggered on a
00118 //               watched PGItem.  See PGItem::focus_out().
00119 ////////////////////////////////////////////////////////////////////
00120 void PGItemNotify::
00121 item_focus_out(PGItem *) {
00122 }
00123 
00124 ////////////////////////////////////////////////////////////////////
00125 //     Function: PGItemNotify::item_press
00126 //       Access: Protected, Virtual
00127 //  Description: Called whenever the "press" event is triggered on a
00128 //               watched PGItem.  See PGItem::press().
00129 ////////////////////////////////////////////////////////////////////
00130 void PGItemNotify::
00131 item_press(PGItem *, const MouseWatcherParameter &) {
00132 }
00133 
00134 ////////////////////////////////////////////////////////////////////
00135 //     Function: PGItemNotify::item_release
00136 //       Access: Protected, Virtual
00137 //  Description: Called whenever the "release" event is triggered on a
00138 //               watched PGItem.  See PGItem::release().
00139 ////////////////////////////////////////////////////////////////////
00140 void PGItemNotify::
00141 item_release(PGItem *, const MouseWatcherParameter &) {
00142 }
00143 
00144 ////////////////////////////////////////////////////////////////////
00145 //     Function: PGItemNotify::item_keystroke
00146 //       Access: Protected, Virtual
00147 //  Description: Called whenever the "keystroke" event is triggered on a
00148 //               watched PGItem.  See PGItem::keystroke().
00149 ////////////////////////////////////////////////////////////////////
00150 void PGItemNotify::
00151 item_keystroke(PGItem *, const MouseWatcherParameter &) {
00152 }
00153 
00154 ////////////////////////////////////////////////////////////////////
00155 //     Function: PGItemNotify::item_candidate
00156 //       Access: Protected, Virtual
00157 //  Description: Called whenever the "candidate" event is triggered on a
00158 //               watched PGItem.  See PGItem::candidate().
00159 ////////////////////////////////////////////////////////////////////
00160 void PGItemNotify::
00161 item_candidate(PGItem *, const MouseWatcherParameter &) {
00162 }
00163 
00164 ////////////////////////////////////////////////////////////////////
00165 //     Function: PGItemNotify::item_move
00166 //       Access: Protected, Virtual
00167 //  Description: Called whenever the "move" event is triggered on a
00168 //               watched PGItem.  See PGItem::move().
00169 ////////////////////////////////////////////////////////////////////
00170 void PGItemNotify::
00171 item_move(PGItem *, const MouseWatcherParameter &) {
00172 }
00173 
00174 ////////////////////////////////////////////////////////////////////
00175 //     Function: PGItemNotify::add_item
00176 //       Access: Protected, Virtual
00177 //  Description: Called by PGItem when a new item is set up to
00178 //               notify this object.
00179 ////////////////////////////////////////////////////////////////////
00180 void PGItemNotify::
00181 add_item(PGItem *item) {
00182   bool inserted = _items.insert(item).second;
00183   nassertv(inserted);
00184 }
00185 
00186 ////////////////////////////////////////////////////////////////////
00187 //     Function: PGItemNotify::remove_item
00188 //       Access: Protected, Virtual
00189 //  Description: Called by PGItem when an item is no longer set up
00190 //               to notify this object.
00191 ////////////////////////////////////////////////////////////////////
00192 void PGItemNotify::
00193 remove_item(PGItem *item) {
00194   Items::iterator bi;
00195   bi = _items.find(item);
00196   nassertv(bi != _items.end());
00197   _items.erase(bi);
00198 }
 All Classes Functions Variables Enumerations