- button = XtVaCreateWidget("toggleButton",
- xmToggleButtonWidgetClass, (Widget) m_mainWidget,
- XmNx, currentX, XmNy, currentY,
- // XmNpushButtonEnabled, True,
- XmNmultiClick, XmMULTICLICK_KEEP,
- XmNlabelType, XmPIXMAP,
- NULL);
- XtAddCallback ((Widget) button, XmNvalueChangedCallback, (XtCallbackProc) wxToolButtonCallback,
- (XtPointer) this);
-
- XtVaSetValues ((Widget) button,
- XmNselectColor, m_backgroundColour.AllocColour(XtDisplay((Widget) button)),
- NULL);
- }
- else
- {
- button = XtVaCreateWidget("button",
- xmPushButtonWidgetClass, (Widget) m_mainWidget,
- XmNx, currentX, XmNy, currentY,
- 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-offset by setting its initial position,
+ // but still don't allow it to position itself above the top margin.
+ int controlY = (pos.y > 0) ? currentY + pos.y : currentY;
+ control->Move(currentX, controlY);
+ currentX += sz.x + packing;
+
+ break;