13 m_bScaleOnFocus =
TTRUE;
15 m_fRectangle1Width = 0.0f;
16 m_fRectangle1Height = 0.0f;
19 m_uiFocusedColour = 0xffffff80;
20 m_uiEnabledColour = 0xffffffff;
21 m_uiDisabledColour = 0xffc0c0c0;
22 m_fFocusedScale = 1.25f;
26 m_wszButtonText =
TNULL;
31 m_oBackgroundRect.Unlink();
42 m_oText.
Create( a_pFont, a_fWidth );
43 SetButtonColour( m_uiEnabledColour );
45 if ( m_bScaleOnFocus )
48 m_oText.SetText( a_wszText );
62 TFLOAT fHeight = m_oText.GetHeight() * a_fScaleY;
63 TFLOAT fWidth = m_oText.GetWidth() * a_fScaleX;
64 m_oBackgroundRect.SetDimensions( fWidth, fHeight );
65 m_oBackgroundRect.SetTextureSection( pTexSec );
72 m_oText.GetDimensions( a_rWidth, a_rHeight );
77 m_oText.SetAlpha( a_fAlpha );
78 m_Rectangle1.SetAlpha( a_fAlpha );
79 m_oBackgroundRect.SetAlpha( a_fAlpha );
81 for (
auto it = m_oText.ChildRBegin(); it !=
TNULL; it = m_oText.GetPrevChild( it ) )
83 it->SetAlpha( a_fAlpha );
91 m_oText.SetShadowAlpha( a_fAlpha );
93 for (
auto it = m_oText.ChildRBegin(); it !=
TNULL; it = m_oText.GetPrevChild( it ) )
95 it->SetShadowAlpha( a_fAlpha );
105 if ( m_bScaleOnFocus )
106 m_oTransform.SetScale( m_fFocusedScale, m_fFocusedScale );
108 SetButtonColour( m_uiFocusedColour );
110 if ( m_bUseRectangle1 )
115 m_Rectangle1.SetDimensions( fWidth + m_fRectangle1Width, fHeight + m_fRectangle1Height );
124 if ( m_bScaleOnFocus )
127 SetButtonColour(
IsEnabled() ? m_uiEnabledColour : m_uiDisabledColour );
129 if ( m_bUseRectangle1 )
130 m_Rectangle1.RemoveSelf();
139 SetButtonColour(
IsEnabled() ? m_uiEnabledColour : m_uiDisabledColour );
146 return m_pFont->GetLinesMargin() * 0.5f + m_fGap;
152 return m_pFont->GetLinesMargin() * 0.5f + m_fGap;
155void AGUI2Button::SetButtonColour(
TUINT a_uiColour )
161 it->SetColour( a_uiColour );
@ AGUI2ATTACHMENT_MIDDLECENTER
virtual void SetAlpha(TFLOAT a_fAlpha) override
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 SetImage(const TCHAR *a_szTexSec, TFLOAT a_fScaleX, TFLOAT a_fScaleY)
virtual void OnFocus() override
virtual TFLOAT GetFlowOffset() override
void Create(AGUI2Font *a_pFont, TFLOAT a_fWidth, const TWCHAR *a_wszText, TFLOAT a_fGap)
virtual void SetEnabled(TBOOL a_bEnabled) override
void AddChildTail(AGUI2Element &a_rElement)
AGUI2Transform m_oTransform
AGUI2Element * GetPrevChild(AGUI2Element *a_pCurrentChild)
virtual void SetColour(TUINT32 a_uiColour)
virtual void SetShadowAlpha(TFLOAT a_fAlpha)
void LinkChildBefore(AGUI2Element &a_rNewChildren, AGUI2Element &a_rInsertAfter)
AGUI2Element * ChildRBegin() const
TBOOL Create(AGUI2FontDef *a_pFontDef)
virtual void SetEnabled(TBOOL a_bEnabled)
virtual void SetAlpha(TFLOAT a_fAlpha) override
static AGUI2TextureSection * GetTextureSection(const TCHAR *a_szSectionName)