Example #1
0
LLResizeBar::LLResizeBar(const LLResizeBar::Params& p)
:	LLView(p),
	mDragLastScreenX( 0 ),
	mDragLastScreenY( 0 ),
	mLastMouseScreenX( 0 ),
	mLastMouseScreenY( 0 ),
	mMinSize( p.min_size ),
	mMaxSize( p.max_size ),
	mSide( p.side ),
	mSnappingEnabled(p.snapping_enabled),
	mAllowDoubleClickSnapping(p.allow_double_click_snapping),
	mResizingView(p.resizing_view)
{
	setFollowsNone();
	// set up some generically good follow code.
	switch( mSide )
	{
	case LEFT:
		setFollowsLeft();
		setFollowsTop();
		setFollowsBottom();
		break;
	case TOP:
		setFollowsTop();
		setFollowsLeft();
		setFollowsRight();
		break;
	case RIGHT:
		setFollowsRight();
		setFollowsTop();
		setFollowsBottom();
		break;
	case BOTTOM:
		setFollowsBottom();
		setFollowsLeft();
		setFollowsRight();
		break;
	default:
		break;
	}
}
BOOL LLLayoutPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
	std::string orientation_string;
	node->getAttributeString("orientation", orientation_string);
	if (orientation_string == "horizontal")
	{
		mOrientation = LLLayoutStack::HORIZONTAL;
	}
	else if (orientation_string == "vertical")
	{
		mOrientation = LLLayoutStack::VERTICAL;
	}

	if(node->hasAttribute("min_dim"))
		node->getAttributeS32("min_dim", mMinDim);
	else if(mOrientation == LLLayoutStack::HORIZONTAL)
		node->getAttributeS32("min_width", mMinDim);
	else if(mOrientation == LLLayoutStack::VERTICAL)
		node->getAttributeS32("min_height", mMinDim);
	node->getAttributeS32("expanded_min_dim", mExpandedMinDim);

	BOOL auto_resize = mAutoResize;
	BOOL user_resize = mUserResize;
	node->getAttributeBOOL("auto_resize", auto_resize);
	node->getAttributeBOOL("user_resize", user_resize);
	mAutoResize = auto_resize;
	mUserResize = user_resize;

	bool ret = LLPanel::initPanelXML(node,parent,factory);
	// panels initialized as hidden should not start out partially visible
	if (!getVisible())
	{
		mVisibleAmt = 0.f;
	}
	setFollowsNone();
	return ret;
}
void LLLayoutPanel::initFromParams(const Params& p)
{
	LLPanel::initFromParams(p);
	setFollowsNone();
}