Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
244 chris 1
#ifndef __BUTTONWIDGET_H__
2
#define __BUTTONWIDGET_H__
3
 
4
#include "Widget.h"
5
 
6
namespace Sexy
7
{
8
 
9
class Image;
10
class ButtonListener;
11
 
12
class ButtonWidget : public Widget
13
{
14
public:
15
        enum {
16
                BUTTON_LABEL_LEFT       = -1,
17
                BUTTON_LABEL_CENTER,
18
                BUTTON_LABEL_RIGHT
19
        };
20
        enum
21
        {
22
                COLOR_LABEL,
23
                COLOR_LABEL_HILITE,
24
                COLOR_DARK_OUTLINE,
25
                COLOR_LIGHT_OUTLINE,
26
                COLOR_MEDIUM_OUTLINE,
27
                COLOR_BKG,
28
                NUM_COLORS
29
        };
30
 
31
        int                                             mId;   
32
        SexyString                              mLabel;
33
        int                                             mLabelJustify;
34
        Font*                                   mFont;
35
        Image*                                  mButtonImage;
36
        Image*                                  mOverImage;
37
        Image*                                  mDownImage;    
38
        Image*                                  mDisabledImage;
39
        Rect                                    mNormalRect;
40
        Rect                                    mOverRect;
41
        Rect                                    mDownRect;
42
        Rect                                    mDisabledRect;
43
 
44
        bool                                    mInverted;
45
        bool                                    mBtnNoDraw;
46
        bool                                    mFrameNoDraw;
47
        ButtonListener*                 mButtonListener;
48
 
49
        double                                  mOverAlpha;
50
        double                                  mOverAlphaSpeed;
51
        double                                  mOverAlphaFadeInSpeed;
52
 
53
        bool                                    HaveButtonImage(Image *theImage, const Rect &theRect);
54
        virtual void                    DrawButtonImage(Graphics *g, Image *theImage, const Rect &theRect, int x, int y);
55
 
56
 
57
public:
58
        ButtonWidget(int theId, ButtonListener* theButtonListener);
59
        virtual ~ButtonWidget();
60
 
61
        virtual void                    SetFont(Font* theFont);
62
        virtual bool                    IsButtonDown();
63
        virtual void                    Draw(Graphics* g);
64
        virtual void                    SetDisabled(bool isDisabled);
65
        virtual void                    MouseEnter();
66
        virtual void                    MouseLeave();
67
        virtual void                    MouseMove(int theX, int theY);
68
        virtual void                    MouseDown(int theX, int theY, int theClickCount) { Widget::MouseDown(theX, theY, theClickCount); }
69
        virtual void                    MouseDown(int theX, int theY, int theBtnNum, int theClickCount);
70
        virtual void                    MouseUp(int theX, int theY) { Widget::MouseUp(theX, theY); }
71
        virtual void                    MouseUp(int theX, int theY, int theClickCount) { Widget::MouseUp(theX, theY, theClickCount); }
72
        virtual void                    MouseUp(int theX, int theY, int theBtnNum, int theClickCount);
73
        virtual void                    Update();
74
};
75
 
76
}
77
 
78
#endif //__BUTTONWIDGET_H__