Пример #1
0
CGUIPanel::CGUIPanel( IGUIEnvironment* environment, IGUIElement* parent, s32 id, const core::rect<s32>& rectangle,
            bool border, E_SCROLL_BAR_MODE vMode, E_SCROLL_BAR_MODE hMode)
    : IGUIElement(EGUIET_ELEMENT, environment, parent, id, rectangle), 
	VScrollBar(0), HScrollBar(0), ClipPane(0), InnerPane(0), 
	Border(border), VScrollBarMode(vMode), HScrollBarMode(hMode), NeedsUpdate(true)
{  

	#ifdef _DEBUG
	setDebugName("CGUIPanel");
	#endif

    s32 width = rectangle.getWidth();
    s32 height = rectangle.getHeight();
    
    core::rect<s32> rct = core::rect<s32>(width - SCROLL_BAR_SIZE,0, width, height);
    
    VScrollBar = environment->addScrollBar( false, rct, 0, id );
	VScrollBar->setSubElement(true);
	VScrollBar->setTabStop(false);
	VScrollBar->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
    VScrollBar->grab();
	IGUIElement::addChild(VScrollBar);
    
    rct = core::rect<s32>(0,height - SCROLL_BAR_SIZE, width - SCROLL_BAR_SIZE,height );
    
    HScrollBar = environment->addScrollBar( true, rct, 0, id );
	HScrollBar->setSubElement(true);
	HScrollBar->setTabStop(false);
	HScrollBar->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT);
    HScrollBar->grab();
	IGUIElement::addChild(HScrollBar);

    rct = core::rect<s32>(0,0, width - SCROLL_BAR_SIZE, height - SCROLL_BAR_SIZE);

	ClipPane = environment->addTab( rct, 0, -1);
	ClipPane->setSubElement(true);
	ClipPane->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
    ClipPane->grab();
	IGUIElement::addChild(ClipPane);

	InnerPane = environment->addTab( rct, ClipPane, -1);
	InnerPane->setSubElement(true);
    InnerPane->grab();
    
	calculateClientArea();
	resizeInnerPane();
}
Пример #2
0
void CGUIPanel::draw()
{
	if (NeedsUpdate)
	{
		calculateClientArea();
		resizeInnerPane();
		NeedsUpdate = false;
	}

	IGUISkin* skin = Environment->getSkin();
	if (Border && skin)
	{
		skin->draw3DSunkenPane( this, skin->getColor( EGDC_APP_WORKSPACE), false, true, AbsoluteRect, &AbsoluteClippingRect );
	}

	IGUIElement::draw();
}
Пример #3
0
void CGUIPanel::updateAbsolutePosition()
{
	IGUIElement::updateAbsolutePosition();
	calculateClientArea();
	resizeInnerPane();
}