- 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);
- }
- 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);
- }
-
- // For each button, if there is a mask, we must create
- // a new wxBitmap that has the correct background colour
- // for the button. Otherwise the background will just be
- // e.g. black if a transparent XPM has been loaded.
- wxBitmap originalBitmap = tool->m_bitmap1;
-
- if (tool->m_bitmap1.GetMask())
- {
- int backgroundPixel;
- XtVaGetValues(button, XmNbackground, &backgroundPixel,
- NULL);
-
-
- wxColour col;
- col.SetPixel(backgroundPixel);
-
- wxBitmap newBitmap = wxCreateMaskedBitmap(tool->m_bitmap1, col);
+ 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) ? pos.y : currentY;
+ int controlX = (pos.x > 0) ? pos.x : currentX;
+ control->Move( isVertical ? controlX : currentX,
+ isVertical ? currentY : controlY );
+ if ( isVertical )
+ currentY += sz.y + packing;
+ else
+ currentX += sz.x + packing;