From 0193a7b74ccc09788e8d2503244f30ac231546cc Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Tue, 16 Apr 2013 04:55:09 +0300 Subject: CHUI-808 FIXED Draggable separator between conversations and message pane is not discoverable: - final solution; --- indra/llui/llresizebar.cpp | 110 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 2 deletions(-) (limited to 'indra/llui/llresizebar.cpp') diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index 15e56cbfe5..cfdc951542 100644 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -28,14 +28,53 @@ #include "llresizebar.h" +#include "lllocalcliprect.h" #include "llmath.h" #include "llui.h" #include "llmenugl.h" #include "llfocusmgr.h" #include "llwindow.h" +class LLImagePanel : public LLPanel +{ +public: + struct Params : public LLInitParam::Block + { + Optional 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 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) +{ + name = "resize_bar"; +} + LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) -: LLView(p), +: LLPanel(p), mDragLastScreenX( 0 ), mDragLastScreenY( 0 ), mLastMouseScreenX( 0 ), @@ -46,7 +85,9 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) mSnappingEnabled(p.snapping_enabled), mAllowDoubleClickSnapping(p.allow_double_click_snapping), mResizingView(p.resizing_view), - mResizeListener(NULL) + mResizeListener(NULL), + mShowDragHandle(p.show_drag_handle), + mImagePanel(NULL) { setFollowsNone(); // set up some generically good follow code. @@ -75,8 +116,37 @@ 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(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) { @@ -342,3 +412,39 @@ BOOL LLResizeBar::handleDoubleClick(S32 x, S32 y, MASK mask) return TRUE; } +void LLResizeBar::setImagePanel(LLPanel * panelp) +{ + const LLView::child_list_t * children = getChildList(); + if (getChildCount() == 2) + { + LLPanel * image_panelp = dynamic_cast(children->back()); + if (image_panelp) + { + removeChild(image_panelp); + delete image_panelp; + } + } + + addChild(panelp); + sendChildToBack(panelp); +} + +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(); +} -- cgit v1.2.3 From 88528cb901c4023817c05010ed85a11160d266ab Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Fri, 19 Apr 2013 00:45:59 +0300 Subject: CHUI-808 FIXED Draggable separator between conversations and message pane is not discoverable: minor fix; --- indra/llui/llresizebar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/llresizebar.cpp') diff --git a/indra/llui/llresizebar.cpp b/indra/llui/llresizebar.cpp index cfdc951542..e67b22c977 100644 --- a/indra/llui/llresizebar.cpp +++ b/indra/llui/llresizebar.cpp @@ -121,7 +121,7 @@ LLResizeBar::LLResizeBar(const LLResizeBar::Params& p) { LLViewBorder::Params border_params; border_params.border_thickness = 1; - border_params.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderlight"); + border_params.highlight_light_color = LLUIColorTable::instance().getColor("ResizebarBorderLight"); border_params.shadow_dark_color = LLUIColorTable::instance().getColor("ResizebarBorderDark"); addBorder(border_params); -- cgit v1.2.3