00001 // Filename: pandaFramework.I 00002 // Created by: drose (02Apr02) 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: PandaFramework::get_graphics_engine 00022 // Access: Public 00023 // Description: Returns the GraphicsEngine that is used to render all 00024 // the windows in the framework. Normally there's no 00025 // reason for user code to mess with this. 00026 //////////////////////////////////////////////////////////////////// 00027 INLINE GraphicsEngine *PandaFramework:: 00028 get_graphics_engine() { 00029 return &_engine; 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: PandaFramework::get_data_root 00034 // Access: Public 00035 // Description: Returns the root of the data graph. This is the 00036 // graph of nodes that is traversed to control the 00037 // inputs from user devices like the mouse and keyboard. 00038 //////////////////////////////////////////////////////////////////// 00039 INLINE const NodePath &PandaFramework:: 00040 get_data_root() const { 00041 return _data_root; 00042 } 00043 00044 //////////////////////////////////////////////////////////////////// 00045 // Function: PandaFramework::get_event_handler 00046 // Access: Public 00047 // Description: Returns the EventHandler object that serves events in 00048 // the framework. This is primarily used to dispatch on 00049 // keypresses and such. 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE EventHandler &PandaFramework:: 00052 get_event_handler() { 00053 return _event_handler; 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: PandaFramework::set_window_title 00058 // Access: Public 00059 // Description: Specifies the title that is set for all subsequently 00060 // created windows. 00061 //////////////////////////////////////////////////////////////////// 00062 INLINE void PandaFramework:: 00063 set_window_title(const string &title) { 00064 _window_title = title; 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: PandaFramework::get_num_windows 00069 // Access: Public 00070 // Description: Returns the number of windows that are currently 00071 // open. 00072 //////////////////////////////////////////////////////////////////// 00073 INLINE int PandaFramework:: 00074 get_num_windows() const { 00075 return _windows.size(); 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: PandaFramework::get_window 00080 // Access: Public 00081 // Description: Returns the nth window currently open. 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE WindowFramework *PandaFramework:: 00084 get_window(int n) const { 00085 nassertr(n >= 0 && n < (int)_windows.size(), NULL); 00086 return _windows[n]; 00087 } 00088 00089 //////////////////////////////////////////////////////////////////// 00090 // Function: PandaFramework::close_window 00091 // Access: Public 00092 // Description: Closes the indicated WindowFramework window and 00093 // removes it from the list. 00094 //////////////////////////////////////////////////////////////////// 00095 INLINE void PandaFramework:: 00096 close_window(WindowFramework *wf) { 00097 int n = find_window(wf); 00098 if (n >= 0) { 00099 close_window(n); 00100 } 00101 } 00102 00103 //////////////////////////////////////////////////////////////////// 00104 // Function: PandaFramework::get_wireframe 00105 // Access: Public 00106 // Description: Returns the current state of the wireframe flag. 00107 //////////////////////////////////////////////////////////////////// 00108 INLINE bool PandaFramework:: 00109 get_wireframe() const { 00110 return _wireframe_enabled; 00111 } 00112 00113 //////////////////////////////////////////////////////////////////// 00114 // Function: PandaFramework::get_texture 00115 // Access: Public 00116 // Description: Returns the current state of the texture flag. 00117 //////////////////////////////////////////////////////////////////// 00118 INLINE bool PandaFramework:: 00119 get_texture() const { 00120 return _texture_enabled; 00121 } 00122 00123 //////////////////////////////////////////////////////////////////// 00124 // Function: PandaFramework::get_two_sided 00125 // Access: Public 00126 // Description: Returns the current state of the two_sided flag. 00127 //////////////////////////////////////////////////////////////////// 00128 INLINE bool PandaFramework:: 00129 get_two_sided() const { 00130 return _two_sided_enabled; 00131 } 00132 00133 //////////////////////////////////////////////////////////////////// 00134 // Function: PandaFramework::get_lighting 00135 // Access: Public 00136 // Description: Returns the current state of the lighting flag. 00137 //////////////////////////////////////////////////////////////////// 00138 INLINE bool PandaFramework:: 00139 get_lighting() const { 00140 return _lighting_enabled; 00141 } 00142 00143 //////////////////////////////////////////////////////////////////// 00144 // Function: PandaFramework::get_background_type 00145 // Access: Public 00146 // Description: Returns the current background type setting. 00147 //////////////////////////////////////////////////////////////////// 00148 INLINE WindowFramework::BackgroundType PandaFramework:: 00149 get_background_type() const { 00150 return _background_type; 00151 } 00152 00153 //////////////////////////////////////////////////////////////////// 00154 // Function: PandaFramework::has_highlight 00155 // Access: Public 00156 // Description: Returns true if any node is highlighted, false 00157 // otherwise. 00158 //////////////////////////////////////////////////////////////////// 00159 INLINE bool PandaFramework:: 00160 has_highlight() const { 00161 return !_highlight.is_empty(); 00162 } 00163 00164 //////////////////////////////////////////////////////////////////// 00165 // Function: PandaFramework::get_highlight 00166 // Access: Public 00167 // Description: Returns the currently highlighted node, if any, or an 00168 // empty NodePath if no node is highlighted. 00169 //////////////////////////////////////////////////////////////////// 00170 INLINE const NodePath &PandaFramework:: 00171 get_highlight() const { 00172 return _highlight; 00173 } 00174 00175 //////////////////////////////////////////////////////////////////// 00176 // Function: PandaFramework::set_exit_flag 00177 // Access: Public 00178 // Description: Sets the flag that indicates it is time for the 00179 // application to exit. The application will actually 00180 // exit at the end of the current frame. 00181 //////////////////////////////////////////////////////////////////// 00182 INLINE void PandaFramework:: 00183 set_exit_flag() { 00184 _exit_flag = true; 00185 } 00186 00187 //////////////////////////////////////////////////////////////////// 00188 // Function: PandaFramework::clear_exit_flag 00189 // Access: Public 00190 // Description: Resets the exit flag after it has previously been 00191 // set. 00192 //////////////////////////////////////////////////////////////////// 00193 INLINE void PandaFramework:: 00194 clear_exit_flag() { 00195 _exit_flag = false; 00196 }