summaryrefslogtreecommitdiff
path: root/plugins/Skins/SkinLib/ImageFieldState.cpp
blob: f74d77e0f3c912c5b442d752fd2d8ec101bca354 (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
36
37
#include "globals.h"
#include "ImageFieldState.h"


ImageFieldState::ImageFieldState(DialogState *dialog, ImageField *field) 
		: FieldState(dialog, field)
{
}

ImageFieldState::~ImageFieldState()
{
}

ImageField * ImageFieldState::getField() const
{
	return (ImageField *) FieldState::getField();
}

Size ImageFieldState::getPreferedSize() const
{
	HBITMAP hBmp = getImage();
	BITMAP bmp;
	if (hBmp == NULL || GetObject(hBmp, sizeof(bmp), &bmp) == 0)
		return Size(0, 0);

	return Size(bmp.bmWidth, bmp.bmHeight);
}

HBITMAP ImageFieldState::getImage() const
{
	return getField()->getImage();
}

bool ImageFieldState::isEmpty() const
{
	return getImage() == NULL;
}