Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pgui/pgMouseWatcherRegion.cxx

Go to the documentation of this file.
00001 // Filename: pgMouseWatcherRegion.cxx
00002 // Created by:  drose (02Jul01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "pgMouseWatcherRegion.h"
00020 #include "pgItem.h"
00021 
00022 #include "string_utils.h"
00023 
00024 int PGMouseWatcherRegion::_next_index = 0;
00025 TypeHandle PGMouseWatcherRegion::_type_handle;
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //     Function: PGMouseWatcherRegion::Constructor
00029 //       Access: Public
00030 //  Description: 
00031 ////////////////////////////////////////////////////////////////////
00032 PGMouseWatcherRegion::
00033 PGMouseWatcherRegion(PGItem *item) :
00034 #ifndef CPPPARSER
00035   MouseWatcherRegion("pg" + format_string(_next_index++), 0, 0, 0, 0),
00036 #endif
00037   _item(item)
00038 {
00039 }
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //     Function: PGMouseWatcherRegion::Destructor
00043 //       Access: Public, Virtual
00044 //  Description: 
00045 ////////////////////////////////////////////////////////////////////
00046 PGMouseWatcherRegion::
00047 ~PGMouseWatcherRegion() {
00048 }
00049 
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //     Function: PGMouseWatcherRegion::enter
00053 //       Access: Public, Virtual
00054 //  Description: This is a callback hook function, called whenever the
00055 //               mouse enters the region.  The mouse is only
00056 //               considered to be "entered" in one region at a time;
00057 //               in the case of nested regions, it exits the outer
00058 //               region before entering the inner one.
00059 ////////////////////////////////////////////////////////////////////
00060 void PGMouseWatcherRegion::
00061 enter(const MouseWatcherParameter &param) {
00062   if (_item != (PGItem *)NULL) {
00063     _item->enter(param);
00064   }
00065 }
00066 
00067 ////////////////////////////////////////////////////////////////////
00068 //     Function: PGMouseWatcherRegion::exit
00069 //       Access: Public, Virtual
00070 //  Description: This is a callback hook function, called whenever the
00071 //               mouse exits the region.  The mouse is only considered
00072 //               to be "entered" in one region at a time; in the case
00073 //               of nested regions, it exits the outer region before
00074 //               entering the inner one.
00075 ////////////////////////////////////////////////////////////////////
00076 void PGMouseWatcherRegion::
00077 exit(const MouseWatcherParameter &param) {
00078   if (_item != (PGItem *)NULL) {
00079     _item->exit(param);
00080   }
00081 }
00082 
00083 ////////////////////////////////////////////////////////////////////
00084 //     Function: PGMouseWatcherRegion::within
00085 //       Access: Public, Virtual
00086 //  Description: This is a callback hook function, called whenever the
00087 //               mouse moves within the boundaries of the region, even
00088 //               if it is also within the boundaries of a nested
00089 //               region.  This is different from "enter", which is
00090 //               only called whenever the mouse is within only that
00091 //               region.
00092 ////////////////////////////////////////////////////////////////////
00093 void PGMouseWatcherRegion::
00094 within(const MouseWatcherParameter &param) {
00095   if (_item != (PGItem *)NULL) {
00096     _item->within(param);
00097   }
00098 }
00099 
00100 ////////////////////////////////////////////////////////////////////
00101 //     Function: PGMouseWatcherRegion::without
00102 //       Access: Public, Virtual
00103 //  Description: This is a callback hook function, called whenever the
00104 //               mouse moves completely outside the boundaries of the
00105 //               region.  See within().
00106 ////////////////////////////////////////////////////////////////////
00107 void PGMouseWatcherRegion::
00108 without(const MouseWatcherParameter &param) {
00109   if (_item != (PGItem *)NULL) {
00110     _item->without(param);
00111   }
00112 }
00113 
00114 ////////////////////////////////////////////////////////////////////
00115 //     Function: PGMouseWatcherRegion::press
00116 //       Access: Public, Virtual
00117 //  Description: This is a callback hook function, called whenever a
00118 //               mouse or keyboard button is depressed while the mouse
00119 //               is within the region.
00120 ////////////////////////////////////////////////////////////////////
00121 void PGMouseWatcherRegion::
00122 press(const MouseWatcherParameter &param) {
00123   if (_item != (PGItem *)NULL) {
00124     _item->press(param, false);
00125   }
00126 }
00127 
00128 ////////////////////////////////////////////////////////////////////
00129 //     Function: PGMouseWatcherRegion::release
00130 //       Access: Public, Virtual
00131 //  Description: This is a callback hook function, called whenever a
00132 //               mouse or keyboard button previously depressed with
00133 //               press() is released.
00134 ////////////////////////////////////////////////////////////////////
00135 void PGMouseWatcherRegion::
00136 release(const MouseWatcherParameter &param) {
00137   if (_item != (PGItem *)NULL) {
00138     _item->release(param, false);
00139   }
00140 }
00141 
00142 ////////////////////////////////////////////////////////////////////
00143 //     Function: PGMouseWatcherRegion::keystroke
00144 //       Access: Public, Virtual
00145 //  Description: This is a callback hook function, called whenever 
00146 //               the user presses a key.
00147 ////////////////////////////////////////////////////////////////////
00148 void PGMouseWatcherRegion::
00149 keystroke(const MouseWatcherParameter &param) {
00150   if (_item != (PGItem *)NULL) {
00151     _item->keystroke(param, false);
00152   }
00153 }

Generated on Fri May 2 00:42:43 2003 for Panda by doxygen1.3