00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef GCN_BUTTON_HPP
00056 #define GCN_BUTTON_HPP
00057
00058 #include <string>
00059
00060 #include "guichan/platform.h"
00061 #include "guichan/widget.h"
00062
00063 namespace gcn
00064 {
00073 class GCN_CORE_DECLSPEC Button : public Widget,
00074 public MouseListener,
00075 public KeyListener
00076 {
00077 public:
00081 Button();
00082
00088 Button(const std::string& caption);
00089
00095 virtual void setCaption(const std::string& caption);
00096
00102 virtual const std::string& getCaption() const;
00103
00110 virtual void setAlignment(unsigned int alignment);
00111
00117 virtual unsigned int getAlignment() const;
00118
00122 virtual void adjustSize();
00123
00129 virtual bool isPressed() const;
00130
00131
00132
00133
00134 virtual void draw(Graphics* graphics);
00135
00136 virtual void drawBorder(Graphics* graphics);
00137
00138 virtual void lostFocus();
00139
00140 virtual void hotKeyPress();
00141 virtual void hotKeyRelease();
00142
00143
00144
00145 virtual void mouseClick(int x, int y, int button, int count);
00146
00147 virtual void mousePress(int x, int y, int button);
00148
00149 virtual void mouseRelease(int x, int y, int button);
00150
00151
00152
00153
00154 virtual bool keyPress(const Key& key);
00155
00156 virtual bool keyRelease(const Key& key);
00157
00158 protected:
00159 std::string mCaption;
00160 bool mMouseDown, mKeyDown, mHotKeyDown;
00161 unsigned int mAlignment;
00162 };
00163 }
00164
00165 #endif // end GCN_BUTTON_HPP