summaryrefslogtreecommitdiff
path: root/plugins/Skins/SkinLib/LabelFieldState.cpp
blob: 364611fbf7e2981c599ba130a00e1ad8e83dd891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "globals.h"
#include "LabelFieldState.h"


LabelFieldState::LabelFieldState(DialogState *dialog, LabelField *field) 
		: ControlFieldState(dialog, field)
{
}

LabelFieldState::~LabelFieldState()
{
}

Size LabelFieldState::getPreferedSize() const
{
	int style = GetWindowLong(getField()->getHWND(), GWL_STYLE);

	int format = DT_EXPANDTABS | DT_EDITCONTROL;
	if ((style & SS_LEFTNOWORDWRAP) || (style & SS_SIMPLE))
		format |= DT_SINGLELINE;
	if (style & SS_NOPREFIX)
		format |= DT_NOPREFIX;
	Size ret = getTextPreferedSize(format);

	int border = getField()->getBorderSize();
	ret.x += 2 * border;
	ret.y += 2 * border;

	return ret;
}

bool LabelFieldState::isEmpty() const
{
	return lstrlen(getText()) <= 0;
}