From 98db78be9552b039090ce5dfc53803df2dd54b41 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 3 Feb 2012 18:59:37 +0300 Subject: Add some missing getters. --- src/gui/editdialog.h | 2 +- src/gui/equipmentwindow.h | 2 +- src/gui/inventorywindow.h | 2 +- src/gui/npcdialog.h | 3 ++- src/gui/outfitwindow.h | 2 +- src/gui/palette.h | 10 +++------- src/gui/serverdialog.h | 1 + src/gui/shopwindow.h | 2 +- src/gui/skilldialog.h | 2 +- src/gui/socialwindow.h | 4 ++-- src/gui/statuswindow.cpp | 6 +++--- src/gui/theme.h | 2 +- src/gui/tradewindow.h | 2 +- src/gui/userpalette.h | 2 +- src/gui/viewport.h | 10 +++++----- src/gui/whoisonline.h | 2 +- src/gui/widgets/browserbox.h | 2 +- src/gui/widgets/button.h | 6 +++--- src/gui/widgets/channeltab.h | 3 ++- src/gui/widgets/chattab.h | 8 ++++---- src/gui/widgets/guildchattab.h | 3 ++- src/gui/widgets/icon.h | 3 ++- src/gui/widgets/layout.h | 4 ++-- src/gui/widgets/popup.h | 18 ++++++++++++------ src/gui/widgets/progressbar.h | 6 ++++-- src/gui/widgets/scrollarea.h | 3 ++- src/gui/widgets/setupitem.h | 4 ++-- src/gui/widgets/setuptabscroll.h | 2 +- src/gui/widgets/shoplistbox.h | 3 ++- src/gui/widgets/tab.h | 4 ++-- src/gui/widgets/tabbedarea.h | 4 ++-- 31 files changed, 69 insertions(+), 58 deletions(-) (limited to 'src/gui') diff --git a/src/gui/editdialog.h b/src/gui/editdialog.h index 69f86edca..ef260acfb 100644 --- a/src/gui/editdialog.h +++ b/src/gui/editdialog.h @@ -57,7 +57,7 @@ class EditDialog : public Window, public gcn::ActionListener */ void action(const gcn::ActionEvent &event); - std::string getMsg() + std::string getMsg() const { return mTextField->getText(); } private: diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index daeaeb3d7..1e7b84533 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -84,7 +84,7 @@ class EquipmentWindow : public Window, public gcn::ActionListener void mousePressed(gcn::MouseEvent& mouseEvent); - Item* getEquipment(int i) + Item* getEquipment(int i) const { return mEquipment ? mEquipment->getEquipment(i) : nullptr; } void setBeing(Being *being); diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 2b35ec9c4..9d4be5afc 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -115,7 +115,7 @@ class InventoryWindow : public Window, void slotsChanged(Inventory* inventory); - bool isMainInventory() + bool isMainInventory() const { return mInventory->isMainInventory(); } /** diff --git a/src/gui/npcdialog.h b/src/gui/npcdialog.h index 4d919a3f2..d4288d5c9 100644 --- a/src/gui/npcdialog.h +++ b/src/gui/npcdialog.h @@ -154,7 +154,8 @@ class NpcDialog : public Window, public gcn::ActionListener, /** * Returns true if any instances exist. */ - static bool isActive() { return !instances.empty(); } + static bool isActive() + { return !instances.empty(); } /** * Returns the first active instance. Useful for pushing user diff --git a/src/gui/outfitwindow.h b/src/gui/outfitwindow.h index a663f3657..6f67c472d 100644 --- a/src/gui/outfitwindow.h +++ b/src/gui/outfitwindow.h @@ -72,7 +72,7 @@ class OutfitWindow : public Window, gcn::ActionListener void setItemSelected(Item *item); - bool isItemSelected() + bool isItemSelected() const { return mItemSelected > 0; } void wearOutfit(int outfit, bool unwearEmpty = true, diff --git a/src/gui/palette.h b/src/gui/palette.h index 36d87e305..7d5d93830 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -98,9 +98,7 @@ class Palette * @return the gradient type of the color with the given index */ inline GradientType getGradientType(int type) const - { - return mColors[type].grad; - } + { return mColors[type].grad; } /** * Get the character used by the specified color. @@ -110,9 +108,7 @@ class Palette * @return the color char of the color with the given index */ inline char getColorChar(int type) const - { - return mColors[type].ch; - } + { return mColors[type].ch; } /** * Gets the gradient delay for the specified type. @@ -122,7 +118,7 @@ class Palette * @return the gradient delay of the color with the given index */ inline int getGradientDelay(int type) const - { return mColors[type].delay; } + { return mColors[type].delay; } /** * Updates all colors, that are non-static. diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index 081535c4c..c23fb8776 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.h @@ -127,6 +127,7 @@ class ServerDialog : public Window, protected: friend class ServersListModel; + MutexLocker lock() { return MutexLocker(&mMutex); } diff --git a/src/gui/shopwindow.h b/src/gui/shopwindow.h index 53ed7690c..a8d131acb 100644 --- a/src/gui/shopwindow.h +++ b/src/gui/shopwindow.h @@ -109,7 +109,7 @@ class ShopWindow : public Window, public gcn::ActionListener, void setAcceptPlayer(std::string name) { mAcceptPlayer = name; } - const std::string &getAcceptPlayer() + const std::string &getAcceptPlayer() const { return mAcceptPlayer; } void sendMessage(const std::string &nick, std::string data, diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h index dcb40927a..9032f82ef 100644 --- a/src/gui/skilldialog.h +++ b/src/gui/skilldialog.h @@ -77,7 +77,7 @@ class SkillDialog : public Window, public gcn::ActionListener SkillInfo* getSkill(int id); - bool hasSkills() + bool hasSkills() const { return !mSkills.empty(); } void widgetResized(const gcn::Event &event); diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h index 1429866ee..9da78562b 100644 --- a/src/gui/socialwindow.h +++ b/src/gui/socialwindow.h @@ -101,13 +101,13 @@ public: void prevTab(); - Map* getMap() + Map* getMap() const { return mMap; } void setMap(Map *map) { mMap = map; mProcessedPortals = false; } - bool getProcessedPortals() + bool getProcessedPortals() const { return mProcessedPortals; } void setProcessedPortals(int n) diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 57c81bc04..86964383a 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -69,7 +69,7 @@ class AttrDisplay : public Container virtual std::string update(); - virtual Type getType() + virtual Type getType() const { return UNKNOWN; } std::string getValue() @@ -96,7 +96,7 @@ class DerDisplay : public AttrDisplay public: DerDisplay(int id, const std::string &name); - virtual Type getType() + virtual Type getType() const { return DERIVED; } }; @@ -107,7 +107,7 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener std::string update(); - virtual Type getType() + virtual Type getType() const { return CHANGEABLE; } void setPointsNeeded(int needed); diff --git a/src/gui/theme.h b/src/gui/theme.h index 3be6882a3..9cb8f6180 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -95,7 +95,7 @@ class Skin */ void updateAlpha(float minimumOpacityAllowed = 0.0f); - int getPadding() + int getPadding() const { return mPadding; } int instances; diff --git a/src/gui/tradewindow.h b/src/gui/tradewindow.h index b055c90ce..268d2f108 100644 --- a/src/gui/tradewindow.h +++ b/src/gui/tradewindow.h @@ -128,7 +128,7 @@ class TradeWindow : public Window, gcn::ActionListener, gcn::SelectionListener void initTrade(std::string nick); - std::string getAutoTradeNick() + std::string getAutoTradeNick() const { return mAutoAddToNick; } bool checkItem(Item *item); diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index cb0593fa7..6fba30abc 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -107,7 +107,7 @@ class UserPalette : public Palette, public gcn::ListModel * * @return the requested test color */ - inline const gcn::Color &getTestColor(int type) + inline const gcn::Color &getTestColor(int type) const { return mColors[type].testColor; } /** diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 4ed80ed32..f3035b5df 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -218,13 +218,13 @@ class Viewport : public WindowContainer, public gcn::MouseListener, Map *getCurrentMap() const { return mMap; } - int getDebugPath() + int getDebugPath() const { return mShowDebugPath; } void setDebugPath(int n) { mShowDebugPath = n; } - int getCameraMode() + int getCameraMode() const { return mCameraMode; } /** @@ -237,15 +237,15 @@ class Viewport : public WindowContainer, public gcn::MouseListener, */ void cleanHoverItems(); - Map *getMap() + Map *getMap() const { return mMap; } void moveCamera(int dx, int dy); - int getCameraRelativeX() + int getCameraRelativeX() const { return mCameraRelativeX; } - int getCameraRelativeY() + int getCameraRelativeY() const { return mCameraRelativeY; } void setCameraRelativeX(int n) diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h index d2f0c30d0..dad51e857 100644 --- a/src/gui/whoisonline.h +++ b/src/gui/whoisonline.h @@ -68,7 +68,7 @@ class OnlinePlayer char getLevel() const { return mLevel; } - const std::string getText() + const std::string getText() const { return mText; } void setText(std::string str); diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index ab3049c0b..d82ebd758 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -187,7 +187,7 @@ class BrowserBox : public gcn::Widget, TextRows &getRows() { return mTextRows; } - bool hasRows() + bool hasRows() const { return !mTextRows.empty(); } void setAlwaysUpdate(bool n) diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index aed46bb55..560e46377 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -70,16 +70,16 @@ class Button : public gcn::Button, public gcn::WidgetListener void setDescription(std::string text) { mDescription = text; } - std::string getDescription() + std::string getDescription() const { return mDescription; } - unsigned getClickCount() + unsigned getClickCount() const { return mClickCount; } void setTag(int tag) { mTag = tag; } - int getTag() + int getTag() const { return mTag; } void widgetResized(const gcn::Event &event); diff --git a/src/gui/widgets/channeltab.h b/src/gui/widgets/channeltab.h index 4b56d2e05..39702a696 100644 --- a/src/gui/widgets/channeltab.h +++ b/src/gui/widgets/channeltab.h @@ -34,7 +34,8 @@ class ChannelTab : public ChatTab { public: - Channel *getChannel() const { return mChannel; } + Channel *getChannel() const + { return mChannel; } void showHelp(); diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index ddf10bf5e..912305a63 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -137,24 +137,24 @@ class ChatTab : public Tab std::list &getRows() { return mTextOutput->getRows(); } - bool hasRows() + bool hasRows() const { return mTextOutput->hasRows(); } void loadFromLogFile(std::string name); - bool getAllowHighlight() + bool getAllowHighlight() const { return mAllowHightlight; } void setAllowHighlight(bool n) { mAllowHightlight = n; } - bool getRemoveNames() + bool getRemoveNames() const { return mRemoveNames; } void setRemoveNames(bool n) { mRemoveNames = n; } - bool getNoAway() + bool getNoAway() const { return mNoAway; } void setNoAway(bool n) diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h index bebdaa1f3..be6f4d034 100644 --- a/src/gui/widgets/guildchattab.h +++ b/src/gui/widgets/guildchattab.h @@ -41,7 +41,8 @@ class GuildChatTab : public ChatTab void saveToLogFile(std::string &msg); - int getType() const { return ChatTab::TAB_GUILD; } + int getType() const + { return ChatTab::TAB_GUILD; } protected: void handleInput(const std::string &msg); diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h index 6f05da3f7..98fee314a 100644 --- a/src/gui/widgets/icon.h +++ b/src/gui/widgets/icon.h @@ -48,7 +48,8 @@ class Icon : public gcn::Widget /** * Gets the current Image. */ - Image *getImage() const { return mImage; } + Image *getImage() const + { return mImage; } /** * Sets the image to display. diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 02fed43b5..046d09b59 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -266,10 +266,10 @@ class LayoutCell void setType(int t) { mType = t; } - int getWidth() + int getWidth() const { return mExtent[0]; } - int getHeight() + int getHeight() const { return mExtent[1]; } void setWidth(int w) diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 8ff21149a..5572abd03 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -94,28 +94,32 @@ class Popup : public Container, public gcn::MouseListener, */ void setMinWidth(int width); - int getMinWidth() const { return mMinWidth; } + int getMinWidth() const + { return mMinWidth; } /** * Sets the minimum height of the popup. */ void setMinHeight(int height); - int getMinHeight() const { return mMinHeight; } + int getMinHeight() const + { return mMinHeight; } /** * Sets the maximum width of the popup. */ void setMaxWidth(int width); - int getMaxWidth() const { return mMaxWidth; } + int getMaxWidth() const + { return mMaxWidth; } /** * Sets the minimum height of the popup. */ void setMaxHeight(int height); - int getMaxHeight() const { return mMaxHeight; } + int getMaxHeight() const + { return mMaxHeight; } /** * Gets the padding of the popup. The padding is the distance between @@ -124,9 +128,11 @@ class Popup : public Container, public gcn::MouseListener, * @return The padding of the popup. * @see setPadding */ - int getPadding() const { return mPadding; } + int getPadding() const + { return mPadding; } - void setPadding(int padding) { mPadding = padding; } + void setPadding(int padding) + { mPadding = padding; } /** * Sets the name of the popup. This is only useful for debug purposes. diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index 163310245..603df6157 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -73,7 +73,8 @@ class ProgressBar : public gcn::Widget, public gcn::WidgetListener /** * Returns the current progress. */ - float getProgress() const { return mProgress; } + float getProgress() const + { return mProgress; } /** * Change the ProgressPalette for this ProgressBar to follow or -1 to @@ -89,7 +90,8 @@ class ProgressBar : public gcn::Widget, public gcn::WidgetListener /** * Returns the color of the progress bar. */ - const gcn::Color &getColor() const { return mColor; } + const gcn::Color &getColor() const + { return mColor; } /** * Sets the text shown on the progress bar. diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 86902b5c9..582033071 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -89,7 +89,8 @@ class ScrollArea : public gcn::ScrollArea, public gcn::WidgetListener /** * Returns whether the widget draws its background or not. */ - bool isOpaque() const { return mOpaque; } + bool isOpaque() const + { return mOpaque; } /** * Called when the mouse moves in the widget area. diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index eb2680ede..71856d6e2 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -75,7 +75,7 @@ class SetupItem : public gcn::ActionListener void setWidget(gcn::Widget *widget) { mWidget = widget; } - gcn::Widget *getWidget() + gcn::Widget *getWidget() const { return mWidget; } Configuration *getConfig(); @@ -93,7 +93,7 @@ class SetupItem : public gcn::ActionListener virtual void externalUpdated(std::string eventName); // virtual int add(ContainerPlacer &place, int x, int y, int width); - bool isMainConfig() + bool isMainConfig() const { return mMainConfig; } protected: diff --git a/src/gui/widgets/setuptabscroll.h b/src/gui/widgets/setuptabscroll.h index 4ad1f464b..d471ecfbc 100644 --- a/src/gui/widgets/setuptabscroll.h +++ b/src/gui/widgets/setuptabscroll.h @@ -43,7 +43,7 @@ class SetupTabScroll : public SetupTab void addControl(SetupItem *widget, std::string event); - VertContainer *getContainer() + VertContainer *getContainer() const { return mContainer; } virtual void apply(); diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 9b416d3a3..694fdb92e 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -56,7 +56,8 @@ class ShopListBox : public ListBox /** * Returns the height of a row. */ - unsigned int getRowHeight() const { return mRowHeight; } + unsigned int getRowHeight() const + { return mRowHeight; } /** * gives information about the current player's money diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index 40b46ede5..829689543 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -61,7 +61,7 @@ class Tab : public gcn::Tab, public gcn::WidgetListener */ void setFlash(int flash); - int getFlash() + int getFlash() const { return mFlash; } void widgetResized(const gcn::Event &event); @@ -70,7 +70,7 @@ class Tab : public gcn::Tab, public gcn::WidgetListener void setLabelFont(gcn::Font *font); - gcn::Label *getLabel() + gcn::Label *getLabel() const { return mLabel; } protected: diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index b202dfc9d..cceaf56b7 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -136,13 +136,13 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener void setRightMargin(int n) { mRightMargin = n; } - int getRightMargin() + int getRightMargin() const { return mRightMargin; } void setFollowDownScroll(bool n) { mFollowDownScroll = n; } - bool getFollowDownScroll() + bool getFollowDownScroll() const { return mFollowDownScroll; } void fixSize() -- cgit v1.2.3-70-g09d2