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/gwen_fieldlabel.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

65 lines
1.2 KiB
C++

/*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#pragma once
#ifndef GWEN_CONTROLS_FIELDLABEL_H
#define GWEN_CONTROLS_FIELDLABEL_H
#include "../gwen_baserender.h"
#include "gwen_label.h"
namespace Gwen
{
namespace Controls
{
class GWEN_EXPORT FieldLabel : public Controls::Label
{
public:
static inline FieldLabel* Setup( Controls::Base* pControl, const Gwen::TextObject& text )
{
FieldLabel* plbl = new FieldLabel( pControl->GetParent() );
plbl->SetText( text );
plbl->SetSize( pControl->Width(), pControl->Height() );
plbl->Dock( pControl->GetDock() );
plbl->SetField( pControl );
return plbl;
}
public:
GWEN_CONTROL_INLINE( FieldLabel, Controls::Label )
{
m_pField = NULL;
SetMargin( Margin( 0, 1, 0, 1 ) );
SetAlignment( Pos::CenterV | Pos::Left );
}
void SetField( Controls::Base* pField )
{
pField->SetParent( this );
pField->Dock( Pos::Right );
m_pField = pField;
}
void Layout( Gwen::Skin::Base* pskin )
{
m_pField->SetWidth( Width() - 70 );
BaseClass::Layout( pskin );
}
protected:
Controls::Base* m_pField;
};
}
}
#endif