Example #1
0
BOOL LLToolBar::postBuild()
{
	for (child_list_const_iter_t child_iter = getChildList()->begin();
		 child_iter != getChildList()->end(); ++child_iter)
	{
		LLView *view = *child_iter;
		LLButton* buttonp = dynamic_cast<LLButton*>(view);
		if(buttonp)
		{
			buttonp->setSoundFlags(LLView::SILENT);
		}
	}

#if LL_DARWIN
	if(mResizeHandle == NULL)
	{
		LLRect rect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT);
		LLResizeHandle::Params p;
		p.name("");
		p.rect(rect);
		p.min_width(RESIZE_HANDLE_WIDTH);
		p.min_height(RESIZE_HANDLE_HEIGHT);
		p.enabled(false);
		mResizeHandle = LLUICtrlFactory::create<LLResizeHandle>(p);
		addChildInBack(mResizeHandle);
		LLLayoutStack* toolbar_stack = getChild<LLLayoutStack>("toolbar_stack");
		toolbar_stack->reshape(toolbar_stack->getRect().getWidth() - RESIZE_HANDLE_WIDTH, toolbar_stack->getRect().getHeight());
	}
#endif // LL_DARWIN

	layoutButtons();

	return TRUE;
}
BOOL LLToolBar::postBuild()
{
	mCommunicateBtn.connect(this, "communicate_btn");
	mCommunicateBtn->setCommitCallback(boost::bind(&LLToolBar::onClickCommunicate, this, _2));
	mFlyBtn.connect(this, "fly_btn");
	mBuildBtn.connect(this, "build_btn");
	mMapBtn.connect(this, "map_btn");
	mRadarBtn.connect(this, "radar_btn");
	mInventoryBtn.connect(this, "inventory_btn");

	for (child_list_const_iter_t child_iter = getChildList()->begin();
		 child_iter != getChildList()->end(); ++child_iter)
	{
		LLView *view = *child_iter;
		LLButton* buttonp = dynamic_cast<LLButton*>(view);
		if(buttonp)
		{
			buttonp->setSoundFlags(LLView::SILENT);
		}
	}

#if LL_DARWIN
	LLResizeHandle::Params p;
	p.rect(LLRect(0, 0, RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT));
	p.name(std::string(""));
	p.min_width(RESIZE_HANDLE_WIDTH);
	p.min_height(RESIZE_HANDLE_HEIGHT);
	p.corner(LLResizeHandle::RIGHT_BOTTOM);
	addChildInBack(new LLFakeResizeHandle(p));
	reshape(getRect().getWidth(), getRect().getHeight());
#endif // LL_DARWIN

	return TRUE;
}
S32 LLScrollingPanelList::addPanel( LLScrollingPanel* panel )
{
    addChildInBack( panel );
    mPanelList.push_front( panel );

    // Resize this view
    S32 total_height = 0;
    S32 max_width = 0;
    S32 cur_gap = 0;
    for (std::deque<LLScrollingPanel*>::iterator iter = mPanelList.begin();
            iter != mPanelList.end(); ++iter)
    {
        LLScrollingPanel *childp = *iter;
        total_height += childp->getRect().getHeight() + cur_gap;
        max_width = llmax( max_width, childp->getRect().getWidth() );
        cur_gap = GAP_BETWEEN_PANELS;
    }
    LLRect rc = getRect();
    rc.setLeftTopAndSize(rc.mLeft, rc.mTop, max_width, total_height);
    setRect(rc);

    notifySizeChanged(rc.getHeight());

    // Reposition each of the child views
    S32 cur_y = total_height;
    for (std::deque<LLScrollingPanel*>::iterator iter = mPanelList.begin();
            iter != mPanelList.end(); ++iter)
    {
        LLScrollingPanel *childp = *iter;
        cur_y -= childp->getRect().getHeight();
        childp->translate( -childp->getRect().mLeft, cur_y - childp->getRect().mBottom);
        cur_y -= GAP_BETWEEN_PANELS;
    }

    return total_height;
}