- button = XtVaCreateManagedWidget("toggleButton",
- xmToggleButtonWidgetClass, (Widget) m_mainWidget,
- XmNleftAttachment, (prevButton == (Widget) 0) ? XmATTACH_FORM : XmATTACH_WIDGET,
- XmNleftWidget, (prevButton == (Widget) 0) ? NULL : prevButton,
- XmNleftOffset, currentSpacing,
- XmNtopAttachment, XmATTACH_FORM,
- // XmNpushButtonEnabled, True,
- XmNmultiClick, XmMULTICLICK_KEEP,
- XmNlabelType, XmPIXMAP,
- NULL);
- XtAddCallback ((Widget) button, XmNvalueChangedCallback, (XtCallbackProc) wxToolButtonCallback,
- (XtPointer) this);
- }
- else
- {
- button = XtVaCreateManagedWidget("button",
- xmPushButtonWidgetClass, (Widget) m_mainWidget,
- XmNleftAttachment, (prevButton == (Widget) 0) ? XmATTACH_FORM : XmATTACH_WIDGET,
- XmNleftWidget, (prevButton == (Widget) 0) ? NULL : prevButton,
- XmNleftOffset, currentSpacing,
- XmNtopAttachment, XmATTACH_FORM,
- XmNpushButtonEnabled, True,
- XmNmultiClick, XmMULTICLICK_KEEP,
- XmNlabelType, XmPIXMAP,
- NULL);
- XtAddCallback (button,
- XmNactivateCallback, (XtCallbackProc) wxToolButtonCallback,
- (XtPointer) this);
+ wxControl* control = tool->GetControl();
+ wxSize sz = control->GetSize();
+ wxPoint pos = control->GetPosition();
+ // Allow a control to specify a y[x]-offset by setting
+ // its initial position, but still don't allow it to
+ // position itself above the top[left] margin.
+ int controlY = (pos.y > 0) ? currentY + pos.y : currentY;
+ int controlX = (pos.x > 0) ? currentX + pos.x : currentX;
+ control->Move( isVertical ? controlX : currentX,
+ isVertical ? currentY : controlY );
+ if ( isVertical )
+ currentY += sz.y + packing;
+ else
+ currentX += sz.x + packing;
+
+ break;