OpenBarnyard
 
Loading...
Searching...
No Matches
AGUI2Button.h
Go to the documentation of this file.
1#pragma once
2#include "AGUI2Menu.h"
3#include "AGUI2Rectangle.h"
4#include "AGUI2Font.h"
5#include "AGUI2TextBox.h"
6
8{
9public:
10 // constructors/destructor
13
14 void Create( AGUI2Font* a_pFont, TFLOAT a_fWidth, const TWCHAR* a_wszText, TFLOAT a_fGap );
15 void SetImage( const TCHAR* a_szTexSec, TFLOAT a_fScaleX, TFLOAT a_fScaleY );
16
17 void SetId( TINT a_iID ) { m_iButtonID = a_iID; }
18 TINT GetId() const { return m_iButtonID; }
19
20 void SetScaleOnFocus( TBOOL a_bScaleOnFocus ) { m_bScaleOnFocus = a_bScaleOnFocus; }
21 void SetFocusedScale( TFLOAT a_fScale ) { m_fFocusedScale = a_fScale; }
22 void SetFocusedColour( TUINT a_uiColour ) { m_uiFocusedColour = a_uiColour; }
23 void SetEnabledColour( TUINT a_uiColour ) { m_uiEnabledColour = a_uiColour; }
24 void SetDisabledColour( TUINT a_uiColour ) { m_uiDisabledColour = a_uiColour; }
25
26 void SetTextShadow( TBOOL a_bEnabled, TUINT32 a_uiColour, TFLOAT a_fAlpha )
27 {
28 m_oText.SetShadow( a_bEnabled, a_uiColour );
29 m_oText.SetShadowAlpha( a_fAlpha );
30 }
31
32 void SetTextShadowOffset( TFLOAT a_fOffset ) { m_oText.SetShadowOffset( a_fOffset, a_fOffset ); }
33 void SetTextShadowOffset( TFLOAT a_fOffsetX, TFLOAT a_fOffsetY ) { m_oText.SetShadowOffset( a_fOffsetX, a_fOffsetY ); }
34
35 AGUI2Rectangle& GetBackground() { return m_oBackgroundRect; }
36 AGUI2TextBox& GetTextBox() { return m_oText; }
37
38 //-----------------------------------------------------------------------------
39 // AGUI2Element
40 //-----------------------------------------------------------------------------
41 virtual void GetDimensions( TFLOAT& a_rWidth, TFLOAT& a_rHeight ) OVERRIDE;
42 virtual void SetAlpha( TFLOAT a_fAlpha ) OVERRIDE;
43 virtual void SetShadowAlpha( TFLOAT a_fAlpha ) OVERRIDE;
44
45 //-----------------------------------------------------------------------------
46 // AGUI2MenuItem
47 //-----------------------------------------------------------------------------
48 virtual void OnFocus() OVERRIDE;
49 virtual void OnFocusLost() OVERRIDE;
50 virtual void SetEnabled( TBOOL a_bEnabled ) OVERRIDE;
53
54private:
55 void SetButtonColour( TUINT a_uiColour );
56
57private:
58 TINT m_iButtonID;
59 TBOOL m_bScaleOnFocus;
60 TBOOL m_bFocused;
61 TFLOAT m_fRectangle1Width;
62 TFLOAT m_fRectangle1Height;
63 TBOOL m_bUseRectangle1;
64 TINT m_Unk3;
65 AGUI2Rectangle m_Rectangle1;
66 TUINT m_uiFocusedColour;
67 TUINT m_Unk4;
68 TUINT m_uiEnabledColour;
69 TUINT m_uiDisabledColour;
70 TFLOAT m_fFocusedScale;
71 TFLOAT m_fScale;
72 AGUI2Font* m_pFont;
73 AGUI2TextBox m_oText;
74 TFLOAT m_fGap;
75 const TWCHAR* m_wszButtonText;
76 AGUI2Rectangle m_oBackgroundRect;
77};
#define OVERRIDE
Definition Defines.h:12
wchar_t TWCHAR
Definition Typedefs.h:21
unsigned int TUINT
Definition Typedefs.h:8
char TCHAR
Definition Typedefs.h:20
float TFLOAT
Definition Typedefs.h:4
uint32_t TUINT32
Definition Typedefs.h:13
int TINT
Definition Typedefs.h:7
bool TBOOL
Definition Typedefs.h:6
virtual void SetAlpha(TFLOAT a_fAlpha) override
AGUI2Rectangle & GetBackground()
Definition AGUI2Button.h:35
virtual TFLOAT GetFlowVisualOffset() override
virtual void OnFocusLost() override
virtual void SetShadowAlpha(TFLOAT a_fAlpha) override
virtual void GetDimensions(TFLOAT &a_rWidth, TFLOAT &a_rHeight) override
void SetFocusedScale(TFLOAT a_fScale)
Definition AGUI2Button.h:21
void SetTextShadowOffset(TFLOAT a_fOffsetX, TFLOAT a_fOffsetY)
Definition AGUI2Button.h:33
void SetFocusedColour(TUINT a_uiColour)
Definition AGUI2Button.h:22
void SetScaleOnFocus(TBOOL a_bScaleOnFocus)
Definition AGUI2Button.h:20
void SetEnabledColour(TUINT a_uiColour)
Definition AGUI2Button.h:23
AGUI2TextBox & GetTextBox()
Definition AGUI2Button.h:36
void SetDisabledColour(TUINT a_uiColour)
Definition AGUI2Button.h:24
void SetImage(const TCHAR *a_szTexSec, TFLOAT a_fScaleX, TFLOAT a_fScaleY)
virtual void OnFocus() override
void SetTextShadow(TBOOL a_bEnabled, TUINT32 a_uiColour, TFLOAT a_fAlpha)
Definition AGUI2Button.h:26
virtual TFLOAT GetFlowOffset() override
void Create(AGUI2Font *a_pFont, TFLOAT a_fWidth, const TWCHAR *a_wszText, TFLOAT a_fGap)
TINT GetId() const
Definition AGUI2Button.h:18
virtual void SetEnabled(TBOOL a_bEnabled) override
void SetTextShadowOffset(TFLOAT a_fOffset)
Definition AGUI2Button.h:32
void SetId(TINT a_iID)
Definition AGUI2Button.h:17