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/Controls/WindowControl.h"
|
||||
#include "Gwen/Controls/ImagePanel.h"
|
||||
#include "Gwen/Controls/Label.h"
|
||||
@@ -14,65 +13,64 @@ using namespace Gwen;
|
||||
using namespace Gwen::Controls;
|
||||
using namespace Gwen::ControlsInternal;
|
||||
|
||||
GWEN_CONTROL_CONSTRUCTOR( WindowControl )
|
||||
GWEN_CONTROL_CONSTRUCTOR(WindowControl)
|
||||
{
|
||||
m_Modal = NULL;
|
||||
m_bInFocus = false;
|
||||
m_bDeleteOnClose = false;
|
||||
|
||||
m_TitleBar = new Dragger( this );
|
||||
m_TitleBar->Dock( Pos::Top );
|
||||
m_TitleBar->SetHeight( 18 );
|
||||
m_TitleBar->SetPadding( Padding( 0, 0, 0, 5 ) );
|
||||
m_TitleBar->SetTarget( this );
|
||||
m_TitleBar = new Dragger(this);
|
||||
m_TitleBar->Dock(Pos::Top);
|
||||
m_TitleBar->SetHeight(18);
|
||||
m_TitleBar->SetPadding(Padding(0, 0, 0, 5));
|
||||
m_TitleBar->SetTarget(this);
|
||||
|
||||
m_Title = new Label( m_TitleBar );
|
||||
m_Title->SetAlignment( Pos::Center );
|
||||
m_Title->SetText( "Window" );
|
||||
m_Title = new Label(m_TitleBar);
|
||||
m_Title->SetAlignment(Pos::Center);
|
||||
m_Title->SetText("Window");
|
||||
m_Title->SetTextColor(Gwen::Colors::White);
|
||||
m_Title->Dock( Pos::Fill );
|
||||
m_Title->Dock(Pos::Fill);
|
||||
|
||||
m_CloseButton = new Button( m_TitleBar );
|
||||
m_CloseButton->SetText( "" );
|
||||
m_CloseButton->SetSize( m_TitleBar->Height(), m_TitleBar->Height() );
|
||||
m_CloseButton = new Button(m_TitleBar);
|
||||
m_CloseButton->SetText("");
|
||||
m_CloseButton->SetSize(m_TitleBar->Height(), m_TitleBar->Height());
|
||||
m_CloseButton->Dock(Pos::Right);
|
||||
m_CloseButton->onPress.Add( this, &WindowControl::CloseButtonPressed );
|
||||
m_CloseButton->SetTabable( false );
|
||||
m_CloseButton->SetName( "closeButton" );
|
||||
m_CloseButton->onPress.Add(this, &WindowControl::CloseButtonPressed);
|
||||
m_CloseButton->SetTabable(false);
|
||||
m_CloseButton->SetName("closeButton");
|
||||
|
||||
//Create a blank content control, dock it to the top - Should this be a ScrollControl?
|
||||
m_InnerPanel = new Base( this );
|
||||
m_InnerPanel->Dock( Pos::Fill );
|
||||
m_InnerPanel = new Base(this);
|
||||
m_InnerPanel->Dock(Pos::Fill);
|
||||
|
||||
BringToFront();
|
||||
|
||||
SetTabable( false );
|
||||
SetTabable(false);
|
||||
Focus();
|
||||
|
||||
SetMinimumSize( Gwen::Point( 100, 40 ) );
|
||||
SetClampMovement( true );
|
||||
SetKeyboardInputEnabled( false );
|
||||
SetMinimumSize(Gwen::Point(100, 40));
|
||||
SetClampMovement(true);
|
||||
SetKeyboardInputEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
WindowControl::~WindowControl()
|
||||
{
|
||||
if ( m_Modal )
|
||||
if (m_Modal)
|
||||
{
|
||||
m_Modal->DelayedDelete();
|
||||
}
|
||||
}
|
||||
|
||||
void WindowControl::MakeModal( bool invisible )
|
||||
void WindowControl::MakeModal(bool invisible)
|
||||
{
|
||||
if ( m_Modal ) return;
|
||||
if (m_Modal) return;
|
||||
|
||||
m_Modal = new ControlsInternal::Modal( GetCanvas() );
|
||||
SetParent( m_Modal );
|
||||
m_Modal = new ControlsInternal::Modal(GetCanvas());
|
||||
SetParent(m_Modal);
|
||||
|
||||
if ( invisible )
|
||||
if (invisible)
|
||||
{
|
||||
m_Modal->SetShouldDrawBackground( false );
|
||||
m_Modal->SetShouldDrawBackground(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,43 +83,42 @@ bool WindowControl::IsOnTop()
|
||||
|
||||
WindowControl* pWindow = (*iter)->DynamicCastWindowControl();
|
||||
|
||||
if ( !pWindow )
|
||||
if (!pWindow)
|
||||
continue;
|
||||
|
||||
if ( pWindow == this )
|
||||
if (pWindow == this)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
void WindowControl::Render( Skin::Base* skin )
|
||||
void WindowControl::Render(Skin::Base* skin)
|
||||
{
|
||||
//This should use m_bInFocus but I need to figure out best way to make layout happen
|
||||
skin->DrawWindow( this, m_TitleBar->Bottom(), IsOnTop() );
|
||||
skin->DrawWindow(this, m_TitleBar->Bottom(), IsOnTop());
|
||||
}
|
||||
|
||||
void WindowControl::RenderUnder( Skin::Base* skin )
|
||||
void WindowControl::RenderUnder(Skin::Base* skin)
|
||||
{
|
||||
BaseClass::RenderUnder( skin );
|
||||
skin->DrawShadow( this );
|
||||
BaseClass::RenderUnder(skin);
|
||||
skin->DrawShadow(this);
|
||||
}
|
||||
|
||||
void WindowControl::SetTitle(Gwen::UnicodeString title)
|
||||
{
|
||||
m_Title->SetText( title );
|
||||
m_Title->SetText(title);
|
||||
}
|
||||
void WindowControl::SetClosable(bool closeable)
|
||||
{
|
||||
m_CloseButton->SetHidden( !closeable );
|
||||
m_CloseButton->SetHidden(!closeable);
|
||||
}
|
||||
|
||||
void WindowControl::SetHidden(bool hidden)
|
||||
{
|
||||
if ( !hidden )
|
||||
if (!hidden)
|
||||
BringToFront();
|
||||
|
||||
BaseClass::SetHidden(hidden);
|
||||
@@ -135,16 +132,14 @@ void WindowControl::Touch()
|
||||
//If Keyboard focus isn't one of our children, make it us
|
||||
}
|
||||
|
||||
void WindowControl::CloseButtonPressed( Gwen::Controls::Base* /*pFromPanel*/ )
|
||||
void WindowControl::CloseButtonPressed(Gwen::Controls::Base* /*pFromPanel*/)
|
||||
{
|
||||
SetHidden( true );
|
||||
SetHidden(true);
|
||||
|
||||
if ( m_bDeleteOnClose )
|
||||
if (m_bDeleteOnClose)
|
||||
DelayedDelete();
|
||||
}
|
||||
|
||||
|
||||
void WindowControl::RenderFocus( Gwen::Skin::Base* /*skin*/ )
|
||||
void WindowControl::RenderFocus(Gwen::Skin::Base* /*skin*/)
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user