From b226f23946987a649fb50bc6d9df2dd8afa7ade1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 23 Dec 2015 01:47:57 +0300 Subject: Add const attribute to gui classes. --- src/gui/fonts/font.h | 2 +- src/gui/models/playertablemodel.h | 6 +++--- src/gui/popupmanager.h | 4 ++-- src/gui/shortcut/spellshortcut.h | 4 ++-- src/gui/widgets/avatarlistbox.h | 2 +- src/gui/widgets/characterdisplay.h | 4 ++-- src/gui/widgets/characterviewnormal.h | 2 +- src/gui/widgets/dropdown.h | 2 +- src/gui/widgets/emoteshortcutcontainer.h | 2 +- src/gui/widgets/horizontcontainer.h | 2 +- src/gui/widgets/itemcontainer.h | 4 ++-- src/gui/widgets/layouthelper.h | 2 +- src/gui/widgets/listbox.h | 4 ++-- src/gui/widgets/setupbuttonitem.h | 17 +++++++++-------- src/gui/widgets/setupitem.h | 10 +++++----- src/gui/widgets/setupquickitem.h | 13 +++++++------ src/gui/widgets/tabs/chat/gmtab.h | 5 +++-- src/gui/widgets/tabs/setup_relations.h | 2 +- src/gui/widgets/tabs/setuptab.h | 4 ++-- src/gui/widgets/textfield.h | 6 +++++- src/gui/widgets/widget.h | 6 +++--- src/gui/widgets/widgetgroup.h | 2 +- 22 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/gui/fonts/font.h b/src/gui/fonts/font.h index 0188586b3..62f32800f 100644 --- a/src/gui/fonts/font.h +++ b/src/gui/fonts/font.h @@ -101,7 +101,7 @@ class Font final int getHeight() const A_WARN_UNUSED; - const TextChunkList *getCache() const A_WARN_UNUSED; + const TextChunkList *getCache() const A_CONST A_WARN_UNUSED; /** * @see Font::drawString diff --git a/src/gui/models/playertablemodel.h b/src/gui/models/playertablemodel.h index 6525a38b3..e71faf1ad 100644 --- a/src/gui/models/playertablemodel.h +++ b/src/gui/models/playertablemodel.h @@ -43,11 +43,11 @@ class PlayerTableModel final : public Widget2, int getRows() const override final; - int getColumns() const override final; + int getColumns() const override final A_CONST; - int getRowHeight() const override final; + int getRowHeight() const override final A_CONST; - int getColumnWidth(const int index) const override final; + int getColumnWidth(const int index) const override final A_CONST; void playerRelationsUpdated(); diff --git a/src/gui/popupmanager.h b/src/gui/popupmanager.h index df1a6725b..efb356e4e 100644 --- a/src/gui/popupmanager.h +++ b/src/gui/popupmanager.h @@ -31,14 +31,14 @@ class PopupManager final /** * Constructor. */ - PopupManager(); + PopupManager() A_CONST; A_DELETE_COPY(PopupManager) /** * Destructor. */ - ~PopupManager(); + ~PopupManager() A_CONST; static bool isBeingPopupVisible() A_WARN_UNUSED; diff --git a/src/gui/shortcut/spellshortcut.h b/src/gui/shortcut/spellshortcut.h index 694bf5fac..4342e082f 100644 --- a/src/gui/shortcut/spellshortcut.h +++ b/src/gui/shortcut/spellshortcut.h @@ -41,14 +41,14 @@ class SpellShortcut final /** * Destructor. */ - ~SpellShortcut(); + ~SpellShortcut() A_CONST; /** * Load the configuration information. */ void load(); - unsigned int getSpellsCount() const A_WARN_UNUSED; + unsigned int getSpellsCount() const A_CONST A_WARN_UNUSED; /** * Set the item that is selected. diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index 3040b3261..58420d2c4 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -47,7 +47,7 @@ class AvatarListBox final : public ListBox, void mousePressed(MouseEvent &event) override final; - void mouseReleased(MouseEvent &event A_UNUSED) override final; + void mouseReleased(MouseEvent &event A_UNUSED) override final A_CONST; void optionChanged(const std::string &value) override final; diff --git a/src/gui/widgets/characterdisplay.h b/src/gui/widgets/characterdisplay.h index 65add714f..c98217636 100644 --- a/src/gui/widgets/characterdisplay.h +++ b/src/gui/widgets/characterdisplay.h @@ -55,9 +55,9 @@ class CharacterDisplay final : public Container, Net::Character *getCharacter() const { return mCharacter; } - void requestFocus() override final; + void requestFocus() override final A_CONST; - void setActive(const bool active); + void setActive(const bool active) A_CONST; bool isSelectFocused() const { return false; } diff --git a/src/gui/widgets/characterviewnormal.h b/src/gui/widgets/characterviewnormal.h index 1bae01cee..1d20f540e 100644 --- a/src/gui/widgets/characterviewnormal.h +++ b/src/gui/widgets/characterviewnormal.h @@ -40,7 +40,7 @@ class CharacterViewNormal final : public CharacterViewBase void resize() override; - void action(const ActionEvent &event A_UNUSED) override final; + void action(const ActionEvent &event A_UNUSED) override final A_CONST; private: std::vector *mCharacterEntries; diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index fb4d03e94..480f702be 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -107,7 +107,7 @@ class DropDown final : public ActionListener, std::string getSelectedString() const A_WARN_UNUSED; - void valueChanged(const SelectionEvent& event) override final; + void valueChanged(const SelectionEvent& event) override final A_CONST; void updateSelection(); diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 9dba54e5f..a4e52b2bf 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -56,7 +56,7 @@ class EmoteShortcutContainer final : public ShortcutContainer /** * Handles mouse when dragged. */ - void mouseDragged(MouseEvent &event) override final; + void mouseDragged(MouseEvent &event) override final A_CONST; /** * Handles mouse when pressed. diff --git a/src/gui/widgets/horizontcontainer.h b/src/gui/widgets/horizontcontainer.h index 7cb1c9878..357e0ba24 100644 --- a/src/gui/widgets/horizontcontainer.h +++ b/src/gui/widgets/horizontcontainer.h @@ -51,7 +51,7 @@ class HorizontContainer final : public Container, void clear() override; - void widgetResized(const Event &event) override final; + void widgetResized(const Event &event) override final A_CONST; protected: int mSpacing; diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index b411e0136..04e3d4ccd 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -84,8 +84,8 @@ class ItemContainer final : public Widget, void safeDraw(Graphics *graphics) override final A_NONNULL(2); // KeyListener - void keyPressed(KeyEvent &event) override final; - void keyReleased(KeyEvent &event) override final; + void keyPressed(KeyEvent &event) override final A_CONST; + void keyReleased(KeyEvent &event) override final A_CONST; // MouseListener void mousePressed(MouseEvent &event) override final; diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h index 2d51ab01d..31fd4dd1e 100644 --- a/src/gui/widgets/layouthelper.h +++ b/src/gui/widgets/layouthelper.h @@ -53,7 +53,7 @@ class LayoutHelper final : public WidgetListener /** * Gets the layout handler. */ - const Layout &getLayout() const A_WARN_UNUSED; + const Layout &getLayout() const A_WARN_UNUSED A_CONST; /** * Computes the position of the widgets according to the current diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 382f56dfe..faf3684ce 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -123,9 +123,9 @@ class ListBox notfinal : public Widget, // Inherited from MouseListener - void mouseWheelMovedUp(MouseEvent& event) override final; + void mouseWheelMovedUp(MouseEvent& event) override final A_CONST; - void mouseWheelMovedDown(MouseEvent& event) override final; + void mouseWheelMovedDown(MouseEvent& event) override final A_CONST; void mousePressed(MouseEvent &event) override; diff --git a/src/gui/widgets/setupbuttonitem.h b/src/gui/widgets/setupbuttonitem.h index af843025c..653d3e28d 100644 --- a/src/gui/widgets/setupbuttonitem.h +++ b/src/gui/widgets/setupbuttonitem.h @@ -43,22 +43,23 @@ class SetupButtonItem final : public SetupItem void createControls(); - void fromWidget() override final; + void fromWidget() override final A_CONST; - void toWidget() override final; + void toWidget() override final A_CONST; - void action(const ActionEvent &event) override final; + void action(const ActionEvent &event) override final A_CONST; - void apply(const std::string &eventName) override final; + void apply(const std::string &eventName) override final A_CONST; - void cancel(const std::string &eventName A_UNUSED) override final; + void cancel(const std::string &eventName A_UNUSED) + override final A_CONST; void externalUpdated(const std::string &eventName A_UNUSED) - override final; + override final A_CONST; - void rereadValue() override final; + void rereadValue() override final A_CONST; - void save() override final; + void save() override final A_CONST; protected: HorizontContainer *mHorizont; diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index cc7a04044..d4bca35bd 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -91,7 +91,7 @@ class SetupItem notfinal : public ActionListener, virtual void externalUpdated(const std::string &eventName); - virtual void externalUnloaded(const std::string &eventName); + virtual void externalUnloaded(const std::string &eventName) A_CONST; MainConfig isMainConfig() const A_WARN_UNUSED { return mMainConfig; } @@ -295,13 +295,13 @@ class SetupItemLabel final : public SetupItem void createControls(); - void fromWidget() override final; + void fromWidget() override final A_CONST; - void toWidget() override final; + void toWidget() override final A_CONST; - void action(const ActionEvent &event) override final; + void action(const ActionEvent &event) override final A_CONST; - void apply(const std::string &eventName) override final; + void apply(const std::string &eventName) override final A_CONST; protected: Label *mLabel; diff --git a/src/gui/widgets/setupquickitem.h b/src/gui/widgets/setupquickitem.h index 70db34131..b19ead347 100644 --- a/src/gui/widgets/setupquickitem.h +++ b/src/gui/widgets/setupquickitem.h @@ -49,22 +49,23 @@ class SetupQuickItem final : public SetupItem, void createControls(); - void fromWidget() override final; + void fromWidget() override final A_CONST; void toWidget() override final; void action(const ActionEvent &event) override final; - void apply(const std::string &eventName) override final; + void apply(const std::string &eventName) override final A_CONST; - void cancel(const std::string &eventName A_UNUSED) override final; + void cancel(const std::string &eventName A_UNUSED) override final + A_CONST; void externalUpdated(const std::string &eventName A_UNUSED) - override final; + override final A_CONST; - void rereadValue() override final; + void rereadValue() override final A_CONST; - void save() override final; + void save() override final A_CONST; void gameModifiersChanged() override final; diff --git a/src/gui/widgets/tabs/chat/gmtab.h b/src/gui/widgets/tabs/chat/gmtab.h index a120eb745..fdc520c9c 100644 --- a/src/gui/widgets/tabs/chat/gmtab.h +++ b/src/gui/widgets/tabs/chat/gmtab.h @@ -36,11 +36,12 @@ class GmTab final : public ChatTab ~GmTab(); protected: - void getAutoCompleteList(StringVect &names) const override final; + void getAutoCompleteList(StringVect &names) const + override final A_CONST; void handleInput(const std::string &msg) override final; - void handleCommandStr(const std::string &msg) override final; + void handleCommandStr(const std::string &msg) override final A_CONST; }; extern GmTab *gmChatTab; diff --git a/src/gui/widgets/tabs/setup_relations.h b/src/gui/widgets/tabs/setup_relations.h index 2d446452e..72abdb313 100644 --- a/src/gui/widgets/tabs/setup_relations.h +++ b/src/gui/widgets/tabs/setup_relations.h @@ -48,7 +48,7 @@ class Setup_Relations final : public SetupTab, void apply() override final; - void cancel() override final; + void cancel() override final A_CONST; void reset(); diff --git a/src/gui/widgets/tabs/setuptab.h b/src/gui/widgets/tabs/setuptab.h index a9fd785ef..db9d3c68f 100644 --- a/src/gui/widgets/tabs/setuptab.h +++ b/src/gui/widgets/tabs/setuptab.h @@ -53,9 +53,9 @@ class SetupTab notfinal : public Container, */ virtual void cancel() = 0; - virtual void externalUpdated(); + virtual void externalUpdated() A_CONST; - virtual void externalUnloaded(); + virtual void externalUnloaded() A_CONST; protected: explicit SetupTab(const Widget2 *const widget); diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 6e77b5e1a..958c1b5f7 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -174,9 +174,13 @@ class TextField notfinal : public Widget, void handleCopy() const; +#ifdef ANDROID void focusGained(const Event &event) override final; +#else + void focusGained(const Event &event) override final A_CONST; +#endif - void focusLost(const Event &event) override; + void focusLost(const Event &event) override A_CONST; void moveCaretBack(); diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index 2cba39d33..ace12e321 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -858,7 +858,7 @@ class Widget notfinal : public Widget2 * @since 0.6.0 */ const std::list& getMouseListeners() const - A_WARN_UNUSED; + A_CONST A_WARN_UNUSED; /** * Gets the key listeners of the widget. @@ -867,7 +867,7 @@ class Widget notfinal : public Widget2 * @since 0.6.0 */ const std::list& getKeyListeners() const - A_WARN_UNUSED; + A_CONST A_WARN_UNUSED; /** * Gets the focus listeners of the widget. @@ -876,7 +876,7 @@ class Widget notfinal : public Widget2 * @since 0.7.0 */ const std::list& getFocusListeners() const - A_WARN_UNUSED; + A_CONST A_WARN_UNUSED; /** * Gets the area of the widget occupied by the widget's children. diff --git a/src/gui/widgets/widgetgroup.h b/src/gui/widgets/widgetgroup.h index 5425ffbe8..6356034ff 100644 --- a/src/gui/widgets/widgetgroup.h +++ b/src/gui/widgets/widgetgroup.h @@ -46,7 +46,7 @@ class WidgetGroup notfinal : public Container, void clear() override final; - void widgetResized(const Event &event) override final; + void widgetResized(const Event &event) override final A_CONST; virtual Widget *createWidget(const std::string &name, const bool pressed = false) -- cgit v1.2.3-70-g09d2