diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/lltooltip.cpp | 47 | ||||
-rw-r--r-- | indra/llui/lltooltip.h | 6 |
2 files changed, 45 insertions, 8 deletions
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index c8094f9c7c..93a4adc9b6 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -38,10 +38,11 @@ // Library includes #include "lltextbox.h" #include "lliconctrl.h" +#include "llbutton.h" #include "llmenugl.h" // hideMenus() #include "llui.h" // positionViewNearMouse() #include "llwindow.h" - +#include "lltrans.h" // // Constants // @@ -155,7 +156,9 @@ LLToolTip::Params::Params() visible_time_near("visible_time_near", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeNear" )), visible_time_far("visible_time_far", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )), sticky_rect("sticky_rect"), - image("image") + image("image"), + time_based_media("time_based_media", false), + media_playing("media_playing", false) { name = "tooltip"; font = LLFontGL::getFontSansSerif(); @@ -186,28 +189,56 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) params.allow_html = false; // disallow hyperlinks in tooltips, as they want to spawn their own explanatory tooltips mTextBox = LLUICtrlFactory::create<LLTextBox> (params); addChild(mTextBox); - + + S32 TOOLTIP_ICON_SIZE = 0; + S32 TOOLTIP_PLAYBUTTON_SIZE = 0; if (p.image.isProvided()) { LLIconCtrl::Params icon_params; icon_params.name = "tooltip_icon"; LLRect icon_rect; LLUIImage* imagep = p.image; - const S32 TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16); + TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16); icon_rect.setOriginAndSize(mPadding, mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE); icon_params.rect = icon_rect; icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM; icon_params.image = p.image; icon_params.mouse_opaque = false; - addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_params)); + LLIconCtrl* tooltip_icon = LLUICtrlFactory::create<LLIconCtrl>(icon_params); + addChild(tooltip_icon); // move text over to fit image in mTextBox->translate(TOOLTIP_ICON_SIZE + mPadding, 0); + if (p.click_callback.isProvided()) + { + tooltip_icon->setMouseUpCallback(boost::bind(p.click_callback())); + } } - - if (p.click_callback.isProvided()) + + if (p.time_based_media.isProvided() && p.time_based_media == true) { - setMouseUpCallback(boost::bind(p.click_callback())); + LLButton::Params p_button; + p_button.name(std::string("play_media")); + TOOLTIP_PLAYBUTTON_SIZE = 16; + LLRect button_rect; + button_rect.setOriginAndSize((mPadding +TOOLTIP_ICON_SIZE),mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE); + p_button.rect = button_rect; + p_button.image_selected.name("button_anim_pause.tga"); + p_button.image_unselected.name("button_anim_play.tga"); + p_button.scale_image(true); + mPlayMediaButton = LLUICtrlFactory::create<LLButton>(p_button); + if(p.click_playmedia_callback.isProvided()) + { + mPlayMediaButton->setCommitCallback(boost::bind(p.click_playmedia_callback())); + } + if(p.media_playing.isProvided()) + { + mPlayMediaButton->setToggleState(p.media_playing); + } + addChild(mPlayMediaButton); + + // move text over to fit image in + mTextBox->translate(TOOLTIP_PLAYBUTTON_SIZE + mPadding, 0); } } diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 63e7249a12..fa30d5554a 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -81,6 +81,11 @@ public: Optional<click_callback_t> click_callback; Optional<LLUIImage*> image; + + + Optional<bool> time_based_media; + Optional<bool> media_playing; + Optional<click_callback_t> click_playmedia_callback; Optional<S32> max_width; Optional<S32> padding; Optional<bool> wrap; @@ -101,6 +106,7 @@ public: private: class LLTextBox* mTextBox; + class LLButton* mPlayMediaButton; LLFrameTimer mFadeTimer; LLFrameTimer mVisibleTimer; S32 mMaxWidth; |