Commit 55508ee4 authored by cutealien's avatar cutealien

Fix another 2 bugs in CGUITreeView:

- Irrlicht elements can't just set ID's otherwise user-elements stop working.
  So anyone who had gui-elements not working with ID 0 or 1 - you probably had a guitree somewhere.
  Those ID's were not even used...
- Make the horizontal scrollbar (mostly) work. Selection still messed up, but was that way before and least h-scrolling works now somewhat (did nothing before).
There are more bugs in this gui-element - like that it doesn't draw the last line regularly. 
But I have no more time, nor motiviation for this now (not the first time finding pretty obvious bugs in the treeview. 
I wish that d*mn thing would never had been checked in. Or the original author would at least have tested it or cared about maintaince!).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4758 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 07b28cab
......@@ -451,7 +451,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
if ( scrollBarVertical )
{
ScrollBarV = new CGUIScrollBar( false, Environment, this, 0,
ScrollBarV = new CGUIScrollBar( false, Environment, this, -1,
core::rect<s32>( RelativeRect.getWidth() - s,
0,
RelativeRect.getWidth(),
......@@ -467,7 +467,7 @@ CGUITreeView::CGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
if ( scrollBarHorizontal )
{
ScrollBarH = new CGUIScrollBar( true, Environment, this, 1,
ScrollBarH = new CGUIScrollBar( true, Environment, this, -1,
core::rect<s32>( 0, RelativeRect.getHeight() - s, RelativeRect.getWidth() - s, RelativeRect.getHeight() ),
!clip );
ScrollBarH->drop();
......@@ -847,16 +847,15 @@ void CGUITreeView::draw()
frameRect.LowerRightCorner.Y -= ScrollBarV->getPos();
}
if ( ScrollBarH )
{
frameRect.UpperLeftCorner.X -= ScrollBarH->getPos();
frameRect.LowerRightCorner.X -= ScrollBarH->getPos();
}
IGUITreeViewNode* node = Root->getFirstChild();
while( node )
{
frameRect.UpperLeftCorner.X = AbsoluteRect.UpperLeftCorner.X + 1 + node->getLevel() * IndentWidth;
if ( ScrollBarH )
{
frameRect.UpperLeftCorner.X -= ScrollBarH->getPos();
frameRect.LowerRightCorner.X -= ScrollBarH->getPos();
}
if( frameRect.LowerRightCorner.Y >= AbsoluteRect.UpperLeftCorner.Y
&& frameRect.UpperLeftCorner.Y <= AbsoluteRect.LowerRightCorner.Y )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment