+ bool isVertical = GetWindowStyle() & wxTB_VERTICAL;
+ const int separatorSize = GetToolSeparation(); // 8;
+ int packing = GetToolPacking();
+ int offset = 0;
+
+ for( wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ node; node = node->GetNext() )
+ {
+ wxToolBarTool *t = (wxToolBarTool*)node->GetData();
+
+ if( t == tool )
+ {
+ switch ( t->GetStyle() )
+ {
+ case wxTOOL_STYLE_CONTROL:
+ {
+ wxSize size = t->GetControl()->GetSize();
+ offset = isVertical ? size.y : size.x;
+ offset += packing;
+ break;
+ }
+ case wxTOOL_STYLE_SEPARATOR:
+ offset = isVertical ? 0 : separatorSize;
+ break;
+ case wxTOOL_STYLE_BUTTON:
+ {
+ Widget w = t->GetButtonWidget();
+ Dimension width, height;
+
+ XtVaGetValues( w,
+ XmNwidth, &width,
+ XmNheight, &height,
+ NULL );
+
+ offset = isVertical ? height : width;
+ offset += packing;
+ break;
+ }
+ }
+ }
+ else if( offset )
+ {
+ switch ( t->GetStyle() )
+ {
+ case wxTOOL_STYLE_CONTROL:
+ {
+ wxPoint pos = t->GetControl()->GetPosition();
+
+ if( isVertical )
+ pos.y -= offset;
+ else
+ pos.x -= offset;
+
+ t->GetControl()->Move( pos );
+ break;
+ }
+ case wxTOOL_STYLE_SEPARATOR:
+ break;
+ case wxTOOL_STYLE_BUTTON:
+ {
+ Dimension x, y;
+ XtVaGetValues( t->GetButtonWidget(),
+ XmNx, &x,
+ XmNy, &y,
+ NULL );
+
+ if( isVertical )
+ y -= offset;
+ else
+ x -= offset;
+
+ XtVaSetValues( t->GetButtonWidget(),
+ XmNx, x,
+ XmNy, y,
+ NULL );
+ break;
+ }
+ }
+ }
+ }
+