diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-11-01 20:04:43 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-11-01 20:04:43 +0100 |
commit | 38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad (patch) | |
tree | 81d0e898790264114683cca9cfd3355bea114415 /src/gui/widgets/browserbox.h | |
parent | c5e341f7b5f5e4efcabd09e00e177bb873db8097 (diff) | |
parent | 1f69108501c4bf51f3adac9ffbf7a7631fb12b9a (diff) | |
download | mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.gz mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.bz2 mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.xz mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.zip |
Merge branch '0.5' of gitorious.org:mana/mana
Conflicts:
src/being.cpp
src/client.cpp
src/commandhandler.cpp
src/gui/setup_video.cpp
src/gui/socialwindow.cpp
src/gui/viewport.cpp
src/gui/widgets/browserbox.cpp
src/gui/widgets/itemcontainer.cpp
src/imageparticle.cpp
src/localplayer.cpp
src/localplayer.h
src/map.cpp
src/net/tmwa/beinghandler.cpp
src/particle.cpp
src/particle.h
src/player.cpp
src/player.h
Diffstat (limited to 'src/gui/widgets/browserbox.h')
-rw-r--r-- | src/gui/widgets/browserbox.h | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index b71f30d7..54a2a8cc 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -2,6 +2,7 @@ * The Mana Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2009 Aethyra Development Team * * This file is part of The Mana Client. * @@ -30,12 +31,39 @@ class LinkHandler; -struct BROWSER_LINK { +struct BROWSER_LINK +{ int x1, x2, y1, y2; /**< Where link is placed */ std::string link; std::string caption; }; +class LinePart +{ + public: + LinePart(int x, int y, gcn::Color color, std::string text) : + mX(x), mY(y), mColor(color), mText(text) + { + } + + int getX() const + { return mX; } + + int getY() const + { return mY; } + + const std::string &getText() const + { return mText; } + + const gcn::Color &getColor() const + { return mColor; } + + private: + int mX, mY; + gcn::Color mColor; + std::string mText; +}; + /** * A simple browser box able to handle links and forward events to the * parent conteiner. @@ -72,7 +100,7 @@ class BrowserBox : public gcn::Widget, /** * Sets the maximum numbers of rows in the browser box. 0 = no limit. */ - void setMaxRow(int max) {mMaxRows = max; }; + void setMaxRow(unsigned max) {mMaxRows = max; }; /** * Disable links & user defined colors to be used in chat input. @@ -111,8 +139,9 @@ class BrowserBox : public gcn::Widget, /** * BrowserBox modes. */ - enum { - AUTO_SIZE, + enum + { + AUTO_SIZE = 0, AUTO_WRAP /**< Maybe it needs a fix or to be redone. */ }; @@ -126,7 +155,8 @@ class BrowserBox : public gcn::Widget, * windows and widgets. So, I think it's better keep BrowserBox * opaque (white background) by default. */ - enum { + enum + { RED = 0xff0000, /**< Color 1 */ GREEN = 0x009000, /**< Color 2 */ BLUE = 0x0000ff, /**< Color 3 */ @@ -142,21 +172,29 @@ class BrowserBox : public gcn::Widget, * Highlight modes for links. * This can be used for a bitmask. */ - enum { + enum + { UNDERLINE = 1, BACKGROUND = 2 }; + typedef std::list<std::string> TextRows; + + TextRows &getRows() + { return mTextRows; } + + void setAlwaysUpdate(bool n) + { mAlwaysUpdate = n; } + private: int calcHeight(); - typedef std::list<std::string> TextRows; typedef TextRows::iterator TextRowIterator; TextRows mTextRows; - typedef std::list<int> TextRowsHeights; - typedef TextRowsHeights::iterator TextRowsHeightIterator; - TextRowsHeights mTextRowsHeights; + typedef std::list<LinePart> LinePartList; + typedef LinePartList::iterator LinePartIterator; + LinePartList mLineParts; typedef std::vector<BROWSER_LINK> Links; typedef Links::iterator LinkIterator; @@ -172,6 +210,8 @@ class BrowserBox : public gcn::Widget, int mHeight; int mWidth; int mYStart; + int mUpdateTime; + bool mAlwaysUpdate; }; #endif |