00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __MYGUI_MESSAGE_H__
00024 #define __MYGUI_MESSAGE_H__
00025
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_Window.h"
00028 #include "MyGUI_ResourceImageSet.h"
00029 #include "MyGUI_EventPair.h"
00030 #include "MyGUI_MessageStyle.h"
00031 #include "MyGUI_ControllerFadeAlpha.h"
00032
00033 namespace MyGUI
00034 {
00035
00036 typedef delegates::CDelegate2<MessagePtr, MessageBoxStyle> EventHandle_MessagePtrMessageStyle;
00037
00038 class MYGUI_EXPORT Message :
00039 public Window
00040 {
00041 MYGUI_RTTI_DERIVED( Message );
00042
00043 public:
00044 Message();
00045
00047 void setMessageText(const UString& _value);
00048
00050 MessageBoxStyle addButtonName(const UString& _name);
00051
00053 void setSmoothShow(bool _value);
00054
00056 const std::string& getDefaultLayer() { return mDefaultLayer; }
00057
00059 void setMessageIcon(MessageBoxStyle _value);
00061 void setWindowFade(bool _value);
00062
00063 void endMessage(MessageBoxStyle _result);
00064 void endMessage();
00065
00067 void setMessageButton(MessageBoxStyle _value);
00068
00070 void setMessageStyle(MessageBoxStyle _value);
00071
00072 void setMessageModal(bool _value);
00073
00082 static MyGUI::MessagePtr createMessageBox(
00083 const std::string& _skin,
00084 const UString& _caption,
00085 const UString& _message,
00086 MessageBoxStyle _style = MessageBoxStyle::Ok | MessageBoxStyle::IconDefault,
00087 const std::string& _layer = "",
00088 bool _modal = true,
00089 const std::string& _button1 = "",
00090 const std::string& _button2 = "",
00091 const std::string& _button3 = "",
00092 const std::string& _button4 = "");
00093
00094
00096 virtual void setProperty(const std::string& _key, const std::string& _value);
00097
00098
00104 EventHandle_MessagePtrMessageStyle eventMessageBoxResult;
00105
00106
00107 virtual void _initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, WidgetPtr _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name);
00108
00109 protected:
00110 virtual ~Message();
00111
00112 void baseChangeWidgetSkin(ResourceSkin* _info);
00113
00114 void updateSize();
00115 void notifyButtonClick(MyGUI::WidgetPtr _sender);
00116 void clearButton();
00117
00118 void onKeyButtonPressed(KeyCode _key, Char _char);
00119 void _destroyMessage(MessageBoxStyle _result);
00120
00121 UString getButtonName(MessageBoxStyle _style);
00122 const char * getIconName(size_t _index);
00123 const char * getButtonName(size_t _index);
00124 const char * getButtonTag(size_t _index);
00125
00126 private:
00127 void initialiseWidgetSkin(ResourceSkin* _info);
00128 void shutdownWidgetSkin();
00129
00130 ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable);
00131
00132 private:
00133 IntSize mOffsetText;
00134 WidgetPtr mWidgetText;
00135
00136 std::string mButtonSkin, mButtonType;
00137 IntSize mButtonSize, mButtonOffset;
00138
00139 VectorWidgetPtr mVectorButton;
00140 MessageBoxStyle mInfoOk;
00141 MessageBoxStyle mInfoCancel;
00142 bool mSmoothShow;
00143
00144 std::string mDefaultLayer, mDefaultCaption;
00145 std::string mFadeSkin, mFadeLayer;
00146 WidgetPtr mWidgetFade;
00147 StaticImagePtr mIcon;
00148 int mLeftOffset1;
00149 int mLeftOffset2;
00150
00151 };
00152
00153 }
00154
00155 #endif // __MYGUI_MESSAGE_H__