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/Utility.h"
|
||||
#include "Gwen/Skin.h"
|
||||
@@ -14,83 +13,79 @@
|
||||
using namespace Gwen;
|
||||
using namespace Gwen::Controls;
|
||||
|
||||
|
||||
|
||||
GWEN_CONTROL_CONSTRUCTOR( NumericUpDown )
|
||||
GWEN_CONTROL_CONSTRUCTOR(NumericUpDown)
|
||||
{
|
||||
SetSize( 100, 20 );
|
||||
SetSize(100, 20);
|
||||
|
||||
Layout::Splitter* pSplitter = new Layout::Splitter( this );
|
||||
pSplitter->Dock( Pos::Right );
|
||||
pSplitter->SetSize( 13, 13 );
|
||||
Layout::Splitter* pSplitter = new Layout::Splitter(this);
|
||||
pSplitter->Dock(Pos::Right);
|
||||
pSplitter->SetSize(13, 13);
|
||||
|
||||
NumericUpDownButton_Up* pButtonUp = new NumericUpDownButton_Up( pSplitter );
|
||||
pButtonUp->onPress.Add( this, &NumericUpDown::OnButtonUp );
|
||||
pButtonUp->SetTabable( false );
|
||||
NumericUpDownButton_Up* pButtonUp = new NumericUpDownButton_Up(pSplitter);
|
||||
pButtonUp->onPress.Add(this, &NumericUpDown::OnButtonUp);
|
||||
pButtonUp->SetTabable(false);
|
||||
|
||||
pSplitter->SetPanel( 0, pButtonUp );
|
||||
|
||||
pSplitter->SetPanel(0, pButtonUp);
|
||||
|
||||
NumericUpDownButton_Down* pButtonDown = new NumericUpDownButton_Down( pSplitter );
|
||||
pButtonDown->onPress.Add( this, &NumericUpDown::OnButtonDown );
|
||||
pButtonDown->SetTabable( false );
|
||||
pButtonUp->SetPadding( Padding( 0, 1, 1, 0 ) );
|
||||
NumericUpDownButton_Down* pButtonDown = new NumericUpDownButton_Down(pSplitter);
|
||||
pButtonDown->onPress.Add(this, &NumericUpDown::OnButtonDown);
|
||||
pButtonDown->SetTabable(false);
|
||||
pButtonUp->SetPadding(Padding(0, 1, 1, 0));
|
||||
|
||||
pSplitter->SetPanel( 1, pButtonDown );
|
||||
pSplitter->SetPanel(1, pButtonDown);
|
||||
|
||||
m_iMax = 100;
|
||||
m_iMin = 0;
|
||||
m_iNumber = 0;
|
||||
SetText( "0" );
|
||||
SetText("0");
|
||||
}
|
||||
|
||||
void NumericUpDown::OnButtonUp( Base* /*control*/ )
|
||||
void NumericUpDown::OnButtonUp(Base* /*control*/)
|
||||
{
|
||||
SyncNumberFromText();
|
||||
SetValue( m_iNumber + 1 );
|
||||
SetValue(m_iNumber + 1);
|
||||
}
|
||||
|
||||
void NumericUpDown::OnButtonDown( Base* /*control*/ )
|
||||
void NumericUpDown::OnButtonDown(Base* /*control*/)
|
||||
{
|
||||
SyncNumberFromText();
|
||||
SetValue( m_iNumber - 1 );
|
||||
SetValue(m_iNumber - 1);
|
||||
}
|
||||
|
||||
|
||||
void NumericUpDown::SyncTextFromNumber()
|
||||
{
|
||||
SetText( Utility::ToString( m_iNumber ) );
|
||||
SetText(Utility::ToString(m_iNumber));
|
||||
}
|
||||
|
||||
void NumericUpDown::SyncNumberFromText()
|
||||
{
|
||||
SetValue( (int) GetFloatFromText() );
|
||||
SetValue((int)GetFloatFromText());
|
||||
}
|
||||
|
||||
void NumericUpDown::SetMin( int i )
|
||||
void NumericUpDown::SetMin(int i)
|
||||
{
|
||||
m_iMin = i;
|
||||
}
|
||||
|
||||
void NumericUpDown::SetMax( int i )
|
||||
void NumericUpDown::SetMax(int i)
|
||||
{
|
||||
m_iMax = i;
|
||||
}
|
||||
|
||||
void NumericUpDown::SetValue( int i )
|
||||
void NumericUpDown::SetValue(int i)
|
||||
{
|
||||
if ( i > m_iMax ) i = m_iMax;
|
||||
if ( i < m_iMin ) i = m_iMin;
|
||||
if (i > m_iMax) i = m_iMax;
|
||||
if (i < m_iMin) i = m_iMin;
|
||||
|
||||
if ( m_iNumber == i )
|
||||
{
|
||||
if (m_iNumber == i)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_iNumber = i;
|
||||
|
||||
// Don't update the text if we're typing in it..
|
||||
if ( !HasFocus() )
|
||||
if (!HasFocus())
|
||||
{
|
||||
SyncTextFromNumber();
|
||||
}
|
||||
@@ -100,7 +95,7 @@ void NumericUpDown::SetValue( int i )
|
||||
|
||||
void NumericUpDown::OnChange()
|
||||
{
|
||||
onChanged.Call( this );
|
||||
onChanged.Call(this);
|
||||
}
|
||||
|
||||
void NumericUpDown::OnTextChanged()
|
||||
|
||||
Reference in New Issue
Block a user