diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-02 12:46:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-02 12:46:32 +0300 |
commit | 11caa7aeeb3a7b40823da8573576d2354b7504b5 (patch) | |
tree | fe34c20ea973e65104747b59675acf6363e7b5d2 /src/gui/widgets | |
parent | 0c4ed5a9594b849b436fca13c6992dee923915ed (diff) | |
download | manaverse-11caa7aeeb3a7b40823da8573576d2354b7504b5.tar.gz manaverse-11caa7aeeb3a7b40823da8573576d2354b7504b5.tar.bz2 manaverse-11caa7aeeb3a7b40823da8573576d2354b7504b5.tar.xz manaverse-11caa7aeeb3a7b40823da8573576d2354b7504b5.zip |
Add missing const and static into gui classes.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/button.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/characterdisplay.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/dropdown.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/emotepage.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/itemcontainer.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/listbox.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/playerbox.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/progressbar.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 24 | ||||
-rw-r--r-- | src/gui/widgets/slider.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/sliderlist.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/sliderlist.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chattab.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/tabs/guildchattab.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_input.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_input.h | 9 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setuptabscroll.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/whispertab.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 4 |
21 files changed, 41 insertions, 65 deletions
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index a2333d581..3dd783e52 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -107,7 +107,7 @@ class Button final : public gcn::Button, /** * Update the alpha value to the button components. */ - void updateAlpha(); + static void updateAlpha(); void mouseReleased(gcn::MouseEvent& mouseEvent) override final; diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index bd3f042f9..5ae4e2f5b 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -127,7 +127,7 @@ void CharacterDisplay::mouseMoved(gcn::MouseEvent &event A_UNUSED) int mouseX = 0; int mouseY = 0; - gui->getMouseState(&mouseX, &mouseY); + Gui::getMouseState(&mouseX, &mouseY); const std::string &name = mName->getCaption(); if (!name.empty()) { diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 068ffe1fc..59cdec6fb 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -183,7 +183,7 @@ DropDown::~DropDown() if (theme) { theme->unload(mSkin); - theme->unloadRect(skinRect); + Theme::unloadRect(skinRect); } } } diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index 8cef8f058..132cfb8e9 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -53,7 +53,7 @@ class EmotePage final : public gcn::Widget, void resetAction(); - int getSelectedIndex() + int getSelectedIndex() const { return mSelectedIndex; } private: diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 272536c87..f4a73af9f 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -134,7 +134,7 @@ class ItemContainer final : public gcn::Widget, void updateMatrix(); - bool getClickCount() A_WARN_UNUSED + bool getClickCount() const A_WARN_UNUSED { return mClicks; } private: diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 83a33eb62..b1a2f0da5 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -97,7 +97,7 @@ class ListBox : public gcn::ListBox, void setCenter(const bool b) { mCenterText = b; } - int getPressedIndex() + int getPressedIndex() const { return mPressedIndex; } unsigned int getRowHeight() const override A_WARN_UNUSED diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 2e078c088..6fda932bf 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -70,13 +70,8 @@ PlayerBox::~PlayerBox() if (gui) gui->removeDragged(this); - Theme *const theme = Theme::instance(); - if (theme) - { - theme->unloadRect(mBackground); - theme->unloadRect(mSelectedBackground); - } - + Theme::unloadRect(mBackground); + Theme::unloadRect(mSelectedBackground); mBeing = nullptr; } diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index aecb323f8..38257e0a8 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -101,8 +101,7 @@ ProgressBar::~ProgressBar() theme->unload(mSkin); mSkin = nullptr; } - if (theme) - theme->unloadRect(mFillRect); + Theme::unloadRect(mFillRect); delete mVertexes; mVertexes = nullptr; } diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 6d7695198..a260142a1 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -96,23 +96,19 @@ ScrollArea::~ScrollArea() delete getContent(); instances--; - const Theme *const theme = Theme::instance(); - if (theme) + if (instances == 0) { - if (instances == 0) + Theme::unloadRect(background); + Theme::unloadRect(vMarker); + Theme::unloadRect(vMarkerHi); + Theme::unloadRect(vBackground); + Theme::unloadRect(hBackground); + for (int i = 0; i < 2; i ++) { - theme->unloadRect(background); - theme->unloadRect(vMarker); - theme->unloadRect(vMarkerHi); - theme->unloadRect(vBackground); - theme->unloadRect(hBackground); - for (int i = 0; i < 2; i ++) + for (int f = UP; f < BUTTONS_DIR; f ++) { - for (int f = UP; f < BUTTONS_DIR; f ++) - { - if (buttons[f][i]) - buttons[f][i]->decRef(); - } + if (buttons[f][i]) + buttons[f][i]->decRef(); } } } diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 37b696a4e..750b58528 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -72,9 +72,8 @@ Slider::~Slider() mInstances--; if (mInstances == 0 && Theme::instance()) { - const Theme *const theme = Theme::instance(); for (int mode = 0; mode < 2; mode ++) - theme->unloadRect(buttons[mode]); + Theme::unloadRect(buttons[mode]); } } diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 6dd968eef..60d7926d1 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -77,8 +77,7 @@ SliderList::~SliderList() void SliderList::updateAlpha() { - mButtons[0]->updateAlpha(); - mButtons[1]->updateAlpha(); + Button::updateAlpha(); } void SliderList::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 4ef673b83..73f8c6f5c 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -67,7 +67,7 @@ class SliderList final : public Container, void adjustSize(); - int getSelected() A_WARN_UNUSED + int getSelected() const A_WARN_UNUSED { return mSelectedIndex; } protected: diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index c4e4b0671..bf14f21fe 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -321,7 +321,7 @@ void SpellShortcutContainer::widgetHidden(const gcn::Event &event A_UNUSED) mSpellPopup->setVisible(false); } -int SpellShortcutContainer::getItemByIndex(const int index) +int SpellShortcutContainer::getItemByIndex(const int index) const { return spellShortcut->getItem( (mNumber * SPELL_SHORTCUT_ITEMS) + index); diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 31e98a592..37e7b5660 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -75,7 +75,7 @@ class SpellShortcutContainer final : public ShortcutContainer void setWidget2(const Widget2 *const widget) override final; - int getItemByIndex(const int index); + int getItemByIndex(const int index) const A_WARN_UNUSED; private: SpellPopup *mSpellPopup; diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp index 1795fd03e..331101209 100644 --- a/src/gui/widgets/tabs/chattab.cpp +++ b/src/gui/widgets/tabs/chattab.cpp @@ -418,15 +418,8 @@ void ChatTab::clearText() void ChatTab::handleInput(const std::string &msg) { - if (chatWindow) - { - Net::getChatHandler()->talk(chatWindow->doReplace(msg), - mChannelName); - } - else - { - Net::getChatHandler()->talk(msg, mChannelName); - } + Net::getChatHandler()->talk(ChatWindow::doReplace(msg), + mChannelName); } void ChatTab::handleCommand(const std::string &msg) diff --git a/src/gui/widgets/tabs/guildchattab.cpp b/src/gui/widgets/tabs/guildchattab.cpp index 364b83968..8de95991f 100644 --- a/src/gui/widgets/tabs/guildchattab.cpp +++ b/src/gui/widgets/tabs/guildchattab.cpp @@ -107,11 +107,7 @@ void GuildChatTab::handleInput(const std::string &msg) { if (!guildManager) return; - - if (chatWindow) - guildManager->chat(chatWindow->doReplace(msg)); - else - guildManager->chat(msg); + guildManager->chat(ChatWindow::doReplace(msg)); } void GuildChatTab::showHelp() diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 2ce99d971..9ce6fd616 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -270,7 +270,7 @@ void Setup_Input::action(const gcn::ActionEvent &event) else if (id == "resetkeys") { inputManager.resetKeys(); - inputManager.update(); + InputManager::update(); refreshKeys(); } else if (id == "default") @@ -378,8 +378,9 @@ void Setup_Input::keyUnresolved() } void Setup_Input::fixTranslation(SetupActionData *const actionDatas, - const int actionStart, const int actionEnd, - const std::string &text) const + const int actionStart, + const int actionEnd, + const std::string &text) { int k = 0; @@ -397,7 +398,7 @@ void Setup_Input::fixTranslation(SetupActionData *const actionDatas, } } -void Setup_Input::fixTranslations() const +void Setup_Input::fixTranslations() { fixTranslation(setupActionData1, static_cast<int>(Input::KEY_SHORTCUT_1), static_cast<int>(Input::KEY_SHORTCUT_20), "Item Shortcut %d"); diff --git a/src/gui/widgets/tabs/setup_input.h b/src/gui/widgets/tabs/setup_input.h index cb2e5cac0..135cb3339 100644 --- a/src/gui/widgets/tabs/setup_input.h +++ b/src/gui/widgets/tabs/setup_input.h @@ -82,11 +82,12 @@ class Setup_Input final : public SetupTab std::string keyToString(const int index) const A_WARN_UNUSED; private: - void fixTranslations() const; + static void fixTranslations(); - void fixTranslation(SetupActionData *const actionDatas, - const int actionStart, const int actionEnd, - const std::string &text) const; + static void fixTranslation(SetupActionData *const actionDatas, + const int actionStart, + const int actionEnd, + const std::string &text); KeyListModel *mKeyListModel; ListBox *mKeyList; diff --git a/src/gui/widgets/tabs/setuptabscroll.h b/src/gui/widgets/tabs/setuptabscroll.h index e3d495690..fb7de574d 100644 --- a/src/gui/widgets/tabs/setuptabscroll.h +++ b/src/gui/widgets/tabs/setuptabscroll.h @@ -60,7 +60,7 @@ class SetupTabScroll : public SetupTab override final { } - int getPreferredFirstItemSize() A_WARN_UNUSED + int getPreferredFirstItemSize() const A_WARN_UNUSED { return mPreferredFirstItemSize; } void widgetResized(const gcn::Event &event) override final; diff --git a/src/gui/widgets/tabs/whispertab.cpp b/src/gui/widgets/tabs/whispertab.cpp index 659704638..2d1e2969a 100644 --- a/src/gui/widgets/tabs/whispertab.cpp +++ b/src/gui/widgets/tabs/whispertab.cpp @@ -52,10 +52,7 @@ WhisperTab::~WhisperTab() void WhisperTab::handleInput(const std::string &msg) { std::string newMsg; - if (chatWindow) - newMsg = chatWindow->doReplace(msg); - else - newMsg = msg; + newMsg = ChatWindow::doReplace(msg); Net::getChatHandler()->privateMessage(mNick, newMsg); if (player_node) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 41084c867..269ace775 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -116,7 +116,7 @@ TextField::~TextField() if (theme) { theme->unload(mSkin); - theme->unloadRect(skin); + Theme::unloadRect(skin); } } } @@ -745,7 +745,7 @@ void TextField::mousePressed(gcn::MouseEvent &mouseEvent) { int x = 0; int y = 0; - gui->getMouseState(&x, &y); + Gui::getMouseState(&x, &y); mPopupMenu->showTextFieldPopup(x, y, this); } } |