MyGUI
3.2.0
|
00001 00006 /* 00007 This file is part of MyGUI. 00008 00009 MyGUI is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU Lesser General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 MyGUI is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 #ifndef __MYGUI_WINDOW_H__ 00023 #define __MYGUI_WINDOW_H__ 00024 00025 #include "MyGUI_Prerequest.h" 00026 #include "MyGUI_TextBox.h" 00027 #include "MyGUI_EventPair.h" 00028 #include "MyGUI_ControllerFadeAlpha.h" 00029 00030 namespace MyGUI 00031 { 00032 00033 // OBSOLETE 00034 typedef delegates::CMultiDelegate2<Widget*, const std::string&> EventHandle_WidgetString; 00035 00036 typedef delegates::CMultiDelegate2<Window*, const std::string&> EventHandle_WindowPtrCStringRef; 00037 typedef delegates::CMultiDelegate1<Window*> EventHandle_WindowPtr; 00038 00039 class MYGUI_EXPORT Window : 00040 public TextBox, // FIXME пока для кэпшена вместо виджета текст 00041 public MemberObsolete<Window> 00042 { 00043 MYGUI_RTTI_DERIVED( Window ) 00044 00045 public: 00046 Window(); 00047 00049 virtual void setVisible(bool _value); 00050 00052 void setVisibleSmooth(bool _value); 00054 void destroySmooth(); 00055 00057 void setAutoAlpha(bool _value); 00059 bool getAutoAlpha() const; 00060 00062 virtual void setCaption(const UString& _value); 00064 virtual const UString& getCaption(); 00065 00067 TextBox* getCaptionWidget(); 00068 00070 void setMinSize(const IntSize& _value); 00072 void setMinSize(int _width, int _height); 00074 IntSize getMinSize(); 00075 00077 void setMaxSize(const IntSize& _value); 00079 void setMaxSize(int _width, int _height); 00081 IntSize getMaxSize(); 00082 00084 virtual void setPosition(const IntPoint& _value); 00086 virtual void setSize(const IntSize& _value); 00088 virtual void setCoord(const IntCoord& _value); 00089 00091 void setPosition(int _left, int _top); 00093 void setSize(int _width, int _height); 00095 void setCoord(int _left, int _top, int _width, int _height); 00096 00098 void setSnap(bool _value); 00100 bool getSnap() const; 00101 00103 const IntCoord& getActionScale() const; 00104 00106 void setMovable(bool _value); 00108 bool getMovable() const; 00109 00110 /*events:*/ 00116 EventPair<EventHandle_WidgetString, EventHandle_WindowPtrCStringRef> 00117 eventWindowButtonPressed; 00118 00123 EventPair<EventHandle_WidgetVoid, EventHandle_WindowPtr> 00124 eventWindowChangeCoord; 00125 00126 protected: 00127 virtual void initialiseOverride(); 00128 virtual void shutdownOverride(); 00129 00130 void onMouseChangeRootFocus(bool _focus); 00131 void onKeyChangeRootFocus(bool _focus); 00132 void onMouseDrag(int _left, int _top, MouseButton _id); 00133 void onMouseButtonPressed(int _left, int _top, MouseButton _id); 00134 void onMouseButtonReleased(int _left, int _top, MouseButton _id); 00135 00136 void notifyMousePressed(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id); 00137 void notifyMouseReleased(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id); 00138 void notifyPressedButtonEvent(MyGUI::Widget* _sender); 00139 void notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id); 00140 00141 // просто обновляет альфу взависимости от флагов 00142 void updateAlpha(); 00143 00144 void animateStop(Widget* _widget); 00145 00146 virtual void setPropertyOverride(const std::string& _key, const std::string& _value); 00147 00148 private: 00149 float getAlphaVisible() const; 00150 void getSnappedCoord(IntCoord& _coord); 00151 IntCoord _getActionScale(Widget* _widget); 00152 00153 ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable); 00154 00155 private: 00156 TextBox* mWidgetCaption; 00157 00158 // размеры окна перед началом его изменений 00159 IntCoord mPreActionCoord; 00160 00161 // наши главные фокусы 00162 bool mMouseRootFocus; 00163 bool mKeyRootFocus; 00164 00165 // автоматическое или ручное управление альфой 00166 bool mIsAutoAlpha; 00167 00168 // минимальные и максимальные размеры окна 00169 IntRect mMinmax; 00170 00171 bool mSnap; // прилеплять ли к краям 00172 00173 IntCoord mCurrentActionScale; 00174 bool mAnimateSmooth; 00175 00176 Widget* mClient; 00177 bool mMovable; 00178 }; 00179 00180 } // namespace MyGUI 00181 00182 #endif // __MYGUI_WINDOW_H__