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/Gwen.h"
#include "Gwen/Controls/MenuItem.h"
#include "Gwen/Skin.h"
@@ -12,44 +11,42 @@
using namespace Gwen;
using namespace Gwen::Controls;
GWEN_CONTROL_CONSTRUCTOR( MenuItem )
GWEN_CONTROL_CONSTRUCTOR(MenuItem)
{
m_Menu = NULL;
m_bOnStrip = false;
m_SubmenuArrow = NULL;
SetTabable( false );
SetCheckable( false );
SetCheck( false );
SetTabable(false);
SetCheckable(false);
SetCheck(false);
}
MenuItem::~MenuItem()
{
}
void MenuItem::Render( Skin::Base* skin )
void MenuItem::Render(Skin::Base* skin)
{
skin->DrawMenuItem( this, IsMenuOpen(), m_bCheckable ? m_bChecked : false );
skin->DrawMenuItem(this, IsMenuOpen(), m_bCheckable ? m_bChecked : false);
}
void MenuItem::Layout( Skin::Base* skin )
void MenuItem::Layout(Skin::Base* skin)
{
BaseClass::Layout( skin );
BaseClass::Layout(skin);
}
Menu* MenuItem::GetMenu()
{
if ( !m_Menu )
if (!m_Menu)
{
m_Menu = new Menu( GetCanvas() );
m_Menu->SetHidden( true );
m_Menu = new Menu(GetCanvas());
m_Menu->SetHidden(true);
if ( !m_bOnStrip )
if (!m_bOnStrip)
{
m_SubmenuArrow = new Symbol::Arrow( this );
m_SubmenuArrow->Dock( Pos::Right );
m_SubmenuArrow->SetSize( 20, 20 );
m_SubmenuArrow = new Symbol::Arrow(this);
m_SubmenuArrow->Dock(Pos::Right);
m_SubmenuArrow->SetSize(20, 20);
}
Invalidate();
@@ -58,31 +55,31 @@ Menu* MenuItem::GetMenu()
return m_Menu;
}
void MenuItem::SetCheck( bool bCheck )
void MenuItem::SetCheck(bool bCheck)
{
if ( bCheck == m_bChecked)
if (bCheck == m_bChecked)
return;
m_bChecked = bCheck;
onCheckChange.Call( this );
onCheckChange.Call(this);
if ( bCheck )
onChecked.Call( this );
if (bCheck)
onChecked.Call(this);
else
onUnChecked.Call( this );
onUnChecked.Call(this);
}
void MenuItem::OnPress()
{
if ( m_Menu )
if (m_Menu)
{
ToggleMenu();
}
else if ( !m_bOnStrip )
else if (!m_bOnStrip)
{
SetCheck( !GetChecked() );
onMenuItemSelected.Call( this );
SetCheck(!GetChecked());
onMenuItemSelected.Call(this);
GetCanvas()->CloseMenus();
}
@@ -91,47 +88,47 @@ void MenuItem::OnPress()
void MenuItem::ToggleMenu()
{
if ( IsMenuOpen() ) CloseMenu();
else OpenMenu();
if (IsMenuOpen())
CloseMenu();
else
OpenMenu();
}
bool MenuItem::IsMenuOpen()
{
if ( !m_Menu ) return false;
if (!m_Menu) return false;
return !m_Menu->Hidden();
}
void MenuItem::OpenMenu()
{
if ( !m_Menu ) return;
if (!m_Menu) return;
m_Menu->SetHidden( false );
m_Menu->SetHidden(false);
m_Menu->BringToFront();
Gwen::Point p = LocalPosToCanvas( Gwen::Point( 0, 0 ) );
Gwen::Point p = LocalPosToCanvas(Gwen::Point(0, 0));
// Strip menus open downwards
if ( m_bOnStrip )
if (m_bOnStrip)
{
m_Menu->SetPos( p.x, p.y + Height() + 1 );
m_Menu->SetPos(p.x, p.y + Height() + 1);
}
// Submenus open sidewards
else
{
m_Menu->SetPos( p.x + Width(), p.y);
m_Menu->SetPos(p.x + Width(), p.y);
}
// TODO: Option this.
// TODO: Make sure on screen, open the other side of the
// TODO: Make sure on screen, open the other side of the
// parent if it's better...
}
void MenuItem::CloseMenu()
{
if ( !m_Menu ) return;
if (!m_Menu) return;
m_Menu->Close();
m_Menu->CloseAll();
}