summaryrefslogtreecommitdiff
path: root/src/gui/shortcutwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-07 22:09:11 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-07 22:09:11 +0300
commitb7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2 (patch)
treeee27a5a1ace7e5dbc588466dc623013e4d5cea99 /src/gui/shortcutwindow.cpp
parent7d3059516fc25134d0d29b497e546f2846162399 (diff)
downloadmanaverse-b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2.tar.gz
manaverse-b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2.tar.bz2
manaverse-b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2.tar.xz
manaverse-b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2.zip
Improve constructors in some classes.
Diffstat (limited to 'src/gui/shortcutwindow.cpp')
-rw-r--r--src/gui/shortcutwindow.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index 3a142cbc2..52ac58757 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -41,10 +41,11 @@ int ShortcutWindow::mBoxesWidth = 0;
class ShortcutTab : public Tab
{
public:
- ShortcutTab(std::string name, ShortcutContainer *const content)
+ ShortcutTab(std::string name, ShortcutContainer *const content) :
+ Tab(),
+ mContent(content)
{
setCaption(name);
- mContent = content;
}
ShortcutContainer* mContent;
@@ -54,7 +55,10 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
ShortcutContainer *const content,
std::string skinFile,
int width, int height) :
- Window("Window", false, nullptr, skinFile)
+ Window("Window", false, nullptr, skinFile),
+ mItems(content),
+ mScrollArea(new ScrollArea(mItems, false)),
+ mTabs(nullptr)
{
setWindowName(title);
setTitleBarHeight(getPadding() + getTitlePadding());
@@ -69,9 +73,6 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
setupWindow->registerWindowForReset(this);
- mTabs = nullptr;
- mItems = content;
-
const int border = SCROLL_PADDING * 2 + getPadding() * 2;
setMinWidth(mItems->getBoxWidth() + border);
setMinHeight(mItems->getBoxHeight() + border);
@@ -87,7 +88,6 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
mBoxesWidth += mItems->getBoxWidth() + border;
- mScrollArea = new ScrollArea(mItems, false);
mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING);
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
@@ -102,7 +102,10 @@ ShortcutWindow::ShortcutWindow(const std::string &title,
ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile,
const int width, const int height) :
- Window("Window", false, nullptr, skinFile)
+ Window("Window", false, nullptr, skinFile),
+ mItems(nullptr),
+ mScrollArea(nullptr),
+ mTabs(new TabbedArea)
{
setWindowName(title);
setTitleBarHeight(getPadding() + getTitlePadding());
@@ -116,10 +119,6 @@ ShortcutWindow::ShortcutWindow(const std::string &title, std::string skinFile,
setupWindow->registerWindowForReset(this);
- mTabs = new TabbedArea;
-
- mItems = nullptr;
-
const int border = SCROLL_PADDING * 2 + getPadding() * 2;
if (width && height)