This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
MyGameFramework/lib/gwen/controls/layout/gwen_position.h
Gered c5cdddbeaa initial commit
current versions of all of my basic framework sources, build configurations/scripts, and supporting assets
2013-01-31 12:53:05 -05:00

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