diff options
-rw-r--r-- | data/themes/jewelry/help.xml | 6 | ||||
-rw-r--r-- | src/gui/helpwindow.cpp | 18 | ||||
-rw-r--r-- | src/gui/helpwindow.h | 3 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 2 |
4 files changed, 21 insertions, 8 deletions
diff --git a/data/themes/jewelry/help.xml b/data/themes/jewelry/help.xml index 3b6f4dc12..88c64c222 100644 --- a/data/themes/jewelry/help.xml +++ b/data/themes/jewelry/help.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8"?> <skinset name="Default" image="window.png"> <widget type="Window" xpos="260" ypos="0"> - <option name="captionoffsetx" value="20" /> + <option name="captionoffsetx" value="20" /> <option name="captionoffsety" value="7" /> <option name="titlebarHeight" value="35" /> <option name="titlebarBold" value="1" /> <option name="padding" value="10" /> - <option name="stickySpacing" value="24" /> + <option name="stickySpacing" value="6" /> <option name="childPalette" value="2" /> <!-- Top Row --> @@ -27,6 +27,6 @@ <part type="closeImage" xpos="-163" ypos="0" width="22" height="22" /> <part type="closeImageHighlighted" xpos="-138" ypos="0" width="22" height="22" /> <part type="stickyImageUp" xpos="-130" ypos="51" width="19" height="22" /> - <part type="stickyImageDown" xpos="-115" ypos="51" width="19" height="22" /> + <part type="stickyImageDown" xpos="-99" ypos="51" width="19" height="22" /> </widget> </skinset> diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index 1e73e658d..cacac99d1 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -24,6 +24,7 @@ #include "configuration.h" +#include "gui/didyouknowwindow.h" #include "gui/gui.h" #include "gui/sdlfont.h" #include "gui/setup.h" @@ -47,6 +48,7 @@ HelpWindow::HelpWindow(): Window(_("Help"), false, nullptr, "help.xml"), gcn::ActionListener(), + mDYKButton(new Button(this, _("Did you know..."), "DYK", this)), mBrowserBox(new BrowserBox(this)), mScrollArea(new ScrollArea(mBrowserBox, true, "help_background.xml")) { @@ -54,6 +56,7 @@ HelpWindow::HelpWindow(): setMinHeight(220); setContentSize(455, 350); setWindowName("Help"); + setCloseButton(true); setResizable(true); setStickyButtonLock(true); @@ -62,15 +65,14 @@ HelpWindow::HelpWindow(): setDefaultSize(500, 400, ImageRect::CENTER); mBrowserBox->setOpaque(false); - Button *const okButton = new Button(this, _("Close"), "close", this); mBrowserBox->setLinkHandler(this); mBrowserBox->setFont(gui->getHelpFont()); mBrowserBox->setProcessVersion(true); mBrowserBox->setEnableImages(true); + place(4, 3, mDYKButton); place(0, 0, mScrollArea, 5, 3).setPadding(3); - place(4, 3, okButton); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); @@ -82,8 +84,16 @@ HelpWindow::HelpWindow(): void HelpWindow::action(const gcn::ActionEvent &event) { - if (event.getId() == "close") - setVisible(false); + if (event.getId() == "DYK") + { + if(didYouKnowWindow) + { + didYouKnowWindow->setVisible(!didYouKnowWindow->isVisible()); + if (didYouKnowWindow->isVisible()) + didYouKnowWindow->requestMoveToTop(); + } + } + } void HelpWindow::handleLink(const std::string &link, diff --git a/src/gui/helpwindow.h b/src/gui/helpwindow.h index 4e27a61e2..cec27aa75 100644 --- a/src/gui/helpwindow.h +++ b/src/gui/helpwindow.h @@ -33,6 +33,7 @@ #include <map> #include <set> +class Button; class BrowserBox; class LinkHandler; class ScrollArea; @@ -81,6 +82,8 @@ class HelpWindow final : public Window, public LinkHandler, void loadFile(std::string file); + Button *mDYKButton; + BrowserBox *mBrowserBox; ScrollArea *mScrollArea; HelpTagsMap mTagFileMap; diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index c9fb9c40c..7a583e954 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -132,7 +132,7 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : _("Drop"), x, h, Input::KEY_WINDOW_DROP, false); // TRANSLATORS: short button name for did you know window. addButton(N_("YK"), - _("Did you know"), x, h, Input::KEY_WINDOW_DIDYOUKNOW); + _("Did you know"), x, h, Input::KEY_WINDOW_DIDYOUKNOW, false); // TRANSLATORS: short button name for shop window. addButton(N_("SHP"), _("Shop"), x, h, Input::KEY_WINDOW_SHOP, false); |