diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-04-25 04:46:42 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-04-27 00:39:50 +0300 |
commit | cea6eeeede9f687ca195cc9b9e778fd6784afbe2 (patch) | |
tree | e3cf8984becf11665feef60c2dae7a57894f955c /indra/llui/llfolderviewitem.cpp | |
parent | 384d694aba523218490ec48c22d97b63acbffd6f (diff) |
viewer#1300 'Star' favorites in inventory
image is WIP
Diffstat (limited to 'indra/llui/llfolderviewitem.cpp')
-rw-r--r-- | indra/llui/llfolderviewitem.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 2bd14f6f6a..84146e5829 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -99,6 +99,8 @@ void LLFolderViewItem::cleanupClass() LLFolderViewItem::Params::Params() : root(), listener(), + favorite_image("favorite_image"), + favorite_content_image("favorite_content_image"), folder_arrow_image("folder_arrow_image"), folder_indentation("folder_indentation"), selection_image("selection_image"), @@ -125,6 +127,8 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p) : LLView(p), mLabelWidth(0), mLabelWidthDirty(false), + mIsFavorite(false), + mHasFavorites(false), mSuffixNeedsRefresh(false), mLabelPaddingRight(DEFAULT_LABEL_PADDING_RIGHT), mParentFolder( NULL ), @@ -194,6 +198,8 @@ BOOL LLFolderViewItem::postBuild() // getDisplayName() is expensive (due to internal getLabelSuffix() and name building) // it also sets search strings so it requires a filter reset mLabel = vmi->getDisplayName(); + mIsFavorite = vmi->isFavorite(); + mHasFavorites = vmi->hasFavorites(); setToolTip(vmi->getName()); // Dirty the filter flag of the model from the view (CHUI-849) @@ -307,6 +313,8 @@ void LLFolderViewItem::refresh() LLFolderViewModelItem& vmi = *getViewModelItem(); mLabel = vmi.getDisplayName(); + mIsFavorite = vmi.isFavorite(); + mHasFavorites = vmi.hasFavorites(); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -339,6 +347,9 @@ void LLFolderViewItem::refreshSuffix() mIconOpen = vmi->getIconOpen(); mIconOverlay = vmi->getIconOverlay(); + mIsFavorite = vmi->isFavorite(); + mHasFavorites = vmi->hasFavorites(); + if (mRoot->useLabelSuffix()) { // Very Expensive! @@ -754,6 +765,29 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L } } +void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUIColor& fg_color) +{ + LLUIImage* favorite_image = NULL; + if (mIsFavorite) + { + favorite_image = default_params.favorite_image; + } + else if (mHasFavorites) + { + favorite_image = default_params.favorite_content_image; + } + + if (favorite_image) + { + const S32 PAD = 2; + const S32 image_size = 30; + + gl_draw_scaled_image( + getRect().getWidth() - image_size - PAD, getRect().getHeight() - mItemHeight + PAD, + image_size, image_size, favorite_image->getImage(), fg_color); + } +} + /*virtual*/ bool LLFolderViewItem::isHighlightAllowed() { return mIsSelected; @@ -913,6 +947,7 @@ void LLFolderViewItem::draw() { drawOpenFolderArrow(default_params, sFgColor); } + drawFavoriteIcon(default_params, sFgColor); drawHighlight(show_context, filled, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor); |