comparison engine/core/gui/widgets/twobutton.h @ 157:bb9902910067

input_rework merged! Bad features: * Broken DND for zero-projekt. * Design short-comings.
author phoku@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 14 Oct 2008 07:41:48 +0000
parents 90005975cdbb
children d76169461729
comparison
equal deleted inserted replaced
156:376b8afc9a18 157:bb9902910067
34 // Second block: files included from the same folder 34 // Second block: files included from the same folder
35 35
36 namespace gcn { 36 namespace gcn {
37 37
38 class TwoButton; 38 class TwoButton;
39 class TwoButtonListener { 39
40 public:
41 virtual ~TwoButtonListener() {}
42 virtual void mouseEntered(TwoButton& btn) = 0;
43 virtual void mouseExited(TwoButton& btn) = 0;
44 };
45
46 class TwoButton : public Button { 40 class TwoButton : public Button {
47 public: 41 public:
48 TwoButton(Image *up_image = 0, Image *down_image = 0, Image *hover_file = 0, const std::string& caption = ""); 42 TwoButton(Image *up_image = 0, Image *down_image = 0, Image *hover_file = 0, const std::string& caption = "");
49 ~TwoButton(); 43 ~TwoButton();
50 void draw(Graphics *graphics); 44 void draw(Graphics *graphics);
56 50
57 void setDownOffset(int x, int y); 51 void setDownOffset(int x, int y);
58 int getDownXOffset() { return x_downoffset; } 52 int getDownXOffset() { return x_downoffset; }
59 int getDownYOffset() { return y_downoffset; } 53 int getDownYOffset() { return y_downoffset; }
60 54
61 void mouseEntered(MouseEvent& mouseEvent);
62 void mouseExited(MouseEvent& mouseEvent);
63
64 void setListener(TwoButtonListener* listener) { m_listener = listener; }
65 TwoButtonListener* getListener() { return m_listener; }
66
67 void setHelpText(const std::string& txt) { m_helptext = txt; } 55 void setHelpText(const std::string& txt) { m_helptext = txt; }
68 const std::string& getHelpText() { return m_helptext; } 56 const std::string& getHelpText() { return m_helptext; }
69 57
70 private: 58 private:
71 Image *m_upImage; 59 Image *m_upImage;
72 Image *m_downImage; 60 Image *m_downImage;
73 Image *m_hoverImage; 61 Image *m_hoverImage;
74 int x_downoffset; 62 int x_downoffset;
75 int y_downoffset; 63 int y_downoffset;
76 TwoButtonListener* m_listener;
77 std::string m_helptext; 64 std::string m_helptext;
78 }; 65 };
79 66
80 } 67 }
81 68