diff options
Diffstat (limited to 'src/gui')
33 files changed, 84 insertions, 79 deletions
diff --git a/src/gui/button.cpp b/src/gui/button.cpp index f9e5e9dc..28b7c0d7 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -66,7 +66,7 @@ Button::Button(): init(); } -Button::Button(const std::string& caption, const std::string &actionEventId, +Button::Button(const std::string &caption, const std::string &actionEventId, gcn::ActionListener *listener): gcn::Button(caption), mIsLogged(false) diff --git a/src/gui/chat.h b/src/gui/chat.h index 3c553c67..2bbf32ae 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -121,7 +121,7 @@ class ChatWindow : public Window, /** * Gets the focused tab's name */ - const std::string& getFocused() const; + const std::string &getFocused() const; /** * Clear the tab with the given name diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index 5695a23f..2623e2c6 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -35,7 +35,7 @@ Image *CheckBox::checkBoxChecked; Image *CheckBox::checkBoxDisabled; Image *CheckBox::checkBoxDisabledChecked; -CheckBox::CheckBox(const std::string& caption, bool selected): +CheckBox::CheckBox(const std::string &caption, bool selected): gcn::CheckBox(caption, selected) { if (instances == 0) diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h index dd59493c..303782b0 100644 --- a/src/gui/checkbox.h +++ b/src/gui/checkbox.h @@ -37,7 +37,7 @@ class CheckBox : public gcn::CheckBox /** * Constructor. */ - CheckBox(const std::string& caption, bool selected = false); + CheckBox(const std::string &caption, bool selected = false); /** * Destructor. diff --git a/src/gui/help.cpp b/src/gui/help.cpp index 03dfd08d..4b4ba983 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -70,7 +70,7 @@ void HelpWindow::action(const gcn::ActionEvent &event) } } -void HelpWindow::handleLink(const std::string& link) +void HelpWindow::handleLink(const std::string &link) { std::string helpFile = link; loadHelp(helpFile); diff --git a/src/gui/help.h b/src/gui/help.h index 98e3aa67..8764e733 100644 --- a/src/gui/help.h +++ b/src/gui/help.h @@ -49,7 +49,7 @@ class HelpWindow : public Window, public LinkHandler, /** * Handles link action. */ - void handleLink(const std::string& link); + void handleLink(const std::string &link); /** * Loads help in the dialog. diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 1b0a2bb2..8023f0c2 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -173,7 +173,7 @@ void ItemPopup::updateColors() graphics->setColor(guiPalette->getColor(Palette::TEXT)); } -gcn::Color ItemPopup::getColor(const std::string& type) +gcn::Color ItemPopup::getColor(const std::string &type) { gcn::Color color; diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index 03e79886..0e386ef7 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -77,7 +77,7 @@ class ItemPopup : public Popup ScrollArea *mItemEffectScroll; ScrollArea *mItemWeightScroll; - gcn::Color getColor(const std::string& type); + static gcn::Color getColor(const std::string &type); }; #endif // ITEMPOPUP_H diff --git a/src/gui/label.cpp b/src/gui/label.cpp index 68195659..d2fba12b 100644 --- a/src/gui/label.cpp +++ b/src/gui/label.cpp @@ -18,6 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "label.h" #include "palette.h" @@ -26,12 +27,12 @@ Label::Label() : { } -Label::Label(const std::string& caption) : +Label::Label(const std::string &caption) : gcn::Label(caption) { } -void Label::draw(gcn::Graphics* graphics) +void Label::draw(gcn::Graphics *graphics) { setForegroundColor(guiPalette->getColor(Palette::TEXT)); gcn::Label::draw(static_cast<gcn::Graphics*>(graphics)); diff --git a/src/gui/label.h b/src/gui/label.h index 026ec081..dcda8e9d 100644 --- a/src/gui/label.h +++ b/src/gui/label.h @@ -42,12 +42,12 @@ class Label : public gcn::Label * Constructor. This version of the constructor sets the label with an * inintialization string. */ - Label(const std::string& caption); + Label(const std::string &caption); /** * Draws the label. */ - void draw(gcn::Graphics* graphics); + void draw(gcn::Graphics *graphics); }; #endif diff --git a/src/gui/linkhandler.h b/src/gui/linkhandler.h index fc9da6da..30267f87 100644 --- a/src/gui/linkhandler.h +++ b/src/gui/linkhandler.h @@ -35,7 +35,7 @@ class LinkHandler public: virtual ~LinkHandler() { } - virtual void handleLink(const std::string& link) = 0; + virtual void handleLink(const std::string &link) = 0; }; #endif diff --git a/src/gui/palette.h b/src/gui/palette.h index 1a466ed4..fab8cd09 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -122,7 +122,7 @@ class Palette : public gcn::ListModel * * @return the requested color or Palette::BLACK */ - const gcn::Color& getColor(char c, bool &valid); + const gcn::Color &getColor(char c, bool &valid); /** * Gets the color associated with the type. Sets the alpha channel @@ -133,7 +133,7 @@ class Palette : public gcn::ListModel * * @return the requested color */ - inline const gcn::Color& getColor(ColorType type, int alpha = 255) + inline const gcn::Color &getColor(ColorType type, int alpha = 255) { gcn::Color* col = &mColVector[type].color; col->a = alpha; @@ -147,7 +147,7 @@ class Palette : public gcn::ListModel * * @return the requested committed color */ - inline const gcn::Color& getCommittedColor(ColorType type) + inline const gcn::Color &getCommittedColor(ColorType type) { return mColVector[type].committedColor; } @@ -159,7 +159,7 @@ class Palette : public gcn::ListModel * * @return the requested test color */ - inline const gcn::Color& getTestColor(ColorType type) + inline const gcn::Color &getTestColor(ColorType type) { return mColVector[type].testColor; } @@ -342,7 +342,7 @@ class Palette : public gcn::ListModel * * @return the transformed string */ - static std::string getConfigName(const std::string& typeName); + static std::string getConfigName(const std::string &typeName); }; extern Palette *guiPalette; diff --git a/src/gui/passwordfield.cpp b/src/gui/passwordfield.cpp index 345ee1c3..fd8ebe22 100644 --- a/src/gui/passwordfield.cpp +++ b/src/gui/passwordfield.cpp @@ -21,7 +21,7 @@ #include "passwordfield.h" -PasswordField::PasswordField(const std::string& text): +PasswordField::PasswordField(const std::string &text): TextField(text) { } diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h index 86195bd1..3b0b5dab 100644 --- a/src/gui/passwordfield.h +++ b/src/gui/passwordfield.h @@ -35,7 +35,7 @@ class PasswordField : public TextField /** * Constructor, initializes the password field with the given string. */ - PasswordField(const std::string& text = ""); + PasswordField(const std::string &text = ""); /** * Draws the password field. diff --git a/src/gui/popup.cpp b/src/gui/popup.cpp index b7dd6a58..47c3c43c 100644 --- a/src/gui/popup.cpp +++ b/src/gui/popup.cpp @@ -50,8 +50,8 @@ class PopupConfigListener : public ConfigListener } }; -Popup::Popup(const std::string& name, Window *parent, - const std::string& skin): +Popup::Popup(const std::string &name, Window *parent, + const std::string &skin): mParent(parent), mPopupName(name), mMinWidth(100), @@ -170,22 +170,22 @@ void Popup::setLocationRelativeTo(gcn::Widget *widget) getY() + (wy + (widget->getHeight() - getHeight()) / 2 - y)); } -void Popup::setMinWidth(unsigned int width) +void Popup::setMinWidth(int width) { mMinWidth = width > mSkin->getMinWidth() ? width : mSkin->getMinWidth(); } -void Popup::setMinHeight(unsigned int height) +void Popup::setMinHeight(int height) { mMinHeight = height > mSkin->getMinHeight() ? height : mSkin->getMinHeight(); } -void Popup::setMaxWidth(unsigned int width) +void Popup::setMaxWidth(int width) { mMaxWidth = width; } -void Popup::setMaxHeight(unsigned int height) +void Popup::setMaxHeight(int height) { mMaxHeight = height; } @@ -206,4 +206,3 @@ void Popup::setGuiAlpha() mAlphaChanged = false; } - diff --git a/src/gui/popup.h b/src/gui/popup.h index f2f5f49b..fcecf4d4 100644 --- a/src/gui/popup.h +++ b/src/gui/popup.h @@ -56,7 +56,7 @@ class Popup : public gcn::Container * a Popup will never go below its parent Window. * @param skin The location where the Popup's skin XML can be found. */ - Popup(const std::string& name = "", Window *parent = NULL, + Popup(const std::string &name = "", Window *parent = NULL, const std::string &skin = "graphics/gui/gui.xml"); /** @@ -87,42 +87,42 @@ class Popup : public gcn::Container /** * Sets the minimum width of the popup. */ - void setMinWidth(unsigned int width); + void setMinWidth(int width); /** * Sets the minimum height of the popup. */ - void setMinHeight(unsigned int height); + void setMinHeight(int height); /** * Sets the maximum width of the popup. */ - void setMaxWidth(unsigned int width); + void setMaxWidth(int width); /** * Sets the minimum height of the popup. */ - void setMaxHeight(unsigned int height); + void setMaxHeight(int height); /** * Gets the minimum width of the popup. */ - int getMinWidth() { return mMinWidth; } + int getMinWidth() const { return mMinWidth; } /** * Gets the minimum height of the popup. */ - int getMinHeight() { return mMinHeight; } + int getMinHeight() const { return mMinHeight; } /** * Gets the maximum width of the popup. */ - int getMaxWidth() { return mMaxWidth; } + int getMaxWidth() const { return mMaxWidth; } /** * Gets the minimum height of the popup. */ - int getMaxHeight() { return mMaxHeight; } + int getMaxHeight() const { return mMaxHeight; } /** * Gets the padding of the popup. The padding is the distance between @@ -140,14 +140,14 @@ class Popup : public gcn::Container * @param padding The padding of the popup. * @see getPadding */ - void setPadding(unsigned int padding) { mPadding = padding; } + void setPadding(int padding) { mPadding = padding; } /** * Returns the parent Window. * * @return The parent Window or <code>NULL</code> if there is none. */ - Window* getParentWindow() { return mParent; } + Window *getParentWindow() const { return mParent; } /** * Sets the name of the popup. This is only useful for debug purposes. @@ -157,7 +157,7 @@ class Popup : public gcn::Container /** * Returns the name of the popup. This is only useful for debug purposes. */ - const std::string& getPopupName() { return mPopupName; } + const std::string &getPopupName() const { return mPopupName; } /** * Schedule this popup for deletion. It will be deleted at the start @@ -179,7 +179,7 @@ class Popup : public gcn::Container int mMinHeight; /**< Minimum Popup height */ int mMaxWidth; /**< Maximum Popup width */ int mMaxHeight; /**< Maximum Popup height */ - unsigned int mPadding; /**< Holds the padding of the window. */ + int mPadding; /**< Holds the padding of the window. */ /** * The config listener that listens to changes relevant to all Popups. diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 9ff9b23f..c2796b59 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -146,7 +146,7 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem) showPopup(x, y); } -void PopupMenu::handleLink(const std::string& link) +void PopupMenu::handleLink(const std::string &link) { Being *being = beingManager->findBeing(mBeingId); diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index 0a6877d9..d9fb4777 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -61,7 +61,7 @@ class PopupMenu : public Window, public LinkHandler /** * Handles link action. */ - void handleLink(const std::string& link); + void handleLink(const std::string &link); private: BrowserBox* mBrowserBox; diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp index 52ceb837..b05e37e6 100644 --- a/src/gui/radiobutton.cpp +++ b/src/gui/radiobutton.cpp @@ -34,7 +34,7 @@ Image *RadioButton::radioChecked; Image *RadioButton::radioDisabled; Image *RadioButton::radioDisabledChecked; -RadioButton::RadioButton(const std::string& caption, const std::string& group, +RadioButton::RadioButton(const std::string &caption, const std::string &group, bool marked): gcn::RadioButton(caption, group, marked) { diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h index 3d952b3f..9aec3add 100644 --- a/src/gui/radiobutton.h +++ b/src/gui/radiobutton.h @@ -35,7 +35,7 @@ class RadioButton : public gcn::RadioButton /* * Constructor. */ - RadioButton(const std::string& caption,const std::string& group, + RadioButton(const std::string &caption,const std::string &group, bool marked = false); /** diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 22f56195..7039f901 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -205,7 +205,7 @@ void SellDialog::action(const gcn::ActionEvent &event) // Attempt sell MessageOut outMsg(mNetwork); - ShopItem* item = mShopItems->at(selectedItem); + ShopItem *item = mShopItems->at(selectedItem); int sellCount; mPlayerMoney += mAmountItems * mShopItems->at(selectedItem)->getPrice(); diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp index 033ba372..073bbc1a 100644 --- a/src/gui/setup_colors.cpp +++ b/src/gui/setup_colors.cpp @@ -57,7 +57,7 @@ Setup_Colors::Setup_Colors() : mScroll = new ScrollArea(mColorBox); mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mTextPreview = new TextPreview(&rawmsg); + mTextPreview = new TextPreview(rawmsg); mPreview = new BrowserBox(BrowserBox::AUTO_WRAP); mPreview->setOpaque(false); diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 3cdc304c..300c91b8 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -51,7 +51,7 @@ void ShopItems::addItem(int id, int amount, int price) #ifdef EATHENA_SUPPORT void ShopItems::addItem(int inventoryIndex, int id, int quantity, int price) { - ShopItem* item = 0; + ShopItem *item = 0; if (mMergeDuplicates) { item = findItem(id); @@ -69,7 +69,7 @@ void ShopItems::addItem(int inventoryIndex, int id, int quantity, int price) } #endif -ShopItem* ShopItems::at(int i) const +ShopItem *ShopItems::at(int i) const { return mShopItems.at(i); } @@ -85,7 +85,7 @@ void ShopItems::clear() mShopItems.clear(); } -ShopItem* ShopItems::findItem(int id) +ShopItem *ShopItems::findItem(int id) { ShopItem *item; diff --git a/src/gui/skin.cpp b/src/gui/skin.cpp index d44c54a8..27a0fa3d 100644 --- a/src/gui/skin.cpp +++ b/src/gui/skin.cpp @@ -29,9 +29,9 @@ #include "../utils/dtor.h" #include "../utils/xml.h" -SkinLoader* skinLoader = NULL; +SkinLoader *skinLoader = NULL; -Skin::Skin(ImageRect skin, Image* close, std::string name): +Skin::Skin(ImageRect skin, Image *close, std::string name): instances(0), mName(name), border(skin), @@ -63,7 +63,7 @@ unsigned int Skin::getMinHeight() border.grid[6]->getHeight(); } -Skin* SkinLoader::load(const std::string &filename) +Skin *SkinLoader::load(const std::string &filename) { SkinIterator skinIterator = mSkins.find(filename); @@ -172,9 +172,9 @@ Skin* SkinLoader::load(const std::string &filename) logger->log("Finished loading Skin."); // Hard-coded for now until we update the above code to look for window buttons. - Image* closeImage = resman->getImage("graphics/gui/close_button.png"); + Image *closeImage = resman->getImage("graphics/gui/close_button.png"); - Skin* skin = new Skin(border, closeImage); + Skin *skin = new Skin(border, closeImage); mSkins[filename] = skin; return skin; diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp index 05e43906..68a6f502 100644 --- a/src/gui/textdialog.cpp +++ b/src/gui/textdialog.cpp @@ -80,7 +80,7 @@ void TextDialog::action(const gcn::ActionEvent &event) } } -const std::string& TextDialog::getText() const +const std::string &TextDialog::getText() const { return textField->getText(); } diff --git a/src/gui/textdialog.h b/src/gui/textdialog.h index 8b4e2cc3..5583e189 100644 --- a/src/gui/textdialog.h +++ b/src/gui/textdialog.h @@ -51,7 +51,7 @@ public: /** * Get the text in the textfield */ - const std::string& getText() const; + const std::string &getText() const; /** * Set the OK button action id diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp index 5c6e4f49..42279fc4 100644 --- a/src/gui/textfield.cpp +++ b/src/gui/textfield.cpp @@ -39,7 +39,7 @@ int TextField::instances = 0; float TextField::mAlpha = config.getValue("guialpha", 0.8); ImageRect TextField::skin; -TextField::TextField(const std::string& text): +TextField::TextField(const std::string &text): gcn::TextField(text), mNumeric(false), mListener(0) diff --git a/src/gui/textfield.h b/src/gui/textfield.h index 73824615..070d86ae 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.h @@ -38,12 +38,13 @@ class TextFieldListener * * \ingroup GUI */ -class TextField : public gcn::TextField { +class TextField : public gcn::TextField +{ public: /** * Constructor, initializes the text field with the given string. */ - TextField(const std::string& text = ""); + TextField(const std::string &text = ""); /** * Destructor. diff --git a/src/gui/textrenderer.h b/src/gui/textrenderer.h index b69e72a7..712c1312 100644 --- a/src/gui/textrenderer.h +++ b/src/gui/textrenderer.h @@ -35,10 +35,14 @@ class TextRenderer /** * Renders a specified text. */ - static inline void renderText(gcn::Graphics *graphics, const std::string& - text, int x, int y, gcn::Graphics::Alignment align, - const gcn::Color color, gcn::Font *font, bool outline = false, - bool shadow = false, int alpha = 255) + static inline void renderText(gcn::Graphics *graphics, + const std::string &text, + int x, int y, + gcn::Graphics::Alignment align, + const gcn::Color &color, + gcn::Font *font, + bool outline = false, + bool shadow = false, int alpha = 255) { graphics->setFont(font); diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h index 1cf6c2c8..cbe64368 100644 --- a/src/gui/truetypefont.h +++ b/src/gui/truetypefont.h @@ -55,7 +55,7 @@ class TrueTypeFont : public gcn::Font */ ~TrueTypeFont(); - virtual int getWidth(const std::string& text) const; + virtual int getWidth(const std::string &text) const; virtual int getHeight() const; diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 01790a67..7d4fbd80 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -32,9 +32,9 @@ float TextPreview::mAlpha = config.getValue("guialpha", 0.8); -TextPreview::TextPreview(const std::string* text) +TextPreview::TextPreview(const std::string &text): + mText(text) { - mText = text; mTextAlpha = false; mFont = gui->getFont(); mTextColor = &guiPalette->getColor(Palette::TEXT); @@ -65,7 +65,7 @@ void TextPreview::draw(gcn::Graphics* graphics) if (mTextBGColor && typeid(*mFont) == typeid(TrueTypeFont)) { TrueTypeFont *font = static_cast<TrueTypeFont*>(mFont); - int x = font->getWidth(*mText) + 1 + 2 * ((mOutline || mShadow) ? 1 :0); + int x = font->getWidth(mText) + 1 + 2 * ((mOutline || mShadow) ? 1 :0); int y = font->getHeight() + 1 + 2 * ((mOutline || mShadow) ? 1 : 0); graphics->setColor(gcn::Color((int) mTextBGColor->r, (int) mTextBGColor->g, @@ -74,7 +74,7 @@ void TextPreview::draw(gcn::Graphics* graphics) graphics->fillRectangle(gcn::Rectangle(1, 1, x, y)); } - TextRenderer::renderText(graphics, *mText, 2, 2, gcn::Graphics::LEFT, + TextRenderer::renderText(graphics, mText, 2, 2, gcn::Graphics::LEFT, gcn::Color(mTextColor->r, mTextColor->g, mTextColor->b, alpha), mFont, mOutline, mShadow, alpha); diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index e7b7db80..0ca343bf 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -32,14 +32,14 @@ class TextPreview : public gcn::Widget { public: - TextPreview(const std::string* text); + TextPreview(const std::string &text); /** * Sets the color the text is printed in. * * @param color the color to set */ - inline void setTextColor(const gcn::Color* color) + inline void setTextColor(const gcn::Color *color) { mTextColor = color; } @@ -49,7 +49,7 @@ class TextPreview : public gcn::Widget * * @param alpha whether to use alpha values for the text or not */ - inline void useTextAlpha(bool alpha) + inline void useTextAlpha(bool alpha) { mTextAlpha = alpha; } @@ -60,7 +60,7 @@ class TextPreview : public gcn::Widget * * @param color the color to set */ - inline void setTextBGColor(const gcn::Color* color) + inline void setTextBGColor(const gcn::Color *color) { mTextBGColor = color; } @@ -70,7 +70,7 @@ class TextPreview : public gcn::Widget * * @param color the color to set */ - inline void setBGColor(const gcn::Color* color) + inline void setBGColor(const gcn::Color *color) { mBGColor = color; } @@ -124,14 +124,14 @@ class TextPreview : public gcn::Widget * Gets opacity for this widget (whether or not the background color * is shown below the widget) */ - bool isOpaque() { return mOpaque; } + bool isOpaque() const { return mOpaque; } private: gcn::Font *mFont; - const std::string* mText; - const gcn::Color* mTextColor; - const gcn::Color* mBGColor; - const gcn::Color* mTextBGColor; + std::string mText; + const gcn::Color *mTextColor; + const gcn::Color *mBGColor; + const gcn::Color *mTextBGColor; static float mAlpha; bool mTextAlpha; bool mOpaque; diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 4689c86a..83354a07 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -53,7 +53,7 @@ class WindowConfigListener : public ConfigListener } }; -Window::Window(const std::string& caption, bool modal, Window *parent, const std::string& skin): +Window::Window(const std::string &caption, bool modal, Window *parent, const std::string &skin): gcn::Window(caption), mGrip(0), mParent(parent), |