forked from 0ad/0ad
e21ebb37f5
This was SVN commit r141.
99 lines
1.9 KiB
C++
Executable File
99 lines
1.9 KiB
C++
Executable File
/*
|
|
GUI Object - Button
|
|
by Gustav Larsson
|
|
gee@pyro.nu
|
|
|
|
--Overview--
|
|
|
|
GUI Object representing a simple button
|
|
|
|
--More info--
|
|
|
|
Check GUI.h
|
|
|
|
*/
|
|
|
|
#ifndef CButton_H
|
|
#define CButton_H
|
|
|
|
//--------------------------------------------------------
|
|
// Includes / Compiler directives
|
|
//--------------------------------------------------------
|
|
#include "GUI.h"
|
|
|
|
//--------------------------------------------------------
|
|
// Macros
|
|
//--------------------------------------------------------
|
|
|
|
//--------------------------------------------------------
|
|
// Types
|
|
//--------------------------------------------------------
|
|
|
|
//--------------------------------------------------------
|
|
// Declarations
|
|
//--------------------------------------------------------
|
|
|
|
/**
|
|
* Button Settings
|
|
*/
|
|
struct SButtonSettings
|
|
{
|
|
CStr m_Font;
|
|
CStr m_Sprite;
|
|
CStr m_SpriteDisabled;
|
|
CStr m_SpriteOver;
|
|
CStr m_SpritePressed;
|
|
EAlign m_TextAlign;
|
|
CColor m_TextColor;
|
|
CColor m_TextColorDisabled;
|
|
CColor m_TextColorOver;
|
|
CColor m_TextColorPressed;
|
|
EValign m_TextValign;
|
|
CStr m_ToolTip;
|
|
CStr m_ToolTipStyle;
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
/**
|
|
* @author Gustav Larsson
|
|
*
|
|
* Button
|
|
*
|
|
* @see IGUIObject
|
|
* @see IGUISettingsObject
|
|
* @see IGUIButtonBehavior
|
|
* @see SButtonSettings
|
|
*/
|
|
class CButton : public IGUISettingsObject<SButtonSettings>, public IGUIButtonBehavior
|
|
{
|
|
GUI_OBJECT(CButton)
|
|
|
|
public:
|
|
CButton();
|
|
virtual ~CButton();
|
|
|
|
/**
|
|
* Since we're doing multiple inheritance, this is to avoid error message
|
|
*
|
|
* @return Settings infos
|
|
*/
|
|
virtual map_Settings GetSettingsInfo() const { return IGUISettingsObject<SButtonSettings>::m_SettingsInfo; }
|
|
|
|
virtual void ResetStates() { IGUIButtonBehavior::ResetStates(); }
|
|
|
|
/**
|
|
* Handle Messages
|
|
*
|
|
* @param Message GUI Message
|
|
*/
|
|
virtual void HandleMessage(const SGUIMessage &Message);
|
|
|
|
/**
|
|
* Draws the Button
|
|
*/
|
|
virtual void Draw();
|
|
};
|
|
|
|
#endif
|