My Project
D:/source/c++/Programme/sally/sally/sallyAPI/Button.h
Go to the documentation of this file.
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 #pragma once
00029 #include "Define.h"
00030 #include "Control.h"
00031 #include "ParameterHoldClick.h"
00032 
00033 namespace SallyAPI
00034 {
00035         namespace GUI
00036         {
00042 
00043                 enum ButtonType {BUTTON_TYPE_NORMAL, BUTTON_TYPE_ONLY_IMAGE, BUTTON_TYPE_FOUR_TEXTS};
00044 
00053 
00054                 class DLL_API_SALLY CButton :
00055                         public SallyAPI::GUI::CControl
00056                 {
00057                 protected:
00058                         int                             m_iImage;
00059                         std::string             m_strImageText;
00060                         bool                    m_bImageTextLocalised;
00061                         D3DCOLOR                m_rgbImageFontColour;
00062                         ButtonType              m_eType;
00063 
00065                         int                     m_iImageSize;
00067                         bool            m_bImageLeft;
00069                         bool            m_bChecked;
00071                         bool            m_bActive;
00073                         bool            m_bDefaultButton;
00074                         float           m_fDeltaStart;
00076                         bool            m_bUseHoleWidth;
00078                         std::string     m_strFourTexts[4];
00080                         int                     m_iFourTextsActive;
00081 
00082 
00083                         void                    DrawImageText(int x, int y, int width, int height);
00084                         void                    DrawFourTextItem(RECT r, const std::string& text, bool active, int itemNumber = -1, bool pressed = false);
00085 
00086                         virtual void    RenderControl();
00087 
00088                         virtual bool    ProcessMouseUp(int x, int y);
00089                         virtual bool    ProcessMouseMove(int x, int y);
00090                 public:
00091                         CButton(SallyAPI::GUI::CGUIBaseObject* parent, int x, int y, int width, int height, int controlId = 0,
00092                                 ButtonType type = BUTTON_TYPE_NORMAL);
00093                         virtual ~CButton();
00094 
00095                         virtual void Timer(float timeDelta);
00096 
00097                         bool    GetCheckStatus();
00098                         void    SetCheckStatus(bool value);
00099 
00100                         void    SetActive(bool set);
00101                         bool    GetActive();
00102 
00103                         void    SetDefaultButton(bool value);
00104                         bool    GetDefaultButton();
00105 
00106                         void    SetImageLeft();
00107                         void    SetImageRight();
00108                         void    SetImageId(int image);
00109 
00110                         bool    IsUseHoleWidth();
00111                         void    UseHoleWidth(bool use);
00112 
00113                         void            SetFourTexts(int i, const std::string& text);
00114                         std::string     GetFourTexts(int i);
00115 
00116                         void            SetFourTextActive(int i);
00117 
00118                         virtual void            SetImageText(const std::string& text);
00119                         virtual std::string     GetImageText();
00120 
00121                         virtual void            SetImageTextColor(D3DCOLOR rgbFontColour);
00122 
00123                         virtual bool            IsImageTextLocalised();
00124                         virtual void            SetImageTextLocalised(bool localised);
00125                 };
00126         }
00127 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines