Fix bug with separator line in tabcontrol not going through when the button-bar was at bottom and width > 1000.

Add some documentation to code.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5469 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-06-04 18:31:23 +00:00
parent 5bfba69e9d
commit a88429459e
1 changed files with 14 additions and 7 deletions

View File

@ -580,12 +580,14 @@ void CGUITabControl::draw()
core::rect<s32> frameRect(AbsoluteRect);
// some empty background as placesholder when there are no tabs
if (Tabs.empty())
driver->draw2DRectangle(skin->getColor(EGDC_3D_HIGH_LIGHT), frameRect, &AbsoluteClippingRect);
if (!font)
return;
// tab button bar can be above or below the tabs
if ( VerticalAlignment == EGUIA_UPPERLEFT )
{
frameRect.UpperLeftCorner.Y += 2;
@ -610,6 +612,7 @@ void CGUITabControl::draw()
//const wchar_t* activetext = 0;
CGUITab *activeTab = 0;
// Draw all tab-buttons except the active one
for (u32 i=CurrentScrollTabIndex; i<Tabs.size(); ++i)
{
// get Text
@ -636,6 +639,7 @@ void CGUITabControl::draw()
if ((s32)i == ActiveTab)
{
// for active button just remember values
left = frameRect.UpperLeftCorner.X;
right = frameRect.LowerRightCorner.X;
//activetext = text;
@ -653,7 +657,8 @@ void CGUITabControl::draw()
}
}
// draw active tab
// Draw active tab button
// Drawn later than other buttons because it draw over the buttons before/after it.
if (left != 0 && right != 0 && activeTab != 0)
{
// draw upper highlight frame
@ -707,24 +712,26 @@ void CGUITabControl::draw()
}
else
{
// No active tab (I guess only happens when there are no tabs?)
// Draw a line separating button bar from tab area
tr.UpperLeftCorner.X = AbsoluteRect.UpperLeftCorner.X;
tr.LowerRightCorner.X = AbsoluteRect.LowerRightCorner.X;
tr.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y - 1;
tr.LowerRightCorner.Y = frameRect.LowerRightCorner.Y;
if ( VerticalAlignment == EGUIA_UPPERLEFT )
{
tr.UpperLeftCorner.X = AbsoluteRect.UpperLeftCorner.X;
tr.LowerRightCorner.X = AbsoluteRect.LowerRightCorner.X;
tr.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y - 1;
tr.LowerRightCorner.Y = frameRect.LowerRightCorner.Y;
driver->draw2DRectangle(skin->getColor(EGDC_3D_HIGH_LIGHT), tr, &AbsoluteClippingRect);
}
else
{
tr.UpperLeftCorner.X = AbsoluteRect.UpperLeftCorner.X;
tr.LowerRightCorner.X = 1000;
tr.UpperLeftCorner.Y = frameRect.UpperLeftCorner.Y - 1;
tr.LowerRightCorner.Y = frameRect.UpperLeftCorner.Y;
driver->draw2DRectangle(skin->getColor(EGDC_3D_DARK_SHADOW), tr, &AbsoluteClippingRect);
}
}
// drawing some border and background for the tab-area.
skin->draw3DTabBody(this, Border, FillBackground, AbsoluteRect, &AbsoluteClippingRect, TabHeight, VerticalAlignment);
// enable scrollcontrols on need