00001 // Filename: pgTop.I 00002 // Created by: drose (13Mar02) 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 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: PGTop::Copy Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE PGTop:: 00022 PGTop(const PGTop ©) : 00023 PandaNode(copy), 00024 _watcher(copy._watcher), 00025 _start_sort(copy._start_sort) 00026 { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: PGTop::get_mouse_watcher 00031 // Access: Published 00032 // Description: Returns the MouseWatcher pointer that the PGTop object 00033 // registers its PG items with, or NULL if the 00034 // MouseWatcher has not yet been set. 00035 //////////////////////////////////////////////////////////////////// 00036 INLINE MouseWatcher *PGTop:: 00037 get_mouse_watcher() const { 00038 return _watcher; 00039 } 00040 00041 //////////////////////////////////////////////////////////////////// 00042 // Function: PGTop::get_group 00043 // Access: Published 00044 // Description: Returns the MouseWatcherGroup pointer that the PGTop 00045 // object registers its PG items with, or NULL if the 00046 // MouseWatcher has not yet been set. 00047 //////////////////////////////////////////////////////////////////// 00048 INLINE MouseWatcherGroup *PGTop:: 00049 get_group() const { 00050 return _watcher_group; 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: PGTop::set_start_sort 00055 // Access: Published 00056 // Description: Specifies the sort index that is assigned during the 00057 // traversal to the first PGItem that is discovered 00058 // during traversal. Subsequent PGItems will be 00059 // assigned consecutively higher sort indexes. 00060 // 00061 // This number is used by the MouseWatcher system to 00062 // rank the clickable mouse regions in the same order in 00063 // which the items are rendered, so that items on top 00064 // will receive mouse priority. 00065 // 00066 // Normally, it makes the most sense to leave this 00067 // initial value at its default value of 0, unless you 00068 // need the PGItems to have a particular sort value with 00069 // respect to some other objects in the scene 00070 // (particularly with a second PGTop node). 00071 //////////////////////////////////////////////////////////////////// 00072 INLINE void PGTop:: 00073 set_start_sort(int start_sort) { 00074 _start_sort = start_sort; 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: PGTop::get_start_sort 00079 // Access: Published 00080 // Description: Returns the sort index that is assigned during the 00081 // traversal to the first PGItem that is discovered 00082 // during traversal. See set_start_sort(). 00083 //////////////////////////////////////////////////////////////////// 00084 INLINE int PGTop:: 00085 get_start_sort() const { 00086 return _start_sort; 00087 } 00088 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: PGTop::add_region 00092 // Access: Public 00093 // Description: Adds the indicated region to the set of regions in 00094 // the group. 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE void PGTop:: 00097 add_region(MouseWatcherRegion *region) { 00098 nassertv(_watcher_group != (PGMouseWatcherGroup *)NULL); 00099 _watcher_group->add_region(region); 00100 }