summaryrefslogtreecommitdiff
path: root/src/gui/setupitem.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-05 17:47:46 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-19 18:46:08 +0300
commit40764f894c6ef0def1d0eb0677d064da13701bcd (patch)
tree4400b0b56d20ebb3e66187990a01615a0c2adb3a /src/gui/setupitem.h
parent0b31fa647c786513c9addc5f8c55708f05226e03 (diff)
downloadmanaplus-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.gz
manaplus-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.bz2
manaplus-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.xz
manaplus-40764f894c6ef0def1d0eb0677d064da13701bcd.zip
Redesign Misc setup page.
Diffstat (limited to 'src/gui/setupitem.h')
-rw-r--r--src/gui/setupitem.h175
1 files changed, 175 insertions, 0 deletions
diff --git a/src/gui/setupitem.h b/src/gui/setupitem.h
new file mode 100644
index 000000000..d1cec0717
--- /dev/null
+++ b/src/gui/setupitem.h
@@ -0,0 +1,175 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SETUPITEM_H
+#define SETUPITEM_H
+
+#include "gui/widgets/tabbedarea.h"
+
+#include "guichanfwd.h"
+
+#include "gui/widgets/setuptabscroll.h"
+#include "gui/widgets/window.h"
+
+#include <guichan/actionlistener.hpp>
+#include <guichan/widget.hpp>
+
+#include <list>
+
+#ifdef __GNUC__
+#define _UNUSED_ __attribute__ ((unused))
+#else
+#define _UNUSED_
+#endif
+
+class CheckBox;
+class Configuration;
+class ContainerPlacer;
+class EditDialog;
+class HorizontContainer;
+class Label;
+class TextField;
+
+class SetupItem : public gcn::ActionListener
+{
+ public:
+ SetupItem(std::string text, std::string description,
+ std::string keyName, SetupTabScroll *parent,
+ std::string eventName, bool mainConfig);
+
+ SetupItem(std::string text, std::string description,
+ std::string keyName, SetupTabScroll *parent,
+ std::string eventName, std::string def, bool mainConfig);
+
+ ~SetupItem();
+
+ void load();
+
+ void save();
+
+ virtual void fromWidget() = 0;
+
+ virtual void toWidget() = 0;
+
+ void setWidget(gcn::Widget *widget)
+ { mWidget = widget; }
+
+ gcn::Widget *getWidget()
+ { return mWidget; }
+
+ Configuration *getConfig();
+
+ virtual std::string getActionEventId();
+
+ virtual void action(const gcn::ActionEvent &event);
+
+ virtual void action();
+
+ virtual void apply(std::string eventName);
+
+ virtual void cancel(std::string eventName);
+
+ virtual void externalUpdated(std::string eventName);
+// virtual int add(ContainerPlacer &place, int x, int y, int width);
+
+ bool isMainConfig()
+ { return mMainConfig; }
+
+ protected:
+ std::string mText;
+
+ std::string mDescription;
+
+ std::string mKeyName;
+
+ SetupTabScroll *mParent;
+
+ std::string mEventName;
+
+ bool mMainConfig;
+
+ bool mUseDefault;
+
+ std::string mValue;
+
+ std::string mDefault;
+
+ gcn::Widget *mWidget;
+
+ std::list<gcn::Widget*> mTempWidgets;
+};
+
+class SetupItemCheckBox : public SetupItem
+{
+ public:
+ SetupItemCheckBox(std::string text, std::string description,
+ std::string keyName, SetupTabScroll *parent,
+ std::string eventName, bool mainConfig = true);
+
+ SetupItemCheckBox(std::string text, std::string description,
+ std::string keyName, SetupTabScroll *parent,
+ std::string eventName, std::string def,
+ bool mainConfig = true);
+
+ ~SetupItemCheckBox();
+
+ void createControls();
+
+ void fromWidget();
+
+ void toWidget();
+
+ protected:
+ CheckBox *mCheckBox;
+};
+
+class SetupItemTextField : public SetupItem
+{
+ public:
+ SetupItemTextField(std::string text, std::string description,
+ std::string keyName, SetupTabScroll *parent,
+ std::string eventName, bool mainConfig = true);
+
+ SetupItemTextField(std::string text, std::string description,
+ std::string keyName, SetupTabScroll *parent,
+ std::string eventName, std::string def,
+ bool mainConfig = true);
+
+ ~SetupItemTextField();
+
+ void createControls();
+
+ void fromWidget();
+
+ void toWidget();
+
+ void action(const gcn::ActionEvent &event);
+
+ void apply(std::string eventName);
+
+ protected:
+ HorizontContainer *mHorizont;
+ Label *mLabel;
+ TextField *mTextField;
+ Button *mButton;
+ EditDialog *mEditDialog;
+};
+
+#endif