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:
erwincoumans
2018-09-23 14:17:31 -07:00
parent b73b05e9fb
commit ab8f16961e
1773 changed files with 1081087 additions and 474249 deletions

View File

@@ -4,7 +4,6 @@
See license in Gwen.h
*/
#include "Gwen/Controls/ListBox.h"
#include "Gwen/Controls/ScrollControl.h"
#include "Gwen/InputHandler.h"
@@ -14,15 +13,15 @@ using namespace Gwen::Controls;
class ListBoxRow : public Layout::TableRow
{
GWEN_CONTROL_INLINE( ListBoxRow, Layout::TableRow )
GWEN_CONTROL_INLINE(ListBoxRow, Layout::TableRow)
{
SetMouseInputEnabled( true );
SetSelected( false );
SetMouseInputEnabled(true);
SetSelected(false);
}
void Render( Skin::Base* skin )
void Render(Skin::Base* skin)
{
skin->DrawListBoxLine( this, IsSelected() );
skin->DrawListBoxLine(this, IsSelected());
}
bool IsSelected() const
@@ -30,108 +29,106 @@ class ListBoxRow : public Layout::TableRow
return m_bSelected;
}
void OnMouseClickLeft( int /*x*/, int /*y*/, bool bDown )
void OnMouseClickLeft(int /*x*/, int /*y*/, bool bDown)
{
if ( bDown && !m_bSelected )
if (bDown && !m_bSelected)
{
SetSelected( true );
onRowSelected.Call( this );
SetSelected(true);
onRowSelected.Call(this);
}
}
void SetSelected( bool b )
void SetSelected(bool b)
{
m_bSelected = b;
// TODO: Get these values from the skin.
if ( b )
SetTextColor( Gwen::Colors::White );
if (b)
SetTextColor(Gwen::Colors::White);
else
SetTextColor( Gwen::Colors::Black );
SetTextColor(Gwen::Colors::Black);
}
private:
bool m_bSelected;
private:
bool m_bSelected;
};
GWEN_CONTROL_CONSTRUCTOR( ListBox )
GWEN_CONTROL_CONSTRUCTOR(ListBox)
{
m_ScrollControl = new ScrollControl( this );
m_ScrollControl->Dock( Pos::Fill );
m_ScrollControl->SetScroll( false, true );
m_ScrollControl->SetAutoHideBars( true );
m_ScrollControl->SetMargin( Margin( 1, 1, 1, 1 ) );
m_ScrollControl = new ScrollControl(this);
m_ScrollControl->Dock(Pos::Fill);
m_ScrollControl->SetScroll(false, true);
m_ScrollControl->SetAutoHideBars(true);
m_ScrollControl->SetMargin(Margin(1, 1, 1, 1));
m_InnerPanel = m_ScrollControl;
m_Table = new Controls::Layout::Table( this );
m_Table->Dock( Pos::Top );
m_Table->SetColumnCount( 1 );
m_Table = new Controls::Layout::Table(this);
m_Table->Dock(Pos::Top);
m_Table->SetColumnCount(1);
m_bMultiSelect = false;
}
void ListBox::OnChildBoundsChanged( Gwen::Rect /*oldChildBounds*/, Base* /*pChild*/ )
void ListBox::OnChildBoundsChanged(Gwen::Rect /*oldChildBounds*/, Base* /*pChild*/)
{
m_ScrollControl->UpdateScrollBars();
}
Layout::TableRow* ListBox::AddItem( const String& strLabel, const String& strName )
Layout::TableRow* ListBox::AddItem(const String& strLabel, const String& strName)
{
return AddItem( Utility::StringToUnicode( strLabel ), strName );
return AddItem(Utility::StringToUnicode(strLabel), strName);
}
Layout::TableRow* ListBox::AddItem( const UnicodeString& strLabel, const String& strName )
Layout::TableRow* ListBox::AddItem(const UnicodeString& strLabel, const String& strName)
{
ListBoxRow* pRow = new ListBoxRow( this );
m_Table->AddRow( pRow );
ListBoxRow* pRow = new ListBoxRow(this);
m_Table->AddRow(pRow);
pRow->SetCellText( 0, strLabel );
pRow->SetName( strName );
pRow->SetCellText(0, strLabel);
pRow->SetName(strName);
pRow->onRowSelected.Add( this, &ListBox::OnRowSelected );
pRow->onRowSelected.Add(this, &ListBox::OnRowSelected);
m_Table->SizeToContents();
return pRow;
}
void ListBox::Render( Skin::Base* skin )
void ListBox::Render(Skin::Base* skin)
{
skin->DrawListBox( this );
skin->DrawListBox(this);
}
void ListBox::UnselectAll()
{
std::list<Layout::TableRow*>::iterator it = m_SelectedRows.begin();
while ( it != m_SelectedRows.end() )
while (it != m_SelectedRows.end())
{
ListBoxRow* pRow = static_cast<ListBoxRow*>(*it);
it = m_SelectedRows.erase( it );
it = m_SelectedRows.erase(it);
pRow->SetSelected( false );
pRow->SetSelected(false);
}
}
void ListBox::OnRowSelected( Base* pControl )
void ListBox::OnRowSelected(Base* pControl)
{
ListBoxRow* pRow = static_cast<ListBoxRow*>(pControl);
if ( !AllowMultiSelect() || !Gwen::Input::IsShiftDown() )
if (!AllowMultiSelect() || !Gwen::Input::IsShiftDown())
{
UnselectAll();
}
m_SelectedRows.push_back( pRow );
onRowSelected.Call( this );
m_SelectedRows.push_back(pRow);
onRowSelected.Call(this);
}
Layout::TableRow* ListBox::GetSelectedRow()
{
if ( m_SelectedRows.empty() ) return NULL;
{
if (m_SelectedRows.empty()) return NULL;
return *m_SelectedRows.begin();
}