diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-25 23:42:57 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-25 23:42:57 +0100 |
commit | cd20fb3432498b8871401bdd65a143197e2a6538 (patch) | |
tree | 1edd3e20e3501de5315fa5bfc46b8673ad40d5dd /src/gui/widgets | |
parent | 4ba8c80791c15c144d66e6a9b23e878d3313fa26 (diff) | |
download | mana-cd20fb3432498b8871401bdd65a143197e2a6538.tar.gz mana-cd20fb3432498b8871401bdd65a143197e2a6538.tar.bz2 mana-cd20fb3432498b8871401bdd65a143197e2a6538.tar.xz mana-cd20fb3432498b8871401bdd65a143197e2a6538.zip |
A host of code style fixes
Mostly putting & and * in the right place and making some getters const.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/textpreview.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/textpreview.h | 20 |
2 files changed, 14 insertions, 14 deletions
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; |