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_RADIOBUTTON_HPP
00056 #define GCN_RADIOBUTTON_HPP
00057
00058 #include <map>
00059 #include <string>
00060
00061 #include "guichan/keylistener.h"
00062 #include "guichan/mouselistener.h"
00063 #include "guichan/platform.h"
00064 #include "guichan/widget.h"
00065
00066 namespace gcn
00067 {
00072 class GCN_CORE_DECLSPEC RadioButton :
00073 public Widget,
00074 public MouseListener,
00075 public KeyListener
00076 {
00077 public:
00078
00082 RadioButton();
00083
00091 RadioButton(const std::string &caption,
00092 const std::string &group,
00093 bool marked=false);
00094
00098 virtual ~RadioButton();
00099
00105 virtual void drawBox(Graphics *graphics);
00106
00112 virtual bool isMarked() const;
00113
00119 virtual void setMarked(bool marked);
00120
00126 virtual const std::string &getCaption() const;
00127
00133 virtual void setCaption(const std::string &caption);
00134
00140 virtual void setGroup(const std::string &group);
00141
00147 virtual const std::string &getGroup() const;
00148
00152 virtual void adjustSize();
00153
00154
00155
00156
00157 virtual void draw(Graphics* graphics);
00158
00159 virtual void drawBorder(Graphics* graphics);
00160
00161
00162
00163
00164 virtual bool keyPress(const Key& key);
00165
00166
00167
00168
00169 virtual void mouseClick(int x, int y, int button, int count);
00170
00171 protected:
00172 bool mMarked;
00173 std::string mCaption;
00174 std::string mGroup;
00175
00176 typedef std::multimap<std::string, RadioButton *> GroupMap;
00177 typedef GroupMap::iterator GroupIterator;
00178
00179 static GroupMap mGroupMap;
00180 };
00181 }
00182
00183 #endif // end GCN_RADIOBUTTON_HPP