summaryrefslogtreecommitdiff
path: root/plugins/Skins/SkinLib/Dialog.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-07-10 18:37:21 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-07-10 18:37:21 +0000
commit9242a80a84fa5c96dbadec9594177875aeeec1ac (patch)
tree05140dc253f5c73bc5a96624ffed8d1eff9a48e7 /plugins/Skins/SkinLib/Dialog.cpp
parent6f8361aaf17045ff81149eeb22ed0a15b4d4ad94 (diff)
only added MyDetails and Skins. not adopted yet
git-svn-id: http://svn.miranda-ng.org/main/trunk@892 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Skins/SkinLib/Dialog.cpp')
-rw-r--r--plugins/Skins/SkinLib/Dialog.cpp100
1 files changed, 100 insertions, 0 deletions
diff --git a/plugins/Skins/SkinLib/Dialog.cpp b/plugins/Skins/SkinLib/Dialog.cpp
new file mode 100644
index 0000000000..edc8437817
--- /dev/null
+++ b/plugins/Skins/SkinLib/Dialog.cpp
@@ -0,0 +1,100 @@
+#include "globals.h"
+#include "Dialog.h"
+#include "DialogState.h"
+
+
+Dialog::Dialog(const char *aName) : name(aName)
+{
+}
+
+
+Dialog::~Dialog()
+{
+ for(unsigned int i = 0; i < fields.size(); i++)
+ delete fields[i];
+
+ fields.clear();
+}
+
+
+const char * Dialog::getName() const
+{
+ return name.c_str();
+}
+
+
+bool Dialog::addField(Field *field)
+{
+ if (getField(field->getName()) != NULL)
+ return false;
+
+ fields.push_back(field);
+ return true;
+}
+
+
+Field * Dialog::getField(const char *name) const
+{
+ if (name == NULL || name[0] == 0)
+ return NULL;
+
+ for(unsigned int i = 0; i < fields.size(); i++)
+ {
+ Field *field = fields[i];
+ if (strcmp(name, field->getName()) == 0)
+ return field;
+ }
+
+ return NULL;
+}
+
+Field * Dialog::getField(unsigned int pos) const
+{
+ if (pos >= fields.size())
+ return NULL;
+ return fields[pos];
+}
+
+int Dialog::getIndexOf(Field *field) const
+{
+ for(unsigned int i = 0; i < fields.size(); i++)
+ {
+ Field *f = fields[i];
+ if (field == f)
+ return i;
+ }
+
+ return -1;
+}
+
+unsigned int Dialog::getFieldCount() const
+{
+ return fields.size();
+}
+
+DialogInfo * Dialog::getInfo()
+{
+ return &info;
+}
+
+const Size & Dialog::getSize() const
+{
+ return size;
+}
+
+
+void Dialog::setSize(const Size &size)
+{
+ this->size = size;
+}
+
+
+DialogState * Dialog::createState()
+{
+ DialogState *ret = new DialogState(this);
+
+ for(unsigned int i = 0; i < fields.size(); i++)
+ ret->fields.push_back(fields[i]->createState(ret));
+
+ return ret;
+}