Example #1
0
ScrollableArea::ScrollableArea(GuiEngine* guiEngine)
:Grid(guiEngine), bVerScrollBarVisible(false), bHorScrollBarVisible(false)
{
	SetDimension(1, 2);

	Gui* contentCell = GetCell(0, 0);

	//Gui* verticalScrollCell = GetCell(1, 0);
	Gui* horizontalScrollCell = GetCell(0, 1);
	//Gui* emptyCell = GetCell(1, 1);
	
	contentCell->SetBgToColor(ColorI(25, 25, 25, 255));
	//verticalScrollCell->SetBgToColor(ColorI(75));
	horizontalScrollCell->SetBgToColor(ColorI(75, 75, 75, 255));
	//emptyCell->SetBgToColor(ColorI(75));

	// Content fill the space
	GetColumn(0)->StretchFillSpace(1.f);
	GetRow(0)->StretchFillSpace(1.f);

	// Scroll bars fixed size
	//GetColumn(1)->SetWidth(16);
	GetRow(1)->SetHeight(16);
	
	// Add scroll bars
	Button* btn = horizontalScrollCell->AddGui<Button>();
	btn->SetMargin(3);
	btn->SetBgToColor(ColorI(120, 120, 120, 255), ColorI(200, 200, 200, 255));
	btn->StretchVerFillParent();
	btn->SetWidth(250);
	//btn = verticalScrollCell->AddButton();
	//btn->SetMargin(3);
	//btn->SetBgToColor(ColorI(120), ColorI(200));
	//btn->StretchHorFillParent();

	SetBgToColor(GetBgIdleColor());
}