void HiCB(Widget w,XtPointer client_data,XtPointer call_data) { XmToggleButtonCallbackStruct *cbs = (XmToggleButtonCallbackStruct *)call_data; printf("Toggle Me and I'm Yours: %d\n", cbs->set); printf("Margins: %d %d %d %d %d %d\n", Lab_MarginWidth(butt), Lab_MarginHeight(butt), Lab_MarginTop(butt), Lab_MarginBottom(butt), Lab_MarginLeft(butt), Lab_MarginRight(butt)); #if TEST_CBS cbs->set = False; #endif }
/* * Draw the label contained in the pushbutton. */ static void draw_label(XmEnhancedButtonWidget eb, XEvent *event, Region region) { GC tmp_gc = NULL; Boolean replaceGC = False; Boolean deadjusted = False; #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) XmDisplay dpy = (XmDisplay)XmGetXmDisplay(XtDisplay(eb)); Boolean etched_in = dpy->display.enable_etched_in_menu; #else Boolean etched_in = False; #endif if (eb->pushbutton.armed && ((!Lab_IsMenupane(eb) && eb->pushbutton.fill_on_arm) || (Lab_IsMenupane(eb) && etched_in))) { if (eb->label.label_type == (int)XmSTRING && eb->pushbutton.arm_color == eb->primitive.foreground) { tmp_gc = eb->label.normal_GC; eb->label.normal_GC = eb->pushbutton.background_gc; replaceGC = True; } } /* * If the button contains a labeled pixmap, we will take it instead of our * own pixmap. */ if (eb->label.label_type == (int)XmPIXMAP) { if (eb->pushbutton.armed) { if (eb->pushbutton.arm_pixmap != XmUNSPECIFIED_PIXMAP) eb->label.pixmap = eb->pushbutton.arm_pixmap; else eb->label.pixmap = eb->pushbutton.unarm_pixmap; } else /* pushbutton is not armed */ eb->label.pixmap = eb->pushbutton.unarm_pixmap; } /* * Temporarily remove the Xm3D_ENHANCE_PIXEL hack ("adjustment") from the * margin values, so we don't confuse Label. */ if (eb->pushbutton.default_button_shadow_thickness > 0) { deadjusted = True; Lab_MarginLeft(eb) -= Xm3D_ENHANCE_PIXEL; Lab_MarginRight(eb) -= Xm3D_ENHANCE_PIXEL; Lab_MarginTop(eb) -= Xm3D_ENHANCE_PIXEL; Lab_MarginBottom(eb) -= Xm3D_ENHANCE_PIXEL; } { XtExposeProc expose; XtProcessLock(); expose = xmLabelClassRec.core_class.expose; XtProcessUnlock(); (*expose)((Widget) eb, event, region); } if (deadjusted) { Lab_MarginLeft(eb) += Xm3D_ENHANCE_PIXEL; Lab_MarginRight(eb) += Xm3D_ENHANCE_PIXEL; Lab_MarginTop(eb) += Xm3D_ENHANCE_PIXEL; Lab_MarginBottom(eb) += Xm3D_ENHANCE_PIXEL; } if (replaceGC) eb->label.normal_GC = tmp_gc; }