summaryrefslogtreecommitdiff
path: root/plugins/Skins/SkinLib/ImageFieldState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Skins/SkinLib/ImageFieldState.cpp')
-rw-r--r--plugins/Skins/SkinLib/ImageFieldState.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/Skins/SkinLib/ImageFieldState.cpp b/plugins/Skins/SkinLib/ImageFieldState.cpp
new file mode 100644
index 0000000000..f74d77e0f3
--- /dev/null
+++ b/plugins/Skins/SkinLib/ImageFieldState.cpp
@@ -0,0 +1,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;
+} \ No newline at end of file