static Boolean set_values(Widget current, Widget request, Widget new_w, ArgList args, Cardinal *num_args) { Boolean need_refresh = False; DEBUGOUT(_LtDebug(__FILE__, new_w, "XmGadget set_values\n")); /* Force the borderWidth to 0 */ new_w->core.border_width = 0; if (!XmRepTypeValidValue(XmRepTypeGetId(XmRUnitType), G_UnitType(new_w), new_w)) { G_UnitType(new_w) = G_UnitType(current); } if (!XmRepTypeValidValue(XmRepTypeGetId(XmRNavigationType), G_NavigationType(new_w), new_w)) { G_NavigationType(new_w) = G_NavigationType(current); } _XmGadgetImportArgs(new_w, args, num_args); need_refresh = _XmNavigSetValues(current, request, new_w, args, num_args); return need_refresh; }
static void initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args) { XmBaseClassExt bce; DEBUGOUT(_LtDebug(__FILE__, new_w, "XmGadget initialize\n")); /* Force the borderWidth to 0 */ new_w->core.border_width = 0; if (!XmRepTypeValidValue(XmRepTypeGetId(XmRNavigationType), G_NavigationType(new_w), new_w)) { G_NavigationType(new_w) = XmNONE; } if (!XmRepTypeValidValue(XmRepTypeGetId(XmRUnitType), G_UnitType(new_w), new_w)) { G_UnitType(new_w) = XmPIXELS; } if (XtWidth(request) == (Dimension)0) { XtWidth(new_w) = (G_HighlightThickness(new_w) * 2 + G_ShadowThickness(new_w) * 2); } if (XtHeight(request) == (Dimension)0) { XtHeight(new_w) = (G_HighlightThickness(new_w) * 2 + G_ShadowThickness(new_w) * 2); } _XmGadgetImportArgs(new_w, args, num_args); /* BaseClass stuff provides this */ _XmGadgetImportSecondaryArgs(new_w, args, num_args); bce = *(XmBaseClassExt *)_XmGetBaseClassExtPtr(XtClass(new_w), XmQmotif); if (bce && bce->secondaryObjectClass) { if (bce->secondaryObjectCreate) { (bce->secondaryObjectCreate) (request, new_w, args, num_args); } } _XmNavigInitialize(request, new_w, args, num_args); G_EventMask(new_w) = 0; G_HaveTraversal(new_w) = False; G_Highlighted(new_w) = False; G_HighlightDrawn(new_w) = False; }
/************************************************************************ * * SetValues * Perform and updating necessary for a set values call. * ************************************************************************/ static Boolean SetValues( Widget cw, Widget rw, Widget nw, ArgList args, Cardinal *num_args ) { XmGadget cur = (XmGadget) cw ; XmGadget req = (XmGadget) rw ; XmGadget new_w = (XmGadget) nw ; Boolean returnFlag; if (XtIsSensitive(cw) != XtIsSensitive(nw)) { if (!XtIsSensitive(nw)) { _XmToolTipLeave(nw, NULL, NULL, NULL); } } if (XmGetToolTipString(nw) != XmGetToolTipString(cw)) { XmSetToolTipString(cw, XmGetToolTipString(nw)); } /* CR 7124: XmNlayoutDirection is a CG resource. */ if (cur->gadget.layout_direction != new_w->gadget.layout_direction) { XmeWarning((Widget) new_w, MESSAGE1); new_w->gadget.layout_direction = cur->gadget.layout_direction; } if( cur->gadget.navigation_type != new_w->gadget.navigation_type ) { if( !XmRepTypeValidValue( XmRID_NAVIGATION_TYPE, new_w->gadget.navigation_type, (Widget) new_w) ) { new_w->gadget.navigation_type = cur->gadget.navigation_type ; } } returnFlag = _XmNavigSetValues ((Widget) cur, (Widget) req, (Widget) new_w, args, num_args); /* Validate changed data. */ if( !XmRepTypeValidValue( XmRID_UNIT_TYPE, new_w->gadget.unit_type, (Widget) new_w) ) { new_w->gadget.unit_type = cur->gadget.unit_type; } /* Convert the necessary fields from unit values to pixel values */ _XmGadgetImportArgs((Widget) new_w, args, num_args); /* Check for resize conditions */ if (cur->gadget.shadow_thickness != new_w->gadget.shadow_thickness || cur->gadget.highlight_thickness != new_w->gadget.highlight_thickness) returnFlag = True; /* Force the border width to 0 */ new_w->rectangle.border_width = 0; if( new_w->gadget.highlight_drawn && ( !XtIsSensitive( (Widget) new_w) || ( cur->gadget.highlight_on_enter && !(new_w->gadget.highlight_on_enter) && (_XmGetFocusPolicy( (Widget) new_w) == XmPOINTER))) ) { if( ((XmGadgetClass) XtClass( new_w)) ->gadget_class.border_unhighlight ) { (*(((XmGadgetClass) XtClass( new_w)) ->gadget_class.border_unhighlight))( (Widget) new_w) ; } } /* Return a flag which may indicate that a redraw needs to occur. */ return (returnFlag); }
/************************************************************************ * * Initialize * The main widget instance initialization routine. * ************************************************************************/ static void Initialize( Widget rw, Widget nw, ArgList args, Cardinal *num_args ) { XmGadget request = (XmGadget) rw ; XmGadget gw = (XmGadget) nw; XmBaseClassExt *cePtr; XtInitProc secondaryCreate; XmString tool_tip_string; static XtResource subresources[] = { { XmNtoolTipString, XmCToolTipString, XmRXmString, sizeof(XmString), 0, XmRImmediate, (XtPointer) NULL }, }; if( !XmRepTypeValidValue( XmRID_UNIT_TYPE, gw->gadget.unit_type, (Widget) gw) ) { gw->gadget.unit_type = XmPIXELS; } /* Convert the fields from unit values to pixel values */ _XmGadgetImportArgs( (Widget) gw, args, num_args); _XmGadgetImportSecondaryArgs( (Widget) gw, args, num_args); cePtr = _XmGetBaseClassExtPtr(XtClass(gw), XmQmotif); if ((*cePtr) && (*cePtr)->secondaryObjectClass && (secondaryCreate = (*cePtr)->secondaryObjectCreate)) (*secondaryCreate)( (Widget) request, (Widget) gw, args, num_args); XtGetSubresources(nw, &tool_tip_string, NULL, NULL, subresources, XtNumber(subresources), args, *num_args); XmSetToolTipString(nw, tool_tip_string); gw->gadget.event_mask = 0; gw->gadget.have_traversal = FALSE ; gw->gadget.highlighted = FALSE ; gw->gadget.highlight_drawn = FALSE ; if( (gw->gadget.navigation_type != XmDYNAMIC_DEFAULT_TAB_GROUP) && !XmRepTypeValidValue( XmRID_NAVIGATION_TYPE, gw->gadget.navigation_type, (Widget) gw) ) { gw->gadget.navigation_type = XmNONE ; } _XmNavigInitialize ((Widget) request, (Widget) gw, args, num_args); gw->gadget.have_traversal = FALSE ; /* Check the geometry information for the widget */ if (request->rectangle.width == 0) gw->rectangle.width += gw->gadget.highlight_thickness * 2 + gw->gadget.shadow_thickness * 2; if (request->rectangle.height == 0) gw->rectangle.height += gw->gadget.highlight_thickness * 2 + gw->gadget.shadow_thickness * 2; /* Force the border width to 0 */ gw->rectangle.border_width = 0; return ; }