summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-18 23:35:58 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-18 23:39:07 +0300
commitdc6771670569d2f296f4c12595966bbcb9aadf65 (patch)
tree92e0a21bd121c7abe43f22e1d25a8f17b6969214 /src/gui
parent6a10bc8d7d186fd83099c75c2a03409d0881aae9 (diff)
downloadplus-dc6771670569d2f296f4c12595966bbcb9aadf65.tar.gz
plus-dc6771670569d2f296f4c12595966bbcb9aadf65.tar.bz2
plus-dc6771670569d2f296f4c12595966bbcb9aadf65.tar.xz
plus-dc6771670569d2f296f4c12595966bbcb9aadf65.zip
Start implimenting new setup pages.
Add new container for setup items. Imporved other containers.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup_other.cpp87
-rw-r--r--src/gui/setup_other.h9
-rw-r--r--src/gui/widgets/horizontcontainer.cpp6
-rw-r--r--src/gui/widgets/setuptabscroll.cpp49
-rw-r--r--src/gui/widgets/setuptabscroll.h41
-rw-r--r--src/gui/widgets/vertcontainer.cpp43
-rw-r--r--src/gui/widgets/vertcontainer.h18
7 files changed, 199 insertions, 54 deletions
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index 7ddc89e67..e499e3c8c 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -25,9 +25,12 @@
#include "gui/widgets/button.h"
#include "gui/widgets/checkbox.h"
+#include "gui/widgets/horizontcontainer.h"
#include "gui/widgets/label.h"
#include "gui/widgets/layouthelper.h"
+#include "gui/widgets/scrollarea.h"
#include "gui/widgets/textfield.h"
+#include "gui/widgets/vertcontainer.h"
#include "configuration.h"
#include "localplayer.h"
@@ -194,44 +197,56 @@ Setup_Other::Setup_Other():
mEnableAttackFilterCheckBox = new CheckBox(_("Enable attack filter"),
mEnableAttackFilter, this, ACTION_ENABLE_ATTACK_FILTER);
- // Do the layout
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
-
- place(0, 0, mShowMonstersTakedDamageCheckBox, 12);
- place(12, 0, mServerAttackCheckBox, 10);
- place(0, 1, mTargetOnlyReachableCheckBox, 12);
- place(12, 1, mAutofixPosCheckBox, 10);
- place(0, 2, mHighlightPortalsCheckBox, 12);
- place(12, 2, mAttackMovingCheckBox, 10);
- place(12, 3, mQuickStatsCheckBox, 10);
- place(12, 4, mWarpParticleCheckBox, 10);
- place(12, 5, mAutoShopCheckBox, 10);
- place(12, 6, mShowMobHPCheckBox, 10);
- place(12, 7, mShowOwnHPCheckBox, 10);
- place(12, 8, mShowJobExpCheckBox, 10);
- place(12, 9, mShowBeingPopupCheckBox, 10);
- place(12, 10, mShowExtMinimapsCheckBox, 10);
- place(12, 11, mEnableAttackFilterCheckBox, 10);
- place(0, 3, mFloorItemsHighlightCheckBox, 12);
- place(0, 4, mHighlightAttackRangeCheckBox, 12);
- place(0, 5, mHighlightMonsterAttackRangeCheckBox, 12);
- place(0, 6, mCyclePlayersCheckBox, 12);
- place(0, 7, mCycleMonstersCheckBox, 12);
- place(0, 8, mEnableBotCheckerCheckBox, 12);
- place(0, 9, mMoveProgramLabel, 12);
- place(0, 10, mMoveProgramField, 9);
- place(9, 10, mMoveProgramButton, 2);
- place(0, 11, mAfkField, 9);
- place(9, 11, mAfkButton, 2);
- place(0, 12, mTradeBotCheckBox, 12);
- place(0, 13, mBuggyServersCheckBox, 12);
- place(0, 14, mDebugLogCheckBox, 12);
-
- place.getCell().matchColWidth(0, 0);
- place = h.getPlacer(0, 1);
-
- setDimension(gcn::Rectangle(0, 0, 550, 500));
+ place(0, 0, mScroll, 10, 10);
+
+
+ mContainer->add(mShowMonstersTakedDamageCheckBox);
+ mContainer->add(mServerAttackCheckBox);
+ mContainer->add(mTargetOnlyReachableCheckBox);
+ mContainer->add(mAutofixPosCheckBox);
+ mContainer->add(mHighlightPortalsCheckBox);
+ mContainer->add(mAttackMovingCheckBox);
+ mContainer->add(mFloorItemsHighlightCheckBox);
+ mContainer->add(mQuickStatsCheckBox);
+ mContainer->add(mHighlightAttackRangeCheckBox);
+ mContainer->add(mWarpParticleCheckBox);
+ mContainer->add(mHighlightMonsterAttackRangeCheckBox);
+ mContainer->add(mAutoShopCheckBox);
+ mContainer->add(mCyclePlayersCheckBox);
+ mContainer->add(mShowMobHPCheckBox);
+ mContainer->add(mCycleMonstersCheckBox);
+ mContainer->add(mShowOwnHPCheckBox);
+ mContainer->add(mEnableBotCheckerCheckBox);
+ mContainer->add(mShowJobExpCheckBox);
+
+ HorizontContainer *hc1 = new HorizontContainer(32, 2);
+ mDeleteWidgets.push_back(hc1);
+ mMoveProgramField->setWidth(200);
+ hc1->add(mMoveProgramLabel);
+ hc1->add(mMoveProgramField);
+ hc1->add(mMoveProgramButton);
+
+ mContainer->add(hc1, true, 4);
+
+ mContainer->add(mShowBeingPopupCheckBox);
+ mContainer->add(mShowExtMinimapsCheckBox);
+
+ HorizontContainer *hc2 = new HorizontContainer(32, 2);
+ mDeleteWidgets.push_back(hc2);
+ mAfkField->setWidth(200);
+ hc2->add(mAfkField);
+ hc2->add(mAfkButton);
+
+ mContainer->add(hc2, true, 4);
+
+ mContainer->add(mEnableAttackFilterCheckBox);
+ mContainer->add(mTradeBotCheckBox);
+ mContainer->add(mBuggyServersCheckBox);
+ mContainer->add(mDebugLogCheckBox);
+
+ setDimension(gcn::Rectangle(0, 0, 550, 350));
}
void Setup_Other::action(const gcn::ActionEvent &event)
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index 8bf4fe659..04ae7fed3 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -25,13 +25,14 @@
#include "guichanfwd.h"
-#include "gui/widgets/setuptab.h"
+#include "gui/widgets/setuptabscroll.h"
#include <guichan/actionlistener.hpp>
class EditDialog;
+class TextField;
-class Setup_Other : public SetupTab, public gcn::ActionListener
+class Setup_Other : public SetupTabScroll, public gcn::ActionListener
{
public:
Setup_Other();
@@ -72,7 +73,7 @@ class Setup_Other : public SetupTab, public gcn::ActionListener
bool mFloorItemsHighlight;
gcn::Label *mMoveProgramLabel;
- gcn::TextField *mMoveProgramField;
+ TextField *mMoveProgramField;
gcn::Button *mMoveProgramButton;
std::string mMoveProgram;
@@ -126,6 +127,8 @@ class Setup_Other : public SetupTab, public gcn::ActionListener
bool mEnableAttackFilter;
EditDialog *mEditDialog;
+
+ std::list<gcn::Widget*> mDeleteWidgets;
};
#endif
diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp
index a04230871..95320055c 100644
--- a/src/gui/widgets/horizontcontainer.cpp
+++ b/src/gui/widgets/horizontcontainer.cpp
@@ -26,7 +26,7 @@
HorizontContainer::HorizontContainer(int height, int spacing):
mSpacing(spacing),
mCount(0),
- mLastX(0)
+ mLastX(spacing)
{
setHeight(height);
addWidgetListener(this);
@@ -38,9 +38,9 @@ void HorizontContainer::add(gcn::Widget *widget)
return;
Container::add(widget);
- widget->setPosition(mLastX, 0);
+ widget->setPosition(mLastX, mSpacing);
mCount++;
- mLastX += widget->getWidth() + mSpacing;
+ mLastX += widget->getWidth() + 2 * mSpacing;
}
void HorizontContainer::clear()
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
new file mode 100644
index 000000000..c46ebaf97
--- /dev/null
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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/>.
+ */
+
+#include "gui/widgets/setuptabscroll.h"
+
+#include "gui/widgets/layouthelper.h"
+#include "gui/widgets/scrollarea.h"
+#include "gui/widgets/vertcontainer.h"
+
+#include "debug.h"
+
+SetupTabScroll::SetupTabScroll() :
+ SetupTab()
+{
+ mContainer = new VertContainer(32, false, 8);
+ mScroll = new ScrollArea(mContainer);
+ mScroll->setOpaque(false);
+ mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
+ mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO);
+
+// LayoutHelper h(this);
+// ContainerPlacer place = h.getPlacer(0, 0);
+// place(0, 0, mScroll, 10, 10);
+}
+
+SetupTabScroll::~SetupTabScroll()
+{
+// delete mScroll;
+ mScroll = 0;
+ delete mContainer;
+ mContainer = 0;
+}
diff --git a/src/gui/widgets/setuptabscroll.h b/src/gui/widgets/setuptabscroll.h
new file mode 100644
index 000000000..83a5e272c
--- /dev/null
+++ b/src/gui/widgets/setuptabscroll.h
@@ -0,0 +1,41 @@
+/*
+ * 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 GUI_SETUPTABSCROLL_H
+#define GUI_SETUPTABSCROLL_H
+
+#include "gui/widgets/setuptab.h"
+
+class ScrollArea;
+class VertContainer;
+
+class SetupTabScroll : public SetupTab
+{
+ public:
+ SetupTabScroll();
+
+ ~SetupTabScroll();
+
+ protected:
+ VertContainer *mContainer;
+ ScrollArea *mScroll;
+};
+
+#endif
diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp
index d4cf0a13f..6f94df535 100644
--- a/src/gui/widgets/vertcontainer.cpp
+++ b/src/gui/widgets/vertcontainer.cpp
@@ -23,23 +23,45 @@
#include "debug.h"
-VertContainer::VertContainer(int spacing):
- mSpacing(spacing),
- mCount(0)
+VertContainer::VertContainer(int verticalItemSize, bool resizable,
+ int leftSpacing):
+ mVerticalItemSize(verticalItemSize),
+ mCount(0),
+ mNextY(0),
+ mLeftSpacing(leftSpacing),
+ mVerticalSpacing(0),
+ mResizable(resizable)
{
addWidgetListener(this);
}
-void VertContainer::add(gcn::Widget *widget)
+void VertContainer::add(gcn::Widget *widget, int spacing)
+{
+ add(widget, mResizable, spacing);
+}
+
+void VertContainer::add(gcn::Widget *widget, bool resizable, int spacing)
{
if (!widget)
return;
Container::add(widget);
- widget->setPosition(0, mCount * mSpacing);
- widget->setSize(getWidth(), mSpacing);
- mCount++;
- setHeight(mCount * mSpacing);
+ widget->setPosition(mLeftSpacing, mNextY);
+ if (resizable)
+ {
+ widget->setSize(getWidth() - mLeftSpacing, mVerticalItemSize);
+ mResizableWidgets.push_back(widget);
+ }
+ else if (widget->getHeight() > mVerticalItemSize)
+ {
+ widget->setSize(widget->getWidth(), mVerticalItemSize);
+ }
+
+ if (spacing == -1)
+ mNextY += mVerticalItemSize + (mVerticalSpacing * 2);
+ else
+ mNextY += mVerticalItemSize + (spacing * 2);
+ setHeight(mNextY);
}
void VertContainer::clear()
@@ -51,6 +73,9 @@ void VertContainer::clear()
void VertContainer::widgetResized(const gcn::Event &event _UNUSED_)
{
- for (WidgetListIterator it = mWidgets.begin(); it != mWidgets.end(); it++)
+ for (WidgetListIterator it = mResizableWidgets.begin();
+ it != mResizableWidgets.end(); it++)
+ {
(*it)->setWidth(getWidth());
+ }
}
diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h
index e96bd5561..268c61d4f 100644
--- a/src/gui/widgets/vertcontainer.h
+++ b/src/gui/widgets/vertcontainer.h
@@ -40,14 +40,26 @@
class VertContainer : public Container, public gcn::WidgetListener
{
public:
- VertContainer(int spacing);
- virtual void add(gcn::Widget *widget);
+ VertContainer(int verticalItemSize, bool resizable = true,
+ int leftSpacing = 0);
+
+ virtual void add(gcn::Widget *widget, bool resizable,
+ int spacing = -1);
+
+ virtual void add(gcn::Widget *widget, int spacing = -1);
+
virtual void clear();
+
void widgetResized(const gcn::Event &event);
private:
- int mSpacing;
+ std::list<gcn::Widget*> mResizableWidgets;
+ int mVerticalItemSize;
int mCount;
+ int mNextY;
+ int mLeftSpacing;
+ int mVerticalSpacing;
+ bool mResizable;
};
#endif