MyGUI  3.2.0
MyGUI_Window.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_WINDOW_H__
23 #define __MYGUI_WINDOW_H__
24 
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_TextBox.h"
27 #include "MyGUI_EventPair.h"
29 
30 namespace MyGUI
31 {
32 
33  // OBSOLETE
35 
38 
40  public TextBox, // FIXME пока для кэпшена вместо виджета текст
41  public MemberObsolete<Window>
42  {
44 
45  public:
46  Window();
47 
49  virtual void setVisible(bool _value);
50 
52  void setVisibleSmooth(bool _value);
54  void destroySmooth();
55 
57  void setAutoAlpha(bool _value);
59  bool getAutoAlpha() const;
60 
62  virtual void setCaption(const UString& _value);
64  virtual const UString& getCaption();
65 
67  TextBox* getCaptionWidget();
68 
70  void setMinSize(const IntSize& _value);
72  void setMinSize(int _width, int _height);
74  IntSize getMinSize();
75 
77  void setMaxSize(const IntSize& _value);
79  void setMaxSize(int _width, int _height);
81  IntSize getMaxSize();
82 
84  virtual void setPosition(const IntPoint& _value);
86  virtual void setSize(const IntSize& _value);
88  virtual void setCoord(const IntCoord& _value);
89 
91  void setPosition(int _left, int _top);
93  void setSize(int _width, int _height);
95  void setCoord(int _left, int _top, int _width, int _height);
96 
98  void setSnap(bool _value);
100  bool getSnap() const;
101 
103  const IntCoord& getActionScale() const;
104 
106  void setMovable(bool _value);
108  bool getMovable() const;
109 
110  /*events:*/
117  eventWindowButtonPressed;
118 
124  eventWindowChangeCoord;
125 
126  protected:
127  virtual void initialiseOverride();
128  virtual void shutdownOverride();
129 
130  void onMouseChangeRootFocus(bool _focus);
131  void onKeyChangeRootFocus(bool _focus);
132  void onMouseDrag(int _left, int _top, MouseButton _id);
133  void onMouseButtonPressed(int _left, int _top, MouseButton _id);
134  void onMouseButtonReleased(int _left, int _top, MouseButton _id);
135 
136  void notifyMousePressed(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
137  void notifyMouseReleased(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
138  void notifyPressedButtonEvent(MyGUI::Widget* _sender);
139  void notifyMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MouseButton _id);
140 
141  // просто обновляет альфу взависимости от флагов
142  void updateAlpha();
143 
144  void animateStop(Widget* _widget);
145 
146  virtual void setPropertyOverride(const std::string& _key, const std::string& _value);
147 
148  private:
149  float getAlphaVisible() const;
150  void getSnappedCoord(IntCoord& _coord);
151  IntCoord _getActionScale(Widget* _widget);
152 
153  ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
154 
155  private:
156  TextBox* mWidgetCaption;
157 
158  // размеры окна перед началом его изменений
159  IntCoord mPreActionCoord;
160 
161  // наши главные фокусы
162  bool mMouseRootFocus;
163  bool mKeyRootFocus;
164 
165  // автоматическое или ручное управление альфой
166  bool mIsAutoAlpha;
167 
168  // минимальные и максимальные размеры окна
169  IntRect mMinmax;
170 
171  bool mSnap; // прилеплять ли к краям
172 
173  IntCoord mCurrentActionScale;
174  bool mAnimateSmooth;
175 
176  Widget* mClient;
177  bool mMovable;
178  };
179 
180 } // namespace MyGUI
181 
182 #endif // __MYGUI_WINDOW_H__