diff options
author | James Cook <james@lindenlab.com> | 2009-10-03 23:40:28 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-10-03 23:40:28 +0000 |
commit | ada0f4fa221f2c7070fb02a2b7ff903bdde11c45 (patch) | |
tree | 0ede83511c304110138c01d16da2fff55162ef31 /indra/llui/lltooltip.h | |
parent | b1a280841e1823a19658923a8eefeb67d1d70735 (diff) |
Merge inspectors UI project, gooey-4, into viewer-2 trunk. Added new tooltips to 3D avatars, 2D avatar names, and 3D objects. Refactors tooltips and text boxes, line editors, and text editors. Breaks LLExpandableTextBox, but a fix is coming.
Resolved conflicts in lltexteditor.cpp, llchatitemscontainerctrl.cpp, llchatmsgbox.cpp, llfloaterbuycurrency.cpp, llnearbychat.cpp, floater_buy_currency.xml, and ru/strings.xml
Merging revisions 134925-135157 of svn+ssh://svn.lindenlab.com/svn/linden/branches/gooey/gooey-4 into C:\source\viewer-2.0.0-3, respecting ancestry
Diffstat (limited to 'indra/llui/lltooltip.h')
-rw-r--r-- | indra/llui/lltooltip.h | 90 |
1 files changed, 56 insertions, 34 deletions
diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index fb7f942099..6715da1611 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -36,7 +36,7 @@ // Library includes #include "llsingleton.h" #include "llinitparam.h" -#include "llview.h" +#include "llpanel.h" // // Classes @@ -46,10 +46,7 @@ class LLToolTipView : public LLView public: struct Params : public LLInitParam::Block<Params, LLView::Params> { - Params() - { - mouse_opaque = false; - } + Params(); }; LLToolTipView(const LLToolTipView::Params&); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); @@ -65,57 +62,82 @@ public: /*virtual*/ void draw(); }; -struct LLToolTipPosParams : public LLInitParam::Block<LLToolTipPosParams> +class LLToolTip : public LLPanel { - Mandatory<S32> x, - y; - LLToolTipPosParams() - : x("x"), - y("y") - {} -}; +public: + struct Params : public LLInitParam::Block<Params, LLPanel::Params> + { + typedef boost::function<void(void)> click_callback_t; -struct LLToolTipParams : public LLInitParam::Block<LLToolTipParams> -{ - typedef boost::function<void(void)> click_callback_t; + Mandatory<std::string> message; + + Optional<LLCoordGL> pos; + Optional<F32> delay_time, + visible_time_over, // time for which tooltip is visible while mouse on it + visible_time_near, // time for which tooltip is visible while mouse near it + visible_time_far; // time for which tooltip is visible while mouse moved away + Optional<LLRect> sticky_rect; + Optional<const LLFontGL*> font; - Mandatory<std::string> message; - - Optional<LLToolTipPosParams> pos; - Optional<F32> delay_time, - visible_time; - Optional<LLRect> sticky_rect; - Optional<S32> width; - Optional<LLUIImage*> image; + Optional<click_callback_t> click_callback; + Optional<LLUIImage*> image; + Optional<S32> max_width; + Optional<S32> padding; + + Params(); + }; + /*virtual*/ void draw(); + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - Optional<click_callback_t> click_callback; + /*virtual*/ void setValue(const LLSD& value); + /*virtual*/ void setVisible(BOOL visible); - LLToolTipParams(); - LLToolTipParams(const std::string& message); + bool isFading(); + F32 getVisibleTime(); + bool hasClickCallback(); + + LLToolTip(const Params& p); + +private: + class LLTextBox* mTextBox; + LLFrameTimer mFadeTimer; + LLFrameTimer mVisibleTimer; + S32 mMaxWidth; + bool mHasClickCallback; + S32 mPadding; // pixels }; + class LLToolTipMgr : public LLSingleton<LLToolTipMgr> { LOG_CLASS(LLToolTipMgr); public: LLToolTipMgr(); - void show(const LLToolTipParams& params); + void show(const LLToolTip::Params& params); void show(const std::string& message); - void enableToolTips(); + void unblockToolTips(); + void blockToolTips(); + void hideToolTips(); bool toolTipVisible(); LLRect getToolTipRect(); - - LLRect getStickyRect(); + LLRect getMouseNearRect(); + void updateToolTipVisibility(); private: - class LLToolTip* createToolTip(const LLToolTipParams& params); + void createToolTip(const LLToolTip::Params& params); bool mToolTipsBlocked; class LLToolTip* mToolTip; - std::string mLastToolTipMessage; - LLRect mToolTipStickyRect; + + // tooltip creation is deferred until the UI is drawn every frame + // so the last tooltip to be created in a given frame will win + LLToolTip::Params mLastToolTipParams; // description of last tooltip we showed + LLToolTip::Params mNextToolTipParams; // description of next tooltip we want to show + bool mNeedsToolTip; // do we want to show a tooltip + + LLRect mMouseNearRect; }; // |