From f56bb35301836e56582a575a75864392a0177875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20P=2E=20Tjern=C3=B8?= Date: Mon, 2 Dec 2013 19:31:46 -0800 Subject: Fix line endings. WHAMMY. --- mp/src/vgui2/vgui_controls/ExpandButton.cpp | 228 ++++++++++++++-------------- 1 file changed, 114 insertions(+), 114 deletions(-) (limited to 'mp/src/vgui2/vgui_controls/ExpandButton.cpp') diff --git a/mp/src/vgui2/vgui_controls/ExpandButton.cpp b/mp/src/vgui2/vgui_controls/ExpandButton.cpp index 5c891acc..a4489d0e 100644 --- a/mp/src/vgui2/vgui_controls/ExpandButton.cpp +++ b/mp/src/vgui2/vgui_controls/ExpandButton.cpp @@ -1,114 +1,114 @@ -//========= Copyright Valve Corporation, All rights reserved. ============// -// -// Purpose: -// -// $NoKeywords: $ -//===========================================================================// - -#include -#include - -#include -#include -#include - -#include -#include -#include - -// memdbgon must be the last include file in a .cpp file!!! -#include - -using namespace vgui; - -DECLARE_BUILD_FACTORY( ExpandButton ); - -//----------------------------------------------------------------------------- -// Purpose: Constructor -//----------------------------------------------------------------------------- -ExpandButton::ExpandButton( Panel *parent, const char *panelName ) : ToggleButton( parent, panelName, "" ) -{ - m_bExpandable = true; - m_hFont = INVALID_FONT; -} - - -//----------------------------------------------------------------------------- -// Purpose: Destructor -//----------------------------------------------------------------------------- -ExpandButton::~ExpandButton() -{ -} - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -void ExpandButton::ApplySchemeSettings(IScheme *pScheme) -{ - BaseClass::ApplySchemeSettings(pScheme); - - m_Color = GetSchemeColor( "ExpandButton.Color", pScheme ); - m_hFont = pScheme->GetFont("Marlett", IsProportional() ); - - // don't draw a background - SetPaintBackgroundEnabled(false); -} - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -IBorder *ExpandButton::GetBorder(bool depressed, bool armed, bool selected, bool keyfocus) -{ - return NULL; -} - - -//----------------------------------------------------------------------------- -// Purpose: Expand the button -//----------------------------------------------------------------------------- -void ExpandButton::SetSelected(bool state) -{ - if ( m_bExpandable && ( state != IsSelected() ) ) - { - // send a message saying we've been checked - KeyValues *msg = new KeyValues("Expanded", "state", (int)state); - PostActionSignal(msg); - - BaseClass::SetSelected(state); - } -} - - -//----------------------------------------------------------------------------- -// Purpose: sets whether or not the state of the check can be changed -//----------------------------------------------------------------------------- -void ExpandButton::SetExpandable(bool state) -{ - m_bExpandable = state; - Repaint(); -} - - -void ExpandButton::Paint() -{ - surface()->DrawSetTextFont( m_hFont ); - - wchar_t code = IsSelected( ) ? L'6' : L'4'; - wchar_t pString[2] = { code, 0 }; - - // draw selected check - int tw, th, w, h; - GetSize( w, h ); - surface()->GetTextSize( m_hFont, pString, tw, th ); - surface()->DrawSetTextColor( m_Color ); - surface()->DrawSetTextPos( ( w - tw ) / 2, ( h - th ) / 2 ); - surface()->DrawUnicodeChar( code ); -} - - -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -void ExpandButton::OnExpanded(Panel *panel) -{ -} +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#include +#include + +#include +#include +#include + +#include +#include +#include + +// memdbgon must be the last include file in a .cpp file!!! +#include + +using namespace vgui; + +DECLARE_BUILD_FACTORY( ExpandButton ); + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +ExpandButton::ExpandButton( Panel *parent, const char *panelName ) : ToggleButton( parent, panelName, "" ) +{ + m_bExpandable = true; + m_hFont = INVALID_FONT; +} + + +//----------------------------------------------------------------------------- +// Purpose: Destructor +//----------------------------------------------------------------------------- +ExpandButton::~ExpandButton() +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void ExpandButton::ApplySchemeSettings(IScheme *pScheme) +{ + BaseClass::ApplySchemeSettings(pScheme); + + m_Color = GetSchemeColor( "ExpandButton.Color", pScheme ); + m_hFont = pScheme->GetFont("Marlett", IsProportional() ); + + // don't draw a background + SetPaintBackgroundEnabled(false); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +IBorder *ExpandButton::GetBorder(bool depressed, bool armed, bool selected, bool keyfocus) +{ + return NULL; +} + + +//----------------------------------------------------------------------------- +// Purpose: Expand the button +//----------------------------------------------------------------------------- +void ExpandButton::SetSelected(bool state) +{ + if ( m_bExpandable && ( state != IsSelected() ) ) + { + // send a message saying we've been checked + KeyValues *msg = new KeyValues("Expanded", "state", (int)state); + PostActionSignal(msg); + + BaseClass::SetSelected(state); + } +} + + +//----------------------------------------------------------------------------- +// Purpose: sets whether or not the state of the check can be changed +//----------------------------------------------------------------------------- +void ExpandButton::SetExpandable(bool state) +{ + m_bExpandable = state; + Repaint(); +} + + +void ExpandButton::Paint() +{ + surface()->DrawSetTextFont( m_hFont ); + + wchar_t code = IsSelected( ) ? L'6' : L'4'; + wchar_t pString[2] = { code, 0 }; + + // draw selected check + int tw, th, w, h; + GetSize( w, h ); + surface()->GetTextSize( m_hFont, pString, tw, th ); + surface()->DrawSetTextColor( m_Color ); + surface()->DrawSetTextPos( ( w - tw ) / 2, ( h - th ) / 2 ); + surface()->DrawUnicodeChar( code ); +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void ExpandButton::OnExpanded(Panel *panel) +{ +} -- cgit v1.2.3