67 lines
1 KiB
C
67 lines
1 KiB
C
|
/*
|
||
|
GWEN
|
||
|
Copyright (c) 2010 Facepunch Studios
|
||
|
See license in Gwen.h
|
||
|
*/
|
||
|
|
||
|
#pragma once
|
||
|
#ifndef GWEN_CONTROLS_LAYOUT_POSITION_H
|
||
|
#define GWEN_CONTROLS_LAYOUT_POSITION_H
|
||
|
|
||
|
#include "../gwen_label.h"
|
||
|
#include "../../gwen_utility.h"
|
||
|
|
||
|
|
||
|
namespace Gwen
|
||
|
{
|
||
|
namespace Controls
|
||
|
{
|
||
|
namespace Layout
|
||
|
{
|
||
|
class GWEN_EXPORT Position : public Base
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
GWEN_CONTROL_INLINE( Position, Base )
|
||
|
{
|
||
|
SetPosition( Pos::Left | Pos::Top );
|
||
|
}
|
||
|
|
||
|
void PostLayout( Skin::Base* skin )
|
||
|
{
|
||
|
for ( Base::List::iterator it = Children.begin(); it != Children.end(); ++it )
|
||
|
{
|
||
|
Base* pChild = *it;
|
||
|
|
||
|
if ( pChild->GetDock() != Pos::None ) continue;
|
||
|
|
||
|
pChild->Position( m_iPosition );
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void SetPosition( int p )
|
||
|
{
|
||
|
if ( m_iPosition == p ) return;
|
||
|
|
||
|
m_iPosition = p;
|
||
|
Invalidate();
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
|
||
|
int m_iPosition;
|
||
|
};
|
||
|
|
||
|
class GWEN_EXPORT Center : public Position
|
||
|
{
|
||
|
GWEN_CONTROL_INLINE( Center, Position )
|
||
|
{
|
||
|
SetPosition( Pos::Center );
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
#endif
|