summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-02 04:43:18 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-02 04:43:18 +0300
commitc845e800f0d4b17bc5ce65806fa5fadd9468c858 (patch)
treea6bc48691aba3a2dd0e88aa18bc3a17a842bf76b /src/gui
parentbebb93a423a9f6bc7a2b7a610548da6ceaacee97 (diff)
downloadmanaverse-c845e800f0d4b17bc5ce65806fa5fadd9468c858.tar.gz
manaverse-c845e800f0d4b17bc5ce65806fa5fadd9468c858.tar.bz2
manaverse-c845e800f0d4b17bc5ce65806fa5fadd9468c858.tar.xz
manaverse-c845e800f0d4b17bc5ce65806fa5fadd9468c858.zip
Change auto hide screen buttons to 3 states
(always show, hide in small window, always hide)
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup_other.cpp10
-rw-r--r--src/gui/setup_other.h2
-rw-r--r--src/gui/widgets/setupitem.cpp14
-rw-r--r--src/gui/widgets/setupitem.h6
-rw-r--r--src/gui/windowmenu.cpp11
-rw-r--r--src/gui/windowmenu.h2
6 files changed, 31 insertions, 14 deletions
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index 602f94fcb..ff678225f 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -164,8 +164,12 @@ Setup_Other::Setup_Other()
new SetupItemLabel(_("Windows"), "", this);
- new SetupItemCheckBox(_("Auto hide shortcuts buttons."), "",
- "autohideButtons", this, "autohideButtonsEvent");
+ mShortcutsList = new SetupItemNames();
+ mShortcutsList->push_back(_("Always show"));
+ mShortcutsList->push_back(_("Auto hide in small resolution"));
+ mShortcutsList->push_back(_("Always auto hide"));
+ new SetupItemSlider2(_("Shortcut buttons"), "", "autohideButtons", this,
+ "autohideButtonsEvent", 0, 2, mShortcutsList, false, true, true);
new SetupItemLabel(_("Proxy server"), "", this);
@@ -222,6 +226,8 @@ Setup_Other::~Setup_Other()
{
delete mProxyTypeList;
mProxyTypeList = nullptr;
+ delete mShortcutsList;
+ mShortcutsList = nullptr;
}
void Setup_Other::apply()
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index ae7daed50..45910c37c 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -44,6 +44,8 @@ class Setup_Other : public SetupTabScroll
protected:
SetupItemNames *mProxyTypeList;
+
+ SetupItemNames *mShortcutsList;
};
#endif
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 93854e823..1cb007eae 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -712,7 +712,7 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, int min, int max,
SetupItemNames *values, bool onTheFly,
- bool mainConfig) :
+ bool mainConfig, bool doNotAlign) :
SetupItem(text, description, keyName, parent, eventName, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
@@ -723,7 +723,8 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description,
mMax(max),
mInvert(false),
mInvertValue(0),
- mOnTheFly(onTheFly)
+ mOnTheFly(onTheFly),
+ mDoNotAlign(doNotAlign)
{
mValueType = VSTR;
createControls();
@@ -733,7 +734,8 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, int min, int max,
SetupItemNames *values, std::string def,
- bool onTheFly, bool mainConfig) :
+ bool onTheFly, bool mainConfig,
+ bool doNotAlign) :
SetupItem(text, description, keyName, parent, eventName, def, mainConfig),
mHorizont(nullptr),
mLabel(nullptr),
@@ -744,7 +746,8 @@ SetupItemSlider2::SetupItemSlider2(std::string text, std::string description,
mMax(max),
mInvert(false),
mInvertValue(0),
- mOnTheFly(onTheFly)
+ mOnTheFly(onTheFly),
+ mDoNotAlign(doNotAlign)
{
mValueType = VSTR;
createControls();
@@ -777,7 +780,8 @@ void SetupItemSlider2::createControls()
mWidget = mSlider;
mSlider->setWidth(150);
mSlider->setHeight(40);
- fixFirstItemSize(mLabel);
+ if (!mDoNotAlign)
+ fixFirstItemSize(mLabel);
mHorizont->add(mLabel);
mHorizont->add(mSlider, -10);
mHorizont->add(mLabel2);
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 86fdf95f9..52f8515c7 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -317,13 +317,14 @@ class SetupItemSlider2 : public SetupItem
std::string keyName, SetupTabScroll *parent,
std::string eventName, int min, int max,
SetupItemNames *values, bool onTheFly = false,
- bool mainConfig = true);
+ bool mainConfig = true, bool doNotAlign = false);
SetupItemSlider2(std::string text, std::string description,
std::string keyName, SetupTabScroll *parent,
std::string eventName, int min, int max,
SetupItemNames *values, std::string def,
- bool onTheFly = false, bool mainConfig = true);
+ bool onTheFly = false, bool mainConfig = true,
+ bool doNotAlign = false);
~SetupItemSlider2();
@@ -354,6 +355,7 @@ class SetupItemSlider2 : public SetupItem
bool mInvert;
int mInvertValue;
bool mOnTheFly;
+ bool mDoNotAlign;
};
class SetupItemSliderList : public SetupItem
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index c57cd8974..6133c69e0 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -60,7 +60,7 @@ extern Window *socialWindow;
WindowMenu::WindowMenu():
mEmotePopup(nullptr),
mHaveMouse(false),
- mAutoHide(true)
+ mAutoHide(1)
{
int x = 0, h = 0;
@@ -114,7 +114,7 @@ WindowMenu::WindowMenu():
setVisible(true);
config.addListener("autohideButtons", this);
- mAutoHide = config.getBoolValue("autohideButtons");
+ mAutoHide = config.getIntValue("autohideButtons");
}
WindowMenu::~WindowMenu()
@@ -401,12 +401,15 @@ void WindowMenu::saveButtons()
void WindowMenu::drawChildren(gcn::Graphics* graphics)
{
- if (!mAutoHide || mHaveMouse)
+ if (mHaveMouse || !mAutoHide || (mAutoHide == 1
+ && mainGraphics && mainGraphics->mWidth > 800))
+ {
Container::drawChildren(graphics);
+ }
}
void WindowMenu::optionChanged(const std::string &name)
{
if (name == "autohideButtons")
- mAutoHide = config.getBoolValue("autohideButtons");
+ mAutoHide = config.getIntValue("autohideButtons");
}
diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h
index 7bb9aa549..8c57f368b 100644
--- a/src/gui/windowmenu.h
+++ b/src/gui/windowmenu.h
@@ -93,7 +93,7 @@ class WindowMenu : public Container,
std::vector <gcn::Button*> mButtons;
std::map <std::string, gcn::Button*> mButtonNames;
bool mHaveMouse;
- bool mAutoHide;
+ int mAutoHide;
};
extern WindowMenu *windowMenu;