Files
bullet3/examples/ThirdPartyLibs/Gwen/Controls/DockedTabControl.cpp
erwincoumans ab8f16961e 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
2018-09-23 14:17:31 -07:00

90 lines
1.8 KiB
C++

/*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#include "Gwen/Gwen.h"
#include "Gwen/Skin.h"
#include "Gwen/Controls/DockedTabControl.h"
#include "Gwen/Controls/Highlight.h"
#include "Gwen/DragAndDrop.h"
#include "Gwen/Controls/WindowControl.h"
using namespace Gwen;
using namespace Gwen::Controls;
GWEN_CONTROL_CONSTRUCTOR(DockedTabControl)
{
m_WindowControl = NULL;
Dock(Pos::Fill);
m_pTitleBar = new TabTitleBar(this);
m_pTitleBar->Dock(Pos::Top);
m_pTitleBar->SetHidden(true);
}
void DockedTabControl::Layout(Skin::Base* skin)
{
GetTabStrip()->SetHidden(TabCount() <= 1);
UpdateTitleBar();
BaseClass::Layout(skin);
}
void DockedTabControl::UpdateTitleBar()
{
if (!GetCurrentButton()) return;
m_pTitleBar->UpdateFromTab(GetCurrentButton());
}
void DockedTabControl::DragAndDrop_StartDragging(Gwen::DragAndDrop::Package* pPackage, int x, int y)
{
BaseClass::DragAndDrop_StartDragging(pPackage, x, y);
SetHidden(true);
// This hiding our parent thing is kind of lousy.
GetParent()->SetHidden(true);
}
void DockedTabControl::DragAndDrop_EndDragging(bool bSuccess, int /*x*/, int /*y*/)
{
SetHidden(false);
if (!bSuccess)
{
GetParent()->SetHidden(false);
}
/*
if ( !bSuccess )
{
// Create our window control
if ( !m_WindowControl )
{
m_WindowControl = new WindowControl( GetCanvas() );
m_WindowControl->SetBounds( x, y, Width(), Height() );
}
m_WindowControl->SetPosition( x, y );
SetParent( m_WindowControl );
SetPosition( 0, 0 );
Dock( Pos::Fill );
}
*/
}
void DockedTabControl::MoveTabsTo(DockedTabControl* pTarget)
{
Base::List Children = GetTabStrip()->Children;
for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
{
TabButton* pButton = (*iter)->DynamicCastTabButton();
if (!pButton) continue;
pTarget->AddPage(pButton);
}
Invalidate();
}