summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-11-05 19:26:23 -0800
committerRichard Linden <none@none>2013-11-05 19:26:23 -0800
commitc35801ef1c56b6c84063f47b490a8d2220b77ca7 (patch)
tree5fe354aa156938a675ebe38d4d1101f2f6bed640 /indra/llui
parent8c4825c3821c490698806f2b4771800cdb5d6956 (diff)
fixed focus issue on inventory
Diffstat (limited to 'indra/llui')
-rwxr-xr-xindra/llui/lliconctrl.cpp26
-rwxr-xr-xindra/llui/lliconctrl.h10
-rwxr-xr-xindra/llui/lllayoutstack.cpp118
-rwxr-xr-xindra/llui/llresizebar.cpp78
-rwxr-xr-xindra/llui/llresizebar.h15
5 files changed, 117 insertions, 130 deletions
diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp
index 30b79b4d20..58b66f60ca 100755
--- a/indra/llui/lliconctrl.cpp
+++ b/indra/llui/lliconctrl.cpp
@@ -42,7 +42,9 @@ LLIconCtrl::Params::Params()
: image("image_name"),
color("color"),
use_draw_context_alpha("use_draw_context_alpha", true),
- scale_image("scale_image")
+ scale_image("scale_image"),
+ min_width("min_width", 0),
+ min_height("min_height", 0)
{}
LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p)
@@ -51,8 +53,8 @@ LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p)
mImagep(p.image),
mUseDrawContextAlpha(p.use_draw_context_alpha),
mPriority(0),
- mDrawWidth(0),
- mDrawHeight(0)
+ mMinWidth(p.min_width),
+ mMinHeight(p.min_height)
{
if (mImagep.notNull())
{
@@ -97,7 +99,13 @@ void LLIconCtrl::setValue(const LLSD& value )
mImagep = LLUI::getUIImage(tvalue.asString(), mPriority);
}
- setIconImageDrawSize();
+ if(mImagep.notNull()
+ && mImagep->getImage().notNull()
+ && mMinWidth
+ && mMinHeight)
+ {
+ mImagep->getImage()->setKnownDrawSize(llmax(mMinWidth, mImagep->getWidth()), llmax(mMinHeight, mImagep->getHeight()));
+ }
}
std::string LLIconCtrl::getImageName() const
@@ -108,14 +116,4 @@ std::string LLIconCtrl::getImageName() const
return std::string();
}
-void LLIconCtrl::setIconImageDrawSize()
-{
- if(mImagep.notNull() && mDrawWidth && mDrawHeight)
- {
- if(mImagep->getImage().notNull())
- {
- mImagep->getImage()->setKnownDrawSize(mDrawWidth, mDrawHeight) ;
- }
- }
-}
diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h
index a19bb99d9d..8b1092df46 100755
--- a/indra/llui/lliconctrl.h
+++ b/indra/llui/lliconctrl.h
@@ -49,7 +49,10 @@ public:
Optional<LLUIImage*> image;
Optional<LLUIColor> color;
Optional<bool> use_draw_context_alpha;
+ Optional<S32> min_width,
+ min_height;
Ignored scale_image;
+
Params();
};
protected:
@@ -71,15 +74,12 @@ public:
void setImage(LLPointer<LLUIImage> image) { mImagep = image; }
const LLPointer<LLUIImage> getImage() { return mImagep; }
-private:
- void setIconImageDrawSize() ;
-
protected:
S32 mPriority;
//the output size of the icon image if set.
- S32 mDrawWidth ;
- S32 mDrawHeight ;
+ S32 mMinWidth,
+ mMinHeight;
// If set to true (default), use the draw context transparency.
// If false, will use transparency returned by getCurrentTransparency(). See STORM-698.
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index b13f61ea7e..c59286fc60 100755
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -33,6 +33,7 @@
#include "lllocalcliprect.h"
#include "llpanel.h"
#include "llcriticaldamp.h"
+#include "lliconctrl.h"
#include "boost/foreach.hpp"
static const F32 MIN_FRACTIONAL_SIZE = 0.00001f;
@@ -268,25 +269,9 @@ void LLLayoutStack::draw()
// only force drawing invisible children if visible amount is non-zero
drawChild(panelp, 0, 0, !clip_rect.isEmpty());
}
- }
-
- const LLView::child_list_t * child_listp = getChildList();
- BOOST_FOREACH(LLView * childp, * child_listp)
- {
- LLResizeBar * resize_barp = dynamic_cast<LLResizeBar*>(childp);
- if (resize_barp && resize_barp->isShowDragHandle() && resize_barp->getVisible() && resize_barp->getRect().isValid())
+ if (panelp->getResizeBar()->getVisible())
{
- LLRect screen_rect = resize_barp->calcScreenRect();
- if (LLUI::getRootView()->getLocalRect().overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect))
- {
- LLUI::pushMatrix();
- {
- const LLRect& rb_rect(resize_barp->getRect());
- LLUI::translate(rb_rect.mLeft, rb_rect.mBottom);
- resize_barp->draw();
- }
- LLUI::popMatrix();
- }
+ drawChild(panelp->getResizeBar());
}
}
}
@@ -351,6 +336,31 @@ void LLLayoutStack::collapsePanel(LLPanel* panel, BOOL collapsed)
static LLTrace::BlockTimerStatHandle FTM_UPDATE_LAYOUT("Update LayoutStacks");
+class LLImagePanel : public LLPanel
+{
+public:
+ struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ {
+ Optional<bool> horizontal;
+ Params() : horizontal("horizontal", false) {}
+ };
+ LLImagePanel(const Params& p) : LLPanel(p), mHorizontal(p.horizontal) {}
+ virtual ~LLImagePanel() {}
+
+ void draw()
+ {
+ const LLRect& parent_rect = getParent()->getRect();
+ const LLRect& rect = getRect();
+ LLRect clip_rect( -rect.mLeft, parent_rect.getHeight() - rect.mBottom - 2
+ , parent_rect.getWidth() - rect.mLeft - (mHorizontal ? 2 : 0), -rect.mBottom);
+ LLLocalClipRect clip(clip_rect);
+ LLPanel::draw();
+ }
+
+private:
+ bool mHorizontal;
+};
+
void LLLayoutStack::updateLayout()
{
LL_RECORD_BLOCK_TIME(FTM_UPDATE_LAYOUT);
@@ -435,8 +445,6 @@ void LLLayoutStack::updateLayout()
}
LLRect resize_bar_rect(panel_rect);
- LLResizeBar * resize_barp = panelp->getResizeBar();
- bool show_drag_handle = resize_barp->isShowDragHandle();
F32 panel_spacing = (F32)mPanelSpacing * panelp->getVisibleAmount();
F32 panel_visible_dim = panelp->getVisibleDim();
S32 panel_spacing_round = (S32)(llround(panel_spacing));
@@ -445,7 +453,7 @@ void LLLayoutStack::updateLayout()
{
cur_pos += panel_visible_dim + panel_spacing;
- if (show_drag_handle && panel_spacing_round > mDragHandleThickness)
+ if (mShowDragHandle && panel_spacing_round > mDragHandleThickness)
{
resize_bar_rect.mLeft = panel_rect.mRight + mDragHandleShift;
resize_bar_rect.mRight = resize_bar_rect.mLeft + mDragHandleThickness;
@@ -456,7 +464,7 @@ void LLLayoutStack::updateLayout()
resize_bar_rect.mRight = panel_rect.mRight + panel_spacing_round + mResizeBarOverlap;
}
- if (show_drag_handle)
+ if (mShowDragHandle)
{
resize_bar_rect.mBottom += mDragHandleSecondIndent;
resize_bar_rect.mTop -= mDragHandleFirstIndent;
@@ -467,7 +475,7 @@ void LLLayoutStack::updateLayout()
{
cur_pos -= panel_visible_dim + panel_spacing;
- if (show_drag_handle && panel_spacing_round > mDragHandleThickness)
+ if (mShowDragHandle && panel_spacing_round > mDragHandleThickness)
{
resize_bar_rect.mTop = panel_rect.mBottom - mDragHandleShift;
resize_bar_rect.mBottom = resize_bar_rect.mTop - mDragHandleThickness;
@@ -478,7 +486,7 @@ void LLLayoutStack::updateLayout()
resize_bar_rect.mBottom = panel_rect.mBottom - panel_spacing_round - mResizeBarOverlap;
}
- if (show_drag_handle)
+ if (mShowDragHandle)
{
resize_bar_rect.mLeft += mDragHandleFirstIndent;
resize_bar_rect.mRight -= mDragHandleSecondIndent;
@@ -541,9 +549,69 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp)
resize_params.min_size(lp->getRelevantMinDim());
resize_params.side((mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM);
resize_params.snapping_enabled(false);
- resize_params.show_drag_handle(mShowDragHandle);
LLResizeBar* resize_bar = LLUICtrlFactory::create<LLResizeBar>(resize_params);
lp->mResizeBar = resize_bar;
+
+ if (mShowDragHandle)
+ {
+ LLPanel::Params resize_bar_bg_panel_p;
+ resize_bar_bg_panel_p.name = "resize_handle_bg_panel";
+ resize_bar_bg_panel_p.rect = lp->mResizeBar->getLocalRect();
+ resize_bar_bg_panel_p.follows.flags = FOLLOWS_ALL;
+ resize_bar_bg_panel_p.tab_stop = false;
+ resize_bar_bg_panel_p.background_visible = true;
+ resize_bar_bg_panel_p.bg_alpha_color = LLUIColorTable::instance().getColor("ResizebarBody");
+ resize_bar_bg_panel_p.has_border = true;
+ resize_bar_bg_panel_p.border.border_thickness = 1;
+ resize_bar_bg_panel_p.border.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight");
+ resize_bar_bg_panel_p.border.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark");
+
+ LLPanel* resize_bar_bg_panel = LLUICtrlFactory::create<LLPanel>(resize_bar_bg_panel_p);
+
+ LLIconCtrl::Params icon_p;
+ icon_p.name = "resize_handle_image";
+ icon_p.rect = lp->mResizeBar->getLocalRect();
+ icon_p.follows.flags = FOLLOWS_ALL;
+ icon_p.image = LLUI::getUIImage(mOrientation == HORIZONTAL ? "Vertical Drag Handle" : "Horizontal Drag Handle");
+ resize_bar_bg_panel->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_p));
+
+ lp->mResizeBar->addChild(resize_bar_bg_panel);
+ }
+
+ /*if (mShowDragHandle)
+ {
+ LLViewBorder::Params border_params;
+ border_params.border_thickness = 1;
+ border_params.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight");
+ border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark");
+
+ addBorder(border_params);
+ setBorderVisible(TRUE);
+
+ LLImagePanel::Params image_panel;
+ mDragHandleImage = LLUI::getUIImage(LLResizeBar::RIGHT == mSide ? "Vertical Drag Handle" : "Horizontal Drag Handle");
+ image_panel.bg_alpha_image = mDragHandleImage;
+ image_panel.background_visible = true;
+ image_panel.horizontal = (LLResizeBar::BOTTOM == mSide);
+ mImagePanel = LLUICtrlFactory::create<LLImagePanel>(image_panel);
+ setImagePanel(mImagePanel);
+ }*/
+
+ //if (mShowDragHandle)
+ //{
+ // setBackgroundVisible(TRUE);
+ // setTransparentColor(LLUIColorTable::instance().getColor("ResizebarBody"));
+ //}
+
+ /*if (mShowDragHandle)
+ {
+ S32 image_width = mDragHandleImage->getTextureWidth();
+ S32 image_height = mDragHandleImage->getTextureHeight();
+ const LLRect& panel_rect = getRect();
+ S32 image_left = (panel_rect.getWidth() - image_width) / 2 - 1;
+ S32 image_bottom = (panel_rect.getHeight() - image_height) / 2;
+ mImagePanel->setRect(LLRect(image_left, image_bottom + image_height, image_left + image_width, image_bottom));
+ }*/
LLView::addChild(resize_bar, 0);
}
}
diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp
index e67b22c977..115c4e23be 100755
--- a/indra/llui/llresizebar.cpp
+++ b/indra/llui/llresizebar.cpp
@@ -35,46 +35,18 @@
#include "llfocusmgr.h"
#include "llwindow.h"
-class LLImagePanel : public LLPanel
-{
-public:
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
- {
- Optional<bool> horizontal;
- Params() : horizontal("horizontal", false) {}
- };
- LLImagePanel(const Params& p) : LLPanel(p), mHorizontal(p.horizontal) {}
- virtual ~LLImagePanel() {}
-
- void draw()
- {
- const LLRect& parent_rect = getParent()->getRect();
- const LLRect& rect = getRect();
- LLRect clip_rect( -rect.mLeft, parent_rect.getHeight() - rect.mBottom - 2
- , parent_rect.getWidth() - rect.mLeft - (mHorizontal ? 2 : 0), -rect.mBottom);
- LLLocalClipRect clip(clip_rect);
- LLPanel::draw();
- }
-
-private:
- bool mHorizontal;
-};
-
-static LLDefaultChildRegistry::Register<LLImagePanel> t1("resize_bar_image_panel");
-
LLResizeBar::Params::Params()
: max_size("max_size", S32_MAX),
snapping_enabled("snapping_enabled", true),
resizing_view("resizing_view"),
side("side"),
- allow_double_click_snapping("allow_double_click_snapping", true),
- show_drag_handle("show_drag_handle", false)
+ allow_double_click_snapping("allow_double_click_snapping", true)
{
name = "resize_bar";
}
LLResizeBar::LLResizeBar(const LLResizeBar::Params& p)
-: LLPanel(p),
+: LLView(p),
mDragLastScreenX( 0 ),
mDragLastScreenY( 0 ),
mLastMouseScreenX( 0 ),
@@ -86,7 +58,6 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p)
mAllowDoubleClickSnapping(p.allow_double_click_snapping),
mResizingView(p.resizing_view),
mResizeListener(NULL),
- mShowDragHandle(p.show_drag_handle),
mImagePanel(NULL)
{
setFollowsNone();
@@ -116,36 +87,6 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p)
default:
break;
}
-
- if (mShowDragHandle)
- {
- LLViewBorder::Params border_params;
- border_params.border_thickness = 1;
- border_params.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight");
- border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark");
-
- addBorder(border_params);
- setBorderVisible(TRUE);
-
- LLImagePanel::Params image_panel;
- mDragHandleImage = LLUI::getUIImage(LLResizeBar::RIGHT == mSide ? "Vertical Drag Handle" : "Horizontal Drag Handle");
- image_panel.bg_alpha_image = mDragHandleImage;
- image_panel.background_visible = true;
- image_panel.horizontal = (LLResizeBar::BOTTOM == mSide);
- mImagePanel = LLUICtrlFactory::create<LLImagePanel>(image_panel);
- setImagePanel(mImagePanel);
- }
-}
-
-BOOL LLResizeBar::postBuild()
-{
- if (mShowDragHandle)
- {
- setBackgroundVisible(TRUE);
- setTransparentColor(LLUIColorTable::instance().getColor("ResizebarBody"));
- }
-
- return LLPanel::postBuild();
}
BOOL LLResizeBar::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -433,18 +374,3 @@ LLPanel * LLResizeBar::getImagePanel() const
{
return getChildCount() > 0 ? (LLPanel *)getChildList()->back() : NULL;
}
-
-void LLResizeBar::draw()
-{
- if (mShowDragHandle)
- {
- S32 image_width = mDragHandleImage->getTextureWidth();
- S32 image_height = mDragHandleImage->getTextureHeight();
- const LLRect& panel_rect = getRect();
- S32 image_left = (panel_rect.getWidth() - image_width) / 2 - 1;
- S32 image_bottom = (panel_rect.getHeight() - image_height) / 2;
- mImagePanel->setRect(LLRect(image_left, image_bottom + image_height, image_left + image_width, image_bottom));
- }
-
- LLPanel::draw();
-}
diff --git a/indra/llui/llresizebar.h b/indra/llui/llresizebar.h
index bcf8ea0b40..20a2406484 100755
--- a/indra/llui/llresizebar.h
+++ b/indra/llui/llresizebar.h
@@ -27,14 +27,14 @@
#ifndef LL_RESIZEBAR_H
#define LL_RESIZEBAR_H
-#include "llpanel.h"
+#include "llview.h"
-class LLResizeBar : public LLPanel
+class LLResizeBar : public LLView
{
public:
enum Side { LEFT, TOP, RIGHT, BOTTOM };
- struct Params : public LLInitParam::Block<Params, LLPanel::Params>
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Mandatory<LLView*> resizing_view;
Mandatory<Side> side;
@@ -43,7 +43,6 @@ public:
Optional<S32> max_size;
Optional<bool> snapping_enabled;
Optional<bool> allow_double_click_snapping;
- Optional<bool> show_drag_handle;
Params();
};
@@ -52,10 +51,8 @@ protected:
LLResizeBar(const LLResizeBar::Params& p);
friend class LLUICtrlFactory;
- /*virtual*/ BOOL postBuild();
public:
- virtual void draw();
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
@@ -66,7 +63,6 @@ public:
void setAllowDoubleClickSnapping(BOOL allow) { mAllowDoubleClickSnapping = allow; }
bool canResize() { return getEnabled() && mMaxSize > mMinSize; }
void setResizeListener(boost::function<void(void*)> listener) {mResizeListener = listener;}
- BOOL isShowDragHandle() const { return mShowDragHandle; }
void setImagePanel(LLPanel * panelp);
LLPanel * getImagePanel() const;
@@ -79,9 +75,8 @@ private:
S32 mMinSize;
S32 mMaxSize;
const Side mSide;
- BOOL mSnappingEnabled;
- BOOL mAllowDoubleClickSnapping;
- BOOL mShowDragHandle;
+ bool mSnappingEnabled,
+ mAllowDoubleClickSnapping;
LLView* mResizingView;
boost::function<void(void*)> mResizeListener;
LLPointer<LLUIImage> mDragHandleImage;