MyGUI  3.0.1
MyGUI_Message.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_MESSAGE_H__
24 #define __MYGUI_MESSAGE_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_Window.h"
28 #include "MyGUI_ResourceImageSet.h"
29 #include "MyGUI_EventPair.h"
30 #include "MyGUI_MessageStyle.h"
32 
33 namespace MyGUI
34 {
35 
37 
39  public Window
40  {
42 
43  public:
44  Message();
45 
47  void setMessageText(const UString& _value);
48 
50  MessageBoxStyle addButtonName(const UString& _name);
51 
53  void setSmoothShow(bool _value);
54 
56  const std::string& getDefaultLayer() { return mDefaultLayer; }
57 
59  void setMessageIcon(MessageBoxStyle _value);
61  void setWindowFade(bool _value);
62 
63  void endMessage(MessageBoxStyle _result);
64  void endMessage();
65 
67  void setMessageButton(MessageBoxStyle _value);
68 
70  void setMessageStyle(MessageBoxStyle _value);
71 
72  void setMessageModal(bool _value);
73 
82  static MyGUI::Message* createMessageBox(
83  const std::string& _skin,
84  const UString& _caption,
85  const UString& _message,
87  const std::string& _layer = "",
88  bool _modal = true,
89  const std::string& _button1 = "",
90  const std::string& _button2 = "",
91  const std::string& _button3 = "",
92  const std::string& _button4 = "");
93 
94 
96  virtual void setProperty(const std::string& _key, const std::string& _value);
97 
98  /*event:*/
105 
106  /*internal:*/
107  virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
108 
109  protected:
110  virtual ~Message();
111 
112  void baseChangeWidgetSkin(ResourceSkin* _info);
113 
114  void updateSize();
115  void notifyButtonClick(MyGUI::Widget* _sender);
116  void clearButton();
117 
118  void onKeyButtonPressed(KeyCode _key, Char _char);
119  void _destroyMessage(MessageBoxStyle _result);
120 
121  UString getButtonName(MessageBoxStyle _style);
122  const char * getIconName(size_t _index);
123  const char * getButtonName(size_t _index);
124  const char * getButtonTag(size_t _index);
125 
126  private:
127  void initialiseWidgetSkin(ResourceSkin* _info);
128  void shutdownWidgetSkin();
129 
130  ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
131 
132  private:
133  IntSize mOffsetText;
134  Widget* mWidgetText;
135 
136  std::string mButtonSkin, mButtonType;
137  IntSize mButtonSize, mButtonOffset;
138 
139  VectorWidgetPtr mVectorButton;
140  MessageBoxStyle mInfoOk;
141  MessageBoxStyle mInfoCancel;
142  bool mSmoothShow;
143 
144  std::string mDefaultLayer, mDefaultCaption;
145  std::string mFadeSkin, mFadeLayer;
146  Widget* mWidgetFade;
147  StaticImage* mIcon;
148  int mLeftOffset1;
149  int mLeftOffset2;
150 
151  };
152 
153 } // namespace MyGUI
154 
155 #endif // __MYGUI_MESSAGE_H__