Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
See license in Gwen.h
|
||||
*/
|
||||
|
||||
|
||||
#include "Gwen/Gwen.h"
|
||||
#include "Gwen/Controls/Label.h"
|
||||
#include "Gwen/Utility.h"
|
||||
@@ -12,62 +11,59 @@
|
||||
using namespace Gwen;
|
||||
using namespace Gwen::Controls;
|
||||
|
||||
GWEN_CONTROL_CONSTRUCTOR( Label )
|
||||
GWEN_CONTROL_CONSTRUCTOR(Label)
|
||||
{
|
||||
m_Text = new ControlsInternal::Text( this );
|
||||
m_Text->SetFont( GetSkin()->GetDefaultFont() );
|
||||
m_Text = new ControlsInternal::Text(this);
|
||||
m_Text->SetFont(GetSkin()->GetDefaultFont());
|
||||
|
||||
SetMouseInputEnabled( false );
|
||||
SetBounds( 0, 0, 100, 10 );
|
||||
SetAlignment( Gwen::Pos::Left | Gwen::Pos::Top );
|
||||
SetMouseInputEnabled(false);
|
||||
SetBounds(0, 0, 100, 10);
|
||||
SetAlignment(Gwen::Pos::Left | Gwen::Pos::Top);
|
||||
}
|
||||
|
||||
void Label::Layout( Skin::Base* /*skin*/ )
|
||||
void Label::Layout(Skin::Base* /*skin*/)
|
||||
{
|
||||
|
||||
int iAlign = m_iAlign;
|
||||
|
||||
int x = m_rTextPadding.left + m_Padding.left;
|
||||
int y = m_rTextPadding.top + m_Padding.top;
|
||||
|
||||
if ( iAlign & Pos::Right ) x = Width() - m_Text->Width() - m_rTextPadding.right - m_Padding.right;
|
||||
if ( iAlign & Pos::CenterH ) x = (m_rTextPadding.left + m_Padding.left) + ((Width() - m_Text->Width() ) * 0.5f) - m_rTextPadding.right - m_Padding.right;
|
||||
if (iAlign & Pos::Right) x = Width() - m_Text->Width() - m_rTextPadding.right - m_Padding.right;
|
||||
if (iAlign & Pos::CenterH) x = (m_rTextPadding.left + m_Padding.left) + ((Width() - m_Text->Width()) * 0.5f) - m_rTextPadding.right - m_Padding.right;
|
||||
|
||||
if ( iAlign & Pos::CenterV ) y = (m_rTextPadding.top + m_Padding.top) + ((Height() - m_Text->Height()) * 0.5f) - m_rTextPadding.bottom - m_Padding.bottom;
|
||||
if ( iAlign & Pos::Bottom ) y = Height() - m_Text->Height() - m_rTextPadding.bottom - m_Padding.bottom;
|
||||
if (iAlign & Pos::CenterV) y = (m_rTextPadding.top + m_Padding.top) + ((Height() - m_Text->Height()) * 0.5f) - m_rTextPadding.bottom - m_Padding.bottom;
|
||||
if (iAlign & Pos::Bottom) y = Height() - m_Text->Height() - m_rTextPadding.bottom - m_Padding.bottom;
|
||||
|
||||
m_Text->SetPos( x, y );
|
||||
|
||||
m_Text->SetPos(x, y);
|
||||
}
|
||||
|
||||
void Label::SetText( const UnicodeString& str, bool bDoEvents )
|
||||
{
|
||||
if ( m_Text->GetText() == str ) return;
|
||||
void Label::SetText(const UnicodeString& str, bool bDoEvents)
|
||||
{
|
||||
if (m_Text->GetText() == str) return;
|
||||
|
||||
m_Text->SetString( str );
|
||||
m_Text->SetString(str);
|
||||
Redraw();
|
||||
|
||||
if ( bDoEvents )
|
||||
if (bDoEvents)
|
||||
OnTextChanged();
|
||||
}
|
||||
|
||||
void Label::SetText( const String& str, bool bDoEvents )
|
||||
{
|
||||
SetText( Gwen::Utility::StringToUnicode( str ), bDoEvents );
|
||||
void Label::SetText(const String& str, bool bDoEvents)
|
||||
{
|
||||
SetText(Gwen::Utility::StringToUnicode(str), bDoEvents);
|
||||
}
|
||||
|
||||
void Label::SizeToContents()
|
||||
{
|
||||
m_Text->SetPos( m_rTextPadding.left + m_Padding.left, m_rTextPadding.top + m_Padding.top );
|
||||
m_Text->SetPos(m_rTextPadding.left + m_Padding.left, m_rTextPadding.top + m_Padding.top);
|
||||
m_Text->RefreshSize();
|
||||
|
||||
SetSize( m_Text->Width() + m_Padding.left + m_Padding.right + m_rTextPadding.left + m_rTextPadding.right, m_Text->Height() + m_Padding.top + m_Padding.bottom + m_rTextPadding.top + m_rTextPadding.bottom );
|
||||
|
||||
SetSize(m_Text->Width() + m_Padding.left + m_Padding.right + m_rTextPadding.left + m_rTextPadding.right, m_Text->Height() + m_Padding.top + m_Padding.bottom + m_rTextPadding.top + m_rTextPadding.bottom);
|
||||
}
|
||||
|
||||
Gwen::Point Label::GetCharacterPosition( int iChar )
|
||||
{
|
||||
Gwen::Point p = m_Text->GetCharacterPosition( iChar );
|
||||
Gwen::Point Label::GetCharacterPosition(int iChar)
|
||||
{
|
||||
Gwen::Point p = m_Text->GetCharacterPosition(iChar);
|
||||
p.x += m_Text->X();
|
||||
p.y += m_Text->Y();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user