diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbutton.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 4 | ||||
-rw-r--r-- | indra/llui/llcombobox.cpp | 26 | ||||
-rw-r--r-- | indra/llui/llcombobox.h | 7 | ||||
-rw-r--r-- | indra/llui/lldockablefloater.cpp | 23 | ||||
-rw-r--r-- | indra/llui/lldockablefloater.h | 1 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.cpp | 5 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.h | 1 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 13 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.h | 8 | ||||
-rw-r--r-- | indra/llui/llmenubutton.cpp | 4 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lltooltip.cpp | 3 | ||||
-rw-r--r-- | indra/llui/lltooltip.h | 1 |
14 files changed, 72 insertions, 33 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index bbaf908d2e..b65f248db2 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -146,7 +146,7 @@ LLButton::LLButton(const LLButton::Params& p) mHoverGlowStrength(p.hover_glow_amount), mCommitOnReturn(p.commit_on_return), mFadeWhenDisabled(FALSE), - mForcePressedState(FALSE), + mForcePressedState(false), mLastDrawCharsCount(0) { static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 08f289092f..3c1b57c4be 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -238,7 +238,7 @@ public: static void setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname); static void showHelp(LLUICtrl* ctrl, const LLSD& sdname); - void setForcePressedState(BOOL b) { mForcePressedState = b; } + void setForcePressedState(bool b) { mForcePressedState = b; } protected: LLPointer<LLUIImage> getImageUnselected() const { return mImageUnselected; } @@ -315,7 +315,7 @@ private: BOOL mNeedsHighlight; BOOL mCommitOnReturn; BOOL mFadeWhenDisabled; - BOOL mForcePressedState; + bool mForcePressedState; LLFrameTimer mFlashingTimer; }; diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 36e309d639..f29e8785eb 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -102,14 +102,14 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mMaxChars(p.max_chars), mPrearrangeCallback(p.prearrange_callback()), mTextEntryCallback(p.text_entry_callback()), - mSelectionCallback(p.selection_callback()), mListPosition(p.list_position), mLastSelectedIndex(-1) { // Text label button LLButton::Params button_params = (mAllowTextEntry ? p.combo_button : p.drop_down_button); - button_params.mouse_down_callback.function(boost::bind(&LLComboBox::onButtonDown, this)); + button_params.mouse_down_callback.function( + boost::bind(&LLComboBox::onButtonMouseDown, this)); button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT); button_params.rect(p.rect); @@ -140,6 +140,10 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mList = LLUICtrlFactory::create<LLScrollListCtrl>(params); addChild(mList); + // Mouse-down on button will transfer mouse focus to the list + // Grab the mouse-up event and make sure the button state is correct + mList->setMouseUpCallback(boost::bind(&LLComboBox::onListMouseUp, this)); + for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin(); it != p.items().end(); ++it) @@ -644,7 +648,7 @@ void LLComboBox::hideList() } } -void LLComboBox::onButtonDown() +void LLComboBox::onButtonMouseDown() { if (!mList->getVisible()) { @@ -670,6 +674,10 @@ void LLComboBox::onButtonDown() if (mButton->hasMouseCapture()) { gFocusMgr.setMouseCapture(mList); + + // But keep the "pressed" look, which buttons normally lose when they + // lose focus + mButton->setForcePressedState(true); } } else @@ -679,6 +687,12 @@ void LLComboBox::onButtonDown() } +void LLComboBox::onListMouseUp() +{ + // In some cases this is the termination of a mouse click that started on + // the button, so clear its pressed state + mButton->setForcePressedState(false); +} //------------------------------------------------------------------ // static functions @@ -706,12 +720,6 @@ void LLComboBox::onItemSelected(const LLSD& data) // commit does the reverse, asserting the value in the list onCommit(); - - // call the callback if it exists - if(mSelectionCallback) - { - mSelectionCallback(this, data); - } } BOOL LLComboBox::handleToolTip(S32 x, S32 y, MASK mask) diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 6285ca5170..4f27588467 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -82,8 +82,7 @@ public: allow_new_values; Optional<S32> max_chars; Optional<commit_callback_t> prearrange_callback, - text_entry_callback, - selection_callback; + text_entry_callback; Optional<EPreferredPosition, PreferredPositionValues> list_position; @@ -200,11 +199,11 @@ public: void setPrearrangeCallback( commit_callback_t cb ) { mPrearrangeCallback = cb; } void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; } - void setSelectionCallback( commit_callback_t cb ) { mSelectionCallback = cb; } void setButtonVisible(BOOL visible); - void onButtonDown(); + void onButtonMouseDown(); + void onListMouseUp(); void onItemSelected(const LLSD& data); void onTextCommit(const LLSD& data); diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index c3dd4ae647..9a2f2ab4d3 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -136,21 +136,10 @@ void LLDockableFloater::setVisible(BOOL visible) void LLDockableFloater::setMinimized(BOOL minimize) { - if(minimize && isDocked()) + if(minimize) { setVisible(FALSE); } - - if (minimize) - { - setCanDock(false); - } - else if (!minimize && mDockControl.get() != NULL && mDockControl.get()->isDockVisible()) - { - setCanDock(true); - } - - LLFloater::setMinimized(minimize); } LLView * LLDockableFloater::getDockWidget() @@ -217,6 +206,16 @@ void LLDockableFloater::draw() LLFloater::draw(); } +void LLDockableFloater::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + if (isDocked()) + { + setDocked(false); + } + + LLFloater::reshape(width, height, called_from_parent); +} + void LLDockableFloater::setDockControl(LLDockControl* dockControl) { mDockControl.reset(dockControl); diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 46491d8a29..e5f94dca91 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -65,6 +65,7 @@ public: /* virtula */BOOL postBuild(); /* virtual */void setDocked(bool docked, bool pop_on_undock = true); /* virtual */void draw(); + /* virtual */void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); /** * If descendant class overrides setVisible() then it must still invoke its diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index 045505af5b..456a2925a3 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -266,6 +266,11 @@ void LLDockControl::off() mEnabled = false; } +void LLDockControl::forceRecalculatePosition() +{ + mRecalculateDocablePosition = true; +} + void LLDockControl::drawToungue() { if (mEnabled) diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index eaedb4c307..30a45bedc7 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -63,6 +63,7 @@ public: public: void on(); void off(); + void forceRecalculatePosition(); void setDock(LLView* dockWidget); LLView* getDock() { diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 14a6ddb7e0..1fb618adee 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -413,6 +413,19 @@ void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL au } } +bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp) +{ + LayoutPanel* panel = findEmbeddedPanelByName(panel_name); + + if (panel) + { + if (min_widthp) *min_widthp = panel->mMinWidth; + if (min_heightp) *min_heightp = panel->mMinHeight; + } + + return NULL != panel; +} + static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks"); void LLLayoutStack::updateLayout(BOOL force_resize) { diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 9cbcb285dc..abd5436018 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -82,6 +82,14 @@ public: void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); + /** + * Gets minimal width and/or height of the specified by name panel. + * + * If it is necessary to get only the one dimension pass NULL for another one. + * @returns true if specified by panel_name internal panel exists, false otherwise. + */ + bool getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp); + void updateLayout(BOOL force_resize = FALSE); static void updateClass(); diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index a657ed039a..cdbd17e4dc 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -133,11 +133,11 @@ void LLMenuButton::draw() if (mMenuVisibleLastFrame) { - setForcePressedState(TRUE); + setForcePressedState(true); } LLButton::draw(); - setForcePressedState(FALSE); + setForcePressedState(false); } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 7b1aaac35c..caaf47240f 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1507,8 +1507,11 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c link_params.color = match.getColor(); // apply font name from requested style_params std::string font_name = LLFontGL::nameFromFont(style_params.font()); - link_params.font.name.setIfNotProvided(font_name); - link_params.font.style = "UNDERLINE"; + std::string font_size = LLFontGL::sizeFromFont(style_params.font()); + link_params.font.name(font_name); + link_params.font.size(font_size); + link_params.font.style("UNDERLINE"); + link_params.link_href = match.getUrl(); // output the text before the Url diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index bb85177811..959313a5b6 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -163,6 +163,7 @@ LLToolTip::Params::Params() visible_time_far("visible_time_far", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )), sticky_rect("sticky_rect"), image("image"), + text_color("text_color"), time_based_media("time_based_media", false), web_based_media("web_based_media", false), media_playing("media_playing", false) @@ -186,7 +187,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) params.h_pad = 0; params.v_pad = 0; params.mouse_opaque = false; - params.text_color = LLUIColorTable::instance().getColor( "ToolTipTextColor" ); + params.text_color = p.text_color; params.bg_visible = false; params.font = p.font; params.use_ellipses = true; diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 8c8fdf0a4c..7978b6a583 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -88,6 +88,7 @@ public: Optional<LLRect> sticky_rect; Optional<const LLFontGL*> font; Optional<LLUIImage*> image; + Optional<LLUIColor> text_color; Optional<bool> time_based_media, web_based_media, media_playing; |