From 03dca7cb7e578d20ec07298cecc47e0ae67aaaf5 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 17 May 2011 16:38:51 -0700 Subject: fixing llaccordian crash with multiple child panels --- indra/llui/llaccordionctrltab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 9e4849c58b..6afe276379 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -1022,7 +1022,7 @@ void LLAccordionCtrlTab::updateLayout ( const LLRect& child_rect ) S32 panel_width = child_rect.getWidth(); static LLUICachedControl scrollbar_size ("UIScrollbarSize", 0); - if(mScrollbar->getVisible() != false) + if(mScrollbar && mScrollbar->getVisible() != false) { panel_top+=mScrollbar->getDocPos(); panel_width-=scrollbar_size; -- cgit v1.2.3 From 406195e4f20e0bea341c8a7a979b56a8259b8536 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 24 May 2011 09:38:49 -0700 Subject: Added badges version 0.1 to buttons. Reviewed by Richard --- indra/llui/CMakeLists.txt | 2 + indra/llui/llbadge.cpp | 263 ++++++++++++++++++++++++++++++++++++++++++++++ indra/llui/llbadge.h | 152 +++++++++++++++++++++++++++ indra/llui/llbutton.cpp | 94 ++++++++++++++++- indra/llui/llbutton.h | 12 ++- 5 files changed, 517 insertions(+), 6 deletions(-) create mode 100644 indra/llui/llbadge.cpp create mode 100644 indra/llui/llbadge.h (limited to 'indra/llui') diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 33ab2e93b5..fb585e062c 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -28,6 +28,7 @@ include_directories( set(llui_SOURCE_FILES llaccordionctrl.cpp llaccordionctrltab.cpp + llbadge.cpp llbutton.cpp llcheckboxctrl.cpp llclipboard.cpp @@ -119,6 +120,7 @@ set(llui_HEADER_FILES llaccordionctrl.h llaccordionctrltab.h + llbadge.h llbutton.h llcallbackmap.h llcheckboxctrl.h diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp new file mode 100644 index 0000000000..ea934aa93b --- /dev/null +++ b/indra/llui/llbadge.cpp @@ -0,0 +1,263 @@ +/** + * @file llbadge.cpp + * @brief Implementation for badges + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#define LLBADGE_CPP +#include "llbadge.h" + +#include "lluictrlfactory.h" + + +static LLDefaultChildRegistry::Register r("badge"); + +// Compiler optimization, generate extern template +template class LLBadge* LLView::getChild(const std::string& name, BOOL recurse) const; + + +LLBadge::Params::Params() + : image("image") + , image_color("image_color") + , label("label") + , label_color("label_color") + , location("location", LLRelPos::TOP_LEFT) + , location_percent_hcenter("location_percent_hcenter") + , location_percent_vcenter("location_percent_vcenter") + , padding_horiz("padding_horiz") + , padding_vert("padding_vert") +{ + // We set a name here so the name isn't necessary in any xml files that use badges + name = "badge"; +} + +bool LLBadge::Params::equals(const Params& a) const +{ + bool comp = true; + + // skip owner in comparison on purpose + + comp &= (image() == a.image()); + comp &= (image_color() == a.image_color()); + comp &= (label() == a.label()); + comp &= (label_color() == a.label_color()); + comp &= (location() == a.location()); + comp &= (location_percent_hcenter() == a.location_percent_hcenter()); + comp &= (location_percent_vcenter() == a.location_percent_vcenter()); + comp &= (padding_horiz() == a.padding_horiz()); + comp &= (padding_vert() == a.padding_vert()); + + return comp; +} + +LLBadge::LLBadge(const LLBadge::Params& p) + : LLUICtrl(p) + , mOwner(p.owner) + , mGLFont(p.font) + , mImage(p.image) + , mImageColor(p.image_color) + , mLabel(p.label) + , mLabelColor(p.label_color) + , mLocation(p.location) + , mLocationPercentHCenter(0.5f) + , mLocationPercentVCenter(0.5f) + , mPaddingHoriz(p.padding_horiz) + , mPaddingVert(p.padding_vert) +{ + if (mImage.isNull()) + { + llwarns << "Badge: " << getName() << " with no image!" << llendl; + } + + // + // The following logic is to set the mLocationPercentHCenter and mLocationPercentVCenter + // based on the Location enum and our horizontal and vertical location percentages. The + // draw code then uses this on the owner rectangle to compute the screen location for + // the badge. + // + + if (!LLRelPos::IsCenter(mLocation)) + { + F32 h_center = p.location_percent_hcenter * 0.01f; + F32 v_center = p.location_percent_vcenter * 0.01f; + + if (LLRelPos::IsRight(mLocation)) + { + mLocationPercentHCenter = 0.5f * (1.0f + h_center); + } + else if (LLRelPos::IsLeft(mLocation)) + { + mLocationPercentHCenter = 0.5f * (1.0f - h_center); + } + + if (LLRelPos::IsTop(mLocation)) + { + mLocationPercentVCenter = 0.5f * (1.0f + v_center); + } + else if (LLRelPos::IsBottom(mLocation)) + { + mLocationPercentVCenter = 0.5f * (1.0f - v_center); + } + } +} + +LLBadge::~LLBadge() +{ +} + +void LLBadge::setLabel(const LLStringExplicit& label) +{ + mLabel = label; +} + +// +// This is a fallback function to render a rectangle for badges without a valid image +// +void renderBadgeBackground(F32 centerX, F32 centerY, F32 width, F32 height, const LLColor4U &color) +{ + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); + gGL.setSceneBlendType(LLRender::BT_REPLACE); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + gGL.color4ubv(color.mV); + gGL.texCoord2i(0, 0); + + F32 x = LLFontGL::sCurOrigin.mX + centerX - width * 0.5f; + F32 y = LLFontGL::sCurOrigin.mY + centerY - height * 0.5f; + + LLRectf screen_rect(llround(x), + llround(y), + llround(x) + width, + llround(y) + height); + + LLVector3 vertices[4]; + vertices[0] = LLVector3(screen_rect.mRight, screen_rect.mTop, 1.0f); + vertices[1] = LLVector3(screen_rect.mLeft, screen_rect.mTop, 1.0f); + vertices[2] = LLVector3(screen_rect.mLeft, screen_rect.mBottom, 1.0f); + vertices[3] = LLVector3(screen_rect.mRight, screen_rect.mBottom, 1.0f); + + gGL.begin(LLRender::QUADS); + { + gGL.vertexBatchPreTransformed(vertices, 4); + } + gGL.end(); + + gGL.popUIMatrix(); +} + + +// virtual +void LLBadge::draw() +{ + if (!mLabel.empty()) + { + LLUICtrl* owner_ctrl = mOwner.get(); + + if (owner_ctrl) + { + // + // Calculate badge position based on owner + // + + LLRect owner_rect; + owner_ctrl->localRectToOtherView(owner_ctrl->getLocalRect(), & owner_rect, this); + + F32 badge_center_x = owner_rect.mLeft + owner_rect.getWidth() * mLocationPercentHCenter; + F32 badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; + + // + // Calculate badge size based on label text + // + + LLWString badge_label_wstring = mLabel; + + S32 badge_label_begin_offset = 0; + S32 badge_char_length = S32_MAX; + S32 badge_pixel_length = S32_MAX; + F32 *right_position_out = NULL; + BOOL do_not_use_ellipses = false; + + F32 badge_width = (2.0f * mPaddingHoriz) + + mGLFont->getWidthF32(badge_label_wstring.c_str(), badge_label_begin_offset, badge_char_length); + + F32 badge_height = (2.0f * mPaddingVert) + mGLFont->getLineHeight(); + + // + // Draw button image, if available. + // Otherwise draw basic rectangular button. + // + + F32 alpha = getDrawContext().mAlpha; + + if (!mImage.isNull()) + { + F32 badge_x = badge_center_x - badge_width * 0.5f; + F32 badge_y = badge_center_y - badge_height * 0.5f; + + mImage->drawSolid(badge_x, badge_y, badge_width, badge_height, mImageColor % alpha); + } + else + { + lldebugs << "No image for badge " << getName() << " on owner " << owner_ctrl->getName() << llendl; + + renderBadgeBackground(badge_center_x, badge_center_y, + badge_width, badge_height, + mImageColor % alpha); + } + + // + // Draw the label + // + + mGLFont->render(badge_label_wstring, badge_label_begin_offset, + badge_center_x, badge_center_y, + mLabelColor % alpha, + LLFontGL::HCENTER, LLFontGL::VCENTER, // centered around the position + LLFontGL::NORMAL, // normal text (not bold, italics, etc.) + LLFontGL::DROP_SHADOW_SOFT, + badge_char_length, badge_pixel_length, + right_position_out, do_not_use_ellipses); + } + } +} + + +namespace LLInitParam +{ + void TypeValues::declareValues() + { + declare("bottom", LLRelPos::BOTTOM); + declare("bottom_left", LLRelPos::BOTTOM_LEFT); + declare("bottom_right", LLRelPos::BOTTOM_RIGHT); + declare("center", LLRelPos::CENTER); + declare("left", LLRelPos::LEFT); + declare("right", LLRelPos::RIGHT); + declare("top", LLRelPos::TOP); + declare("top_left", LLRelPos::TOP_LEFT); + declare("top_right", LLRelPos::TOP_RIGHT); + } +} + + +// eof diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h new file mode 100644 index 0000000000..c2e0a763b2 --- /dev/null +++ b/indra/llui/llbadge.h @@ -0,0 +1,152 @@ +/** + * @file llbadge.h + * @brief Header for badges + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLBADGE_H +#define LL_LLBADGE_H + +#include + +#include "lluicolor.h" +#include "lluictrl.h" +#include "llstring.h" +#include "lluiimage.h" + +// +// Declarations +// + +class LLUICtrlFactory; +class LLFontGL; + +// +// Relative Position Alignment +// + +namespace LLRelPos +{ + enum Location + { + CENTER = 0, + + LEFT = (1 << 0), + RIGHT = (1 << 1), + + TOP = (1 << 2), + BOTTOM = (1 << 3), + + BOTTOM_LEFT = (BOTTOM | LEFT), + BOTTOM_RIGHT = (BOTTOM | RIGHT), + + TOP_LEFT = (TOP | LEFT), + TOP_RIGHT = (TOP | RIGHT), + }; + + inline bool IsBottom(Location relPos) { return (relPos & BOTTOM) == BOTTOM; } + inline bool IsCenter(Location relPos) { return (relPos == CENTER); } + inline bool IsLeft(Location relPos) { return (relPos & LEFT) == LEFT; } + inline bool IsRight(Location relPos) { return (relPos & RIGHT) == RIGHT; } + inline bool IsTop(Location relPos) { return (relPos & TOP) == TOP; } +} + +// NOTE: This needs to occur before Optional declaration for proper compilation. +namespace LLInitParam +{ + template<> + struct TypeValues : public TypeValuesHelper + { + static void declareValues(); + }; +} + +// +// Classes +// + +class LLBadge +: public LLUICtrl +{ +public: + struct Params + : public LLInitParam::Block + { + Optional< LLHandle > owner; // Mandatory in code but not in xml + + Optional< LLUIImage* > image; + Optional< LLUIColor > image_color; + + Optional< std::string > label; + Optional< LLUIColor > label_color; + + Optional< LLRelPos::Location > location; + Optional< U32 > location_percent_hcenter; + Optional< U32 > location_percent_vcenter; + + Optional< F32 > padding_horiz; + Optional< F32 > padding_vert; + + Params(); + + bool equals(const Params&) const; + }; + +protected: + friend class LLUICtrlFactory; + LLBadge(const Params& p); + +public: + + ~LLBadge(); + + virtual void draw(); + + const std::string getLabel() const { return wstring_to_utf8str(mLabel); } + void setLabel( const LLStringExplicit& label); + +private: + const LLFontGL* mGLFont; + + LLPointer< LLUIImage > mImage; + LLUIColor mImageColor; + + LLUIString mLabel; + LLUIColor mLabelColor; + + LLRelPos::Location mLocation; + F32 mLocationPercentHCenter; + F32 mLocationPercentVCenter; + + LLHandle< LLUICtrl > mOwner; + + F32 mPaddingHoriz; + F32 mPaddingVert; +}; + +// Build time optimization, generate once in .cpp file +#ifndef LLBADGE_CPP +extern template class LLBadge* LLView::getChild(const std::string& name, BOOL recurse) const; +#endif + +#endif // LL_LLBADGE_H diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 45ceaff696..a63281b3c1 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -56,6 +56,9 @@ static LLDefaultChildRegistry::Register r("button"); template class LLButton* LLView::getChild( const std::string& name, BOOL recurse) const; + + + // globals loaded from settings.xml S32 LLBUTTON_H_PAD = 0; S32 BTN_HEIGHT_SMALL= 0; @@ -99,7 +102,8 @@ LLButton::Params::Params() scale_image("scale_image", true), hover_glow_amount("hover_glow_amount"), commit_on_return("commit_on_return", true), - use_draw_context_alpha("use_draw_context_alpha", true) + use_draw_context_alpha("use_draw_context_alpha", true), + badge("badge") { addSynonym(is_toggle, "toggle"); held_down_delay.seconds = 0.5f; @@ -160,8 +164,8 @@ LLButton::LLButton(const LLButton::Params& p) mMouseDownSignal(NULL), mMouseUpSignal(NULL), mHeldDownSignal(NULL), - mUseDrawContextAlpha(p.use_draw_context_alpha) - + mUseDrawContextAlpha(p.use_draw_context_alpha), + mBadge(NULL) { static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams()); @@ -244,6 +248,17 @@ LLButton::LLButton(const LLButton::Params& p) { setHeldDownCallback(initCommitCallback(p.mouse_held_callback)); } + + // Only create a badge here if a non-default one was provided. + if (p.badge.isProvided()) + { + if (!p.badge().equals(LLUICtrlFactory::getDefaultParams())) + { + LLBadge::Params badge_params(p.badge()); + badge_params.owner = getUICtrlHandle(); + mBadge = LLUICtrlFactory::create(badge_params); + } + } } LLButton::~LLButton() @@ -327,6 +342,13 @@ boost::signals2::connection LLButton::setHeldDownCallback( button_callback_t cb, BOOL LLButton::postBuild() { autoResize(); + + // Attach the badge to the appropriate parent panel + if (mBadge) + { + addBadgeToParentPanel(); + } + return TRUE; } BOOL LLButton::handleUnicodeCharHere(llwchar uni_char) @@ -867,7 +889,7 @@ void LLButton::draw() S32_MAX, text_width, NULL, mUseEllipses); } - + LLUICtrl::draw(); } @@ -1063,6 +1085,70 @@ void LLButton::setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignmen } } +void LLButton::addBadgeToParentPanel() +{ + if (mBadge) + { + // Find the appropriate parent panel for the badge + + LLPanel * parentPanel = NULL; + LLUICtrl * parent = getParentUICtrl(); + + while (parent) + { + parentPanel = dynamic_cast(parent); + + if (parentPanel != NULL) + { + break; + } + + parent = parent->getParentUICtrl(); + } + + if (parentPanel) + { + parentPanel->addChild(mBadge); + } + else + { + llwarns << "Unable to find parent panel for badge " << mBadge->getName() << " on button " << getName() << llendl; + } + } + else + { + llwarns << "Unable to add NULL badge to button " << getName() << llendl; + } +} + +void LLButton::setBadgeLabel(const LLStringExplicit& label) +{ + if (mBadge == NULL) + { + LLBadge::Params badge_params(LLUICtrlFactory::getDefaultParams()); + badge_params.owner = getUICtrlHandle(); + mBadge = LLUICtrlFactory::create(badge_params); + + addBadgeToParentPanel(); + } + + if (mBadge) + { + mBadge->setLabel(label); + + // + // Push the badge to the front so it renders last + // + + LLUICtrl * parent = mBadge->getParentUICtrl(); + + if (parent) + { + parent->sendChildToFront(mBadge); + } + } +} + void LLButton::onMouseCaptureLost() { resetMouseDownTimer(); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 0cfc393e05..232ab81e0d 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -27,6 +27,8 @@ #ifndef LL_LLBUTTON_H #define LL_LLBUTTON_H +#include "lluuid.h" +#include "llbadge.h" #include "llcontrol.h" #include "lluictrl.h" #include "v4color.h" @@ -52,8 +54,6 @@ S32 round_up(S32 grid, S32 value); class LLUICtrlFactory; -class LLUIImage; -class LLUUID; // // Classes @@ -126,6 +126,8 @@ public: Optional held_down_delay; Optional use_draw_context_alpha; + + Optional badge; Params(); }; @@ -249,6 +251,8 @@ public: void setImageDisabledSelected(LLPointer image); void setImageFlash(LLPointer image); void setImagePressed(LLPointer image); + + void setBadgeLabel(const LLStringExplicit& label); void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } BOOL getCommitOnReturn() const { return mCommitOnReturn; } @@ -267,6 +271,8 @@ protected: LLPointer getImageUnselected() const { return mImageUnselected; } LLPointer getImageSelected() const { return mImageSelected; } + void addBadgeToParentPanel(); + LLFrameTimer mMouseDownTimer; private: @@ -357,6 +363,8 @@ private: bool mForcePressedState; LLFrameTimer mFlashingTimer; + + LLBadge* mBadge; }; // Build time optimization, generate once in .cpp file -- cgit v1.2.3 From 33e4a2c7b1ab3a06f1adb5edd9850523c897ea77 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 25 May 2011 10:39:34 -0700 Subject: Updated Marketplace Inbox & Outbox panel to maintain size when one is expanded vs the other --- indra/llui/lllayoutstack.cpp | 18 +++++++++--------- indra/llui/lllayoutstack.h | 4 ++++ 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 9b6830a816..8a92796942 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -78,20 +78,20 @@ LLLayoutPanel::~LLLayoutPanel() delete mResizeBar; mResizeBar = NULL; } - + F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation) { if (orientation == LLLayoutStack::HORIZONTAL) { F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth())); + clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth())); return mVisibleAmt * collapse_amt; } else { - F32 collapse_amt = + F32 collapse_amt = clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinDim / (F32)llmax(1, getRect().getHeight()))); - return mVisibleAmt * collapse_amt; + return mVisibleAmt * collapse_amt; } } @@ -182,14 +182,14 @@ BOOL LLLayoutStack::postBuild() } bool LLLayoutStack::addChild(LLView* child, S32 tab_group) - { +{ LLLayoutPanel* panelp = dynamic_cast(child); - if (panelp) - { + if (panelp) + { mPanels.push_back(panelp); - } + } return LLView::addChild(child, tab_group); - } +} S32 LLLayoutStack::getDefaultHeight(S32 cur_height) diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 4ac8ef0ee9..2fc2cf3eb4 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -177,6 +177,10 @@ public: ~LLLayoutPanel(); void initFromParams(const Params& p); + + S32 getMinDim() const { return mMinDim; } + S32 getMaxDim() const { return mMaxDim; } + void setMinDim(S32 value) { mMinDim = value; } void setMaxDim(S32 value) { mMaxDim = value; } -- cgit v1.2.3 From 98bcd9e2efe4cc0dc5e51da09c6f18424b9d9144 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Mon, 6 Jun 2011 17:00:59 -0700 Subject: EXP-859 FIX -- Save setting for last time inbox expanded EXP-841 PROGRESS -- Create outbox sync button with basic enable/disable logic and animation EXP-866 PROGRESS -- Create inbox observer to dynamically update inbox item count and badge value EXP-872 PROGRESS -- Hide inbox and outbox unless applicable Inbox expansion time is now saved as setting variable "LastInventoryInboxExpand". New outbox sync button art. Observers for items and categories are now implemented in the LLSidepanelInventory but the exact method of use is still to be determined. Functions are in place to show and hide the inbox and outbox panels but the logic around the decision is TBD. The resize bar for the inbox/outbox is now disabled when both inbox and outbox are collapsed. Reviewed by Leyla. --- indra/llui/llloadingindicator.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llloadingindicator.h b/indra/llui/llloadingindicator.h index 4c47cc267c..7c44478848 100644 --- a/indra/llui/llloadingindicator.h +++ b/indra/llui/llloadingindicator.h @@ -86,6 +86,8 @@ public: */ void start(); + void reset() { mCurImageIdx = 0; } + private: LLLoadingIndicator(const Params&); void initFromParams(const Params&); -- cgit v1.2.3 From 1aed9849285b574346087eb5ac7e0c8038fa21fe Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Tue, 7 Jun 2011 13:57:19 -0700 Subject: EXP-865 PROGRESS -- Modify LLBadge to allow it to hang off of non-buttons Added the following for increased LLBadge functionality: * Panels now choose whether or not they accept buttons as children, which they do by default. * UI controls now shuffle controls with "requests_front" to the front of their children list at postBuild time. * Badges are set to "requests_front" by default * Badges now accept border image and color attributes Reviewed by Callum --- indra/llui/llbadge.cpp | 11 +++++++++++ indra/llui/llbadge.h | 6 ++++++ indra/llui/llbutton.cpp | 2 +- indra/llui/llbutton.h | 2 +- indra/llui/llpanel.cpp | 8 ++++++-- indra/llui/llpanel.h | 5 +++++ indra/llui/lluictrl.cpp | 36 +++++++++++++++++++++++++++++++++++- indra/llui/lluictrl.h | 8 ++++++-- 8 files changed, 71 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index ea934aa93b..e4c64e327e 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -38,6 +38,8 @@ template class LLBadge* LLView::getChild(const std::string& name, LLBadge::Params::Params() : image("image") + , border_image("border_image") + , border_color("border_color") , image_color("image_color") , label("label") , label_color("label_color") @@ -57,6 +59,8 @@ bool LLBadge::Params::equals(const Params& a) const // skip owner in comparison on purpose + comp &= (border_image() == a.border_image()); + comp &= (border_color() == a.border_color()); comp &= (image() == a.image()); comp &= (image_color() == a.image_color()); comp &= (label() == a.label()); @@ -73,6 +77,8 @@ bool LLBadge::Params::equals(const Params& a) const LLBadge::LLBadge(const LLBadge::Params& p) : LLUICtrl(p) , mOwner(p.owner) + , mBorderImage(p.border_image) + , mBorderColor(p.border_color) , mGLFont(p.font) , mImage(p.image) , mImageColor(p.image_color) @@ -216,6 +222,11 @@ void LLBadge::draw() F32 badge_y = badge_center_y - badge_height * 0.5f; mImage->drawSolid(badge_x, badge_y, badge_width, badge_height, mImageColor % alpha); + + if (!mBorderImage.isNull()) + { + mBorderImage->drawSolid(badge_x, badge_y, badge_width, badge_height, mBorderColor % alpha); + } } else { diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index c2e0a763b2..05a76af42c 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -94,6 +94,9 @@ public: { Optional< LLHandle > owner; // Mandatory in code but not in xml + Optional< LLUIImage* > border_image; + Optional< LLUIColor > border_color; + Optional< LLUIImage* > image; Optional< LLUIColor > image_color; @@ -126,6 +129,9 @@ public: void setLabel( const LLStringExplicit& label); private: + LLPointer< LLUIImage > mBorderImage; + LLUIColor mBorderColor; + const LLFontGL* mGLFont; LLPointer< LLUIImage > mImage; diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index a63281b3c1..c841933a5f 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1098,7 +1098,7 @@ void LLButton::addBadgeToParentPanel() { parentPanel = dynamic_cast(parent); - if (parentPanel != NULL) + if (parentPanel && parentPanel->acceptsBadge()) { break; } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 232ab81e0d..07f0395719 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -125,7 +125,7 @@ public: Optional hover_glow_amount; Optional held_down_delay; - Optional use_draw_context_alpha; + Optional use_draw_context_alpha; Optional badge; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index b2383106a8..1dcdd79efa 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -87,7 +87,8 @@ LLPanel::Params::Params() filename("filename"), class_name("class"), help_topic("help_topic"), - visible_callback("visible_callback") + visible_callback("visible_callback"), + accepts_badge("accepts_badge") { name = "panel"; addSynonym(background_visible, "bg_visible"); @@ -113,7 +114,8 @@ LLPanel::LLPanel(const LLPanel::Params& p) mCommitCallbackRegistrar(false), mEnableCallbackRegistrar(false), mXMLFilename(p.filename), - mVisibleSignal(NULL) + mVisibleSignal(NULL), + mAcceptsBadge(p.accepts_badge) // *NOTE: Be sure to also change LLPanel::initFromParams(). We have too // many classes derived from LLPanel to retrofit them all to pass in params. { @@ -485,6 +487,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p) mBgAlphaImage = p.bg_alpha_image(); mBgOpaqueImageOverlay = p.bg_opaque_image_overlay; mBgAlphaImageOverlay = p.bg_alpha_image_overlay; + + mAcceptsBadge = p.accepts_badge; } static LLFastTimer::DeclareTimer FTM_PANEL_SETUP("Panel Setup"); diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index 7bbbeaf709..67674fab7e 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -89,6 +89,8 @@ public: Multiple strings; Optional visible_callback; + + Optional accepts_badge; Params(); }; @@ -250,6 +252,8 @@ public: boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb ); + bool acceptsBadge() const { return mAcceptsBadge; } + protected: // Override to set not found list LLButton* getDefaultButton() { return mDefaultBtn; } @@ -264,6 +268,7 @@ protected: static factory_stack_t sFactoryStack; private: + bool mAcceptsBadge; BOOL mBgVisible; // any background at all? BOOL mBgOpaque; // use opaque color or image LLUIColor mBgOpaqueColor; diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 0a06b5e74f..d58df5801b 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -68,6 +68,7 @@ LLUICtrl::ControlVisibility::ControlVisibility() LLUICtrl::Params::Params() : tab_stop("tab_stop", true), chrome("chrome", false), + requests_front("requests_front", false), label("label"), initial_value("value"), init_callback("init_callback"), @@ -96,9 +97,10 @@ const LLUICtrl::Params& LLUICtrl::getDefaultParams() LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) : LLView(p), - mTentative(FALSE), mIsChrome(FALSE), + mRequestsFront(p.requests_front), mTabStop(FALSE), + mTentative(FALSE), mViewModel(viewmodel), mControlVariable(NULL), mEnabledControlVariable(NULL), @@ -123,6 +125,8 @@ void LLUICtrl::initFromParams(const Params& p) { LLView::initFromParams(p); + mRequestsFront = p.requests_front; + setIsChrome(p.chrome); setControlName(p.control_name); if(p.enabled_controls.isProvided()) @@ -403,6 +407,36 @@ LLViewModel* LLUICtrl::getViewModel() const return mViewModel; } +//virtual +BOOL LLUICtrl::postBuild() +{ + // + // Find all of the children that want to be in front and move them to the front + // + + if (getChildCount() > 0) + { + std::vector childrenToMoveToFront; + + for (LLView::child_list_const_iter_t child_it = beginChild(); child_it != endChild(); ++child_it) + { + LLUICtrl* uictrl = dynamic_cast(*child_it); + + if (uictrl && uictrl->mRequestsFront) + { + childrenToMoveToFront.push_back(uictrl); + } + } + + for (std::vector::iterator it = childrenToMoveToFront.begin(); it != childrenToMoveToFront.end(); ++it) + { + sendChildToFront(*it); + } + } + + return LLView::postBuild(); +} + bool LLUICtrl::setControlValue(const LLSD& value) { if (mControlVariable) diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index b37e9f6b1b..09bed9b958 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -94,7 +94,8 @@ public: { Optional label; Optional tab_stop, - chrome; + chrome, + requests_front; Optional initial_value; Optional init_callback, @@ -143,6 +144,8 @@ protected: virtual LLViewModel* getViewModel() const; // We shouldn't ever need to set this directly //virtual void setViewModel(const LLViewModelPtr&); + + virtual BOOL postBuild(); public: // LLView interface @@ -301,8 +304,9 @@ protected: private: - BOOL mTabStop; BOOL mIsChrome; + BOOL mRequestsFront; + BOOL mTabStop; BOOL mTentative; LLRootHandle mUICtrlHandle; -- cgit v1.2.3 From 888b39c283e53fd128778e70e231bcb6053de4b8 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 8 Jun 2011 13:14:15 -0700 Subject: EXP-865 PROGRESS -- Modify LLBadge to allow it to hang off of non-buttons Moved LLBadge use from LLButton into a separate LLBadgeOwner class. LLButton now derives from LLBadgeOwner which handles the bulk of the badge management. --- indra/llui/CMakeLists.txt | 2 + indra/llui/llbadgeowner.cpp | 116 ++++++++++++++++++++++++++++++++++++++++++++ indra/llui/llbadgeowner.h | 58 ++++++++++++++++++++++ indra/llui/llbutton.cpp | 87 +++------------------------------ indra/llui/llbutton.h | 10 +--- 5 files changed, 185 insertions(+), 88 deletions(-) create mode 100644 indra/llui/llbadgeowner.cpp create mode 100644 indra/llui/llbadgeowner.h (limited to 'indra/llui') diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index fb585e062c..e9283788bd 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -29,6 +29,7 @@ set(llui_SOURCE_FILES llaccordionctrl.cpp llaccordionctrltab.cpp llbadge.cpp + llbadgeowner.cpp llbutton.cpp llcheckboxctrl.cpp llclipboard.cpp @@ -121,6 +122,7 @@ set(llui_HEADER_FILES llaccordionctrl.h llaccordionctrltab.h llbadge.h + llbadgeowner.h llbutton.h llcallbackmap.h llcheckboxctrl.h diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp new file mode 100644 index 0000000000..c77cf21ae0 --- /dev/null +++ b/indra/llui/llbadgeowner.cpp @@ -0,0 +1,116 @@ +/** + * @file llbadgeowner.cpp + * @brief Class to manage badges attached to a UI control + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llbadgeowner.h" +#include "llpanel.h" + +// +// Classes +// + +LLBadgeOwner::LLBadgeOwner(LLHandle ctrlHandle) + : mBadge(NULL) + , mBadgeOwnerCtrl(ctrlHandle) +{ +} + +void LLBadgeOwner::initBadgeParams(const LLBadge::Params& p) +{ + if (!p.equals(LLUICtrlFactory::getDefaultParams())) + { + mBadge = createBadge(p); + } +} + +void LLBadgeOwner::setBadgeLabel(const LLStringExplicit& label) +{ + if (mBadge == NULL) + { + mBadge = createBadge(LLUICtrlFactory::getDefaultParams()); + + addBadgeToParentPanel(); + } + + if (mBadge) + { + mBadge->setLabel(label); + + // + // Push the badge to the front so it renders on top + // + + LLUICtrl * parent = mBadge->getParentUICtrl(); + + if (parent) + { + parent->sendChildToFront(mBadge); + } + } +} + +void LLBadgeOwner::addBadgeToParentPanel() +{ + if (mBadge && mBadgeOwnerCtrl.get()) + { + // Find the appropriate parent panel for the badge + + LLUICtrl * owner_ctrl = mBadgeOwnerCtrl.get(); + LLUICtrl * parent = owner_ctrl->getParentUICtrl(); + + LLPanel * parentPanel = NULL; + + while (parent) + { + parentPanel = dynamic_cast(parent); + + if (parentPanel && parentPanel->acceptsBadge()) + { + break; + } + + parent = parent->getParentUICtrl(); + } + + if (parentPanel) + { + parentPanel->addChild(mBadge); + } + else + { + llwarns << "Unable to find parent panel for badge " << mBadge->getName() << " on ui control " << owner_ctrl->getName() << llendl; + } + } +} + +LLBadge* LLBadgeOwner::createBadge(const LLBadge::Params& p) +{ + LLBadge::Params badge_params(p); + badge_params.owner = mBadgeOwnerCtrl; + + return LLUICtrlFactory::create(badge_params); +} diff --git a/indra/llui/llbadgeowner.h b/indra/llui/llbadgeowner.h new file mode 100644 index 0000000000..7b2bbe01fd --- /dev/null +++ b/indra/llui/llbadgeowner.h @@ -0,0 +1,58 @@ +/** + * @file llbadgeowner.h + * @brief Header for badge owners + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLBADGEOWNER_H +#define LL_LLBADGEOWNER_H + +#include "llbadge.h" +#include "lluictrl.h" + +// +// Classes +// + +class LLBadgeOwner +{ +public: + + LLBadgeOwner(LLHandle ctrlHandle); + + void initBadgeParams(const LLBadge::Params& p); + void addBadgeToParentPanel(); + + void setBadgeLabel(const LLStringExplicit& label); + +private: + + LLBadge* createBadge(const LLBadge::Params& p); + +private: + + LLBadge* mBadge; + LLHandle mBadgeOwnerCtrl; +}; + +#endif // LL_LLBADGEOWNER_H diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index c841933a5f..ecad38894c 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -113,6 +113,7 @@ LLButton::Params::Params() LLButton::LLButton(const LLButton::Params& p) : LLUICtrl(p), + LLBadgeOwner(getUICtrlHandle()), mMouseDownFrame(0), mMouseHeldDownCount(0), mBorderEnabled( FALSE ), @@ -164,8 +165,7 @@ LLButton::LLButton(const LLButton::Params& p) mMouseDownSignal(NULL), mMouseUpSignal(NULL), mHeldDownSignal(NULL), - mUseDrawContextAlpha(p.use_draw_context_alpha), - mBadge(NULL) + mUseDrawContextAlpha(p.use_draw_context_alpha) { static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams()); @@ -248,16 +248,10 @@ LLButton::LLButton(const LLButton::Params& p) { setHeldDownCallback(initCommitCallback(p.mouse_held_callback)); } - - // Only create a badge here if a non-default one was provided. + if (p.badge.isProvided()) { - if (!p.badge().equals(LLUICtrlFactory::getDefaultParams())) - { - LLBadge::Params badge_params(p.badge()); - badge_params.owner = getUICtrlHandle(); - mBadge = LLUICtrlFactory::create(badge_params); - } + LLBadgeOwner::initBadgeParams(p.badge()); } } @@ -343,14 +337,11 @@ BOOL LLButton::postBuild() { autoResize(); - // Attach the badge to the appropriate parent panel - if (mBadge) - { - addBadgeToParentPanel(); - } + addBadgeToParentPanel(); - return TRUE; + return LLUICtrl::postBuild(); } + BOOL LLButton::handleUnicodeCharHere(llwchar uni_char) { BOOL handled = FALSE; @@ -1085,70 +1076,6 @@ void LLButton::setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignmen } } -void LLButton::addBadgeToParentPanel() -{ - if (mBadge) - { - // Find the appropriate parent panel for the badge - - LLPanel * parentPanel = NULL; - LLUICtrl * parent = getParentUICtrl(); - - while (parent) - { - parentPanel = dynamic_cast(parent); - - if (parentPanel && parentPanel->acceptsBadge()) - { - break; - } - - parent = parent->getParentUICtrl(); - } - - if (parentPanel) - { - parentPanel->addChild(mBadge); - } - else - { - llwarns << "Unable to find parent panel for badge " << mBadge->getName() << " on button " << getName() << llendl; - } - } - else - { - llwarns << "Unable to add NULL badge to button " << getName() << llendl; - } -} - -void LLButton::setBadgeLabel(const LLStringExplicit& label) -{ - if (mBadge == NULL) - { - LLBadge::Params badge_params(LLUICtrlFactory::getDefaultParams()); - badge_params.owner = getUICtrlHandle(); - mBadge = LLUICtrlFactory::create(badge_params); - - addBadgeToParentPanel(); - } - - if (mBadge) - { - mBadge->setLabel(label); - - // - // Push the badge to the front so it renders last - // - - LLUICtrl * parent = mBadge->getParentUICtrl(); - - if (parent) - { - parent->sendChildToFront(mBadge); - } - } -} - void LLButton::onMouseCaptureLost() { resetMouseDownTimer(); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 07f0395719..5880a0e1f2 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -28,7 +28,7 @@ #define LL_LLBUTTON_H #include "lluuid.h" -#include "llbadge.h" +#include "llbadgeowner.h" #include "llcontrol.h" #include "lluictrl.h" #include "v4color.h" @@ -60,7 +60,7 @@ class LLUICtrlFactory; // class LLButton -: public LLUICtrl +: public LLUICtrl, public LLBadgeOwner { public: struct Params @@ -252,8 +252,6 @@ public: void setImageFlash(LLPointer image); void setImagePressed(LLPointer image); - void setBadgeLabel(const LLStringExplicit& label); - void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } BOOL getCommitOnReturn() const { return mCommitOnReturn; } @@ -271,8 +269,6 @@ protected: LLPointer getImageUnselected() const { return mImageUnselected; } LLPointer getImageSelected() const { return mImageSelected; } - void addBadgeToParentPanel(); - LLFrameTimer mMouseDownTimer; private: @@ -363,8 +359,6 @@ private: bool mForcePressedState; LLFrameTimer mFlashingTimer; - - LLBadge* mBadge; }; // Build time optimization, generate once in .cpp file -- cgit v1.2.3 From 86470d3889436017264a69d57fb2060a591955f4 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 8 Jun 2011 15:46:34 -0700 Subject: Fixed to allow param blocks to exceed 64k, even though the size makes me wince. Modified viewer window to not create a navigation bar on exit if one doesn't yet exist. Reviewed by Richard. --- indra/llui/tests/llurlmatch_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp index e09ef33d49..3cd61e574e 100644 --- a/indra/llui/tests/llurlmatch_test.cpp +++ b/indra/llui/tests/llurlmatch_test.cpp @@ -95,7 +95,7 @@ namespace LLInitParam { const U8* my_addr = reinterpret_cast(this); const U8* block_addr = reinterpret_cast(enclosing_block); - mEnclosingBlockOffset = (U16)(my_addr - block_addr); + mEnclosingBlockOffset = 0x7FFFffff & ((U32)(my_addr - block_addr)); } bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack, S32 generation){ return true; } -- cgit v1.2.3 From def85f2778d9b69bc3fb0e89c1cef854a1c01886 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Thu, 9 Jun 2011 12:12:28 -0700 Subject: EXP-865 FIX -- Modify LLBadge to allow it to hang off of non-buttons LLBadgeOwner now only depends on LLView instead of LLUICtrl Sidebar Tab Buttons now can support badges Reviewed by Leyla --- indra/llui/llbadge.cpp | 8 ++++---- indra/llui/llbadge.h | 5 +++-- indra/llui/llbadgeowner.cpp | 30 +++++++++++++++--------------- indra/llui/llbadgeowner.h | 6 +++--- indra/llui/llbutton.cpp | 2 +- 5 files changed, 26 insertions(+), 25 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index e4c64e327e..53db226b20 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -178,16 +178,16 @@ void LLBadge::draw() { if (!mLabel.empty()) { - LLUICtrl* owner_ctrl = mOwner.get(); + LLView* owner_view = mOwner.get(); - if (owner_ctrl) + if (owner_view) { // // Calculate badge position based on owner // LLRect owner_rect; - owner_ctrl->localRectToOtherView(owner_ctrl->getLocalRect(), & owner_rect, this); + owner_view->localRectToOtherView(owner_view->getLocalRect(), & owner_rect, this); F32 badge_center_x = owner_rect.mLeft + owner_rect.getWidth() * mLocationPercentHCenter; F32 badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; @@ -230,7 +230,7 @@ void LLBadge::draw() } else { - lldebugs << "No image for badge " << getName() << " on owner " << owner_ctrl->getName() << llendl; + lldebugs << "No image for badge " << getName() << " on owner " << owner_view->getName() << llendl; renderBadgeBackground(badge_center_x, badge_center_y, badge_width, badge_height, diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index 05a76af42c..0f923ef01b 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -33,6 +33,7 @@ #include "lluictrl.h" #include "llstring.h" #include "lluiimage.h" +#include "llview.h" // // Declarations @@ -92,7 +93,7 @@ public: struct Params : public LLInitParam::Block { - Optional< LLHandle > owner; // Mandatory in code but not in xml + Optional< LLHandle > owner; // Mandatory in code but not in xml Optional< LLUIImage* > border_image; Optional< LLUIColor > border_color; @@ -144,7 +145,7 @@ private: F32 mLocationPercentHCenter; F32 mLocationPercentVCenter; - LLHandle< LLUICtrl > mOwner; + LLHandle< LLView > mOwner; F32 mPaddingHoriz; F32 mPaddingVert; diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index c77cf21ae0..11f1463b9b 100644 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -33,9 +33,9 @@ // Classes // -LLBadgeOwner::LLBadgeOwner(LLHandle ctrlHandle) +LLBadgeOwner::LLBadgeOwner(LLHandle< LLView > viewHandle) : mBadge(NULL) - , mBadgeOwnerCtrl(ctrlHandle) + , mBadgeOwnerView(viewHandle) { } @@ -64,7 +64,7 @@ void LLBadgeOwner::setBadgeLabel(const LLStringExplicit& label) // Push the badge to the front so it renders on top // - LLUICtrl * parent = mBadge->getParentUICtrl(); + LLView * parent = mBadge->getParent(); if (parent) { @@ -75,34 +75,34 @@ void LLBadgeOwner::setBadgeLabel(const LLStringExplicit& label) void LLBadgeOwner::addBadgeToParentPanel() { - if (mBadge && mBadgeOwnerCtrl.get()) + LLView * owner_view = mBadgeOwnerView.get(); + + if (mBadge && owner_view) { // Find the appropriate parent panel for the badge - LLUICtrl * owner_ctrl = mBadgeOwnerCtrl.get(); - LLUICtrl * parent = owner_ctrl->getParentUICtrl(); - - LLPanel * parentPanel = NULL; + LLView * parent = owner_view->getParent(); + LLPanel * parent_panel = NULL; while (parent) { - parentPanel = dynamic_cast(parent); + parent_panel = dynamic_cast(parent); - if (parentPanel && parentPanel->acceptsBadge()) + if (parent_panel && parent_panel->acceptsBadge()) { break; } - parent = parent->getParentUICtrl(); + parent = parent->getParent(); } - if (parentPanel) + if (parent_panel) { - parentPanel->addChild(mBadge); + parent_panel->addChild(mBadge); } else { - llwarns << "Unable to find parent panel for badge " << mBadge->getName() << " on ui control " << owner_ctrl->getName() << llendl; + llwarns << "Unable to find parent panel for badge " << mBadge->getName() << " on " << owner_view->getName() << llendl; } } } @@ -110,7 +110,7 @@ void LLBadgeOwner::addBadgeToParentPanel() LLBadge* LLBadgeOwner::createBadge(const LLBadge::Params& p) { LLBadge::Params badge_params(p); - badge_params.owner = mBadgeOwnerCtrl; + badge_params.owner = mBadgeOwnerView; return LLUICtrlFactory::create(badge_params); } diff --git a/indra/llui/llbadgeowner.h b/indra/llui/llbadgeowner.h index 7b2bbe01fd..456ef90c13 100644 --- a/indra/llui/llbadgeowner.h +++ b/indra/llui/llbadgeowner.h @@ -28,7 +28,7 @@ #define LL_LLBADGEOWNER_H #include "llbadge.h" -#include "lluictrl.h" +#include "llview.h" // // Classes @@ -38,7 +38,7 @@ class LLBadgeOwner { public: - LLBadgeOwner(LLHandle ctrlHandle); + LLBadgeOwner(LLHandle< LLView > viewHandle); void initBadgeParams(const LLBadge::Params& p); void addBadgeToParentPanel(); @@ -52,7 +52,7 @@ private: private: LLBadge* mBadge; - LLHandle mBadgeOwnerCtrl; + LLHandle< LLView > mBadgeOwnerView; }; #endif // LL_LLBADGEOWNER_H diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 907dc31721..637024e513 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -110,7 +110,7 @@ LLButton::Params::Params() LLButton::LLButton(const LLButton::Params& p) : LLUICtrl(p), - LLBadgeOwner(getUICtrlHandle()), + LLBadgeOwner(LLView::getHandle()), mMouseDownFrame(0), mMouseHeldDownCount(0), mBorderEnabled( FALSE ), -- cgit v1.2.3 From 3eeb14ee0abb5720e010d94eba52db09fa32237e Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Fri, 10 Jun 2011 16:20:30 -0700 Subject: EXP-856 FIX -- Inbox item count reflected as badge on inventory button * Modified badges to be parented to their owners if their owners have no parents * Modified side tray tab panels to create badges on side tab buttons when the xml specifies a badge. * Modified inbox to drive the badge value of the sidebar_inventory button. * Updated inbox and outbox sizes so scroll bars function as expected * Updated inventory_panel.xml to allow scroll tag to specify scroll bar properties, instead of just having them hardcoded. Reviewed by Richard --- indra/llui/llbadgeowner.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 11f1463b9b..3d63fc7f60 100644 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -79,26 +79,28 @@ void LLBadgeOwner::addBadgeToParentPanel() if (mBadge && owner_view) { - // Find the appropriate parent panel for the badge + // Badge parent is badge owner by default + LLView * badge_parent = owner_view; + // Find the appropriate parent for the badge LLView * parent = owner_view->getParent(); - LLPanel * parent_panel = NULL; while (parent) { - parent_panel = dynamic_cast(parent); + LLPanel * parent_panel = dynamic_cast(parent); if (parent_panel && parent_panel->acceptsBadge()) { + badge_parent = parent; break; } parent = parent->getParent(); } - if (parent_panel) + if (badge_parent) { - parent_panel->addChild(mBadge); + badge_parent->addChild(mBadge); } else { -- cgit v1.2.3 From 64f978dc81cf6b3dad42fc5f1cf3896208efc8ac Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 16 Jun 2011 16:39:30 -0700 Subject: EXP-891 Right click on Inbox or Outbox toggles up down arrow but has no action --- indra/llui/llbutton.cpp | 57 +++++++++++++++++++++++++++---------------------- indra/llui/llbutton.h | 4 ++++ 2 files changed, 36 insertions(+), 25 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 637024e513..7b015bd576 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -100,7 +100,8 @@ LLButton::Params::Params() hover_glow_amount("hover_glow_amount"), commit_on_return("commit_on_return", true), use_draw_context_alpha("use_draw_context_alpha", true), - badge("badge") + badge("badge"), + handle_right_mouse("handle_right_mouse") { addSynonym(is_toggle, "toggle"); held_down_delay.seconds = 0.5f; @@ -162,7 +163,8 @@ LLButton::LLButton(const LLButton::Params& p) mMouseDownSignal(NULL), mMouseUpSignal(NULL), mHeldDownSignal(NULL), - mUseDrawContextAlpha(p.use_draw_context_alpha) + mUseDrawContextAlpha(p.use_draw_context_alpha), + mHandleRightMouse(p.handle_right_mouse) { static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams()); @@ -457,7 +459,7 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if (!childrenHandleRightMouseDown(x, y, mask)) + if (mHandleRightMouse && !childrenHandleRightMouseDown(x, y, mask)) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); @@ -470,37 +472,42 @@ BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) // if (pointInView(x, y)) // { // } + // send the mouse down signal + LLUICtrl::handleRightMouseDown(x,y,mask); + // *TODO: Return result of LLUICtrl call above? Should defer to base class + // but this might change the mouse handling of existing buttons in a bad way + // if they are not mouse opaque. } - // send the mouse down signal - LLUICtrl::handleRightMouseDown(x,y,mask); - // *TODO: Return result of LLUICtrl call above? Should defer to base class - // but this might change the mouse handling of existing buttons in a bad way - // if they are not mouse opaque. + return TRUE; } BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) { - // We only handle the click if the click both started and ended within us - if( hasMouseCapture() ) + if (mHandleRightMouse) { - // Always release the mouse - gFocusMgr.setMouseCapture( NULL ); + // We only handle the click if the click both started and ended within us + if( hasMouseCapture() ) + { + // Always release the mouse + gFocusMgr.setMouseCapture( NULL ); -// if (pointInView(x, y)) -// { -// mRightMouseUpSignal(this, x,y,mask); -// } - } - else - { - childrenHandleRightMouseUp(x, y, mask); + // if (pointInView(x, y)) + // { + // mRightMouseUpSignal(this, x,y,mask); + // } + } + else + { + childrenHandleRightMouseUp(x, y, mask); + } + + // send the mouse up signal + LLUICtrl::handleRightMouseUp(x,y,mask); + // *TODO: Return result of LLUICtrl call above? Should defer to base class + // but this might change the mouse handling of existing buttons in a bad way. + // if they are not mouse opaque. } - // send the mouse up signal - LLUICtrl::handleRightMouseUp(x,y,mask); - // *TODO: Return result of LLUICtrl call above? Should defer to base class - // but this might change the mouse handling of existing buttons in a bad way. - // if they are not mouse opaque. return TRUE; } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 5880a0e1f2..5968916006 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -129,6 +129,8 @@ public: Optional badge; + Optional handle_right_mouse; + Params(); }; @@ -359,6 +361,8 @@ private: bool mForcePressedState; LLFrameTimer mFlashingTimer; + + bool mHandleRightMouse; }; // Build time optimization, generate once in .cpp file -- cgit v1.2.3 From 4267014b146798cabe96568b2091c6bb2dd2b294 Mon Sep 17 00:00:00 2001 From: Leslie Linden Date: Wed, 22 Jun 2011 17:35:25 -0400 Subject: EXP-890 FIX -- Resizing inbox or outbox to minimum size while open does not show present items when hte box is next opened EXP-897 FIX -- Black box shown in UI when shrinking Inbox down in size * Layout panel now supports "expanded_min_dim" parameter which allows a different min size to be specified when the layout panel is collapsed vs expanded. * Inbox and Outbox expanded_min_dim attributes are now set to be larger than min dim so they can not be collapsed all the way when they are expanded. --- indra/llui/lllayoutstack.cpp | 97 +++++++++++++++++++++++--------------------- indra/llui/lllayoutstack.h | 34 ++++++++++++---- 2 files changed, 77 insertions(+), 54 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 8a92796942..d87ee428aa 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -49,6 +49,8 @@ void LLLayoutStack::OrientationNames::declareValues() // LLLayoutPanel::LLLayoutPanel(const Params& p) : LLPanel(p), + mExpandedMinDimSpecified(false), + mExpandedMinDim(p.min_dim), mMinDim(p.min_dim), mMaxDim(p.max_dim), mAutoResize(p.auto_resize), @@ -58,6 +60,13 @@ LLLayoutPanel::LLLayoutPanel(const Params& p) mVisibleAmt(1.f), // default to fully visible mResizeBar(NULL) { + // Set the expanded min dim if it is provided, otherwise it gets the p.min_dim value + if (p.expanded_min_dim.isProvided()) + { + mExpandedMinDimSpecified = true; + mExpandedMinDim = p.expanded_min_dim(); + } + // panels initialized as hidden should not start out partially visible if (!getVisible()) { @@ -84,13 +93,13 @@ F32 LLLayoutPanel::getCollapseFactor(LLLayoutStack::ELayoutOrientation orientati if (orientation == LLLayoutStack::HORIZONTAL) { F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, (F32)mMinDim / (F32)llmax(1, getRect().getWidth())); + clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, getRelevantMinDim() / (F32)llmax(1, getRect().getWidth())); return mVisibleAmt * collapse_amt; } else { F32 collapse_amt = - clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, (F32)mMinDim / (F32)llmax(1, getRect().getHeight()))); + clamp_rescale(mCollapseAmt, 0.f, 1.f, 1.f, llmin(1.f, getRelevantMinDim() / (F32)llmax(1, getRect().getHeight()))); return mVisibleAmt * collapse_amt; } } @@ -281,9 +290,9 @@ bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_dimp { LLLayoutPanel* panel = findEmbeddedPanelByName(panel_name); - if (panel) + if (panel && min_dimp) { - if (min_dimp) *min_dimp = panel->mMinDim; + *min_dimp = panel->getRelevantMinDim(); } return NULL != panel; @@ -316,7 +325,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize) e_panel_list_t::iterator panel_it; for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { - LLPanel* panelp = (*panel_it); + LLLayoutPanel* panelp = (*panel_it); if (panelp->getVisible()) { if (mAnimate) @@ -366,9 +375,9 @@ void LLLayoutStack::updateLayout(BOOL force_resize) if (mOrientation == HORIZONTAL) { // enforce minimize size constraint by default - if (panelp->getRect().getWidth() < (*panel_it)->mMinDim) + if (panelp->getRect().getWidth() < (*panel_it)->getRelevantMinDim()) { - panelp->reshape((*panel_it)->mMinDim, panelp->getRect().getHeight()); + panelp->reshape((*panel_it)->getRelevantMinDim(), panelp->getRect().getHeight()); } total_width += llround(panelp->getRect().getWidth() * (*panel_it)->getCollapseFactor(mOrientation)); // want n-1 panel gaps for n panels @@ -380,9 +389,9 @@ void LLLayoutStack::updateLayout(BOOL force_resize) else //VERTICAL { // enforce minimize size constraint by default - if (panelp->getRect().getHeight() < (*panel_it)->mMinDim) + if (panelp->getRect().getHeight() < (*panel_it)->getRelevantMinDim()) { - panelp->reshape(panelp->getRect().getWidth(), (*panel_it)->mMinDim); + panelp->reshape(panelp->getRect().getWidth(), (*panel_it)->getRelevantMinDim()); } total_height += llround(panelp->getRect().getHeight() * (*panel_it)->getCollapseFactor(mOrientation)); if (panel_it != mPanels.begin()) @@ -409,28 +418,20 @@ void LLLayoutStack::updateLayout(BOOL force_resize) || (!(*panel_it)->mAutoResize && !force_resize)) { - if (mOrientation == HORIZONTAL) - { - shrink_headroom_total += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim; - } - else //VERTICAL - { - shrink_headroom_total += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim; - } + S32 relevant_dimension = (mOrientation == HORIZONTAL) ? (*panel_it)->getRect().getWidth() : (*panel_it)->getRect().getHeight(); + F32 relevant_min = ((*panel_it)->mCollapsed ? (*panel_it)->getRelevantMinDim() : (*panel_it)->mExpandedMinDim); + + shrink_headroom_total += relevant_dimension - relevant_min; } else { num_resizable_panels++; - if (mOrientation == HORIZONTAL) - { - shrink_headroom_available += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim; - shrink_headroom_total += (*panel_it)->getRect().getWidth() - (*panel_it)->mMinDim; - } - else //VERTICAL - { - shrink_headroom_available += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim; - shrink_headroom_total += (*panel_it)->getRect().getHeight() - (*panel_it)->mMinDim; - } + + S32 relevant_dimension = (mOrientation == HORIZONTAL) ? (*panel_it)->getRect().getWidth() : (*panel_it)->getRect().getHeight(); + F32 relevant_min = ((*panel_it)->mCollapsed ? (*panel_it)->getRelevantMinDim() : (*panel_it)->mExpandedMinDim); + + shrink_headroom_available += relevant_dimension - relevant_min; + shrink_headroom_total += relevant_dimension - relevant_min; } } @@ -452,27 +453,28 @@ void LLLayoutStack::updateLayout(BOOL force_resize) for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { - LLPanel* panelp = (*panel_it); + LLLayoutPanel* panelp = (*panel_it); S32 cur_width = panelp->getRect().getWidth(); S32 cur_height = panelp->getRect().getHeight(); S32 new_width = cur_width; - S32 new_height = cur_height; + S32 new_height = cur_height; + S32 relevant_min = (S32) panelp->getRelevantMinDim(); if (mOrientation == HORIZONTAL) { - new_width = llmax((*panel_it)->mMinDim, new_width); + new_width = llmax(relevant_min, new_width); } else { - new_height = llmax((*panel_it)->mMinDim, new_height); + new_height = llmax(relevant_min, new_height); } S32 delta_size = 0; // if panel can automatically resize (not animating, and resize flag set)... - if ((*panel_it)->getCollapseFactor(mOrientation) == 1.f - && (force_resize || (*panel_it)->mAutoResize) - && !(*panel_it)->mResizeBar->hasMouseCapture()) + if (panelp->getCollapseFactor(mOrientation) == 1.f + && (force_resize || panelp->mAutoResize) + && !panelp->mResizeBar->hasMouseCapture()) { if (mOrientation == HORIZONTAL) { @@ -481,8 +483,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { // shrink proportionally to amount over minimum // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - (*panel_it)->mMinDim) / (F32)shrink_headroom_available)) : 0; - shrink_headroom_available -= (cur_width - (*panel_it)->mMinDim); + delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_width - panelp->getRelevantMinDim()) / (F32)shrink_headroom_available)) : 0; + shrink_headroom_available -= (cur_width - relevant_min); } else { @@ -491,7 +493,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize) num_resizable_panels--; } pixels_to_distribute -= delta_size; - new_width = llmax((*panel_it)->mMinDim, cur_width + delta_size); + new_width = llmax(relevant_min, cur_width + delta_size); } else { @@ -504,8 +506,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { // shrink proportionally to amount over minimum // so we can do this in one pass - delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - (*panel_it)->mMinDim) / (F32)shrink_headroom_available)) : 0; - shrink_headroom_available -= (cur_height - (*panel_it)->mMinDim); + delta_size = (shrink_headroom_available > 0) ? llround((F32)pixels_to_distribute * ((F32)(cur_height - relevant_min) / (F32)shrink_headroom_available)) : 0; + shrink_headroom_available -= (cur_height - relevant_min); } else { @@ -513,7 +515,7 @@ void LLLayoutStack::updateLayout(BOOL force_resize) num_resizable_panels--; } pixels_to_distribute -= delta_size; - new_height = llmax((*panel_it)->mMinDim, cur_height + delta_size); + new_height = llmax(relevant_min, cur_height + delta_size); } else { @@ -566,19 +568,20 @@ void LLLayoutStack::updateLayout(BOOL force_resize) LLLayoutPanel* last_resizeable_panel = NULL; for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) { - LLPanel* panelp = (*panel_it); + LLLayoutPanel* panelp = (*panel_it); + F32 relevant_min = panelp->getRelevantMinDim(); if (mOrientation == HORIZONTAL) { (*panel_it)->mResizeBar->setResizeLimits( - (*panel_it)->mMinDim, - (*panel_it)->mMinDim + shrink_headroom_total); + relevant_min, + relevant_min + shrink_headroom_total); } else //VERTICAL { (*panel_it)->mResizeBar->setResizeLimits( - (*panel_it)->mMinDim, - (*panel_it)->mMinDim + shrink_headroom_total); + relevant_min, + relevant_min + shrink_headroom_total); } // toggle resize bars based on panel visibility, resizability, etc @@ -658,7 +661,7 @@ void LLLayoutStack::calcMinExtents() { if (mOrientation == HORIZONTAL) { - mMinWidth += (*panel_it)->mMinDim; + mMinWidth += (*panel_it)->getRelevantMinDim(); if (panel_it != mPanels.begin()) { mMinWidth += mPanelSpacing; @@ -666,7 +669,7 @@ void LLLayoutStack::calcMinExtents() } else //VERTICAL { - mMinHeight += (*panel_it)->mMinDim; + mMinHeight += (*panel_it)->getRelevantMinDim(); if (panel_it != mPanels.begin()) { mMinHeight += mPanelSpacing; diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 2fc2cf3eb4..d8ef0aeaca 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -30,10 +30,10 @@ #include "llpanel.h" -class LLPanel; class LLLayoutPanel; + class LLLayoutStack : public LLView, public LLInstanceTracker { public: @@ -149,6 +149,7 @@ private: F32 mCloseTimeConstant; }; // end class LLLayoutStack + class LLLayoutPanel : public LLPanel { friend class LLLayoutStack; @@ -156,13 +157,15 @@ friend class LLUICtrlFactory; public: struct Params : public LLInitParam::Block { - Optional min_dim, + Optional expanded_min_dim, + min_dim, max_dim; Optional user_resize, auto_resize; Params() - : min_dim("min_dim", 0), + : expanded_min_dim("expanded_min_dim", 0), + min_dim("min_dim", 0), max_dim("max_dim", 0), user_resize("user_resize", true), auto_resize("auto_resize", true) @@ -179,17 +182,34 @@ public: void initFromParams(const Params& p); S32 getMinDim() const { return mMinDim; } - S32 getMaxDim() const { return mMaxDim; } + void setMinDim(S32 value) { mMinDim = value; if (!mExpandedMinDimSpecified) mExpandedMinDim = value; } - void setMinDim(S32 value) { mMinDim = value; } + S32 getMaxDim() const { return mMaxDim; } void setMaxDim(S32 value) { mMaxDim = value; } -protected: - LLLayoutPanel(const Params& p) ; + S32 getExpandedMinDim() const { return mExpandedMinDim; } + void setExpandedMinDim(S32 value) { mExpandedMinDim = value; mExpandedMinDimSpecified = true; } + + S32 getRelevantMinDim() const + { + S32 min_dim = mMinDim; + + if (!mCollapsed) + { + min_dim = mExpandedMinDim; + } + + return min_dim; + } +protected: + LLLayoutPanel(const Params& p); F32 getCollapseFactor(LLLayoutStack::ELayoutOrientation orientation); + bool mExpandedMinDimSpecified; + S32 mExpandedMinDim; + S32 mMinDim; S32 mMaxDim; BOOL mAutoResize; -- cgit v1.2.3