00001 /************************************************************************ 00002 filename: CEGUIPopupMenu.h 00003 created: 27/3/2005 00004 author: Tomas Lindquist Olsen (based on code by Paul D Turner) 00005 00006 purpose: Interface to base class for PopupMenu widget 00007 *************************************************************************/ 00008 /************************************************************************* 00009 Crazy Eddie's GUI System (http://www.cegui.org.uk) 00010 Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk) 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 *************************************************************************/ 00026 #ifndef _CEGUIPopupMenu_h_ 00027 #define _CEGUIPopupMenu_h_ 00028 00029 #include "CEGUIBase.h" 00030 #include "CEGUIWindow.h" 00031 #include "elements/CEGUIPopupMenuProperties.h" 00032 #include "elements/CEGUIMenuBase.h" 00033 00034 00035 #if defined(_MSC_VER) 00036 # pragma warning(push) 00037 # pragma warning(disable : 4251) 00038 #endif 00039 00040 00041 // Start of CEGUI namespace section 00042 namespace CEGUI 00043 { 00044 00049 class CEGUIEXPORT PopupMenu : public MenuBase 00050 { 00051 public: 00052 static const String EventNamespace; 00053 00054 /************************************************************************* 00055 Accessor type functions 00056 *************************************************************************/ 00065 float getFadeInTime(void) const {return d_fadeInTime;} 00066 00067 00076 float getFadeOutTime(void) const {return d_fadeOutTime;} 00077 00078 00079 /************************************************************************* 00080 Manipulators 00081 *************************************************************************/ 00090 void setFadeInTime(float fadetime) {d_fadeInTime=fadetime;} 00091 00092 00101 void setFadeOutTime(float fadetime) {d_fadeOutTime=fadetime;} 00102 00107 void openPopupMenu(void); 00108 00109 00114 void closePopupMenu(void); 00115 00116 00117 /************************************************************************* 00118 Construction and Destruction 00119 *************************************************************************/ 00124 PopupMenu(const String& type, const String& name); 00125 00126 00131 virtual ~PopupMenu(void); 00132 00133 00134 protected: 00135 /************************************************************************* 00136 Implementation Functions 00137 *************************************************************************/ 00148 virtual void updateSelf(float elapsed); 00149 00150 00158 virtual void layoutItemWidgets(void); 00159 00160 00168 virtual Size getContentSize(void); 00169 00170 00181 virtual bool testClassName_impl(const String& class_name) const 00182 { 00183 if (class_name==(const utf8*)"PopupMenu") return true; 00184 return MenuBase::testClassName_impl(class_name); 00185 } 00186 00187 00188 /************************************************************************* 00189 Overridden event handlers 00190 *************************************************************************/ 00191 virtual void onAlphaChanged(WindowEventArgs& e); 00192 00193 00194 /************************************************************************* 00195 Implementation Data 00196 *************************************************************************/ 00197 float d_origAlpha; 00198 00199 float d_fadeElapsed; 00200 float d_fadeOutTime; 00201 float d_fadeInTime; 00202 bool d_fading; 00203 bool d_fadingOut; 00204 00205 private: 00206 /************************************************************************* 00207 Static Properties for this class 00208 *************************************************************************/ 00209 static PopupMenuProperties::FadeInTime d_fadeInTimeProperty; 00210 static PopupMenuProperties::FadeOutTime d_fadeOutTimeProperty; 00211 00212 00213 /************************************************************************* 00214 Private methods 00215 *************************************************************************/ 00216 void addPopupMenuProperties(void); 00217 }; 00218 00219 } // End of CEGUI namespace section 00220 00221 00222 #if defined(_MSC_VER) 00223 # pragma warning(pop) 00224 #endif 00225 00226 00227 #endif // end of guard _CEGUIPopupMenu_h_