Irrlicht 3D Engine
IGUIButton.h
Go to the documentation of this file.
00001 // Copyright (C) 2002-2012 Nikolaus Gebhardt
00002 // This file is part of the "Irrlicht Engine".
00003 // For conditions of distribution and use, see copyright notice in irrlicht.h
00004 
00005 #ifndef __I_GUI_BUTTON_H_INCLUDED__
00006 #define __I_GUI_BUTTON_H_INCLUDED__
00007 
00008 #include "IGUIElement.h"
00009 
00010 namespace irr
00011 {
00012 
00013 namespace video
00014 {
00015     class ITexture;
00016 } // end namespace video
00017 
00018 namespace gui
00019 {
00020     class IGUIFont;
00021     class IGUISpriteBank;
00022 
00023     enum EGUI_BUTTON_STATE
00024     {
00026         EGBS_BUTTON_UP=0,
00028         EGBS_BUTTON_DOWN,
00030         EGBS_BUTTON_MOUSE_OVER,
00032         EGBS_BUTTON_MOUSE_OFF,
00034         EGBS_BUTTON_FOCUSED,
00036         EGBS_BUTTON_NOT_FOCUSED,
00038         EGBS_COUNT
00039     };
00040 
00042     const c8* const GUIButtonStateNames[] =
00043     {
00044         "buttonUp",
00045         "buttonDown",
00046         "buttonMouseOver",
00047         "buttonMouseOff",
00048         "buttonFocused",
00049         "buttonNotFocused",
00050         0,
00051         0,
00052     };
00053 
00055 
00058     class IGUIButton : public IGUIElement
00059     {
00060     public:
00061 
00063         IGUIButton(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
00064             : IGUIElement(EGUIET_BUTTON, environment, parent, id, rectangle) {}
00065 
00067 
00069         virtual void setOverrideFont(IGUIFont* font=0) = 0;
00070 
00072 
00073         virtual IGUIFont* getOverrideFont(void) const = 0;
00074 
00076 
00078         virtual IGUIFont* getActiveFont() const = 0;
00079 
00081 
00082         virtual void setImage(video::ITexture* image=0) = 0;
00083 
00085 
00087         virtual void setImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
00088 
00090 
00093         virtual void setPressedImage(video::ITexture* image=0) = 0;
00094 
00096 
00098         virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos) = 0;
00099 
00101         virtual void setSpriteBank(IGUISpriteBank* bank=0) = 0;
00102 
00104 
00110         virtual void setSprite(EGUI_BUTTON_STATE state, s32 index,
00111                 video::SColor color=video::SColor(255,255,255,255), bool loop=false) = 0;
00112 
00114 
00116         virtual void setIsPushButton(bool isPushButton=true) = 0;
00117 
00119         virtual void setPressed(bool pressed=true) = 0;
00120 
00122         virtual bool isPressed() const = 0;
00123 
00125         virtual void setUseAlphaChannel(bool useAlphaChannel=true) = 0;
00126 
00128         virtual bool isAlphaChannelUsed() const = 0;
00129 
00131         virtual bool isPushButton() const = 0;
00132 
00134         virtual void setDrawBorder(bool border=true) = 0;
00135 
00137         virtual bool isDrawingBorder() const = 0;
00138 
00140         virtual void setScaleImage(bool scaleImage=true) = 0;
00141 
00143         virtual bool isScalingImage() const = 0;
00144     };
00145 
00146 
00147 } // end namespace gui
00148 } // end namespace irr
00149 
00150 #endif
00151