1 /*! 2 @file 3 @author Albert Semenov 4 @date 12/2008 5 */ 6 #ifndef MENU_1_H_ 7 #define MENU_1_H_ 8 9 #include <MyGUI.h> 10 #include "BaseLayout/BaseLayout.h" 11 12 namespace demo 13 { 14 15 struct ControllerType 16 { 17 enum EnumType 18 { 19 Jump, 20 Accelerated, 21 Slowed, 22 Inertional, 23 MAX 24 }; 25 26 ControllerType(EnumType _value = MAX) : valueControllerType27 value(_value) 28 { 29 } 30 31 friend bool operator == (ControllerType const& a, ControllerType const& b) 32 { 33 return a.value == b.value; 34 } 35 36 friend bool operator != (ControllerType const& a, ControllerType const& b) 37 { 38 return a.value != b.value; 39 } 40 41 private: 42 EnumType value; 43 }; 44 45 class State : 46 public wraps::BaseLayout 47 { 48 public: 49 State(const std::string& _layout, ControllerType _type); 50 virtual ~State(); 51 52 MyGUI::Widget* getClient(); 53 54 void setVisible(bool _visible); 55 56 MyGUI::delegates::CDelegate2<ControllerType, bool> eventButtonPress; 57 58 private: 59 void notifyMouseButtonClick(MyGUI::Widget* _sender); 60 void notifyFrameEvent(float _time); 61 void notifyPostAction(MyGUI::Widget* _sender, MyGUI::ControllerItem* _controller); 62 63 MyGUI::ControllerPosition* createControllerPosition(const MyGUI::IntPoint& _point); 64 MyGUI::ControllerFadeAlpha* createControllerFadeAlpha(float _alpha, float _coef, bool _enable); 65 66 void FrameAdvise(bool _advise); 67 68 private: 69 bool mFrameAdvise; 70 MyGUI::Button* mButton1; 71 MyGUI::Button* mButton2; 72 MyGUI::Button* mButton3; 73 MyGUI::Button* mButton4; 74 float mCountTime; 75 ControllerType mType; 76 }; 77 78 } // namespace demo 79 80 #endif // MENU_1_H_ 81