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
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 #ifndef KYRA_BUTTONWIDGET_INCLUDED
00070 #define KYRA_BUTTONWIDGET_INCLUDED
00071
00072 #include "../gui/widget.h"
00073
00077 class KrButton : public KrWidget
00078 {
00079 public:
00080 virtual ~KrButton();
00081
00083 void SetTextChar( const std::string& text );
00084
00096 void SetIcon( KrSprite* giveSprite );
00097
00098
00099 virtual void AddedtoTree();
00100
00101 protected:
00102 KrButton( int width,
00103 int height,
00104 const KrScheme& scheme );
00105 KrButton( KrSprite* graphic,
00106 const KrScheme& scheme );
00107
00108
00109 enum
00110 {
00111 OVER = 0x01,
00112 DOWN = 0x02,
00113
00114 ICON_DEPTH = 1,
00115 TEXT_DEPTH = 2,
00116 };
00117 void SetMode( int mode );
00118 void PlaceText();
00119 void PlaceIcon();
00120
00121 int width, height, mode;
00122
00123 private:
00124 KrImNode *holder;
00125 KrBoxResource *plateRes;
00126 KrBox *plate;
00127 KrBevelElement bevel;
00128 KrSprite *icon;
00129 bool userDrawn;
00130 int iconX, iconY;
00131
00132 KrTextBox* textBox;
00133 std::string text;
00134 };
00135
00136
00154 class KrPushButton : public KrButton
00155 {
00156 public:
00158 KrPushButton( int width,
00159 int height,
00160 const KrScheme& scheme ) : KrButton( width, height, scheme ) {}
00161
00166 KrPushButton( KrSprite* graphic,
00167 const KrScheme& scheme ) : KrButton( graphic, scheme ) {}
00168
00169 ~KrPushButton() {}
00170
00171 virtual int IsMouseListener() { return LEFT_MOUSE; }
00172 virtual void MouseIn( bool down, bool in );
00173 virtual void MouseMove( bool down, int x, int y );
00174 virtual void MouseClick( int down, int x, int y );
00175
00176
00177
00178
00179
00180 virtual void Accelerate( bool down );
00181 };
00182
00183
00201 class KrToggleButton : public KrButton
00202 {
00203 public:
00205 KrToggleButton( int width,
00206 int height,
00207 const KrScheme& scheme ) : KrButton( width, height, scheme ) {}
00208
00213 KrToggleButton( KrSprite* graphic,
00214 const KrScheme& scheme ) : KrButton( graphic, scheme ) {}
00215
00216 ~KrToggleButton() {}
00217
00218 virtual int IsMouseListener() { return LEFT_MOUSE; }
00219 virtual void MouseIn( bool down, bool in );
00220 virtual void MouseMove( bool down, int x, int y );
00221 virtual void MouseClick( int down, int x, int y );
00222
00223
00224
00225 virtual bool IsSelectable() { return true; }
00226 virtual void Selected( bool selected );
00227 virtual void Accelerate( bool down );
00228 };
00229
00230
00231 #endif
00232