Widget CreateConstraintResourceControls( Widget parent, Widget left_widget, Widget bottom_widget, unsigned int child_type ) { XmString string; Widget RowColumn; Widget ArrowSensLabel, ArrowSensPulldown, ArrowSensOptions, ArrowSensPB[NUM_ARROW_SENS_BTNS]; Widget DecimalPtsLabel, DecimalPtsTF; Widget IncrValueLabel, IncrValueTF; Widget MaxValueLabel, MaxValueTF; Widget MinValueLabel, MinValueTF; Widget NumValuesLabel, NumValuesTF; Widget PositionLabel; Widget ChildTypeLabel, ChildTypePulldown, ChildTypeOptions, ChildTypePB[NUM_CHILD_TYPE_BTNS]; Widget ValuesLabel, ValuesList; char buffer[30], buffer2[30]; Widget client_widget; int i, j; XmStringTable stringTable; client_widget = ( child_type == XmSTRING ) ? StringTextF : NumericTextF; n = 0; XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNleftWidget, left_widget ); n++; XtSetArg( args[n], XmNbottomAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNbottomWidget, bottom_widget ); n++; XtSetArg(args[n], XmNnumColumns, 9); n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++; XtSetArg(args[n], XmNpacking, XmPACK_COLUMN); n++; RowColumn = XmCreateRowColumn( parent, "RowColumn", args, n ); XtManageChild( RowColumn ); /* * Create label and option menu for XmNarrowSensitivity resource. */ string = XmStringCreateLtoR("Arrow Sensitivity", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ArrowSensLabel = XmCreateLabel( RowColumn, "ArrowSensLabel", args, n ); XtManageChild( ArrowSensLabel ); XmStringFree( string ); n = 0; ArrowSensPulldown = XmCreatePulldownMenu(RowColumn, "ArrowSensPulldown", args, n); for ( i = 0; i < NUM_ARROW_SENS_BTNS; i++ ) { string = XmStringCreateLtoR( arrow_sens_strings[i], XmFONTLIST_DEFAULT_TAG ); if ( child_type == XmSTRING ) sprintf( buffer, "StringArrowSensPB%d", i ); else if ( child_type == XmNUMERIC ) sprintf( buffer, "NumericArrowSensPB%d", i ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ArrowSensPB[i] = XmCreatePushButton( ArrowSensPulldown, buffer, args, n ); XmStringFree( string ); if ( child_type == XmSTRING ) { string_arrow_sens_cd[i].textfield = client_widget; string_arrow_sens_cd[i].sensitivity = arrow_sens[i]; XtAddCallback( ArrowSensPB[i], XmNactivateCallback, ArrowSensCB, &string_arrow_sens_cd[i]); } else if ( child_type = XmNUMERIC ) { numeric_arrow_sens_cd[i].textfield = client_widget; numeric_arrow_sens_cd[i].sensitivity = arrow_sens[i]; XtAddCallback( ArrowSensPB[i], XmNactivateCallback, ArrowSensCB, &numeric_arrow_sens_cd[i]); } } XtManageChildren( ArrowSensPB, NUM_ARROW_SENS_BTNS ); if ( child_type == XmSTRING ) sprintf( buffer, "StringArrowSensOptions", i ); else if ( child_type == XmNUMERIC ) sprintf( buffer, "NumericArrowSensOptions", i ); n = 0; XtSetArg( args[n], XmNmenuHistory, ArrowSensPB[NUM_ARROW_SENS_BTNS - 1] ); n++; XtSetArg( args[n], XmNsubMenuId, ArrowSensPulldown ); n++; ArrowSensOptions = XmCreateOptionMenu( RowColumn, buffer, args, n ); XtManageChild( ArrowSensOptions ); string = XmStringCreateLtoR("Decimal Points", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; DecimalPtsLabel = XmCreateLabel( RowColumn, "DecimalPtsLabel", args, n ); XtManageChild( DecimalPtsLabel ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNvalue, "0" ); n++; if ( child_type == XmSTRING ) sprintf( buffer, "%s", "StringDecimalPtsTF" ); else if ( child_type == XmNUMERIC ) sprintf( buffer, "%s", "NumericDecimalPtsTF" ); DecimalPtsTF = XmCreateTextField( RowColumn, buffer, args, n ); XtManageChild( DecimalPtsTF ); XtAddCallback( DecimalPtsTF, XmNactivateCallback, DecimalPtsCB, (XtPointer)client_widget ); string = XmStringCreateLtoR("Increment Value", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; IncrValueLabel = XmCreateLabel( RowColumn, "IncrValueLabel", args, n ); XtManageChild( IncrValueLabel ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNvalue, "1" ); n++; if ( child_type == XmSTRING ) sprintf( buffer, "%s", "StringIncrValueTF" ); else if ( child_type == XmNUMERIC ) sprintf( buffer, "%s", "NumericIncrValueTF" ); IncrValueTF = XmCreateTextField( RowColumn, buffer, args, n ); XtManageChild( IncrValueTF ); XtAddCallback( IncrValueTF, XmNactivateCallback, IncrValueCB, (XtPointer)client_widget ); string = XmStringCreateLtoR("Maximum Value", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; MaxValueLabel = XmCreateLabel( RowColumn, "MaxValueLabel", args, n ); XtManageChild( MaxValueLabel ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNvalue, "10" ); n++; if ( child_type == XmSTRING ) sprintf( buffer, "%s", "StringMaxValueTF" ); else if ( child_type == XmNUMERIC ) sprintf( buffer, "%s", "NumericMaxValueTF" ); MaxValueTF = XmCreateTextField( RowColumn, buffer, args, n ); XtManageChild( MaxValueTF ); XtAddCallback( MaxValueTF, XmNactivateCallback, MaxValueCB, (XtPointer)client_widget ); string = XmStringCreateLtoR("Minimum Value", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; MinValueLabel = XmCreateLabel( RowColumn, "MinValueLabel", args, n ); XtManageChild( MinValueLabel ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNvalue, "0" ); n++; if ( child_type == XmSTRING ) sprintf( buffer, "%s", "StringMinValueTF" ); else if ( child_type == XmNUMERIC ) sprintf( buffer, "%s", "NumericMinValueTF" ); MinValueTF = XmCreateTextField( RowColumn, buffer, args, n ); XtManageChild( MinValueTF ); XtAddCallback( MinValueTF, XmNactivateCallback, MinValueCB, (XtPointer)client_widget ); string = XmStringCreateLtoR("Num Values", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; NumValuesLabel = XmCreateLabel( RowColumn, "NumValuesLabel", args, n ); XtManageChild( NumValuesLabel ); XmStringFree( string ); client_widget = ( child_type == XmSTRING ) ? StringTextF : NumericTextF; /* * Get current value of XmNnumValues resource. */ n = 0; XtSetArg( args[n], XmNnumValues, &j ); n++; XtGetValues( client_widget, args, n ); sprintf( buffer, "%d", j ); n = 0; XtSetArg( args[n], XmNvalue, buffer ); n++; if ( child_type == XmSTRING ) sprintf( buffer2, "%s", "StringNumValuesTF" ); else if ( child_type == XmNUMERIC ) sprintf( buffer2, "%s", "NumericNumValuesTF" ); NumValuesTF = XmCreateTextField( RowColumn, buffer2, args, n ); XtManageChild( NumValuesTF ); XtAddCallback( NumValuesTF, XmNactivateCallback, NumValuesCB, (XtPointer)client_widget ); string = XmStringCreateLtoR("Position", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; PositionLabel = XmCreateLabel( RowColumn, "PositionLabel", args, n ); XtManageChild( PositionLabel ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNvalue, "0" ); n++; if ( child_type == XmSTRING ) { sprintf( buffer, "%s", "StringPositionTF" ); StringPositionTF = XmCreateTextField( RowColumn, buffer, args, n ); XtManageChild( StringPositionTF ); XtAddCallback( StringPositionTF, XmNactivateCallback, PositionCB, (XtPointer)client_widget ); XtAddCallback( SpinBox1, XmNvalueChangedCallback, UpdatePositionCB, (XtPointer)StringPositionTF ); } else if ( child_type == XmNUMERIC ) { sprintf( buffer, "%s", "NumericPositionTF" ); NumericPositionTF = XmCreateTextField( RowColumn, buffer, args, n ); XtManageChild( NumericPositionTF ); XtAddCallback( NumericPositionTF, XmNactivateCallback, PositionCB, (XtPointer)client_widget ); XtAddCallback( SpinBox2, XmNvalueChangedCallback, UpdatePositionCB, (XtPointer)NumericPositionTF ); } string = XmStringCreateLtoR("SpinBox Child Type", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ChildTypeLabel = XmCreateLabel( RowColumn, "ChildTypeLabel", args, n ); XtManageChild( ChildTypeLabel ); XmStringFree( string ); n = 0; ChildTypePulldown = XmCreatePulldownMenu(RowColumn, "ChildTypePulldown", args, n); for ( i = 0; i < NUM_CHILD_TYPE_BTNS; i++ ) { string = XmStringCreateLtoR( child_type_strings[i], XmFONTLIST_DEFAULT_TAG ); if ( child_type == XmSTRING ) sprintf( buffer, "StringChildTypePB%d", i ); else if ( child_type == XmNUMERIC ) sprintf( buffer, "NumericChildTypePB%d", i ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ChildTypePB[i] = XmCreatePushButton( ChildTypePulldown, buffer, args, n ); XmStringFree( string ); if ( child_type == XmSTRING ) { string_child_type_cd[i].textfield = client_widget; string_child_type_cd[i].child_type = child_types[i]; XtAddCallback( ChildTypePB[i], XmNactivateCallback, ChildTypeCB, &string_child_type_cd[i] ); } else if ( child_type == XmNUMERIC ) { numeric_child_type_cd[i].textfield = client_widget; numeric_child_type_cd[i].child_type = child_types[i]; XtAddCallback( ChildTypePB[i], XmNactivateCallback, ChildTypeCB, &numeric_child_type_cd[i] ); } } XtManageChildren( ChildTypePB, NUM_CHILD_TYPE_BTNS ); n = 0; if ( child_type == XmSTRING ) { XtSetArg( args[n], XmNmenuHistory, ChildTypePB[0] ); n++; } else if ( child_type == XmNUMERIC ) { XtSetArg( args[n], XmNmenuHistory, ChildTypePB[1] ); n++; } XtSetArg( args[n], XmNsubMenuId, ChildTypePulldown ); n++; ChildTypeOptions = XmCreateOptionMenu( RowColumn, "ChildTypeOptions", args, n ); XtManageChild( ChildTypeOptions ); string = XmStringCreateLtoR( "Values", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ValuesLabel = XmCreateLabel( RowColumn, "ValuesLabel", args, n ); XtManageChild( ValuesLabel ); XmStringFree( string ); /* * Get current values for XmNvalues resource. */ n = 0; XtSetArg( args[n], XmNnumValues, &j ); n++; XtSetArg( args[n], XmNvalues, &stringTable ); n++; XtGetValues( client_widget, args, n ); /* * Assign current string values to List for display. */ if ( child_type == XmSTRING ) sprintf( buffer, "%s", "StringValuesList" ); else if ( child_type == XmNUMERIC ) sprintf( buffer, "%s", "NumericValuesList" ); n = 0; XtSetArg( args[n], XmNitemCount, j ); n++; XtSetArg( args[n], XmNitems, stringTable ); n++; XtSetArg( args[n], XmNvisibleItemCount, 1 ); n++; ValuesList = XmCreateScrolledList( RowColumn, buffer, args, n ); XtManageChild( ValuesList ); return( RowColumn ); }
Widget Build_Pulldown_Menu ( Widget parent, char *menu_title, char menu_mnemonic, MENU_ITEM *items ) { Widget PullDown, cascade, widget; int i; XmString str; /* Create the menu shell: */ PullDown = XmCreatePulldownMenu ( parent, "_pulldown", NULL, 0 ); /* Create the cascade button: */ str = XmStringCreateSimple ( menu_title ); cascade = XtVaCreateManagedWidget ( menu_title, xmCascadeButtonGadgetClass, parent, XmNsubMenuId, PullDown, XmNlabelString, str, XmNmnemonic, menu_mnemonic, NULL ); XmStringFree ( str ); /* Now add the menu items: */ for ( i = 0; MITEM_label(items,i) != NULL; i++ ) { /* If a subitem menu is specified, make a recursive call for the * pull-right menu, and use the cascade button returned: */ if ( MITEM_subitems(items,i) != NULL ) { widget = Build_Pulldown_Menu ( PullDown, MITEM_label(items,i), MITEM_mnemonic(items,i), MITEM_subitems(items,i) ); } else { widget = XtVaCreateManagedWidget ( MITEM_label(items,i), *MITEM_class(items,i), PullDown, NULL ); } /* In either case, this item can have a mnemonic: */ if ( MITEM_mnemonic(items,i) != NULL ) { XtVaSetValues ( widget, XmNmnemonic, MITEM_mnemonic(items,i), NULL ); } /* Any item can have an accelerator except cascade menus. But we * don't worry about the exception, assuming that the menu item * structures were built correctly: */ if ( MITEM_accelerator(items,i) != NULL ) { str = XmStringCreateSimple ( MITEM_accel_text(items,i) ); XtVaSetValues ( widget, XmNaccelerator, MITEM_accelerator(items,i), XmNacceleratorText, str, NULL ); XmStringFree ( str ); } /* Finally, anyone can have a callback: */ if ( MITEM_callback(items,i) != NULL ) { XtAddCallback ( widget, XmNactivateCallback, MITEM_callback(items,i), MITEM_callback_data(items,i) ); } } /* Return the cascade button: */ return cascade; }
Widget ui_build_menu( Widget parent, int menu_type, int num_columns, char *menu_title, char *menu_name, MenuItem *menu_items ) { Widget menu, cascade, widget; Arg args[4]; int i; XmString xmlabel; int n = 0; if (num_columns > 1) { XtSetArg(args[n], XmNpacking, XmPACK_COLUMN); n++; XtSetArg(args[n], XmNnumColumns, num_columns); n++; } if (menu_type == XmMENU_PULLDOWN) menu = XmCreatePulldownMenu(parent, "pulldown_menu", args, n); else { XtSetArg(args[n], XmNwhichButton, AB_BMenu); n++; menu = XmCreatePopupMenu(parent, "popup_menu", args, n); } if (menu_type == XmMENU_PULLDOWN) { cascade = XtVaCreateManagedWidget(menu_name, xmCascadeButtonWidgetClass, parent, XmNsubMenuId, menu, NULL); if (menu_title) { xmlabel = XmStringCreateLocalized(menu_title); XtVaSetValues(cascade, XmNlabelString, xmlabel, NULL); XmStringFree(xmlabel); } } for (i = 0; menu_items[i].label != NULL; i++) { if (menu_items[i].subitems) { widget = ui_build_menu(menu, XmMENU_PULLDOWN, menu_items[i].num_columns, menu_items[i].label, menu_items[i].name, (MenuItem *)menu_items[i].subitems); XtVaSetValues(widget, XmNuserData, (XtArgVal)menu_items[i].user_data, NULL); } else { widget = XtVaCreateManagedWidget(menu_items[i].name, *menu_items[i].wclass, menu, XmNuserData, (XtArgVal)menu_items[i].user_data, NULL); if (menu_items[i].label != NULL) { xmlabel = XmStringCreateLocalized(menu_items[i].label); XtVaSetValues(widget, XmNlabelString, xmlabel, NULL); XmStringFree(xmlabel); } /* If label is glyph type, then change type and call * routine to set glyph. */ if (menu_items[i].label_type == AB_LABEL_GLYPH) { XtVaSetValues(widget, XmNlabelType, XmPIXMAP, NULL); dtb_set_label_from_bitmap_data(widget, menu_items[i].pixwidth, menu_items[i].pixheight, menu_items[i].bits); } } if (menu_items[i].active == FALSE) XtSetSensitive(widget, FALSE); else if (menu_items[i].callback != NULL) XtAddCallback(widget, XmNactivateCallback, menu_items[i].callback, menu_items[i].client_data); } if (menu_type == XmMENU_POPUP) return menu; else return cascade; }
static void Save_log_finished_popup() { Widget dialog; Widget temp_widget; Widget ok_button; XmString ok; XmString msg; ok = XmStringCreateLocalized( "OK" ); msg = XmStringCreateLtoR( Msg_buf, XmFONTLIST_DEFAULT_TAG ); dialog = XmCreateInformationDialog( Top_widget, "info", NULL, 0 ); /* Get rid of Cancel and Help buttons on popup. */ temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_CANCEL_BUTTON ); XtUnmanageChild( temp_widget ); temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_HELP_BUTTON ); XtUnmanageChild( temp_widget ); /* Set properties of message label. */ temp_widget = XmMessageBoxGetChild( dialog, XmDIALOG_MESSAGE_LABEL ); XtVaSetValues( temp_widget, XmNforeground, hci_get_read_color( TEXT_FOREGROUND ), XmNbackground, hci_get_read_color( WARNING_COLOR ), XmNfontList, hci_get_fontlist( LIST ), NULL ); /* Set properties of OK button. */ ok_button = XmMessageBoxGetChild( dialog, XmDIALOG_OK_BUTTON ); XtVaSetValues( ok_button, XmNforeground, hci_get_read_color( BUTTON_FOREGROUND ), XmNbackground, hci_get_read_color( BUTTON_BACKGROUND ), XmNfontList, hci_get_fontlist( LIST ), NULL ); XtAddCallback( ok_button, XmNactivateCallback, Success_callback, NULL ); /* Set properties of popup. */ XtVaSetValues (dialog, XmNmessageString, msg, XmNokLabelString, ok, XmNbackground, hci_get_read_color( WARNING_COLOR ), XmNforeground, hci_get_read_color( TEXT_FOREGROUND ), XmNdialogStyle, XmDIALOG_PRIMARY_APPLICATION_MODAL, XmNdeleteResponse, XmDESTROY, NULL); /* Free allocated space. */ XmStringFree( ok ); XmStringFree( msg ); /* Do this to make popup appear. */ XtManageChild( dialog ); XtPopup( Top_widget, XtGrabNone ); }
Widget dslw_create ( Widget w ) /************************************************************************ * dslw_create * * * * This function creates the data selection popup window. * * * * Widget dslw_create ( w ) * * * * Input parameters: * * w Widget The parent widget * * * * Output parameters: * * * * Return parameters: * * dslw_create Widget The data selection popup widget * * * ** * * Log: * * L. Williams/EAI 7/95 for nwx2.1 * * C. Lin/EAI 8/95 * * D.W.Plummer/NCEP 9/96 Commented out "Select by ..."; changed * * time selection to hours instead of days * * D.W.Plummer/NCEP 11/96 removed commented section from 9/96 * * changed time selection from hours only * * to either hours or days depending on * * product type (eg., W or O, etc.) * * G. Krueger/EAI 11/97 Renamed NxmHelp functions * * I. Durham/GSC 5/98 changed call for underscore * * T. Piper/GSC 6/01 Freed xmstr * * T. Piper/SAIC 7/02 Reinstated the select by state option * * T. Piper/SAIC 10/05 declared ii & nn long * * E. Safford/SAIC 12/07 renamed guidInit to idata_init() * ***********************************************************************/ { struct guid_grp *grp_ptr; Widget paned_w, topform; Widget groups_frame, products_frame; Widget rc, form, form2, form3, form4, frame3; Widget radio_box1, close_button, help_button; Widget label1, label2, label3, label4; Widget data_group_list; XmString station, state, *xmstr, msg; Arg wargs[10]; Pixel fg, bg; int jj, ier; long ii, nn; /*---------------------------------------------------------------------*/ nn = 0; XtSetArg(wargs[nn], XmNtitle, "Data Selection"); nn++; dataSelectW = XmCreateBulletinBoardDialog(w, "data_selection", wargs, nn); paned_w = XtVaCreateManagedWidget("paned_w", xmPanedWindowWidgetClass, dataSelectW, XmNsashWidth, 1, XmNsashHeight, 1, NULL); XtVaGetValues(paned_w, XmNforeground, &fg, XmNbackground, &bg, NULL); topform = XtVaCreateManagedWidget("topform", xmFormWidgetClass, paned_w, NULL); /* * Create Group List */ msg = XmStringCreateLocalized("Select Data Type Group"); label1 = XtVaCreateManagedWidget("Group label", xmLabelWidgetClass, topform, XmNlabelString, msg, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); XmStringFree(msg); groups_frame = XtVaCreateWidget("groups_frame", xmFrameWidgetClass, topform, XmNshadowType, XmSHADOW_IN, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, label1, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); form = XtVaCreateWidget("form", xmFormWidgetClass, groups_frame, NULL); guid_ngrp = idata_init( &ier ); if ( ier != G_NORMAL ) { printf("NWX: ERROR reading guidata.tbl. See system administrator.\n"); exit(guid_ngrp); } grp_ptr=guid_grp_head; xmstr = (XmString *) XtMalloc(sizeof (XmString) * (size_t)guid_ngrp); for (ii = 0; ii < guid_ngrp; ii++) { xmstr[ii] = XmStringCreateLocalized(grp_ptr->grpname); grp_ptr = grp_ptr->nextgrp; } nn = 0; XtSetArg(wargs[nn], XmNitems, xmstr); nn++; XtSetArg(wargs[nn], XmNitemCount, guid_ngrp); nn++; XtSetArg(wargs[nn], XmNvisibleItemCount, 7); nn++; XtSetArg(wargs[nn], XmNselectionPolicy, XmSINGLE_SELECT); nn++; XtSetArg(wargs[nn], XmNscrollingPolicy, XmAUTOMATIC); nn++; XtSetArg(wargs[nn], XmNtopAttachment, XmATTACH_FORM); nn++; XtSetArg(wargs[nn], XmNleftAttachment, XmATTACH_FORM); nn++; XtSetArg(wargs[nn], XmNrightAttachment, XmATTACH_FORM); nn++; XtSetArg(wargs[nn], XmNbottomAttachment, XmATTACH_FORM); nn++; data_group_list = XmCreateScrolledList(form, "data_group", wargs, nn); XtManageChild(data_group_list); XtAddCallback(data_group_list, XmNsingleSelectionCallback, dslw_groupCb, _prodlistW); XtManageChild(form); XtManageChild(groups_frame); for (jj = 0; jj < guid_ngrp; jj++) XmStringFree(xmstr[jj]); XtFree((XtPointer)xmstr); /* * Create Product List */ msg = XmStringCreateLocalized("Select Data Type Product"); label2 = XtVaCreateManagedWidget("product label1", xmLabelWidgetClass, topform, XmNlabelString, msg, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, groups_frame, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); XmStringFree(msg); msg = XmStringCreateLocalized(" * Product Unavailable "); label3 = XtVaCreateManagedWidget("product label2", xmLabelWidgetClass, topform, XmNlabelString, msg, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, label2, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); XmStringFree(msg); products_frame = XtVaCreateWidget("products_frame", xmFrameWidgetClass, topform, XmNshadowType, XmSHADOW_IN, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, label3, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); form = XtVaCreateWidget ("form", xmFormWidgetClass, products_frame, NULL); nn = 0; XtSetArg(wargs[nn], XmNvisibleItemCount, 7); nn++; XtSetArg(wargs[nn], XmNwordWrap, True); nn++; XtSetArg(wargs[nn], XmNselectionPolicy, XmSINGLE_SELECT); nn++; XtSetArg(wargs[nn], XmNscrollingPolicy, XmAUTOMATIC); nn++; XtSetArg(wargs[nn], XmNtopAttachment, XmATTACH_FORM); nn++; XtSetArg(wargs[nn], XmNleftAttachment, XmATTACH_FORM); nn++; XtSetArg(wargs[nn], XmNrightAttachment, XmATTACH_FORM); nn++; XtSetArg(wargs[nn], XmNbottomAttachment, XmATTACH_FORM); nn++; _prodlistW = XmCreateScrolledList(form, "data_type", wargs, nn); XtManageChild(_prodlistW); XtAddCallback(_prodlistW, XmNsingleSelectionCallback, dslw_prodCb, NULL); XtManageChild(form); XtManageChild(products_frame); /* * Bottom Pane */ form = XtVaCreateManagedWidget("form", xmFormWidgetClass, paned_w, XmNfractionBase, 1, NULL); /* * "Time Covered" */ _dttmFrameW = XtVaCreateManagedWidget("_dttmFrameW", xmFrameWidgetClass, form, XmNshadowType, XmSHADOW_IN, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 1, NULL); form2 = XtVaCreateManagedWidget("form2", xmFormWidgetClass, _dttmFrameW, NULL); pdata_setTimeCovered( EVENT, &ier ); /* timeCoveredType = EVENT; */ msg = XmStringCreateLocalized("Time Covered (Hours)"); _timeLabel = XtVaCreateManagedWidget("Time", xmLabelWidgetClass, form2, XmNlabelString, msg, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); XmStringFree(msg); rc = XtVaCreateWidget("rc", xmRowColumnWidgetClass, form2, XmNorientation, XmHORIZONTAL, XmNradioBehavior, True, XmNtraversalOn, False, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, _timeLabel, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); nn = (long)XtNumber ( HourVals ); _timeButtons = (WidgetList)XtMalloc(nn * sizeof(Widget)); for ( ii = 0 ; ii < nn ; ii++ ) { _timeButtons[ii] = XtVaCreateManagedWidget( HourVals[ii], xmToggleButtonWidgetClass, rc, NULL ); XtAddCallback(_timeButtons[ii], XmNarmCallback, (XtCallbackProc)dslw_dttmCb, (XtPointer)ii); } XmToggleButtonSetState( _timeButtons[0], True, False ); XtManageChild(rc); dslw_dttmSensitive ( False ); /* * Select By */ form = XtVaCreateManagedWidget("form", xmFormWidgetClass, paned_w, XmNfractionBase, 1, NULL); frame3 = XtVaCreateManagedWidget("frame3", xmFrameWidgetClass, form, XmNshadowType, XmSHADOW_IN, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 1, NULL); form4 = XtVaCreateManagedWidget("form", xmFormWidgetClass, frame3, NULL); msg = XmStringCreateLocalized("Select By"); label4 = XtVaCreateManagedWidget("select_by", xmLabelWidgetClass, form4, XmNlabelString, msg, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, NULL); XmStringFree(msg); station = XmStringCreateLocalized("station"); state = XmStringCreateLocalized("state"); radio_box1 = XmVaCreateSimpleRadioBox(form4, "radio_box1", 0, (XtCallbackProc)dslw_slctCb, XmVaRADIOBUTTON, station, NULL, NULL, NULL, XmVaRADIOBUTTON, state, NULL, NULL, NULL, XmNnumColumns, 2, XmNspacing, 55, XmNradioBehavior, TRUE, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, label4, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtManageChild(radio_box1); XmStringFree(station); XmStringFree(state); /* * CLOSE, and HELP */ form3 = XtVaCreateManagedWidget("form3", xmFormWidgetClass, paned_w, XmNfractionBase, 2, NULL); close_button = XtVaCreateManagedWidget("CLOSE", xmPushButtonGadgetClass, form3, XmNshadowType, XmSHADOW_IN, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 1, NULL); XtAddCallback ( close_button, XmNactivateCallback, (XtCallbackProc)dslw_closeCb, NULL); help_button = XtVaCreateManagedWidget("HELP", xmPushButtonGadgetClass, form3, XmNshadowType, XmSHADOW_IN, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 1, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 2, NULL); XtAddCallback ( help_button, XmNactivateCallback, (XtCallbackProc)NxmHelp_helpBtnCb, (XtPointer)2); return(dataSelectW); }
RGISVecPanel::RGISVecPanel (Widget parent, Widget leftWidget) : RGISPanel (parent,leftWidget) { int toggle; char *toggleNames [] = { (char *) "None", (char *) "Selected", (char *) "All" }; XmString string; Widget label, toggleB; string = XmStringCreate ((char *) "Annotation:",UICharSetBold); label = XtVaCreateManagedWidget ("RGISVecPanelVerticalLabel",xmLabelWidgetClass,Form (), XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 25, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNlabelString, string, NULL); XmStringFree (string); RowColumnWGT = XtVaCreateManagedWidget ("RGISVecPanelRowColumn",xmRowColumnWidgetClass,Form (), XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 25, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, label, XmNleftOffset, 5, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, XmNorientation, XmVERTICAL, XmNpacking, XmPACK_COLUMN, XmNspacing, 0, XmNmarginWidth, 0, XmNmarginHeight, 0, XmNnumColumns, 1, XmNradioBehavior, True, XmNradioAlwaysOne, True, NULL); for (toggle = 0;toggle < (int) (sizeof (toggleNames) / sizeof (char *));++toggle) { string = XmStringCreate (toggleNames [toggle],UICharSetNormal); toggleB = XtVaCreateManagedWidget ("RGISVecPanelToggleWGT",xmToggleButtonGadgetClass,RowColumnWGT, XmNlabelString, string, XmNhighlightThickness, 0, XmNmarginHeight, 1, XmNset, True, NULL); XmStringFree (string); XtAddCallback (toggleB,XmNvalueChangedCallback,(XtCallbackProc) _RGISPanelFlagsToggleCBK,(void *) ((char *) NULL + _RGISVectorControlCodes [toggle])); } string = XmStringCreate ((char *) "Display",UICharSetNormal); ActiveToggleWGT = XtVaCreateManagedWidget ("RGISVecPanelActiveToggleWGT",xmToggleButtonGadgetClass,Form (), XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftWidget, RowColumnWGT, XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET, XmNrightWidget, RowColumnWGT, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 25, XmNlabelString, string, XmNhighlightThickness, 0, XmNset, True, NULL); XmStringFree (string); XtAddCallback (ActiveToggleWGT,XmNvalueChangedCallback,(XtCallbackProc) _RGISPanelFlagsToggleCBK,(void *) DBDataFlagHideIdle); string = XmStringCreate ((char *) "Idle Items:",UICharSetBold); label = XtVaCreateManagedWidget ("RGISVecPanelVerticalLabel",xmLabelWidgetClass,Form (), XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, ActiveToggleWGT, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, ActiveToggleWGT, XmNlabelString, string, NULL); XmStringFree (string); }
void ErrDialog( char *errString, Widget visualParent ) { int n; Arg args[10]; XmString ok; /* create the compound string */ style.tmpXmStr = CMPSTR(errString); style.errParent = visualParent; if (style.errDialog == NULL) /* create it */ { ok = XmStringCreateLocalized((String) _DtOkString); n = 0; XtSetArg(args[n], XmNokLabelString, ok); n++; XtSetArg(args[n], XmNmessageString, style.tmpXmStr); n++; XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++; XtSetArg (args[n], XmNautoUnmanage, False); n++; XtSetArg (args[n], XmNdefaultPosition, False); n++; style.errDialog = XmCreateErrorDialog(style.shell,"ErrorNotice",args,n); XtAddCallback (style.errDialog, XmNokCallback, UnmanageCB, NULL); XtAddCallback (style.errDialog, XmNcancelCallback, UnmanageCB, NULL); XtAddCallback (style.errDialog, XmNmapCallback, CenterMsgCB, NULL); XtUnmanageChild ( XmMessageBoxGetChild (style.errDialog, XmDIALOG_CANCEL_BUTTON)); XtUnmanageChild ( XmMessageBoxGetChild (style.errDialog, XmDIALOG_HELP_BUTTON)); /* set the dialog shell parent title */ n=0; XtSetArg (args[n], XmNmwmInputMode, MWM_INPUT_PRIMARY_APPLICATION_MODAL); n++; XtSetArg (args[n], XmNuseAsyncGeometry, True); n++; XtSetArg (args[n], XmNtitle, ((char *)GETMESSAGE(2, 3, "Error"))); n++; XtSetValues (XtParent(style.errDialog), args, n); } else /* change the string */ { n = 0; XtSetArg(args[n], XmNmessageString, style.tmpXmStr); n++; XtSetValues (style.errDialog, args, n); } /* free the compound string */ XmStringFree (style.tmpXmStr); if (XtIsManaged(style.errParent) || XtParent(style.errParent) == NULL) { XtManageChild(style.errDialog); /* ring the bell (PM behavior) */ XBell(style.display, 0); } else { XtAddEventHandler(XtParent(style.errParent), StructureNotifyMask, 0, (XtEventHandler)errParentMap, NULL); } }
/* * Function: _DtPrintCreateMarginFrame * * Creates a frame for specifying margins. The frame contains four text * fields, one for each _DtPrintMarginEnum. * * parent - specifies the parent of the frame. * * Returns the widget id of the frame. */ Widget _DtPrintCreateMarginFrame( Widget parent ) { DtpoMarginFrame *info; Arg args[16]; int n; XmString xms; info = (DtpoMarginFrame *) XtMalloc( sizeof(DtpoMarginFrame) ); n = 0; XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++; XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++; XtSetArg(args[n], XmNuserData, info); n++; info->frame = XmCreateFrame(parent, "MarginFrame", args, n); XtAddCallback( info->frame, XmNdestroyCallback, _DtPrintDestroyMarginFrameCB, (XtPointer) info ); xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_LABEL); n = 0; XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++; XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++; XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++; XtSetArg(args[n], XmNlabelString, xms); n++; info->label = XmCreateLabel(info->frame, "MarginLabel", args, n); XtManageChild(info->label); XmStringFree(xms); n = 0; XtSetArg(args[n], XmNallowOverlap, False); n++; XtSetArg(args[n], XmNfractionBase, 2); n++; info->form = XmCreateForm(info->frame, "MarginForm", args, n); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++; XtSetArg(args[n], XmNrightPosition, 1); n++; XtSetArg(args[n], XmNrightOffset, 5); n++; info->top = XmCreateTextField(info->form, "MarginTopText", args, n); XtManageChild(info->top); xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_TOP_MARGIN_LABEL); n = 0; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->top); n++; XtSetArg(args[n], XmNtopOffset, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNrightWidget, info->top); n++; XtSetArg(args[n], XmNrightOffset, 3); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget, info->top); n++; XtSetArg(args[n], XmNbottomOffset, 0); n++; info->top_label = XmCreateLabelGadget(info->form, "MarginTopLabel", args, n); XmStringFree(xms); XtManageChild(info->top_label); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->top); n++; XtSetArg(args[n], XmNtopOffset, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; info->right = XmCreateTextField(info->form, "MarginRightText", args, n); XtManageChild(info->right); xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_RIGHT_MARGIN_LABEL); n = 0; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->right); n++; XtSetArg(args[n], XmNtopOffset, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNrightWidget, info->right); n++; XtSetArg(args[n], XmNrightOffset, 3); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget, info->right); n++; XtSetArg(args[n], XmNbottomOffset, 0); n++; info->right_label = XmCreateLabelGadget(info->form, "MarginRightLabel", args, n); XmStringFree(xms); XtManageChild(info->right_label); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->top); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNrightWidget, info->top); n++; XtSetArg(args[n], XmNrightOffset, 0); n++; info->bottom = XmCreateTextField(info->form, "MarginBottomText", args, n); XtManageChild(info->bottom); xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_BOTTOM_MARGIN_LABEL); n = 0; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->bottom); n++; XtSetArg(args[n], XmNtopOffset, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNrightWidget, info->bottom); n++; XtSetArg(args[n], XmNrightOffset, 3); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget, info->bottom); n++; XtSetArg(args[n], XmNbottomOffset, 0); n++; info->bottom_label = XmCreateLabelGadget(info->form, "MarginBottomLabel", args, n); XmStringFree(xms); XtManageChild(info->bottom_label); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->bottom); n++; XtSetArg(args[n], XmNtopOffset, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNrightWidget, info->right); n++; XtSetArg(args[n], XmNrightOffset, 0); n++; info->left = XmCreateTextField(info->form, "MarginLeftText", args, n); XtManageChild(info->left); xms = XmStringCreateLocalized(DTPO_MARGIN_FRAME_LEFT_MARGIN_LABEL); n = 0; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->left); n++; XtSetArg(args[n], XmNtopOffset, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNrightWidget, info->left); n++; XtSetArg(args[n], XmNrightOffset, 3); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNbottomWidget, info->left); n++; XtSetArg(args[n], XmNbottomOffset, 0); n++; info->left_label = XmCreateLabelGadget(info->form, "MarginLeftLabel", args, n); XmStringFree(xms); XtManageChild(info->left_label); XtManageChild(info->form); return info->frame; }
/* ** Create a new help window displaying a given subject, "topic" ** ** Important hint: If this widget is restructured or the name of the text ** subwidget is changed don't forget to adapt the default translations of the ** help text. They are located in nedit.c, look for ** static char *fallbackResources ** (currently: nedit.helpForm.sw.helpText*translations...) */ static Widget createHelpPanel(enum HelpTopic topic) { Arg al[50]; int ac; Widget appShell, btn, closeBtn, form, btnFW; Widget sw, hScrollBar, vScrollBar; XmString st1; char * helpText = NULL; char * styleData = NULL; ac = 0; XtSetArg(al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++; appShell = CreateWidget(TheAppShell, "help", topLevelShellWidgetClass, al, ac); AddSmallIcon(appShell); /* With openmotif 2.1.30, a crash may occur when the text widget of the help window is (slowly) resized to a zero width. By imposing a minimum _window_ width, we can work around this problem. The minimum width should be larger than the width of the scrollbar. 50 is probably a safe value; this leaves room for a few characters */ XtVaSetValues(appShell, XtNminWidth, 50, NULL); form = XtVaCreateManagedWidget("helpForm", xmFormWidgetClass, appShell, NULL); XtVaSetValues(form, XmNshadowThickness, 0, NULL); /* Create the bottom row of buttons */ btn = XtVaCreateManagedWidget("find", xmPushButtonWidgetClass, form, XmNlabelString, st1=XmStringCreateSimple("Find..."), XmNmnemonic, 'F', XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 3, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 25, NULL); XtAddCallback(btn, XmNactivateCallback, searchHelpCB, appShell); XmStringFree(st1); btn = XtVaCreateManagedWidget("findAgain", xmPushButtonWidgetClass, form, XmNlabelString, st1=XmStringCreateSimple("Find Again"), XmNmnemonic, 'A', XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 27, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 49, NULL); XtAddCallback(btn, XmNactivateCallback, searchHelpAgainCB, appShell); XmStringFree(st1); btn = XtVaCreateManagedWidget("print", xmPushButtonWidgetClass, form, XmNlabelString, st1=XmStringCreateSimple("Print..."), XmNmnemonic, 'P', XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 51, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 73, NULL); XtAddCallback(btn, XmNactivateCallback, printCB, appShell); XmStringFree(st1); closeBtn = XtVaCreateManagedWidget("close", xmPushButtonWidgetClass, form, XmNlabelString, st1=XmStringCreateSimple("Close"), XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 75, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 97, NULL); XtAddCallback(closeBtn, XmNactivateCallback, closeCB, appShell); XmStringFree(st1); /* Create the next row of buttons (for navigation) */ btn = XtVaCreateManagedWidget("prevTopic", xmPushButtonWidgetClass, form, XmNlabelString, st1=XmStringCreateSimple("<< Browse"), XmNmnemonic, 'o', XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, closeBtn, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 51, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 73, NULL); XtAddCallback(btn, XmNactivateCallback, prevTopicCB, appShell); XmStringFree(st1); btn = XtVaCreateManagedWidget("nextTopic", xmPushButtonWidgetClass, form, XmNlabelString, st1=XmStringCreateSimple("Browse >>"), XmNmnemonic, 'e', XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, closeBtn, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 75, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 97, NULL); XtAddCallback(btn, XmNactivateCallback, nextTopicCB, appShell); XmStringFree(st1); btn = XtVaCreateManagedWidget("histBack", xmPushButtonWidgetClass, form, XmNlabelString, st1=XmStringCreateSimple("Back"), XmNmnemonic, 'B', XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, closeBtn, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 3, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 25, NULL); XtAddCallback(btn, XmNactivateCallback, bwHistoryCB, appShell); XmStringFree(st1); btnFW = XtVaCreateManagedWidget("histForw", xmPushButtonWidgetClass, form, XmNlabelString, st1=XmStringCreateSimple("Forward"), XmNmnemonic, 'w', XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, closeBtn, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 27, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 49, NULL); XtAddCallback(btnFW, XmNactivateCallback, fwHistoryCB, appShell); XmStringFree(st1); /* Create a text widget inside of a scrolled window widget */ sw = XtVaCreateManagedWidget("sw", xmScrolledWindowWidgetClass, form, XmNshadowThickness, 2, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, btnFW, NULL); hScrollBar = XtVaCreateManagedWidget("hScrollBar", xmScrollBarWidgetClass, sw, XmNorientation, XmHORIZONTAL, XmNrepeatDelay, 10, NULL); vScrollBar = XtVaCreateManagedWidget("vScrollBar", xmScrollBarWidgetClass, sw, XmNorientation, XmVERTICAL, XmNrepeatDelay, 10, NULL); /* Make sure the fixed size help font is loaded, such that we can base our text widget size calculation on it. */ loadFontsAndColors(sw, 'A'); HelpTextPanes[topic] = XtVaCreateManagedWidget("helpText", textWidgetClass, sw, textNfont, HelpStyleInfo[0].font, /* MUST correspond to 'A' above */ textNrows, 30, textNcolumns, 65, textNbacklightCharTypes, NULL, textNhScrollBar, hScrollBar, textNvScrollBar, vScrollBar, textNreadOnly, True, textNcontinuousWrap, True, textNautoShowInsertPos, True, NULL); XtVaSetValues(sw, XmNworkWindow, HelpTextPanes[topic], XmNhorizontalScrollBar, hScrollBar, XmNverticalScrollBar, vScrollBar, NULL); /* Initialize help style information, if it hasn't already been init'd */ initHelpStyles (HelpTextPanes[topic]); /* Put together the text to display and separate it into parallel text and style data for display by the widget */ helpText = stitch (HelpTextPanes[topic], HelpText[topic], &styleData); /* Stuff the text into the widget's text buffer */ BufSetAll (TextGetBuffer (HelpTextPanes[topic]) , helpText); XtFree (helpText); /* Create a style buffer for the text widget and fill it with the style data which was generated along with the text content */ HelpStyleBuffers[topic] = BufCreate(); BufSetAll(HelpStyleBuffers[topic], styleData); XtFree (styleData); TextDAttachHighlightData(((TextWidget)HelpTextPanes[topic])->text.textD, HelpStyleBuffers[topic], HelpStyleInfo, N_STYLES, '\0', NULL, NULL); /* This shouldn't be necessary (what's wrong in text.c?) */ HandleXSelections(HelpTextPanes[topic]); /* Process dialog mnemonic keys */ AddDialogMnemonicHandler(form, FALSE); /* Set the default button */ XtVaSetValues(form, XmNdefaultButton, closeBtn, NULL); XtVaSetValues(form, XmNcancelButton, closeBtn, NULL); /* realize all of the widgets in the new window */ RealizeWithoutForcingPosition(appShell); /* Give the text pane the initial focus */ XmProcessTraversal(HelpTextPanes[topic], XmTRAVERSE_CURRENT); /* Make close command in window menu gracefully prompt for close */ AddMotifCloseCallback(appShell, (XtCallbackProc)closeCB, appShell); /* Initialize navigation information, if it hasn't already been init'd */ initNavigationHistory(); /* Set the window title */ setHelpWinTitle(appShell, topic); #ifdef EDITRES XtAddEventHandler (appShell, (EventMask)0, True, (XtEventHandler)_XEditResCheckMessages, NULL); #endif /* EDITRES */ return appShell; }
Widget XNavMotif::build_menu( Widget Parent, int MenuType, const char *MenuTitle, void *MenuUserData, void (*Callback)( Widget, XNav *, XmAnyCallbackStruct *), void *CallbackData, xmenu_sMenuItem *Items, int *idx) { Widget Menu, Cascade, W; int i; unsigned int Level; XmString Str; WidgetClass Class; Arg ArgList[5]; XmFontList fontlist; XFontStruct *font; XmFontListEntry fontentry; // Set default fontlist font = XLoadQueryFont( flow_Display(Parent), "-*-Helvetica-Bold-R-Normal--12-*-*-*-P-*-ISO8859-1"); fontentry = XmFontListEntryCreate( (char*) "tag1", XmFONT_IS_FONT, font); fontlist = XmFontListAppendEntry( NULL, fontentry); XtFree( (char *)fontentry); i = 0; XtSetArg(ArgList[i], XmNuserData, MenuUserData); i++; XtSetArg(ArgList[i], XmNbuttonFontList, fontlist); i++; XtSetArg(ArgList[i], XmNlabelFontList, fontlist); i++; if (MenuType == MENU_PULLDOWN || MenuType == MENU_OPTION) Menu = XmCreatePulldownMenu(Parent, (char*) "_pulldown", ArgList, i); else if (MenuType == MENU_POPUP) Menu = XmCreatePopupMenu(Parent, (char*) "_popup", ArgList, i); else { XtWarning("Invalid menu type passed to BuildMenu()."); return NULL; } if (MenuType == MENU_PULLDOWN) { Str = XmStringCreateSimple((char*) MenuTitle); Cascade = XtVaCreateManagedWidget(MenuTitle, xmCascadeButtonGadgetClass, Parent, XmNsubMenuId, Menu, XmNlabelString, Str, NULL); XmStringFree(Str); } else if (MenuType == MENU_OPTION) { Str = XmStringCreateSimple((char*) MenuTitle); XtSetArg(ArgList[0], XmNsubMenuId, Menu); XtSetArg(ArgList[1], XmNlabelString, Str); Cascade = XmCreateOptionMenu(Parent, (char*) MenuTitle, ArgList, 2); XmStringFree(Str); } XmFontListFree( fontlist); Level = Items[*idx].Level; for (; Items[*idx].Level != 0 && Items[*idx].Level >= Level; (*idx)++) { if (Items[*idx].Item == xmenu_eMenuItem_Cascade || Items[*idx].Item == xmenu_eMenuItem_Ref) { if (MenuType == MENU_OPTION) { XtWarning("You can't have submenus from option menu items."); return NULL; } else { i = *idx; (*idx)++; build_menu(Menu, MENU_PULLDOWN, Lng::translate( Items[i].Name), MenuUserData, Callback, CallbackData, Items, idx); (*idx)--; } } else { if (Items[*idx].Item == xmenu_eMenuItem_Separator) Class = xmSeparatorGadgetClass; else Class = xmPushButtonGadgetClass; W = XtVaCreateManagedWidget(Lng::translate( Items[*idx].Name), Class, Menu, XmNuserData, *idx, XmNsensitive, (Boolean)(Items[*idx].Flags.f.Sensitive == 1), NULL); if (Callback && Class == xmPushButtonGadgetClass) XtAddCallback(W, XmNactivateCallback, (XtCallbackProc) Callback, (XtPointer) CallbackData); } } return MenuType == MENU_POPUP ? Menu : Cascade; }
/* * Function: _DtPrintCreateHdrFtrFrame * * Creates a frame for specifying the contents of page headers and footers. * The frame contains four option menus, one for each _DtPrintHdrFtrEnum. * The pulldown menus for the option menu are constructed from the .string * field in the array of _DtPrintHdrFtrSpec in "specs". * * _DtPrintCreateHdrFtrFrame copies the pointer to the array of * _DtPrintHdrFtrSpec. IT DOES NOT COPY THE ELEMENTS OF THE ARRAY. * * parent - specifies the parent of the frame. * nspecs - specifies the number of entries in the specs array. * specs - array of header/footer specifiers. The .string * field is used to construct labels in the GUI. * The .data field is returned in calls to * _DtPrintGetHdrFtrSpec. * * Returns the widget id for the frame. */ Widget _DtPrintCreateHdrFtrFrame( Widget parent, int nspecs, char **spec_strings, void **spec_data ) { DtpoHdrFtrFrame *info; Arg args[16]; int n; int i; XmString xms; info = (DtpoHdrFtrFrame *) XtMalloc( sizeof(DtpoHdrFtrFrame) ); info->nspecs = nspecs; info->specs = (DtpoHdrFtrSpec *) XtMalloc(nspecs*sizeof(DtpoHdrFtrSpec)); for (i=0; i<nspecs; i++) { info->specs[i].string = spec_strings[i]; if (spec_data != (void*) NULL) info->specs[i].data = spec_data[i]; else info->specs[i].data = (void*) NULL; info->specs[i].button = (Widget) NULL; } /* * Create the frame and attach add a destroyCallback to clean up * memory allocated for this object. */ n = 0; XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++; XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++; XtSetArg(args[n], XmNuserData, info); n++; info->frame = XmCreateFrame(parent, "HdrFtrFrame", args, n); XtAddCallback( info->frame, XmNdestroyCallback, _DtPrintDestroyHdrFtrFrameCB, (XtPointer) info ); /* * Create a label child for the frame */ xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_LABEL); n = 0; XtSetArg(args[n], XmNchildType, XmFRAME_TITLE_CHILD); n++; XtSetArg(args[n], XmNchildHorizontalAlignment, XmALIGNMENT_BEGINNING); n++; XtSetArg(args[n], XmNchildVerticalAlignment, XmALIGNMENT_CENTER); n++; XtSetArg(args[n], XmNlabelString, xms); n++; info->label = XmCreateLabel(info->frame, "HdrFtrLabel", args, n); XtManageChild(info->label); XmStringFree(xms); /* * Create a form work area child which will be populated by the * OptionMenu's. */ n = 0; XtSetArg(args[n], XmNallowOverlap, False); n++; XtSetArg(args[n], XmNfractionBase, 2); n++; info->form = XmCreateForm(info->frame, "HdrFtrForm", args, n); /* * Create the pulldown menu for the option menus. * Store the button index in the userData resource of each button. */ info->menu = XmCreatePulldownMenu(parent, "HdrFtrMenu", NULL, 0); for (i=0; i<info->nspecs; i++) { static char button_label[32]; sprintf(button_label, "Button%d", i); xms = XmStringCreateLocalized(info->specs[i].string); n = 0; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNuserData, i); n++; info->specs[i].button = XmCreatePushButtonGadget(info->menu, button_label, args, n); XmStringFree(xms); XtManageChild(info->specs[i].button); } /* * Create the option menus using the menu created above. */ xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_TOP_LEFT_LABEL); n=0; XtSetArg(args[n], XmNsubMenuId, info->menu); n++; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNuserData, info); n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++; XtSetArg(args[n], XmNrightPosition, 1); n++; XtSetArg(args[n], XmNrightOffset, 5); n++; info->top_left = XmCreateOptionMenu( info->form, "PageHeaderLeftOM", args, n ); XmStringFree(xms); XtManageChild(info->top_left); xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_TOP_RIGHT_LABEL); n=0; XtSetArg(args[n], XmNsubMenuId, info->menu); n++; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNuserData, info); n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->top_left); n++; XtSetArg(args[n], XmNtopOffset, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; info->top_right = XmCreateOptionMenu( info->form, "PageHeaderRightOM", args, n ); XmStringFree(xms); XtManageChild(info->top_right); xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_BOTTOM_LEFT_LABEL); n=0; XtSetArg(args[n], XmNsubMenuId, info->menu); n++; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNuserData, info); n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->top_left); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNrightWidget, info->top_left); n++; XtSetArg(args[n], XmNrightOffset, 0); n++; info->bottom_left = XmCreateOptionMenu( info->form, "PageFooterLeftOM", args, n ); XmStringFree(xms); XtManageChild(info->bottom_left); xms = XmStringCreateLocalized(DTPO_HEADERFOOTER_FRAME_BOTTOM_RIGHT_LABEL); n=0; XtSetArg(args[n], XmNsubMenuId, info->menu); n++; XtSetArg(args[n], XmNlabelString, xms); n++; XtSetArg(args[n], XmNuserData, info); n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++; XtSetArg(args[n], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, info->bottom_left); n++; XtSetArg(args[n], XmNtopOffset, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); n++; XtSetArg(args[n], XmNrightWidget, info->top_right); n++; XtSetArg(args[n], XmNrightOffset, 0); n++; info->bottom_right = XmCreateOptionMenu( info->form, "PageFooterRightOM", args, n ); XmStringFree(xms); XtManageChild(info->bottom_right); XtManageChild(info->form); return info->frame; }
void Download_findu_trail( /*@unused@*/ Widget w, /*@unused@*/ XtPointer clientData, /*@unused@*/ XtPointer callData) { static Widget pane, my_form, button_ok, button_cancel, call, sep; Atom delw; XmString x_str; if (!download_findu_dialog) { begin_critical_section(&download_findu_dialog_lock, "track_gui.c:Download_findu_trail" ); download_findu_dialog = XtVaCreatePopupShell(langcode("WPUPTSP007"), xmDialogShellWidgetClass, appshell, XmNdeleteResponse,XmDESTROY, XmNdefaultPosition, FALSE, XmNfontList, fontlist1, NULL); pane = XtVaCreateWidget("Download_findu_trail pane", xmPanedWindowWidgetClass, download_findu_dialog, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, NULL); my_form = XtVaCreateWidget("Download_findu_trail my_form", xmFormWidgetClass, pane, XmNfractionBase, 2, XmNautoUnmanage, FALSE, XmNshadowThickness, 1, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, NULL); call = XtVaCreateManagedWidget(langcode("WPUPTSP008"), xmLabelWidgetClass, my_form, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 10, XmNbottomAttachment, XmATTACH_NONE, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNrightAttachment, XmATTACH_NONE, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, XmNfontList, fontlist1, NULL); download_trail_station_data = XtVaCreateManagedWidget("download_trail_station_data", xmTextFieldWidgetClass, my_form, XmNeditable, TRUE, XmNcursorPositionVisible, TRUE, XmNsensitive, TRUE, XmNshadowThickness, 1, XmNcolumns, 15, XmNwidth, ((15*7)+2), XmNmaxLength, 15, XmNbackground, colors[0x0f], XmNtopAttachment,XmATTACH_FORM, XmNtopOffset, 5, XmNbottomAttachment,XmATTACH_NONE, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, call, XmNleftOffset, 10, XmNrightAttachment,XmATTACH_NONE, XmNnavigationType, XmTAB_GROUP, XmNtraversalOn, TRUE, XmNfontList, fontlist1, NULL); x_str = XmStringCreateLocalized(langcode("WPUPTSP009")); posit_start_value = XtVaCreateManagedWidget("Start of Trail (hrs ago)", xmScaleWidgetClass, my_form, XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget, call, XmNtopOffset, 15, XmNbottomAttachment,XmATTACH_NONE, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNrightAttachment,XmATTACH_NONE, XmNnavigationType, XmTAB_GROUP, XmNtraversalOn, TRUE, //XmNwidth, 190, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNsensitive, TRUE, XmNorientation, XmHORIZONTAL, XmNborderWidth, 1, XmNminimum, 1, XmNmaximum, MAX_FINDU_START_TIME, XmNshowValue, TRUE, XmNvalue, posit_start, // Note: Some versions of OpenMotif (distributed with Fedora, // perhaps others) don't work properly with XtVaTypedArg() as used // here, instead showing blank labels for the Scale widgets. // XtVaTypedArg, XmNtitleString, XmRString, langcode("WPUPTSP009"), 22, XmNtitleString, x_str, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, XmNfontList, fontlist1, NULL); XmStringFree(x_str); x_str = XmStringCreateLocalized(langcode("WPUPTSP010")); posit_length_value = XtVaCreateManagedWidget("Length of trail (hrs)", xmScaleWidgetClass, my_form, XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget, posit_start_value, XmNtopOffset, 15, XmNbottomAttachment,XmATTACH_NONE, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNrightAttachment,XmATTACH_NONE, XmNnavigationType, XmTAB_GROUP, XmNtraversalOn, TRUE, //XmNwidth, 190, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNsensitive, TRUE, XmNorientation, XmHORIZONTAL, XmNborderWidth, 1, XmNminimum, 1, XmNmaximum, MAX_FINDU_DURATION, XmNshowValue, TRUE, XmNvalue, posit_length, // Note: Some versions of OpenMotif (distributed with Fedora, // perhaps others) don't work properly with XtVaTypedArg() as used // here, instead showing blank labels for the Scale widgets. // XtVaTypedArg, XmNtitleString, XmRString, langcode("WPUPTSP010"), 19, XmNtitleString, x_str, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, XmNfontList, fontlist1, NULL); XmStringFree(x_str); sep = XtVaCreateManagedWidget("Download_findu_trail sep", xmSeparatorGadgetClass, my_form, XmNorientation, XmHORIZONTAL, XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget,posit_length_value, XmNtopOffset, 10, XmNbottomAttachment,XmATTACH_NONE, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment,XmATTACH_FORM, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, XmNfontList, fontlist1, NULL); button_ok = XtVaCreateManagedWidget(langcode("WPUPTSP007"), xmPushButtonGadgetClass, my_form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, sep, XmNtopOffset, 5, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 5, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, XmNleftOffset, 5, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 1, XmNnavigationType, XmTAB_GROUP, XmNtraversalOn, TRUE, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, XmNfontList, fontlist1, NULL); if (fetching_findu_trail_now) XtSetSensitive(button_ok, FALSE); button_cancel = XtVaCreateManagedWidget(langcode("UNIOP00002"), xmPushButtonGadgetClass, my_form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, sep, XmNtopOffset, 5, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 5, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 1, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 2, XmNrightOffset, 5, XmNnavigationType, XmTAB_GROUP, XmNtraversalOn, TRUE, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, XmNfontList, fontlist1, NULL); XtAddCallback(button_ok, XmNactivateCallback, Download_trail_now, download_findu_dialog); XtAddCallback(button_cancel, XmNactivateCallback, Download_trail_destroy_shell, download_findu_dialog); XtAddCallback(posit_start_value, XmNvalueChangedCallback, Reset_posit_length_max, download_findu_dialog); pos_dialog(download_findu_dialog); delw = XmInternAtom(XtDisplay(download_findu_dialog),"WM_DELETE_WINDOW", FALSE); XmAddWMProtocolCallback(download_findu_dialog, delw, Download_trail_destroy_shell, (XtPointer)download_findu_dialog); XmTextFieldSetString(download_trail_station_data,download_trail_station_call); XtManageChild(my_form); XtManageChild(pane); end_critical_section(&download_findu_dialog_lock, "track_gui.c:Download_trail" ); XtPopup(download_findu_dialog,XtGrabNone); fix_dialog_size(download_findu_dialog); // Move focus to the Cancel button. This appears to highlight the // button fine, but we're not able to hit the <Enter> key to // have that default function happen. Note: We _can_ hit the // <SPACE> key, and that activates the option. // XmUpdateDisplay(download_findu_dialog); XmProcessTraversal(button_cancel, XmTRAVERSE_CURRENT); } else (void)XRaiseWindow(XtDisplay(download_findu_dialog), XtWindow(download_findu_dialog)); }
Widget RenderingOptionsDialog::createDialog(Widget parent) { Arg arg[10]; ImageWindow *iw = this->imageWindow; XtSetArg(arg[0], XmNautoUnmanage, False); // Widget dialog = XmCreateFormDialog( parent, this->name, arg, 1); Widget dialog = this->CreateMainForm( parent, this->name, arg, 1); XtVaSetValues(XtParent(dialog), XmNtitle, "Rendering...", NULL); Widget modeLabel = XtVaCreateManagedWidget( "modeLabel", xmLabelWidgetClass, dialog, XmNtopAttachment , XmATTACH_FORM, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 5, NULL); Widget modeSection = XtVaCreateManagedWidget( "modeSection", xmRowColumnWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , modeLabel, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 5, XmNorientation , XmHORIZONTAL, XmNspacing , 21, XmNmarginWidth , 21, XmNradioBehavior , True, NULL); this->softwareButton = new ToggleButtonInterface(modeSection, "softwareButton", iw->getSoftwareCmd(), TRUE); XtVaSetValues(this->softwareButton->getRootWidget(), XmNindicatorType , XmONE_OF_MANY, XmNshadowThickness , 0, NULL); this->hardwareButton = new ToggleButtonInterface(modeSection, "hardwareButton", iw->getHardwareCmd(), FALSE); XtVaSetValues(this->hardwareButton->getRootWidget(), XmNindicatorType , XmONE_OF_MANY, XmNshadowThickness , 0, NULL); Widget separator1 = XtVaCreateManagedWidget( "separator1", xmSeparatorWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , modeSection, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 2, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 2, NULL); Widget upLabel = XtVaCreateManagedWidget( "upLabel", xmLabelWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , separator1, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 5, NULL); Widget upApproxLabel = XtVaCreateManagedWidget( "upApproxLabel", xmLabelWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , upLabel, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, NULL); #if defined(aviion) XmString xmstr = XmStringCreateLtoR ("", "bold"); #endif Widget upPulldown = this->createUpPulldown(dialog); Widget buttonUpOptionMenu = this->buttonUpOptionMenu = XtVaCreateManagedWidget( "buttonUpOptionMenu", xmRowColumnWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , upLabel, XmNtopOffset , 10, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 2, XmNentryAlignment , XmALIGNMENT_CENTER, XmNrowColumnType , XmMENU_OPTION, XmNsubMenuId , upPulldown, #if defined(aviion) XmNlabelString , xmstr, #endif NULL); Widget upDensityLabel = XtVaCreateManagedWidget( "upDensityLabel", xmLabelWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , buttonUpOptionMenu, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, NULL); this->upEveryNumber = XtVaCreateManagedWidget( "upEveryNumber", xmNumberWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , buttonUpOptionMenu, XmNtopOffset , 10, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 5, XmNiMinimum , 1, XmNiMaximum , 1000000, XmNrecomputeSize , False, XmNdataType , INTEGER, XmNcharPlaces , 7, XmNeditable , True, NULL); XtAddCallback(this->upEveryNumber, XmNactivateCallback, (XtCallbackProc)RenderingOptionsDialog_NumberCB, (XtPointer)this); Widget separator2 = XtVaCreateManagedWidget( "separator2", xmSeparatorWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , this->upEveryNumber, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 2, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 2, NULL); Widget downLabel = XtVaCreateManagedWidget( "downLabel", xmLabelWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , separator2, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 5, NULL); Widget downApproxLabel = XtVaCreateManagedWidget( "downApproxLabel", xmLabelWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , downLabel, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, NULL); Widget downPulldown = this->createDownPulldown(dialog); Widget buttonDownOptionMenu = this->buttonDownOptionMenu = XtVaCreateManagedWidget( "buttonDownOptionMenu", xmRowColumnWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , downLabel, XmNtopOffset , 10, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 2, XmNentryAlignment , XmALIGNMENT_CENTER, XmNrowColumnType , XmMENU_OPTION, XmNsubMenuId , downPulldown, #if defined(aviion) XmNlabelString , xmstr, NULL); XmStringFree(xmstr); #else NULL); #endif Widget downDensityLabel = XtVaCreateManagedWidget( "downDensityLabel", xmLabelWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , buttonDownOptionMenu, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, NULL); this->downEveryNumber = XtVaCreateManagedWidget( "downEveryNumber", xmNumberWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , buttonDownOptionMenu, XmNtopOffset , 10, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 5, XmNiMinimum , 1, XmNiMaximum , 1000000, XmNrecomputeSize , False, XmNdataType , INTEGER, XmNcharPlaces , 7, XmNeditable , True, NULL); XtAddCallback(this->downEveryNumber, XmNactivateCallback, (XtCallbackProc)RenderingOptionsDialog_NumberCB, (XtPointer)this); Widget separator3 = XtVaCreateManagedWidget( "separator3", xmSeparatorWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , this->downEveryNumber, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, XmNrightAttachment , XmATTACH_FORM, XmNrightOffset , 5, NULL); this->cancel = XtVaCreateManagedWidget( "closeButton", xmPushButtonWidgetClass, dialog, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , separator3, XmNtopOffset , 10, XmNleftAttachment , XmATTACH_FORM, XmNleftOffset , 5, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset , 5, XmNrecomputeSize , False, NULL); this->sensitizeRenderMode(! iw->isRenderModeConnected()); this->sensitizeButtonUpApprox(! iw->isButtonUpApproxConnected()); this->sensitizeButtonDownApprox(! iw->isButtonDownApproxConnected()); this->sensitizeButtonUpDensity(! iw->isButtonUpDensityConnected()); this->sensitizeButtonDownDensity(! iw->isButtonDownDensityConnected()); return dialog; }
void CreateControlPanel() { Widget PopupShell, Form1, SBResLabel, SBStringResLabel, SBNumericResLabel; Widget Manager1, Manager2, Manager3; Widget ArrowSensLabel, ArrowSensPulldown, ArrowSensOptions, ArrowSensPB[NUM_ARROW_SENS_BTNS]; Widget DecimalPtsLabel, DecimalPtsTF; Widget IncrValueLabel, IncrValueTF; Widget MaxValueLabel, MaxValueTF; Widget MinValueLabel, MinValueTF; Widget NumValuesLabel, NumValuesTF; Widget PositionLabel, PositionTF; Widget ChildTypeLabel, ChildTypePulldown, ChildTypeOptions, ChildTypePB[NUM_CHILD_TYPE_BTNS]; Widget ValuesLabel, ValuesComboBox; XmString string; int i; n = 0; XtSetArg( args[n], XmNx, 0 ); n++; XtSetArg( args[n], XmNy, 500 ); n++; XtSetArg( args[n], XmNwidth, CONTROL_PANEL_WIDTH ); n++; XtSetArg( args[n], XmNheight, CONTROL_PANEL_HEIGHT ); n++; PopupShell = XtCreatePopupShell("Resource Control Panel", topLevelShellWidgetClass, Shell1, args, n ); XtManageChild( PopupShell ); n = 0; Form1 = XmCreateForm( PopupShell, "Form1", args, n ); XtManageChild( Form1 ); string = XmStringCreateLtoR("SpinBox Resources", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNlabelString, string ); n++; XtSetArg( args[n], XmNbackground, CommonGetColor("white")); n++; XtSetArg( args[n], XmNforeground, CommonGetColor("blue")); n++; SBResLabel = XmCreateLabel( Form1, "SBResLabel", args, n ); XtManageChild( SBResLabel ); XmStringFree( string ); Manager1 = CreateSpinBoxResourceControls( Form1, SBResLabel, Form1, Form1 ); /* * Create SpinBox Constraint Resource Panel for an XmSTRING child * type. */ Manager2 = CreateConstraintResourceControls( Form1, Form1, Form1, XmSTRING ); string = XmStringCreateLtoR("SpinBox Constraint Resources - XmSTRING", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNtopWidget, Manager1 ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_FORM ); n++; XtSetArg( args[n], XmNlabelString, string ); n++; XtSetArg( args[n], XmNbackground, CommonGetColor("white")); n++; XtSetArg( args[n], XmNforeground, CommonGetColor("blue")); n++; SBStringResLabel = XmCreateLabel( Form1, "SBStringResLabel", args, n ); XtManageChild( SBStringResLabel ); XmStringFree( string ); /* * Create SpinBox Constraint Resource Panel for an XmNUMERIC child * type. */ Manager3 = CreateConstraintResourceControls( Form1, Manager2, Form1, XmNUMERIC ); string = XmStringCreateLtoR("SpinBox Constraint Resources - XmNUMERIC", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNtopWidget, Manager1 ); n++; XtSetArg( args[n], XmNx, CONTROL_PANEL_WIDTH / 2 - MARGIN ); n++; XtSetArg( args[n], XmNlabelString, string ); n++; XtSetArg( args[n], XmNbackground, CommonGetColor("white")); n++; XtSetArg( args[n], XmNforeground, CommonGetColor("blue")); n++; SBNumericResLabel = XmCreateLabel( Form1, "SBStringResLabel", args, n ); XtManageChild( SBNumericResLabel ); XmStringFree( string ); XtPopup( PopupShell, XtGrabNone ); }
RGISGrdPanel::RGISGrdPanel (Widget parent, Widget leftWidget) : RGISPanel (parent,leftWidget) { int argNum; Arg wargs [16]; Widget label; XmString string; string = XmStringCreate ((char *) "Layers:",UICharSetBold); label = XtVaCreateManagedWidget ("RGISGrdPanelLayersLabel",xmLabelWidgetClass,Form (), XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNlabelString, string, NULL); XmStringFree (string); argNum = 0; XtSetArg (wargs [argNum], XmNtopAttachment, XmATTACH_WIDGET); ++argNum; XtSetArg (wargs [argNum], XmNtopWidget, label); ++argNum; XtSetArg (wargs [argNum], XmNtopOffset, 5); ++argNum; XtSetArg (wargs [argNum], XmNleftAttachment, XmATTACH_FORM); ++argNum; XtSetArg (wargs [argNum], XmNleftOffset, 20); ++argNum; XtSetArg (wargs [argNum], XmNrightAttachment, XmATTACH_FORM); ++argNum; XtSetArg (wargs [argNum], XmNrightOffset, 20); ++argNum; XtSetArg (wargs [argNum], XmNscrollingPolicy, XmAUTOMATIC); ++argNum; XtSetArg (wargs [argNum], XmNscrollBarDisplayPolicy, XmAS_NEEDED); ++argNum; XtSetArg (wargs [argNum], XmNvisualPolicy, XmVARIABLE); ++argNum; XtSetArg (wargs [argNum], XmNvisibleItemCount, 5); ++argNum; XtSetArg (wargs [argNum], XmNshadowThickness, 2); ++argNum; XtSetArg (wargs [argNum], XmNselectionPolicy, XmSINGLE_SELECT); ++argNum; XtSetArg (wargs [argNum], XmNtextColumns, DBStringLength); ++argNum; XtManageChild (LayerListWGT = XmCreateScrolledList (Form (),(char *) "RGISGrdPanelLayerList",wargs,argNum)); XtAddCallback (LayerListWGT,XmNsingleSelectionCallback, (XtCallbackProc) _RGISGridLayerListCBK,(void *) NULL); string = XmStringCreate ((char *) "Dynamic Shades",UICharSetBold); DynamicToggleWGT = XtVaCreateManagedWidget ("RGISGrdPanelDynamicToggleWGT",xmToggleButtonGadgetClass,Form (), XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, LayerListWGT, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 5, XmNlabelString, string, XmNhighlightThickness, 0, XmNshadowThickness, 0, XmNset, False, NULL); XmStringFree (string); string = XmStringCreate ((char *) "Annotate",UICharSetBold); AnnotateToggleWGT = XtVaCreateManagedWidget ("RGISNetGrdPanelAnnotToggleWGT",xmToggleButtonGadgetClass,Form (), XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, LayerListWGT, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, XmNlabelString, string, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 5, XmNhighlightThickness, 0, XmNshadowThickness, 0, XmNset, False, NULL); XmStringFree (string); }
void pgfilterw_create ( Widget parent ) /************************************************************************ * pgfilterw_create * * * * This function creates the display filter control window. * * * * void pgfilterw_create ( parent ) * * * * Input parameters: * * parent Widget Parent widget * * * * Output parameters: * * * ** * * Log: * * J. Wu/SAIC 07/04 initial coding * * E. Safford/SAIC 08/04 make filter times horizontal layout & * * use ALL_ON/ALL_OFF definitions * * T. Piper/SAIC 10/05 declared ii & nn long * * J. Wu/SAIC 06/06 load table from CVG lib & adjust layout * * M. Li/SAIC 02/07 Change callback type for filter hour * ***********************************************************************/ { int ier; long ii, nn; char *ctlstrs[] = { ALL_ON, "Close" }; Widget pane, optform, cntl_form; XmString xmstr; /*---------------------------------------------------------------------*/ /* * Load the filter table. */ cvg_rdfilter ( &ier ); /* * Initialize filter selections in CVG library */ strcpy ( _curFilter, CANCEL_FILTER ); cvg_setfilter ( _curFilter, &ier ); /* * Retrieve all valid filter entries */ cvg_gettblfilter ( &_nFilTime[TIME_FILTER], _filTime[TIME_FILTER], &ier ); for ( ii = 0; ii < _nFilTime[TIME_FILTER]; ii++ ) { _filterStatus[ii] = False; } /* * Create main dialog window. */ _filterForm = XmCreateFormDialog ( parent, "pgfilterw_popup", NULL, 0 ); xmstr = XmStringCreateLocalized("Filter Control"); XtVaSetValues ( _filterForm, XmNnoResize, TRUE, XmNautoUnmanage, FALSE, XmNdialogTitle, xmstr, NULL ); XmStringFree(xmstr); /* * Create pane area. */ pane = XtVaCreateManagedWidget ( "filterw_pane", xmPanedWindowWidgetClass, _filterForm, XmNsashWidth, 1, XmNsashHeight, 1, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL ); /* * Create check buttons */ optform = XtVaCreateManagedWidget ( "filterw_optform", xmRowColumnWidgetClass, pane, XmNpacking, XmPACK_TIGHT, XmNorientation, XmHORIZONTAL, NULL ); nn = _nFilTime[0]; _filterChkBtn = (WidgetList) XtMalloc( (size_t)nn * sizeof(Widget) ); for ( ii = 0; ii < nn; ii++ ) { _filterChkBtn[ii] = XtVaCreateManagedWidget ( _filTime[0][ii], xmToggleButtonWidgetClass, optform, NULL ); XtAddCallback ( _filterChkBtn[ii], XmNvalueChangedCallback, (XtCallbackProc)pgfilterw_toggleCb, (XtPointer) ii ); } /* * Create control buttons */ nn = XtNumber ( ctlstrs ); _cntlBtn = (WidgetList) XtMalloc( (size_t)nn * sizeof(Widget) ); cntl_form = XtVaCreateManagedWidget ( "filter_cntl_form", xmFormWidgetClass, pane, XmNfractionBase, nn * 100, NULL ); for ( ii = 0; ii < nn; ii++ ) { _cntlBtn[ii] = XtVaCreateManagedWidget ( ctlstrs[ii], xmPushButtonWidgetClass, cntl_form, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, ((ii * 100) + 10 ), XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, (((ii + 1) * 100) - 10), NULL ); XtAddCallback ( _cntlBtn[ii], XmNactivateCallback, (XtCallbackProc)pgfilterw_ctlBtnCb, (XtPointer) ii ); } /* * Make the "ALL ON/ALL OFF" button insensetive if no valid filters * found from the filter table. */ if ( _nFilTime[TIME_FILTER] <= 0 ) { XtSetSensitive ( _cntlBtn[0], False ); } }
RGISNetPanel::RGISNetPanel (Widget parent, Widget leftWidget) : RGISPanel (parent,leftWidget) { int button; Widget rowCol, label; XmString string; ColorMenuWGT = XmCreatePulldownMenu (Form (),(char *) "RGISNetPanelColorMenu",NULL,0); for (button = 0;button < (int) (sizeof (_RGISNetPanelColors) / sizeof (RGISNetPanelColor)); ++button) _RGISNetPanelColors [button].MakeButton (ColorMenuWGT); string = XmStringCreate ((char *) "Color Code:",UICharSetBold); ColorMenuWGT = XtVaCreateManagedWidget ("RGISNetPanelColorMenu",xmRowColumnWidgetClass,Form (), XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 25, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 15, XmNsubMenuId, ColorMenuWGT, XmNlabelString, string, XmNrowColumnType, XmMENU_OPTION, XmNtraversalOn, False, NULL); XmStringFree (string); string = XmStringCreate ((char *) "Stick Symbol:",UICharSetBold); label = XtVaCreateManagedWidget ("RGISNetPanelSymbolLabel",xmLabelWidgetClass,Form (), XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, ColorMenuWGT, XmNtopOffset, 25, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNlabelString, string, NULL); XmStringFree (string); rowCol = XtVaCreateManagedWidget ("RGISNetPanelRowColumn",xmRowColumnWidgetClass,Form (), XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, ColorMenuWGT, XmNtopOffset, 25, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, label, XmNleftOffset, 5, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNorientation, XmVERTICAL, XmNpacking, XmPACK_COLUMN, XmNspacing, 0, XmNmarginWidth, 0, XmNmarginHeight, 0, XmNnumColumns, 1, XmNradioBehavior, False, XmNradioAlwaysOne, False, NULL); string = XmStringCreate ((char *) "Direction",UICharSetNormal); FlowDirToggleWGT = XtVaCreateManagedWidget ("RGISNetPanelFlowDirToggleWGT",xmToggleButtonGadgetClass,rowCol, XmNlabelString, string, XmNhighlightThickness, 0, XmNset, True, NULL); XmStringFree (string); XtAddCallback (FlowDirToggleWGT,XmNvalueChangedCallback,(XtCallbackProc) _RGISPanelFlagsToggleCBK,(void *) DBDataFlagDispModeNetDirection); string = XmStringCreate ((char *) "Active Only",UICharSetNormal); ActiveToggleWGT = XtVaCreateManagedWidget ("RGISNetPanelActiveToggleWGT",xmToggleButtonGadgetClass,rowCol, XmNlabelString, string, XmNhighlightThickness, 0, XmNset, True, NULL); XmStringFree (string); XtAddCallback (ActiveToggleWGT,XmNvalueChangedCallback,(XtCallbackProc) _RGISPanelFlagsToggleCBK,(void *) DBDataFlagHideIdle); }
/* ** Create a dialog for the output of a shell command. The dialog lives until ** the user presses the Dismiss button, and is then destroyed */ static void createOutputDialog(Widget parent, char *text) { Arg al[50]; int ac, rows, cols, hasScrollBar, wrapped; Widget form, textW, button; XmString st1; /* measure the width and height of the text to determine size for dialog */ measureText(text, MAX_OUT_DIALOG_COLS, &rows, &cols, &wrapped); if (rows > MAX_OUT_DIALOG_ROWS) { rows = MAX_OUT_DIALOG_ROWS; hasScrollBar = True; } else hasScrollBar = False; if (cols > MAX_OUT_DIALOG_COLS) cols = MAX_OUT_DIALOG_COLS; if (cols == 0) cols = 1; /* Without completely emulating Motif's wrapping algorithm, we can't be sure that we haven't underestimated the number of lines in case a line has wrapped, so let's assume that some lines could be obscured */ if (wrapped) hasScrollBar = True; ac = 0; form = CreateFormDialog(parent, "shellOutForm", al, ac); ac = 0; XtSetArg(al[ac], XmNlabelString, st1=MKSTRING("OK")); ac++; XtSetArg(al[ac], XmNmarginWidth, BUTTON_WIDTH_MARGIN); ac++; XtSetArg(al[ac], XmNhighlightThickness, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; button = XmCreatePushButtonGadget(form, "ok", al, ac); XtManageChild(button); XtVaSetValues(form, XmNdefaultButton, button, NULL); XtVaSetValues(form, XmNcancelButton, button, NULL); XmStringFree(st1); XtAddCallback(button, XmNactivateCallback, destroyOutDialogCB, XtParent(form)); ac = 0; XtSetArg(al[ac], XmNrows, rows); ac++; XtSetArg(al[ac], XmNcolumns, cols); ac++; XtSetArg(al[ac], XmNresizeHeight, False); ac++; XtSetArg(al[ac], XmNtraversalOn, False); ac++; XtSetArg(al[ac], XmNwordWrap, True); ac++; XtSetArg(al[ac], XmNscrollHorizontal, False); ac++; XtSetArg(al[ac], XmNscrollVertical, hasScrollBar); ac++; XtSetArg(al[ac], XmNhighlightThickness, 0); ac++; XtSetArg(al[ac], XmNspacing, 0); ac++; XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++; XtSetArg(al[ac], XmNeditable, False); ac++; XtSetArg(al[ac], XmNvalue, text); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomWidget, button); ac++; textW = XmCreateScrolledText(form, "outText", al, ac); AddMouseWheelSupport(textW); XtManageChild(textW); XtVaSetValues(XtParent(form), XmNtitle, "Output from Command", NULL); ManageDialogCenteredOnPointer(form); }
RGISGrpPanel::RGISGrpPanel (Widget parent, Widget leftWidget) : RGISPanel (parent,leftWidget) { int argNum; Arg wargs [18]; XmString string; Widget newButton, subForm; subForm = XtVaCreateManagedWidget ("RGISGrpPanelSubForm",xmFormWidgetClass,Form (), XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 15, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 15, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 15, XmNshadowThickness, 0, NULL); string = XmStringCreate ((char *) "New",UICharSetBold); newButton = XtVaCreateManagedWidget ("RGISGrpPanelNewButtonWGT",xmPushButtonGadgetClass,subForm, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 25, XmNbottomAttachment, XmATTACH_FORM, XmNlabelString, string, NULL); XmStringFree (string); XtAddCallback (newButton,XmNactivateCallback,(XtCallbackProc) _RGISGrpPanelNewCBK,(void *) this); string = XmStringCreate ((char *) "Delete",UICharSetBold); DeleteButtonWGT = XtVaCreateManagedWidget ("RGISGrpPanelLoadButtonWGT",xmPushButtonGadgetClass,subForm, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 25, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 50, XmNbottomAttachment, XmATTACH_FORM, XmNlabelString, string, NULL); XtSetSensitive (DeleteButtonWGT,False); XmStringFree (string); XtAddCallback (DeleteButtonWGT,XmNactivateCallback,(XtCallbackProc) _RGISGrpPanelDeleteCBK,(void *) this); string = XmStringCreate ((char *) "Load",UICharSetBold); LoadButtonWGT = XtVaCreateManagedWidget ("RGISGrpPanelLoadButtonWGT",xmPushButtonGadgetClass,subForm, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 50, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 75, XmNbottomAttachment, XmATTACH_FORM, XmNlabelString, string, NULL); XtSetSensitive (LoadButtonWGT,False); XmStringFree (string); XtAddCallback (LoadButtonWGT,XmNactivateCallback,(XtCallbackProc) _RGISGrpPanelLoadCBK,(void *) this); string = XmStringCreate ((char *) "Save",UICharSetBold); SaveButtonWGT = XtVaCreateManagedWidget ("RGISGrpPanelSaveButtonWGT",xmPushButtonGadgetClass,subForm, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 75, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNlabelString, string, NULL); XtSetSensitive (SaveButtonWGT,False); XmStringFree (string); XtAddCallback (SaveButtonWGT,XmNactivateCallback,(XtCallbackProc) _RGISGrpPanelSaveCBK,(void *) this); argNum = 0; XtSetArg (wargs [argNum], XmNtopAttachment, XmATTACH_FORM); ++argNum; XtSetArg (wargs [argNum], XmNtopOffset, 15); ++argNum; XtSetArg (wargs [argNum], XmNleftAttachment, XmATTACH_FORM); ++argNum; XtSetArg (wargs [argNum], XmNleftOffset, 15); ++argNum; XtSetArg (wargs [argNum], XmNrightAttachment, XmATTACH_FORM); ++argNum; XtSetArg (wargs [argNum], XmNrightOffset, 15); ++argNum; XtSetArg (wargs [argNum], XmNbottomAttachment, XmATTACH_WIDGET); ++argNum; XtSetArg (wargs [argNum], XmNbottomWidget, subForm); ++argNum; XtSetArg (wargs [argNum], XmNbottomOffset, 10); ++argNum; XtSetArg (wargs [argNum], XmNscrollingPolicy, XmAUTOMATIC); ++argNum; XtSetArg (wargs [argNum], XmNscrollBarDisplayPolicy, XmAS_NEEDED); ++argNum; XtSetArg (wargs [argNum], XmNvisualPolicy, XmVARIABLE); ++argNum; XtSetArg (wargs [argNum], XmNshadowThickness, 2); ++argNum; XtSetArg (wargs [argNum], XmNselectionPolicy, XmSINGLE_SELECT); ++argNum; XtSetArg (wargs [argNum], XmNtextColumns, DBStringLength); ++argNum; XtManageChild (GroupListWGT = XmCreateScrolledList (Form (),(char *) "RGISGrpPanelList",wargs,argNum)); XtAddCallback (GroupListWGT,XmNsingleSelectionCallback, (XtCallbackProc) _RGISGridGroupListCBK,(void *) this); GroupLIST = (DBObjectLIST<DBObjTableField> *) NULL; }
void scrnInitX(void) { Widget toplevel, control; Widget mb, fileMenu, viewMenu, confMenu, helpMenu; Widget procFrame = NULL, bboxFrame = NULL; #ifdef ICON_DEFINED Pixmap icon; #endif XmString s; Arg args[10]; unsigned i, n; int argc = 0; addRegwRsrcOpts(); addDatwRsrcOpts(); toplevel = XtAppInitialize(&app_context, "XSki", options, topopts, &argc, NULL, NULL, NULL, 0); top_level = toplevel; /* XXX - temporary for Platform only */ XtGetApplicationResources(toplevel, &app_data, resources, toprsrc, NULL, 0); XtAppAddActions(app_context, actions, XtNumber(actions)); dpy = XtDisplay(toplevel); #ifdef ICON_DEFINED /* set default icon */ icon = XCreateBitmapFromData(dpy, RootWindowOfScreen(XtScreen(toplevel)), icon_bits, icon_width, icon_height); XtSetArg(args[0], XmNiconPixmap, icon); XtSetValues(toplevel, args, 1); #endif #if 0 XSynchronize(dpy, True); #endif /* create control window manager */ control = XmCreateForm(toplevel, "control", NULL, 0); XtManageChild(control); /* Control window menubar */ n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; mb = XmCreateMenuBar(control, "mb", args, n); XtManageChild(mb); fileMenu = createMBitem(mb, "File"); viewMenu = createMBitem(mb, "View"); confMenu = createMBitem(mb, "Configure"); helpMenu = createMBitem(mb, "Help"); #if 0 createSubmenuItem(fileMenu, "load", loadCallback); #else createSubmenuItem(fileMenu, "load", 0); #endif createSubmenuItem(fileMenu, "save", 0); createSubmenuItem(fileMenu, "trace", 0); createSubmenuItem(fileMenu, "traceOn", 0); createSubmenuItem(fileMenu, "traceOff", 0); createSubmenuItem(fileMenu, "read", 0); XtManageChild(XmCreateSeparatorGadget(fileMenu, "", NULL, 0)); createSubmenuItem(fileMenu, "quit", simCmdCallback); createSubmenuItem(viewMenu, "program", programCallback); createSubmenuItem(viewMenu, "data", dataCallback); createSubmenuItem(viewMenu, "registers", regCallback); createSubmenuItem(viewMenu, "cache", 0); createSubmenuItem(viewMenu, "tlb", sdtCallback); XtManageChild(XmCreateSeparatorGadget(viewMenu, "", NULL, 0)); createSubmenuItem(viewMenu, "callstack", cstCallback); createSubmenuItem(viewMenu, "statistics", 0); createSubmenuItem(viewMenu, "breakpoints", blistCallback); createSubmenuItem(viewMenu, "branches", 0); createSubmenuItem(viewMenu, "symbols", symlistCallback); createSubmenuItem(viewMenu, "macros", 0); #if 0 /* No support for window format yet */ createSubmenuItem(confMenu, "program", prgFmtCallback); #else createSubmenuItem(confMenu, "program", 0); #endif createSubmenuItem(confMenu, "data", 0); #if 0 /* No support for window format yet */ createSubmenuItem(confMenu, "registers", regFmtCallback); #else createSubmenuItem(confMenu, "registers", 0); #endif createSubmenuItem(helpMenu, "context", 0); createSubmenuItem(helpMenu, "overview", 0); createSubmenuItem(helpMenu, "commands", cmdHelpCallback); createSubmenuItem(helpMenu, "product", prodInfoCallback); /* Control window processor option menu */ if (nproc > 1) { Widget procMenu, proc[NPROC]; n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, mb); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; procFrame = XmCreateFrame(control, "", args, n); XtManageChild(procFrame); procMenu = XmCreatePulldownMenu(procFrame, "", NULL, 0); for (i = 0; i < nproc; i++) { char name[4]; (void)sprintf(name, "p%d", i); proc[i] = XmCreatePushButton(procMenu, name, NULL, 0); XtAddCallback(proc[i], XmNactivateCallback, changeCprocCallback, (XtPointer)i); } XtManageChildren(proc, nproc); n = 0; XtSetArg(args[n], XmNsubMenuId, procMenu); n++; XtManageChild(XmCreateOptionMenu(procFrame, "procOption", args, n)); } /* Control window button box */ if (app_data.numButtons) { Widget bbox, btns[20]; /* create button box manager */ n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, procFrame ? procFrame : mb); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; bboxFrame = XmCreateFrame(control, "", args, n); XtManageChild(bboxFrame); /* create button box window */ bbox = XmCreateRowColumn(bboxFrame, "bbox", NULL, 0); XtManageChild(bbox); /* create each button */ for (i = 0; i < app_data.numButtons; i++) { char name[8]; (void)sprintf(name, "bb%d", i); btns[i] = XmCreatePushButton(bbox, name, NULL, 0); } XtManageChildren(btns, app_data.numButtons); } /* Control window command area */ n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, bboxFrame ? bboxFrame : procFrame ? procFrame : mb); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; cmd = XmCreateCommand(control, "cmd", args, n); XtManageChild(cmd); XtAddCallback(cmd, XmNcommandEnteredCallback, simCmdCallback, 0); /* command history box */ n = 0; XtSetArg(args[0], XmNinitialFocus, cmd); n++; XtSetValues(control, args, n); cmdHist = XmCommandGetChild(cmd, XmDIALOG_HISTORY_LIST); /* message window */ msgs = XmCreateScrolledText(control, "msgs", NULL, 0); XtManageChild(msgs); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, cmd); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetValues(XtParent(msgs), args, n); /* create stop simulation dialog */ /* Consider changing this to a button. This would allow other functionality to still be active when simulation is going on. For example, Help, Quit, opening and closing windows, etc. */ stopsim = XmCreateWorkingDialog(control, "stopsim", NULL, 0); n = 0; XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++; s = XmStringCreateLocalized("Running..."); XtSetArg(args[n], XmNdialogTitle, s); n++; s = XmStringCreateLocalized(" icnt: 0 "); XtSetArg(args[n], XmNmessageString, s); n++; s = XmStringCreateLocalized("Stop"); XtSetArg(args[n], XmNcancelLabelString, s); n++; XtSetValues(stopsim, args, n); XtAddCallback(stopsim, XmNcancelCallback, stop_execLoopXCB, NULL); XtUnmanageChild(XmMessageBoxGetChild(stopsim, XmDIALOG_OK_BUTTON)); XtUnmanageChild(XmMessageBoxGetChild(stopsim, XmDIALOG_HELP_BUTTON)); XmStringFree(s); /* XXX - This should probably be inside regwInit */ for (i = 0; i < topregw; i++) regwtbl[i].show = app_data.showRs[i]; /* XXX - This should probably be inside datwInit */ for (i = 0; i < topdatw; i++) datwtbl[i].show = app_data.viewDw[i]; prgwInit(); datwInit(); regwInit(); if (app_data.viewProg) prgwDrawX(); datwDrawX(); if (app_data.viewRegs) regwDrawX(); noscreen = NO; XtRealizeWidget(toplevel); }
void XschBuildPresentPanel() { Widget PanelLabel; Widget PanelButton; Pixmap PanelPixmap; XmString PanelString; XmString PanelString1; XmString PanelString2; XmFontList PanelFontList; XFontStruct *PanelFont; Display *PanelDisplay; char Buffer[ 64 ]; Arg Args[3]; autbegin(); PanelDisplay = XtDisplay( XschMainWindow ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-o-*--24-*" ); PanelFontList = XmFontListCreate( PanelFont, "Panel_charset1" ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--18-*" ); PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset2" ); PanelFont = XLoadQueryFont( PanelDisplay, "-*-helvetica-bold-r-*--12-*" ); PanelFontList = XmFontListAdd( PanelFontList, PanelFont, "Panel_charset4" ); XtSetArg( Args[0], XmNshadowType , XmSHADOW_ETCHED_IN ); XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING ); XtSetArg( Args[2], XmNtitle , "Xsch present" ); XschHelpPresentPanel.PANEL = XmCreateFormDialog( XschMainWindow, XschHelpPresentPanel.TITLE, Args, 3); XtAddCallback( XschHelpPresentPanel.PANEL, XmNdestroyCallback, XschDestroyDialogCallback, NULL ); XschHelpPresentPanel.PANEL_FORM = XtVaCreateManagedWidget( "", xmFormWidgetClass, XschHelpPresentPanel.PANEL, XmNtopAttachment , XmATTACH_FORM, XmNbottomAttachment , XmATTACH_FORM, XmNleftAttachment , XmATTACH_FORM, XmNrightAttachment , XmATTACH_FORM, NULL ); XschHelpPresentPanel.FRAME = XtVaCreateManagedWidget( "", xmFrameWidgetClass, XschHelpPresentPanel.PANEL_FORM, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 05, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition , 95, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 05, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 95, NULL ); XschHelpPresentPanel.FORM = XtVaCreateManagedWidget( "", xmFormWidgetClass, XschHelpPresentPanel.FRAME, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 05, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition , 95, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 05, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 95, NULL ); PanelPixmap = XschCreatePixmap( XschMainWindow, LIP6bw_bits, LIP6bw_width, LIP6bw_height); PanelLabel = XtVaCreateManagedWidget( "", xmLabelGadgetClass, XschHelpPresentPanel.FORM, XmNlabelType , XmPIXMAP, XmNlabelPixmap , PanelPixmap, NULL ); sprintf( Buffer, "ALLIANCE CAD SYSTEM %s\n", ALLIANCE_VERSION ); PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XschHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_POSITION, XmNtopPosition , 15, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 75, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 25, NULL ); XmStringFree( PanelString ); PanelString1 = XmStringCreateLtoR( "Xsch" , "Panel_charset1" ); PanelString2 = XmStringCreateLtoR( "\n( Touch Me )", "Panel_charset4" ); PanelString = XmStringConcat( PanelString1, PanelString2 ); PanelButton = XtVaCreateManagedWidget( "", xmPushButtonWidgetClass, XschHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNshadowThickness , 3, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelLabel, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 60, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 40, NULL ); XmStringFree( PanelString ); XmStringFree( PanelString1 ); XmStringFree( PanelString2 ); XtAddCallback( PanelButton, XmNactivateCallback, XschExitDialogCallback, NULL ); sprintf( Buffer, "\nGraphic Schematic Viewer\nVersion %s", VERSION ); PanelString = XmStringCreateLtoR( Buffer, "Panel_charset2" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XschHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelButton, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_POSITION, XmNrightPosition , 75, XmNleftAttachment , XmATTACH_POSITION, XmNleftPosition , 25, NULL ); XmStringFree( PanelString ); PanelString = XmStringCreateLtoR( "copyright \251 1996-2004 ASIM, \ CAO-VLSI Team\nWritten by Ludovic Jacomme\nE-mail : [email protected]", "Panel_charset4" ); PanelLabel = XtVaCreateManagedWidget( "", xmLabelWidgetClass, XschHelpPresentPanel.FORM, XmNfontList , PanelFontList, XmNlabelString , PanelString, XmNtopAttachment , XmATTACH_WIDGET, XmNtopWidget , PanelLabel, XmNtopOffset , 5, XmNrightAttachment , XmATTACH_FORM, XmNleftAttachment , XmATTACH_FORM, NULL ); XmStringFree( PanelString ); autend(); }
static Widget create_dialogs(popupMessageSizeHintT size, Widget parent, int cnt, const char *helptext, pre_message_cbT pre_cb, XtPointer arg, const char *yes_button, message_cbT yes_cb, XtPointer yes_arg, const char *no_button, message_cbT no_cb, XtPointer no_arg, const char *cancel_button, message_cbT cancel_cb, XtPointer cancel_arg) { Widget new_popup_window; char *translations_str = NULL; #ifdef MOTIF Widget new_dialog; UNUSED(size); #else char *key_translations_str = NULL; int msg_w = 400, msg_h = 100; Widget new_message_paned, new_message_text, new_message_box, new_message_ok, new_message_help = 0, new_message_not_ok; XtTranslations wm_translations, key_translations; #endif /* save callbacks to global arrays */ pre_callbacks[cnt].callback = pre_cb; pre_callbacks[cnt].arg = arg; yes_callbacks[cnt].callback = yes_cb; yes_callbacks[cnt].arg = yes_arg; no_callbacks[cnt].callback = no_cb; no_callbacks[cnt].arg = no_arg; cancel_callbacks[cnt].callback = cancel_cb; cancel_callbacks[cnt].arg = cancel_arg; XtAddActions(popdown_actions, XtNumber(popdown_actions)); #ifndef MOTIF /* get index into WM_popdown arg */ translations_str = get_string_va("<Message>WM_PROTOCOLS: WM_popdown(%d)", cnt); wm_translations = XtParseTranslationTable(translations_str); free(translations_str); #endif if (!XtIsRealized(globals.widgets.top_level)) { /* If toplevel window hasn't been realized yet, create a new toplevel shell (otherwise, setting visual/color map wouldn't work); use same application names so that resource settings will also apply to this window. */ new_popup_window = XtVaAppCreateShell("xdvi", "Xdvi", transientShellWidgetClass, DISP, NULL); } else { new_popup_window = XtVaCreatePopupShell(Xdvi_MESSAGE_SHELL_NAME, #ifdef MOTIF xmDialogShellWidgetClass, parent, XmNdeleteResponse, XmDO_NOTHING, /* we'll take care of that ourselves */ #else transientShellWidgetClass, parent, XtNx, 60, XtNy, 80, XtNtranslations, wm_translations, XtNaccelerators, G_accels_cr, #endif XtNtransientFor, parent, XtNmappedWhenManaged, False, NULL); } #ifdef MOTIF WM_DELETE_WINDOW = XmInternAtom(XtDisplay(new_popup_window), "WM_DELETE_WINDOW", False); XmAddWMProtocolCallback(new_popup_window, WM_DELETE_WINDOW, cancel_action, NULL); /* We also need to override the default ESC binding to use our internal housekeeping functions */ translations_str = get_string_va("#override\n<Key>osfCancel:close-popup-cancel(%d)", cnt); /* { */ /* XtTranslations xlats; */ /* char *translation_str = get_string_va("<Key>osfCancel:close-popup-cancel(%d)", cnt); */ /* xlats = XtParseTranslationTable(translation_str); */ /* free(translation_str); */ /* XtOverrideTranslations(new_dialog, xlats); */ /* } */ new_dialog = XtVaCreateWidget(Xdvi_MESSAGE_DIALOG_NAME, xmMessageBoxWidgetClass, new_popup_window, XmNdialogType, XmDIALOG_WARNING, /* default */ XmNtraversalOn, True, XmNhighlightOnEnter, True, XmNuserData, cast_int_to_XtPointer(cnt), XmNtranslations, XtParseTranslationTable(translations_str), NULL); free(translations_str); XtAddCallback(new_dialog, XmNokCallback, ok_action, NULL); if (no_button != NULL) { Arg args[4]; Widget b; XmString b_str = XmStringCreateLocalized((char *)no_button); XtSetArg(args[0], XmNlabelString, b_str); b = XmCreatePushButton(new_dialog, "no_button", args, 1); XtAddCallback(b, XmNactivateCallback, not_ok_action, NULL); XtManageChild(b); } if (cancel_button != NULL) { XmString cancel_label = XmStringCreateLtoR((char *)cancel_button, G_charset); XtVaSetValues(XmMessageBoxGetChild(new_dialog, XmDIALOG_CANCEL_BUTTON), XmNlabelString, cancel_label, NULL); XmStringFree(cancel_label); XtAddCallback(new_dialog, XmNcancelCallback, cancel_action, NULL); } else { XtUnmanageChild(XmMessageBoxGetChild(new_dialog, XmDIALOG_CANCEL_BUTTON)); } XtInstallAllAccelerators(new_dialog, XmMessageBoxGetChild(new_dialog, XmDIALOG_OK_BUTTON)); if (helptext != NULL) { XtAddCallback(new_dialog, XmNhelpCallback, help_action, (XtPointer)helptext); } else { XtUnmanageChild(XmMessageBoxGetChild(new_dialog, XmDIALOG_HELP_BUTTON)); } if (yes_button != NULL) { /* change `OK' button label */ XmString yes_label; yes_label = XmStringCreateLtoR((char *)yes_button, G_charset); XtVaSetValues(XmMessageBoxGetChild(new_dialog, XmDIALOG_OK_BUTTON), XmNlabelString, yes_label, NULL); XmStringFree(yes_label); } /* insert the new widgets into the global arrays */ dialog[cnt] = new_dialog; #else /* MOTIF */ switch (size) { case SIZE_SMALL: msg_w = 300; msg_h = 100; break; case SIZE_MEDIUM: msg_w = 430; msg_h = 160; break; case SIZE_LARGE: msg_w = 450; msg_h = 180; break; } WM_DELETE_WINDOW = XInternAtom(XtDisplay(new_popup_window), "WM_DELETE_WINDOW", False); new_message_paned = XtVaCreateManagedWidget("message_paned", panedWidgetClass, new_popup_window, XtNaccelerators, G_accels_cr, NULL); new_message_text = XtVaCreateManagedWidget("message_text", asciiTextWidgetClass, new_message_paned, /* XtNheight, 100, */ /* XtNwidth, 400, */ XtNwidth, msg_w, XtNheight, msg_h, /* wrap horizontally instead of scrolling * TODO: this won't work for the first widget instance? */ XtNwrap, XawtextWrapWord, XtNscrollVertical, XAW_SCROLL_ALWAYS, XtNeditType, XawtextRead, XtNinput, True, XtNdisplayCaret, False, XtNleftMargin, 5, XtNaccelerators, G_accels_cr, NULL); /* box for the OK/Cancel button */ new_message_box = XtVaCreateManagedWidget("message_box", formWidgetClass, new_message_paned, /* resizing by user isn't needed */ XtNshowGrip, False, XtNdefaultDistance, 6, /* some padding */ /* resizing the window shouldn't influence this box, * but only the text widget */ XtNskipAdjust, True, XtNaccelerators, G_accels_cr, NULL); new_message_ok = XtVaCreateManagedWidget(yes_button == NULL ? "OK" : yes_button, commandWidgetClass, new_message_box, XtNtop, XtChainTop, XtNbottom, XtChainBottom, XtNleft, XtChainLeft, XtNright, XtChainLeft, XtNaccelerators, G_accels_cr, NULL); /* add quit_action callback for the "OK" button */ /* FIXME: how to make accelerators be accepted by new_popup_window as well? */ key_translations_str = get_string_va("<Key>q:close-popup-cancel(%d)\n" "<Key>Return:close-popup-cancel(%d)\n" "<Key>Escape:close-popup-cancel(%d)\n", cnt, cnt, cnt); key_translations = XtParseTranslationTable(key_translations_str); free(key_translations_str); XtOverrideTranslations(new_popup_window, key_translations); XtOverrideTranslations(new_message_paned, key_translations); XtOverrideTranslations(new_message_text, key_translations); XtInstallAllAccelerators(new_message_box, new_message_ok); XtAddCallback(new_message_ok, XtNcallback, ok_action, cast_int_to_XtPointer(cnt)); /* we create additional buttons in any case, to make the sizing more consistent */ new_message_help = XtVaCreateManagedWidget("Help", commandWidgetClass, new_message_box, XtNtop, XtChainTop, XtNfromHoriz, new_message_ok, XtNbottom, XtChainBottom, XtNleft, XtChainRight, XtNright, XtChainRight, XtNaccelerators, G_accels_cr, NULL); message_help[cnt] = new_message_help; /* add cancel button */ new_message_not_ok = XtVaCreateManagedWidget(cancel_button == NULL ? "Cancel" : cancel_button, commandWidgetClass, new_message_box, XtNtop, XtChainTop, XtNfromHoriz, new_message_ok, XtNbottom, XtChainBottom, XtNleft, helptext == NULL ? XtChainRight : XtChainLeft, XtNright, helptext == NULL ? XtChainRight : XtChainLeft, XtNaccelerators, G_accels_cr, NULL); message_not_ok[cnt] = new_message_not_ok; if (no_button != NULL) { ASSERT(0, "third button not yet implemented in Xaw!!!"); } adjust_width_to_max(new_message_ok, new_message_help, new_message_not_ok, NULL); /* if helptext argument is not-NULL, add help_action callback, else unmanage help button */ if (helptext != NULL) { XtAddCallback(new_message_help, XtNcallback, help_action, (XtPointer)helptext); } else { XtUnmanageChild(new_message_help); } if (cancel_button != NULL) { XtAddCallback(new_message_not_ok, XtNcallback, cancel_action, cast_int_to_XtPointer(cnt)); } else { XtUnmanageChild(new_message_not_ok); } /* insert the new widgets into the global arrays */ message_box[cnt] = new_message_box; message_paned[cnt] = new_message_paned; message_text[cnt] = new_message_text; message_ok[cnt] = new_message_ok; #endif /* MOTIF */ popup_window[cnt] = new_popup_window; return new_popup_window; }
main(int argc, char **argv) { Widget shell, rowcolumn, scale, pushbutton, label1, label2, text; Widget paned, text2; int n, i; Widget widlist[100]; Widget emacscli[100]; Arg args[100]; int no_ews = 1; char buf[100]; if (argc > 1) no_ews = atoi(argv[1]); shell = XtAppInitialize(&xt_app_con, "Testmotif", NULL, 0, &argc, argv, NULL, NULL, 0); rowcolumn = XmCreateRowColumn(shell, "rowcolumn", NULL, 0); XtManageChild(rowcolumn); n = 0; XtSetArg(args[n], XmNtraversalOn, TRUE); n++; #if 0 label1 = XmCreateLabel(rowcolumn, "label1", args, n); #endif label1 = XtVaCreateWidget("label1", xmLabelWidgetClass, rowcolumn, XmNwidth, 50, XmNheight, 30, XmNtraversalOn, TRUE, NULL); label2 = XmCreateLabel(rowcolumn, "label2", NULL, 0); scale = XmCreateScale(rowcolumn, "scale", NULL, 0); XtAddCallback(scale, XmNvalueChangedCallback, ScaleValueChangedCB, label1); paned = XmCreatePanedWindow(rowcolumn, "paned", NULL, 0); n = 0; widlist[n++] = label1; widlist[n++] = label2; widlist[n++] = scale; widlist[n++] = paned; XtManageChildren(widlist, n); pushbutton = XmCreatePushButton(paned, "pushbutton", NULL, 0); text = XmCreateText(paned, "text", NULL, 0); for (i = 0; i < no_ews; i++) { int sz = snprintf(buf, sizeof(buf), "extcli%d", i); assert(sz>=0 && sz < sizeof(buf)); emacscli[i] = XtVaCreateWidget(buf, externalClientWidgetClass, paned, XmNwidth, 500, XmNheight, 200, XmNtraversalOn, TRUE, NULL); } text2 = XmCreateText(paned, "text2", NULL, 0); n = 0; widlist[n++] = pushbutton; widlist[n++] = text; for (i = 0; i < no_ews; i++) widlist[n++] = emacscli[i]; widlist[n++] = text2; XtManageChildren(widlist, n); XtRealizeWidget(shell); { XmString lab; char labarr[1000]; char tmpbuf[50]; strcpy(labarr, "window:"); for (i = 0; i < no_ews; i++) { int sz = snprintf(tmpbuf, sizeof(tmpbuf), " %d", XtWindow(emacscli[i])); assert(sz>=0 && sz<sizeof(tmpbuf)); strcat(labarr, tmpbuf); } lab = XmStringCreateLocalized(labarr); XtVaSetValues(label2, XmNlabelString, lab, NULL); XmStringFree(lab); } XtAppMainLoop(xt_app_con); }
/* * Popup a window with wrapped text in it. * For Motif, the text is explicitly wrapped inside this method. */ static Widget internal_popup_window(Widget parent, popupMessageSizeHintT size, popupMessageT type, int x_coord, int y_coord, const char *helptext, char *msg_buf, #ifndef MOTIF const char *xaw_ret_action_str, #endif pre_message_cbT pre_cb, XtPointer arg, const char *yes_button, message_cbT yes_cb, XtPointer yes_arg, const char *no_button, message_cbT no_cb, XtPointer no_arg, const char *cancel_button, message_cbT cancel_cb, XtPointer cancel_arg) { int my_popup_num = 0; #ifdef MOTIF XmString str; #endif Widget ret; ASSERT(type < (sizeof my_msg_map / sizeof my_msg_map[0]), "too few elements in my_msg_map"); #if DEBUG fprintf(stderr, "internal_popup_window called with prompt: \"%s\"\n", msg_buf); #endif if (globals.widgets.top_level == 0) { /* If toplevel window hasn't been created yet, dump messages to STDERR and return. */ fprintf(stderr, "\n%s:\n%s\n", my_msg_map[type].window_title, msg_buf); if (helptext) { fputs("---------- helptext ----------\n", stderr); fputs(helptext, stderr); fputs("\n---------- end of helptext ----------\n", stderr); } return NULL; } /* search for first free position in g_popup_array */ while (my_popup_num < MAX_POPUPS && (g_popup_array[my_popup_num] == 1)) { my_popup_num++; } if (my_popup_num == MAX_POPUPS) { /* already enough popups on screen, just dump it to stderr */ fprintf(stderr, "%s: %s\n", my_msg_map[type].window_title, msg_buf); /* Note: If a mad function continues to open popups, this will * stop after MAX_POPUPS, but open a new window for each * window the user pops down. Maybe we ought to do something * about this. */ return NULL; } else { /* mark it as non-free */ g_popup_array[my_popup_num] = 1; } #if DEBUG fprintf(stderr, "first free position in g_popup_array: %d\n", my_popup_num); #endif /* just to make sure ... */ if (parent == NULL) parent = globals.widgets.top_level; /* create a new set of widgets for the additional popup. */ ret = create_dialogs(size, parent, my_popup_num, helptext, pre_cb, arg, yes_button, yes_cb, yes_arg, no_button, no_cb, no_arg, cancel_button, cancel_cb, cancel_arg); #ifdef MOTIF XtVaSetValues(popup_window[my_popup_num], XmNtitle, my_msg_map[type].window_title, NULL); XtVaSetValues(dialog[my_popup_num], XmNdialogType, my_msg_map[type].motif_msg_type, NULL); { /* wrap message at space before MSG_WRAP_LEN */ char *testwrap = msg_buf; int ctr; for (ctr = 0; *testwrap++; ctr++) { if (*testwrap == '\n') { ctr = 0; } else if (ctr > MSG_WRAP_LEN) { size_t before_len = 0, after_len = 0; char *before_ptr, *after_ptr; before_ptr = after_ptr = testwrap; /* try to find shortest sequence before or after point to wrap at; this seems to give the most pleasing results. */ while (before_ptr > msg_buf && !isspace((int)*--before_ptr)) { before_len++; } while (*after_ptr != '\0' && !isspace((int)*++after_ptr)) { after_len++; } if (before_len < after_len && isspace((int)*before_ptr)) { /* use last in sequence of multiple spaces */ while (isspace((int)*++before_ptr)) { ; } /* back up, and wrap */ *--before_ptr = '\n'; ctr = 0; } else if (isspace((int)*after_ptr)) { /* use last in sequence of multiple spaces */ while (isspace((int)*++after_ptr)) { ; } /* back up, and wrap */ *--after_ptr = '\n'; ctr = 0; } } } } str = XmStringCreateLtoR((char *)msg_buf, G_charset); XtVaSetValues(dialog[my_popup_num], XmNmessageString, str, XmNtraversalOn, True, XmNhighlightOnEnter, True, NULL); XmStringFree(str); XtManageChild(dialog[my_popup_num]); if (x_coord > 0 && y_coord > 0) { position_window(XtParent(dialog[my_popup_num]), (Position)x_coord, (Position)y_coord); } XtPopup(XtParent(dialog[my_popup_num]), XtGrabNone); /* XtPopup(XtParent(dialog[my_popup_num]), XtGrabExclusive); */ #else /* MOTIF */ /* add a binding of xaw_ret_action_str to <Return> to relevant widgets. The callbacks (xaw_ret_action_str) are responsible for parsing the passed arguments (pointers, or empty arguments). */ if (xaw_ret_action_str != NULL) { XtTranslations xlats; char *translation_str; if (yes_arg != NULL) translation_str = get_string_va("<Key>Return:close-popup(%d)%s(%p)", my_popup_num, xaw_ret_action_str, yes_arg); else translation_str = get_string_va("<Key>Return:close-popup(%d)%s()", my_popup_num, xaw_ret_action_str); xlats = XtParseTranslationTable(translation_str); free(translation_str); XtOverrideTranslations(popup_window[my_popup_num], xlats); XtOverrideTranslations(message_paned[my_popup_num], xlats); XtOverrideTranslations(message_text[my_popup_num], xlats); } XtVaSetValues(popup_window[my_popup_num], XtNtitle, my_msg_map[type].window_title, NULL); XtVaSetValues(message_text[my_popup_num], XtNstring, msg_buf, NULL); XtRealizeWidget(popup_window[my_popup_num]); XSetWMProtocols(XtDisplay(popup_window[my_popup_num]), XtWindow(popup_window[my_popup_num]), &WM_DELETE_WINDOW, 1); if (x_coord <= 0 || y_coord <= 0) center_window(popup_window[my_popup_num], parent); else position_window(popup_window[my_popup_num], (Position)x_coord, (Position)y_coord); if (my_popup_num > 0) { /* some window managers position new windows exactly above the existing one; to prevent this, move it with some offset from the previous one: */ Position x = 0, y = 0; XtVaGetValues(popup_window[my_popup_num-1], XtNx, &x, XtNy, &y, NULL); XtVaSetValues(popup_window[my_popup_num], XtNx, x + POPUP_OFFSET, XtNy, y + POPUP_OFFSET, NULL); } XtPopup(popup_window[my_popup_num], XtGrabNone); /* XtPopup(XtParent(popup_window[my_popup_num]), XtGrabExclusive); */ if (XtIsManaged(message_not_ok[my_popup_num]) && XtIsManaged(message_help[my_popup_num])) { /* center the help button. This is something of a sham, since it won't survive resizing; but in general most users won't resize dialogs ;-) */ Position x1, x2, bw; int w, dist; XtVaGetValues(message_ok[my_popup_num], XtNx, &x1, XtNwidth, &w, XtNborderWidth, &bw, NULL); XtVaGetValues(message_help[my_popup_num], XtNx, &x2, NULL); /* following formula is measured, not calculated - I have no idea why it's e.g. 2 * w, not 1.5 * w ... */ dist = (x2 - x1 - 2 * w) / 2 - 2 * bw; XtVaSetValues(message_not_ok[my_popup_num], XtNhorizDistance, dist, NULL); } #endif /* MOTIF */ return ret; }
/* ARGSUSED */ void dslw_groupCb ( Widget w, XtPointer clnt, XtPointer call ) /************************************************************************ * dslw_groupCb * * * * This functions display the group products. It is the callback for * * group list. * * * * void dslw_groupCb(w, clnt, call) * * * * Input parameters: * * w Widget * * clnt XtPointer * * call XtPointer * * * ** * * Log: * * L. Williams/EAI 06/95 * * C. Lin/EAI 10/95 add comments * * J. Wu/GSC 05/01 free XmStrings * * T. Piper/GSC 6/01 Freed xmstr * * T. Piper/SAIC 10/06 Replaced XmStringGetLtoR with * * XmStringUnparse * ***********************************************************************/ { struct guid_grp *group_ptr; XmListCallbackStruct *cbs = (XmListCallbackStruct *) call; XmString *xmstr; char str[100]; int ii; int prdcnt, nselect; char *selected_item; /*---------------------------------------------------------------------*/ /* * return when no selection was made */ XtVaGetValues(w, XmNselectedItemCount, &nselect, NULL); if ( nselect == 0 ) return; XmListDeselectAllItems(_prodlistW); /* * get the selected group name */ selected_item = XmStringUnparse (cbs->item, NULL, XmCHARSET_TEXT, XmCHARSET_TEXT, NULL, 0, XmOUTPUT_ALL); /* * Search the link list for the selected item */ group_ptr = guid_grp_head; while ( group_ptr ) { if (strcmp(group_ptr->grpname, selected_item) == 0) { usrSelect.group = group_ptr; break; } else group_ptr = group_ptr->nextgrp; } /* * If products exist move product name into array. */ if (group_ptr->nprod) { xmstr = (XmString *) XtMalloc(sizeof(XmString) * (size_t)group_ptr->nprod); for (ii=0; ii<group_ptr->nprod; ii++) { if ( group_ptr->prod[ii].index == -2 ) { /* * the selected product is not available */ sprintf(str, "%s *", group_ptr->prod[ii].prdname); xmstr[ii] = XmStringCreateLocalized(str); } else xmstr[ii] = XmStringCreateLocalized(group_ptr->prod[ii].prdname); } } else { /* * No products exist. */ xmstr = (XmString *) XtMalloc (sizeof(XmString)); xmstr[0] = XmStringCreateLocalized("No products available"); } XtFree( selected_item ); /* * display "No products available" */ prdcnt=group_ptr->nprod; if (!prdcnt) ++prdcnt; XtVaSetValues(_prodlistW, XmNitems, xmstr, XmNitemCount, prdcnt, NULL); for (ii=0; ii<prdcnt; ii++) { XmStringFree( xmstr[ii] ); } XtFree((XtPointer)xmstr); }
static Widget _Uxbuild_AddFiletype(void) { Widget _UxParent; char *UxTmp0; Widget AF_CharacteristicsWindow; Widget ActionAreaForm; int ntotalbuttons = 4; int nbutton = 0; Widget AF_ScrolledWindow; Widget AF_BigForm; Dimension dim1, dim2, dim3; Widget AF_MED_IconForm, AF_TINY_IconForm; IconData *pIconData; char *pre, *suf, *title; XmString emptyString; size_t len; #define TIGHTNESS 20 #define ICON_MIN_HEIGHT 83 #define FINDEDIT_SPACING 6 #define BORDER_OFFSET 3 /* Creation of AddFiletype */ _UxParent = UxParent; if ( _UxParent == NULL ) { _UxParent = UxTopLevel; } pre = GETMESSAGE(3, 10, "Create Action"); suf = GETMESSAGE(7, 10, "Add Datatype"); len = strlen(pre) + strlen(suf) + 4; title = XtMalloc(len); snprintf(title,len - 1, "%s - %s", pre, suf); _UxParent = XtVaCreatePopupShell( "AddFiletype_shell", xmDialogShellWidgetClass, _UxParent, XmNx, 422, XmNy, 148, XmNshellUnitType, XmPIXELS, XmNtitle, title, NULL ); /* XtAddCallback(_UxParent, XmNpopupCallback, LayoutCB_AddFiletype, NULL); */ if (bLowRes) { AF_BigForm = XtVaCreateWidget( "AF_BigForm", xmFormWidgetClass, _UxParent, XmNunitType, XmPIXELS, XmNdialogStyle, XmDIALOG_APPLICATION_MODAL, RES_CONVERT( XmNdialogTitle, title ), XmNautoUnmanage, FALSE, NULL ); AF_ScrolledWindow = XtVaCreateManagedWidget( "AF_ScrolledWindow", xmScrolledWindowWidgetClass, AF_BigForm, XmNscrollingPolicy, XmAUTOMATIC, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, NULL ); XtVaSetValues(AF_BigForm, XmNuserData, AF_ScrolledWindow, NULL); AddFiletype = XtVaCreateManagedWidget( "AddFiletype", xmFormWidgetClass, AF_ScrolledWindow, NULL ); } else { AddFiletype = XtVaCreateWidget( "AddFiletype", xmFormWidgetClass, _UxParent, XmNunitType, XmPIXELS, XmNdialogStyle, XmDIALOG_APPLICATION_MODAL, RES_CONVERT( XmNdialogTitle, title ), XmNautoUnmanage, FALSE, NULL ); } XtFree(title); XtAddCallback( AddFiletype, XmNhelpCallback, (XtCallbackProc) helpCB_general, (XtPointer) HELP_ADDFILETYPE ); /* Creation of AF_FiletypeFamilyNameLabel */ AF_FiletypeFamilyNameLabel = XtVaCreateManagedWidget( "AF_FiletypeFamilyNameLabel", xmLabelWidgetClass, AddFiletype, RES_CONVERT( XmNlabelString, GETMESSAGE(7, 14, "Name of Datatype Family:")), XmNalignment, XmALIGNMENT_BEGINNING, XmNtopOffset, 15, XmNtopAttachment, XmATTACH_FORM, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, NULL ); /* Creation of AF_FileTypeNameTextField */ AF_FileTypeNameTextField = XtVaCreateManagedWidget( "AF_FileTypeNameTextField", xmTextFieldWidgetClass, AddFiletype, XmNtopOffset, 0, XmNtopWidget, AF_FiletypeFamilyNameLabel, XmNtopAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, NULL ); ActionAreaForm = XtVaCreateManagedWidget( "ActionAreaForm", xmFormWidgetClass, AddFiletype, XmNnavigationType, XmTAB_GROUP, XmNskipAdjust, TRUE, XmNfractionBase, ((TIGHTNESS * ntotalbuttons) - 1), XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNbottomOffset, 20, XmNbottomAttachment, XmATTACH_FORM, NULL ); /* Creation of AF_OkButton */ AF_OkButton = XtVaCreateManagedWidget( "AF_OkButton", xmPushButtonGadgetClass, ActionAreaForm, RES_CONVERT( XmNlabelString, GETMESSAGE(6, 10, "OK")), XmNmultiClick, XmMULTICLICK_DISCARD, XmNleftAttachment, nbutton ? XmATTACH_POSITION : XmATTACH_FORM, XmNleftPosition, TIGHTNESS * nbutton, XmNrightAttachment, nbutton != (ntotalbuttons - 1) ? XmATTACH_POSITION : XmATTACH_FORM, XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1), NULL ); nbutton++; XtAddCallback( AF_OkButton, XmNactivateCallback, (XtCallbackProc) activateCB_AF_OkButton, (XtPointer) NULL ); /* Creation of AF_ApplyButton */ AF_ApplyButton = XtVaCreateManagedWidget( "AF_ApplyButton", xmPushButtonGadgetClass, ActionAreaForm, RES_CONVERT( XmNlabelString, GETMESSAGE(6, 11, "Apply")), XmNleftAttachment, nbutton ? XmATTACH_POSITION : XmATTACH_FORM, XmNleftPosition, TIGHTNESS * nbutton, XmNrightAttachment, nbutton != (ntotalbuttons - 1) ? XmATTACH_POSITION : XmATTACH_FORM, XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1), NULL ); nbutton++; XtAddCallback( AF_ApplyButton, XmNactivateCallback, (XtCallbackProc) activateCB_AF_ApplyButton, (XtPointer) NULL ); /* Creation of AF_CancelButton */ AF_CancelButton = XtVaCreateManagedWidget( "AF_CancelButton", xmPushButtonGadgetClass, ActionAreaForm, RES_CONVERT( XmNlabelString, GETMESSAGE(6, 12, "Cancel")), XmNleftAttachment, nbutton ? XmATTACH_POSITION : XmATTACH_FORM, XmNleftPosition, TIGHTNESS * nbutton, XmNrightAttachment, nbutton != (ntotalbuttons - 1) ? XmATTACH_POSITION : XmATTACH_FORM, XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1), NULL ); nbutton++; XtAddCallback( AF_CancelButton, XmNactivateCallback, (XtCallbackProc) activateCB_AF_CancelButton, (XtPointer) NULL ); /* Creation of AF_HelpButton */ AF_HelpButton = XtVaCreateManagedWidget( "AF_HelpButton", xmPushButtonGadgetClass, ActionAreaForm, RES_CONVERT( XmNlabelString, GETMESSAGE(6, 13, "Help")), XmNuserData, AddFiletype, XmNleftAttachment, nbutton ? XmATTACH_POSITION : XmATTACH_FORM, XmNleftPosition, TIGHTNESS * nbutton, XmNrightAttachment, nbutton != (ntotalbuttons - 1) ? XmATTACH_POSITION : XmATTACH_FORM, XmNrightPosition, (TIGHTNESS * nbutton)+(TIGHTNESS - 1), NULL ); nbutton++; XtAddCallback( AF_HelpButton, XmNactivateCallback, (XtCallbackProc) helpCB_general, (XtPointer) HELP_ADDFILETYPE ); /* Creation of AF_IdCharacteristicsLabel */ AF_IdCharacteristicsLabel = XtVaCreateManagedWidget( "AF_IdCharacteristicsLabel", xmLabelWidgetClass, AddFiletype, RES_CONVERT( XmNlabelString, GETMESSAGE(7, 15, "Identifying Characteristics:")), XmNalignment, XmALIGNMENT_BEGINNING, XmNtopOffset, 10, XmNtopWidget, AF_FileTypeNameTextField, XmNtopAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, NULL ); /* Creation of AF_IdCharacteristicsText */ AF_IdCharacteristicsText = XtVaCreateManagedWidget( "AF_IdCharacteristicsText", xmTextWidgetClass, AddFiletype, XmNheight, 90, XmNeditMode, XmMULTI_LINE_EDIT , XmNeditable, FALSE, XmNrows, 3, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNtopOffset, 0, XmNtopWidget, AF_IdCharacteristicsLabel, XmNtopAttachment, XmATTACH_WIDGET, NULL ); #ifdef DEBUG printf("AF_IdCharacteristicsText = %p\n", AF_IdCharacteristicsText); #endif /* Creation of AF_IdCharacteristicsEdit */ AF_IdCharacteristicsEdit = XtVaCreateManagedWidget( "AF_IdCharacteristicsEdit", xmPushButtonGadgetClass, AddFiletype, RES_CONVERT( XmNlabelString, GETMESSAGE(7, 16, "Edit...")), XmNalignment, XmALIGNMENT_BEGINNING, XmNmultiClick, XmMULTICLICK_DISCARD, XmNnavigationType, XmTAB_GROUP, XmNtraversalOn, TRUE, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNbottomWidget, AF_IdCharacteristicsText, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, NULL ); XtAddCallback( AF_IdCharacteristicsEdit, XmNactivateCallback, (XtCallbackProc) activateCB_edit_id_characteristics, (XtPointer) NULL ); XtRealizeWidget(AF_IdCharacteristicsEdit); XtVaGetValues(AF_IdCharacteristicsEdit, XmNwidth, &dim1, NULL); XtVaSetValues(AF_IdCharacteristicsText, XmNrightOffset, dim1 + 25, XmNrightAttachment, XmATTACH_FORM, NULL); /* Creation of AF_FiletypeIconHelpLabel */ AF_FiletypeIconHelpLabel = XtVaCreateManagedWidget( "AF_FiletypeIconHelpLabel", xmLabelWidgetClass, AddFiletype, RES_CONVERT( XmNlabelString, GETMESSAGE(7, 17, "Help Text for this Datatype Icon:")), XmNalignment, XmALIGNMENT_BEGINNING, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNtopOffset, 10, XmNtopWidget, AF_IdCharacteristicsText, XmNtopAttachment, XmATTACH_WIDGET, NULL ); /* XtVaSetValues(AF_IdCharacteristicsText, XmNrightWidget, AF_IdCharacteristicsEdit, XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET, NULL); */ /* Creation of AF_FiletypePrintCmdTextField */ AF_FiletypePrintCmdTextField = XtVaCreateManagedWidget( "AF_FiletypePrintCmdTextField", xmTextFieldWidgetClass, AddFiletype, XmNbottomOffset, 15, XmNbottomWidget, AF_OkButton, XmNbottomAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, NULL ); /* Creation of AF_FiletypePrintCmdLabel */ AF_FiletypePrintCmdLabel = XtVaCreateManagedWidget( "AF_FiletypePrintCmdLabel", xmLabelWidgetClass, AddFiletype, RES_CONVERT( XmNlabelString, GETMESSAGE(7, 23, "Command to Print this Datatype:")), XmNalignment, XmALIGNMENT_BEGINNING, XmNbottomOffset, 0, XmNbottomWidget, AF_FiletypePrintCmdTextField, XmNbottomAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, NULL ); /* Creation of AF_OpenCmdText */ AF_OpenCmdText = XtVaCreateManagedWidget( "AF_OpenCmdText", xmTextWidgetClass, AddFiletype, XmNeditable, FALSE, XmNbottomOffset, 15, XmNbottomWidget, AF_FiletypePrintCmdLabel, XmNbottomAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNrows, 1, XmNeditMode, XmMULTI_LINE_EDIT , NULL ); /* Creation of AF_OpenFiletypeCmdLabel */ AF_OpenFiletypeCmdLabel = XtVaCreateManagedWidget( "AF_OpenFiletypeCmdLabel", xmLabelWidgetClass, AddFiletype, RES_CONVERT( XmNlabelString, GETMESSAGE(7, 22, "Command to Open this Datatype:")), XmNalignment, XmALIGNMENT_BEGINNING, XmNbottomOffset, 0, XmNbottomWidget, AF_OpenCmdText, XmNbottomAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, NULL ); /* Creation of AF_CommandsLabel */ AF_CommandsLabel = XtVaCreateManagedWidget( "AF_CommandsLabel", xmLabelWidgetClass, AddFiletype, XmNalignment, XmALIGNMENT_BEGINNING, RES_CONVERT( XmNlabelString, GETMESSAGE(7, 21, "Commands")), XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNbottomOffset, 15, XmNbottomWidget, AF_OpenFiletypeCmdLabel, XmNbottomAttachment, XmATTACH_WIDGET, NULL ); /* Creation of AF_FiletypeIconForm */ AF_FiletypeIconForm = XtVaCreateManagedWidget( "AF_FiletypeIconForm", xmFormWidgetClass, AddFiletype, XmNresizePolicy, XmRESIZE_NONE, XmNborderWidth, 0, XmNbottomOffset, 20, XmNbottomWidget, AF_CommandsLabel, XmNbottomAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNshadowType, XmSHADOW_ETCHED_IN, XmNshadowThickness, 3, XmNheight, 90, NULL ); AF_MED_IconForm = XtVaCreateManagedWidget( "AF_MED_IconForm", xmFormWidgetClass, AF_FiletypeIconForm, XmNresizePolicy, XmRESIZE_NONE, XmNborderWidth, ICON_BORDER_WIDTH, XmNleftPosition, 16, XmNleftOffset, 0, XmNleftAttachment, XmATTACH_POSITION, XmNbottomPosition, 88, XmNbottomOffset, 0, XmNbottomAttachment, XmATTACH_POSITION, NULL ); /* Creation of AF_MED_IconGadget */ emptyString = XmStringCreateLocalized(""); pIconData = (IconData *)XtMalloc(sizeof(IconData)); memset(pIconData, 0, sizeof(IconData)); IconDataList[AF_MED] = pIconData; AF_MED_IconGadget = XtVaCreateManagedWidget( "AF_MED_IconGadget", dtIconGadgetClass, AF_MED_IconForm, XmNalignment, XmALIGNMENT_CENTER, XmNuserData, pIconData, XmNrecomputeSize, TRUE, XmNstring, emptyString, XmNleftOffset, BORDER_OFFSET, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, BORDER_OFFSET, XmNrightAttachment, XmATTACH_FORM, XmNtopOffset, BORDER_OFFSET, XmNtopAttachment, XmATTACH_FORM, XmNbottomOffset, BORDER_OFFSET, XmNbottomAttachment, XmATTACH_FORM, NULL ); pIconData->wid = AF_MED_IconGadget; pIconData->size = Medium_Icon; XtAddCallback( AF_MED_IconGadget, XmNcallback, (XtCallbackProc) activateCB_filetype_icon, (XtPointer) NULL ); createCB_IconGadget(AF_MED_IconGadget, FALSE, Medium_Icon); last_filetype_pushed = AF_MED_IconGadget; AF_TINY_IconForm = XtVaCreateManagedWidget( "AF_TINY_IconForm", xmFormWidgetClass, AF_FiletypeIconForm, XmNresizePolicy, XmRESIZE_NONE, XmNleftPosition, 41, XmNleftOffset, -1, XmNleftAttachment, XmATTACH_POSITION, XmNbottomPosition, 86, XmNbottomOffset, 0, XmNbottomAttachment, XmATTACH_POSITION, NULL ); /* Creation of AF_TINY_IconGadget */ pIconData = (IconData *)XtMalloc(sizeof(IconData)); memset(pIconData, 0, sizeof(IconData)); IconDataList[AF_TINY] = pIconData; AF_TINY_IconGadget = XtVaCreateManagedWidget( "AF_TINY_IconGadget", dtIconGadgetClass, AF_TINY_IconForm, XmNalignment, XmALIGNMENT_CENTER, XmNuserData, pIconData, XmNrecomputeSize, TRUE, XmNstring, emptyString, XmNleftOffset, BORDER_OFFSET, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, BORDER_OFFSET, XmNrightAttachment, XmATTACH_FORM, XmNtopOffset, BORDER_OFFSET, XmNtopAttachment, XmATTACH_FORM, XmNbottomOffset, BORDER_OFFSET, XmNbottomAttachment, XmATTACH_FORM, NULL ); pIconData->wid = AF_TINY_IconGadget; pIconData->size = Tiny_Icon; XtAddCallback( AF_TINY_IconGadget, XmNcallback, (XtCallbackProc) activateCB_filetype_icon, (XtPointer) NULL ); createCB_IconGadget(AF_TINY_IconGadget, FALSE, Tiny_Icon); XmStringFree(emptyString); /* Creation of AF_FiletypeIconsEditButton */ AF_FiletypeIconsEditButton = XtVaCreateManagedWidget( "AF_FiletypeIconsEditButton", xmPushButtonGadgetClass, AF_FiletypeIconForm, RES_CONVERT( XmNlabelString, GETMESSAGE(6, 20, "Edit Icon...")), XmNalignment, XmALIGNMENT_BEGINNING, XmNmultiClick, XmMULTICLICK_DISCARD, /*XmNnavigationType, XmTAB_GROUP,*/ XmNleftPosition, 64, XmNleftOffset, -1, XmNleftAttachment, XmATTACH_POSITION, NULL ); XtAddCallback( AF_FiletypeIconsEditButton, XmNactivateCallback, (XtCallbackProc) activateCB_edit_icon, (XtPointer) CA_FILETYPE_ICONS ); /* Creation of AF_FiletypeIconFindSetButton */ AF_FiletypeIconFindSetButton = XtVaCreateManagedWidget( "AF_FiletypeIconFindSetButton", xmPushButtonGadgetClass, AF_FiletypeIconForm, XmNx, 290, XmNy, 20, RES_CONVERT( XmNlabelString, GETMESSAGE(6, 19, "Find Set...")), XmNalignment, XmALIGNMENT_BEGINNING, /*XmNnavigationType, XmTAB_GROUP,*/ XmNmultiClick, XmMULTICLICK_DISCARD, XmNleftPosition, 64, XmNleftOffset, -1, XmNleftAttachment, XmATTACH_POSITION, NULL ); XtAddCallback( AF_FiletypeIconFindSetButton, XmNactivateCallback, (XtCallbackProc) activateCB_open_FindSet, (XtPointer) CA_FILETYPE_ICONS ); /******************************************************************/ /* Determine which button is wider, attach the short one onto it */ /******************************************************************/ XtVaGetValues(AF_FiletypeIconsEditButton, XmNwidth, &dim1, NULL); XtVaGetValues(AF_FiletypeIconFindSetButton, XmNwidth, &dim2, NULL); if (dim1 > dim2) { XtVaSetValues(AF_FiletypeIconFindSetButton, XmNwidth, dim1, NULL); } else { XtVaSetValues(AF_FiletypeIconsEditButton, XmNwidth, dim2, NULL); } /******************************************************************/ /* Determine vertical positioning for findset and edit buttons */ /******************************************************************/ /*XtRealizeWidget(AF_FiletypeIconForm);*/ XtVaGetValues(AF_FiletypeIconForm, XmNheight, &dim3, NULL); XtVaGetValues(AF_FiletypeIconsEditButton, XmNheight, &dim1, NULL); XtVaGetValues(AF_FiletypeIconFindSetButton, XmNheight, &dim2, NULL); #ifdef DEBUG printf("find set size = %d\n", dim2); printf("edit size = %d\n", dim1); printf("icon area form size = %d\n", dim3); #endif if ((int)(dim1 + dim2) + 3*(FINDEDIT_SPACING) > (int)dim3) { XtVaSetValues(AF_FiletypeIconsEditButton, XmNbottomOffset, FINDEDIT_SPACING, XmNbottomAttachment, XmATTACH_FORM, NULL); XtVaSetValues(AF_FiletypeIconFindSetButton, XmNbottomOffset, FINDEDIT_SPACING, XmNbottomWidget, AF_FiletypeIconsEditButton, XmNbottomAttachment, XmATTACH_WIDGET, XmNtopOffset, FINDEDIT_SPACING, XmNtopAttachment, XmATTACH_FORM, NULL); } else { XtVaSetValues(AF_FiletypeIconsEditButton, XmNtopPosition, 50, XmNtopOffset, (int)(FINDEDIT_SPACING / 2), XmNtopAttachment, XmATTACH_POSITION, NULL); XtVaSetValues(AF_FiletypeIconFindSetButton, XmNbottomPosition, 50, XmNbottomOffset, (int)(FINDEDIT_SPACING / 2), XmNbottomAttachment, XmATTACH_POSITION, NULL); } /******************************************************************/ /* Creation of AF_FiletypeIconsBoxLabel */ /******************************************************************/ AF_FiletypeIconsBoxLabel = XtVaCreateManagedWidget( "AF_FiletypeIconsBoxLabel", xmLabelWidgetClass, AddFiletype, RES_CONVERT( XmNlabelString, GETMESSAGE(7, 18, "Datatype Icons:")), XmNalignment, XmALIGNMENT_BEGINNING, XmNbottomOffset, 0, XmNbottomWidget, AF_FiletypeIconForm, XmNbottomAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, NULL ); /* Creation of AF_FiletypeHelpScrolledWindow */ AF_FiletypeHelpScrolledWindow = XtVaCreateManagedWidget( "AF_FiletypeHelpScrolledWindow", xmScrolledWindowWidgetClass, AddFiletype, XmNscrollingPolicy, XmAPPLICATION_DEFINED, XmNx, 10, XmNy, 226, XmNvisualPolicy, XmVARIABLE, XmNscrollBarDisplayPolicy, XmSTATIC, XmNshadowThickness, 0, XmNtopOffset, 0, XmNtopWidget, AF_FiletypeIconHelpLabel, XmNtopAttachment, XmATTACH_WIDGET, XmNbottomOffset, 10, XmNbottomWidget, AF_FiletypeIconsBoxLabel, XmNbottomAttachment, XmATTACH_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNheight, 94, NULL ); /* Creation of AF_FiletypeHelpText */ AF_FiletypeHelpText = XtVaCreateManagedWidget( "AF_FiletypeHelpText", xmTextWidgetClass, AF_FiletypeHelpScrolledWindow, XmNscrollHorizontal, FALSE, XmNscrollVertical, TRUE, XmNeditMode, XmMULTI_LINE_EDIT , XmNwordWrap, TRUE, XmNx, 19, XmNy, 0, XmNheight, 80, NULL ); /* Creation of AF_separator2 */ AF_separator2 = XtVaCreateManagedWidget( "AF_separator2", xmSeparatorWidgetClass, AddFiletype, XmNleftOffset, 0, XmNleftWidget, AF_CommandsLabel, XmNleftAttachment, XmATTACH_WIDGET, XmNrightOffset, 10, XmNrightAttachment, XmATTACH_FORM, XmNbottomOffset, 10, XmNbottomWidget, AF_CommandsLabel, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, NULL ); #if 0 /* Creation of AF_separator1 */ AF_separator1 = XtVaCreateManagedWidget( "AF_separator1", xmSeparatorWidgetClass, AddFiletype, XmNbottomOffset, 0, XmNbottomWidget, AF_separator2, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 10, XmNleftAttachment, XmATTACH_FORM, XmNrightOffset, 0, XmNrightWidget, AF_CommandsLabel, XmNrightAttachment, XmATTACH_WIDGET, NULL ); #endif XtVaSetValues(AddFiletype, XmNcancelButton, AF_CancelButton, XmNdefaultButton, AF_OkButton, XmNinitialFocus, AF_FileTypeNameTextField, NULL ); XtAddCallback( AddFiletype, XmNdestroyCallback, (XtCallbackProc) UxDestroyContextCB, (XtPointer) UxAddFiletypeContext); if (bLowRes) { return ( AF_BigForm ); } else { return ( AddFiletype ); } }
/* ** Set the label string on an object ** (converts it to XmString internally, if needed) */ void ui_obj_set_label_string( ABObj obj, STRING label ) { ABObj labelObj = NULL; if (obj == NULL) return; switch (obj_get_type(obj)) { case AB_TYPE_BUTTON: case AB_TYPE_CHOICE: case AB_TYPE_COMBO_BOX: case AB_TYPE_LABEL: case AB_TYPE_LIST: case AB_TYPE_SPIN_BOX: case AB_TYPE_SCALE: case AB_TYPE_TEXT_FIELD: labelObj = objxm_comp_get_subobj(obj, AB_CFG_LABEL_OBJ); if (labelObj == NULL || objxm_get_widget(labelObj) == NULL) return; ui_set_label_string(objxm_get_widget(labelObj), label); break; case AB_TYPE_ITEM: switch(obj_get_item_type(obj)) { case AB_ITEM_FOR_MENU: case AB_ITEM_FOR_MENUBAR: case AB_ITEM_FOR_CHOICE: labelObj = objxm_comp_get_subobj(obj, AB_CFG_LABEL_OBJ); if (labelObj == NULL || objxm_get_widget(labelObj) == NULL) return; ui_set_label_string(objxm_get_widget(labelObj), label); break; case AB_ITEM_FOR_COMBO_BOX: case AB_ITEM_FOR_LIST: case AB_ITEM_FOR_SPIN_BOX: { ABObj p_obj = obj_get_parent(obj); Widget parent = objxm_get_widget(p_obj); AB_ITEM_TYPE itype = (AB_ITEM_TYPE)obj_get_subtype(obj); int pos; int num_items; XmString xmitem; if (parent != NULL) { xmitem = XmStringCreateLocalized(label); pos = obj_get_child_num(obj); pos++; /* XmList starts at 1 */ if (obj_is_combo_box_item(obj)) parent = ui_combobox_get_list_widget(parent); if (obj_is_list_item(obj) || obj_is_combo_box_item(obj)) XtVaGetValues(parent, XmNitemCount, &num_items, NULL); else if (obj_is_spin_box_item(obj)) XtVaGetValues(parent, DtNnumValues, &num_items, NULL); if (pos <= num_items) { if (obj_is_list_item(obj) || obj_is_combo_box_item(obj)) { XmListReplacePositions(parent, &pos, &xmitem, 1); } else { DtSpinBoxDeletePos(parent, pos); DtSpinBoxAddItem(parent, xmitem, pos); } } XmStringFree(xmitem); } } break; default: break; } break; case AB_TYPE_BASE_WINDOW: case AB_TYPE_DIALOG: case AB_TYPE_FILE_CHOOSER: labelObj = objxm_comp_get_subobj(obj, AB_CFG_LABEL_OBJ); if (labelObj == NULL || objxm_get_widget(labelObj) == NULL) return; XtVaSetValues(objxm_get_widget(labelObj), XmNtitle, label, NULL); break; default: break; } }
/*+++++++++++++++++++++++++++++++++++++++*/ static Widget build_dtwmDlg( Widget shell ) { register int i, n; Arg args[MAX_ARGS]; XmString button_string[NUM_LABELS]; XmString string; Widget form; Widget windowFocusForm; Widget iconPlacementForm; int count = 0; Widget widgetList1[6]; /* get dtwm resource values */ /* Set up DialogBoxDialog button labels */ button_string[0] = CMPSTR((String) _DtOkString); button_string[1] = CMPSTR((String) _DtCancelString); button_string[2] = CMPSTR((String) _DtHelpString); /* Create toplevel DialogBox */ /* saveRestore * Note that save.poscnt has been initialized elsewhere. * save.posArgs may contain information from restoreBeep().*/ XtSetArg(save.posArgs[save.poscnt], XmNbuttonCount, NUM_LABELS); save.poscnt++; XtSetArg(save.posArgs[save.poscnt], XmNbuttonLabelStrings, button_string); save.poscnt++; XtSetArg(save.posArgs[save.poscnt], XmNdefaultPosition, False); save.poscnt++; style.dtwmDialog = __DtCreateDialogBoxDialog(shell, "dtwmDialog", save.posArgs, save.poscnt); XtAddCallback(style.dtwmDialog, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_DTWM_DIALOG); XmStringFree(button_string[0]); XmStringFree(button_string[1]); XmStringFree(button_string[2]); widgetList1[0] = _DtDialogBoxGetButton(style.dtwmDialog,2); n=0; XtSetArg(args[n], XmNautoUnmanage, False); n++; XtSetArg(args[n], XmNcancelButton, widgetList1[0]); n++; XtSetValues (style.dtwmDialog, args, n); n=0; XtSetArg(args[n], XmNtitle, ((char *)GETMESSAGE(18, 1, "Style Manager - Window"))); n++; XtSetArg (args[n], XmNuseAsyncGeometry, True); n++; XtSetArg(args[n], XmNmwmFunctions, DIALOG_MWM_FUNC); n++; XtSetValues (XtParent(style.dtwmDialog), args, n); n = 0; XtSetArg(args[n], XmNallowOverlap, False); n++; XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++; form = XmCreateForm(style.dtwmDialog, "dtwmForm", args, n); n = 0; XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++; XtSetArg(args[n], XmNbehavior, XmICON_LABEL); n++; XtSetArg(args[n], XmNpixmapForeground, style.secBSCol); n++; XtSetArg(args[n], XmNpixmapBackground, style.secTSCol); n++; XtSetArg(args[n], XmNstring, NULL); n++; XtSetArg(args[n], XmNshadowThickness, 0); n++; XtSetArg(args[n], XmNimageName, DTWM_ICON); n++; XtSetArg(args[n], XmNtraversalOn, False); n++; widgetList1[count++] = dtwm.pictLabel = _DtCreateIcon(form, "dtwmpictLabel", args, n); n = 0; XtSetArg(args[n], XmNmarginHeight, LB_MARGIN_HEIGHT); n++; XtSetArg(args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++; string = CMPSTR(((char *)GETMESSAGE(18, 2, "Default"))); XtSetArg(args[n], XmNlabelString, string); n++; widgetList1[count++] = dtwm.systemDefault = XmCreatePushButtonGadget(form, "systemDefault", args, n); XmStringFree(string); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 3, "Window Behavior")); XtSetArg(args[n], XmNtitleString, string); n++; widgetList1[count++] = dtwm.windowFocusTB = _DtCreateTitleBox(form, "windowFocusTB", args, n); XmStringFree(string); n = 0; XtSetArg(args[n], XmNallowOverlap, False); n++; XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++; windowFocusForm = XmCreateForm(dtwm.windowFocusTB, "windowFocusForm", args, n); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 4, "Window Icons")); XtSetArg(args[n], XmNtitleString, string); n++; widgetList1[count++] = dtwm.iconPlacementTB = _DtCreateTitleBox(form, "iconPlacementTB", args, n); XmStringFree(string); n = 0; XtSetArg(args[n], XmNallowOverlap, False); n++; XtSetArg(args[n], XmNchildType, XmWORK_AREA); n++; iconPlacementForm = XmCreateForm(dtwm.iconPlacementTB, "iconPlacementForm", args, n); n = 0; XtSetArg(args[n], XmNmarginWidth, 0); n++; XtSetArg(args[n], XmNmarginHeight, 0); n++; dtwm.focusPolicyRC = XmCreateRadioBox(windowFocusForm, "focusPolicyRC", args, n); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 13, "Point In Window To Make Active")); XtSetArg(args[n], XmNlabelString, string); n++; dtwm.pointerTG = XmCreateToggleButtonGadget(dtwm.focusPolicyRC, "pointerTG", args, n); XmStringFree(string); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 14, "Click In Window To Make Active")); XtSetArg(args[n], XmNlabelString, string); n++; dtwm.explicitTG = XmCreateToggleButtonGadget(dtwm.focusPolicyRC, "explicitTG", args, n); XmStringFree(string); n = 0; XtSetArg(args[n], XmNmargin, 0); n++; dtwm.focusSeparator = XmCreateSeparatorGadget(windowFocusForm, "focusSeparator", args, n); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 15, "Raise Window When Made Active")); XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++; XtSetArg(args[n], XmNlabelString, string); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; dtwm.autoRaiseTG = XmCreateToggleButtonGadget(windowFocusForm, "autoRaiseTG", args, n); XmStringFree(string); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 11, "Allow Primary Windows On Top")); XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++; XtSetArg(args[n], XmNlabelString, string); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; dtwm.secStackTG = XmCreateToggleButtonGadget(windowFocusForm, "secStackTG", args, n); XmStringFree(string); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 16, "Show Contents During Move")); XtSetArg(args[n], XmNnavigationType, XmTAB_GROUP); n++; XtSetArg(args[n], XmNlabelString, string); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; dtwm.moveOpaqueTG = XmCreateToggleButtonGadget(windowFocusForm, "moveOpaqueTG", args, n); XmStringFree(string); n = 0; XtSetArg(args[n], XmNmarginWidth, 0); n++; XtSetArg(args[n], XmNmarginHeight, 0); n++; dtwm.useIconBoxRC = XmCreateRadioBox(iconPlacementForm, "useIconBoxRC", args, n); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 9, "Use Icon Box")); XtSetArg(args[n], XmNlabelString, string); n++; dtwm.iconBoxTG = XmCreateToggleButtonGadget(dtwm.useIconBoxRC, "iconBoxTG", args, n); XmStringFree(string); n = 0; string = CMPSTR((char *)GETMESSAGE(18, 10, "Place On Workspace")); XtSetArg(args[n], XmNlabelString, string); n++; dtwm.desktopTG = XmCreateToggleButtonGadget(dtwm.useIconBoxRC, "desktopTG", args, n); XmStringFree(string); XtAddCallback(style.dtwmDialog, XmNmapCallback, formLayoutCB, NULL); XtAddCallback(style.dtwmDialog, XmNmapCallback, _DtmapCB_dtwmDlg, shell); XtAddCallback(style.dtwmDialog, XmNcallback, ButtonCB, NULL); XtAddCallback(dtwm.systemDefault, XmNactivateCallback, systemDefaultCB, NULL); XtManageChild(form); XtManageChildren(widgetList1,count); XtManageChild(windowFocusForm); XtManageChild(iconPlacementForm); XtManageChild(dtwm.focusPolicyRC); XtManageChild(dtwm.pointerTG); XtManageChild(dtwm.explicitTG); XtManageChild(dtwm.focusSeparator); XtManageChild(dtwm.autoRaiseTG); XtManageChild(dtwm.secStackTG); XtManageChild(dtwm.moveOpaqueTG); XtManageChild(dtwm.useIconBoxRC); XtManageChild(dtwm.iconBoxTG); XtManageChild(dtwm.desktopTG); return(style.dtwmDialog); }
void ui_populate_pulldown_menu( Widget menu, int num_columns, MenuItem *menu_items ) { Widget widget; Arg args[4]; int i; XmString xmlabel; int n = 0; if (!menu) return; if (num_columns > 1) { XtSetArg(args[n], XmNpacking, XmPACK_COLUMN); n++; XtSetArg(args[n], XmNnumColumns, num_columns); n++; XtSetValues(menu, args, n); } for (i = 0; menu_items[i].label != NULL; i++) { if (menu_items[i].subitems) { widget = ui_build_menu(menu, XmMENU_PULLDOWN, menu_items[i].num_columns, menu_items[i].label, menu_items[i].name, (MenuItem *)menu_items[i].subitems); XtVaSetValues(widget, XmNuserData, (XtArgVal)menu_items[i].user_data, NULL); } else { widget = XtVaCreateManagedWidget(menu_items[i].name, *menu_items[i].wclass, menu, XmNuserData, (XtArgVal)menu_items[i].user_data, NULL); if (menu_items[i].label != NULL) { xmlabel = XmStringCreateLocalized(menu_items[i].label); XtVaSetValues(widget, XmNlabelString, xmlabel, NULL); XmStringFree(xmlabel); } /* If label is glyph type, then change type and call * routine to set glyph. */ if (menu_items[i].label_type == AB_LABEL_GLYPH) { XtVaSetValues(widget, XmNlabelType, XmPIXMAP, NULL); dtb_set_label_from_bitmap_data(widget, menu_items[i].pixwidth, menu_items[i].pixheight, menu_items[i].bits); } } if (menu_items[i].active == FALSE) XtSetSensitive(widget, FALSE); else if (menu_items[i].callback != NULL) XtAddCallback(widget, XmNactivateCallback, menu_items[i].callback, menu_items[i].client_data); } }
Widget CreateSpinBoxResourceControls( Widget parent, Widget top_widget, Widget left_widget, Widget right_widget ) { XmString string; Widget SBResLabel, RowColumn; Widget ArrowLayoutLabel, ArrowLayoutPulldown, ArrowLayoutOptions, ArrowLayoutPB[NUM_ARROW_LAYOUT_BTNS]; Widget ArrowSizeLabel, ArrowSizePulldown, ArrowSizeOptions, ArrowSizePB[NUM_ARROW_SIZE_BTNS]; Widget DefArrowSensitiveLabel, DefArrowSensitivePulldown, DefArrowSensitiveOptions, DefArrowSensitivePB[NUM_DEF_ARROW_SENS_BTNS]; Widget InitialDelayLabel, InitialDelayTF; Widget RepeatDelayLabel, RepeatDelayTF; int i; char buffer[30]; n = 0; XtSetArg( args[n], XmNtopAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNtopWidget, top_widget ); n++; XtSetArg( args[n], XmNleftAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNleftWidget, left_widget ); n++; XtSetArg( args[n], XmNrightAttachment, XmATTACH_WIDGET ); n++; XtSetArg( args[n], XmNrightWidget, right_widget ); n++; XtSetArg(args[n], XmNnumColumns, 5); n++; XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++; XtSetArg(args[n], XmNpacking, XmPACK_COLUMN); n++; RowColumn = XmCreateRowColumn( parent, "RowColumn", args, n ); XtManageChild( RowColumn ); /* * Create label and option menu for XmNarrowLayout resource. */ string = XmStringCreateLtoR("Arrow Layout", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ArrowLayoutLabel = XmCreateLabel( RowColumn, "ArrowLayoutLabel", args, n ); XtManageChild( ArrowLayoutLabel ); XmStringFree( string ); n = 0; ArrowLayoutPulldown = XmCreatePulldownMenu(RowColumn, "ArrowLayoutPulldown", args, n); for ( i = 0; i < NUM_ARROW_LAYOUT_BTNS; i++ ) { string = XmStringCreateLtoR( arrow_layout_strings[i], XmFONTLIST_DEFAULT_TAG ); sprintf( buffer, "ArrowLayoutPB%d", i ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ArrowLayoutPB[i] = XmCreatePushButton( ArrowLayoutPulldown, buffer, args, n ); XmStringFree( string ); XtAddCallback( ArrowLayoutPB[i], XmNactivateCallback, ArrowLayoutCB, (XtPointer)&arrow_layout[i] ); } XtManageChildren( ArrowLayoutPB, NUM_ARROW_LAYOUT_BTNS ); n = 0; XtSetArg( args[n], XmNmenuHistory, ArrowLayoutPB[NUM_ARROW_LAYOUT_BTNS - 1] ); n++; XtSetArg( args[n], XmNsubMenuId, ArrowLayoutPulldown ); n++; ArrowLayoutOptions = XmCreateOptionMenu( RowColumn, "ArrowLayoutOptions", args, n ); XtManageChild( ArrowLayoutOptions ); /* * Create label and option menu for XmNarrowSize resource. */ string = XmStringCreateLtoR("Arrow Size", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ArrowSizeLabel = XmCreateLabel( RowColumn, "ArrowSizeLabel", args, n ); XtManageChild( ArrowSizeLabel ); XmStringFree( string ); n = 0; ArrowSizePulldown = XmCreatePulldownMenu(RowColumn, "ArrowSizePulldown", args, n); for ( i = 0; i < NUM_ARROW_SIZE_BTNS; i++ ) { string = XmStringCreateLtoR( arrow_size_strings[i], XmFONTLIST_DEFAULT_TAG ); sprintf( buffer, "ArrowSizePB%d", i ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; ArrowSizePB[i] = XmCreatePushButton( ArrowSizePulldown, buffer, args, n ); XmStringFree( string ); XtAddCallback( ArrowSizePB[i], XmNactivateCallback, ArrowSizeCB, (XtPointer)arrow_size_strings[i] ); } XtManageChildren( ArrowSizePB, NUM_ARROW_SIZE_BTNS ); n = 0; XtSetArg( args[n], XmNmenuHistory, ArrowSizePB[0] ); n++; XtSetArg( args[n], XmNsubMenuId, ArrowSizePulldown ); n++; ArrowSizeOptions = XmCreateOptionMenu( RowColumn, "ArrowSizeOptions", args, n ); XtManageChild( ArrowSizeOptions ); /* * Create label and option menu for XmNdefaultArrowSensitivity resource. */ string = XmStringCreateLtoR("Default Arrow Sensitivity", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; DefArrowSensitiveLabel = XmCreateLabel( RowColumn, "DefArrowSensitiveLabel", args, n ); XtManageChild( DefArrowSensitiveLabel ); XmStringFree( string ); n = 0; DefArrowSensitivePulldown = XmCreatePulldownMenu(RowColumn, "DefArrowSensitivePulldown", args, n); for ( i = 0; i < NUM_DEF_ARROW_SENS_BTNS; i++ ) { string = XmStringCreateLtoR( def_arrow_sens_strings[i], XmFONTLIST_DEFAULT_TAG ); sprintf( buffer, "DefArrowSensitivePB%d", i ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; DefArrowSensitivePB[i] = XmCreatePushButton( DefArrowSensitivePulldown, buffer, args, n ); XmStringFree( string ); XtAddCallback( DefArrowSensitivePB[i], XmNactivateCallback, DefArrowSensitiveCB, (XtPointer)&def_arrow_sens[i] ); } XtManageChildren( DefArrowSensitivePB, NUM_DEF_ARROW_SENS_BTNS ); n = 0; XtSetArg( args[n], XmNmenuHistory, DefArrowSensitivePB[0] ); n++; XtSetArg( args[n], XmNsubMenuId, DefArrowSensitivePulldown ); n++; DefArrowSensitiveOptions = XmCreateOptionMenu( RowColumn, "DefArrowSensitiveOptions", args, n ); XtManageChild( DefArrowSensitiveOptions ); /* * Create label and text field for XmNinitialDelay resource. */ string = XmStringCreateLtoR("Initial Delay", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; InitialDelayLabel = XmCreateLabel( RowColumn, "InitialDelayLabel", args, n ); XtManageChild( InitialDelayLabel ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNvalue, "250" ); n++; InitialDelayTF = XmCreateTextField( RowColumn, "InitialDelayTF", args, n ); XtManageChild( InitialDelayTF ); XtAddCallback( InitialDelayTF, XmNactivateCallback, InitialDelayCB, (XtPointer)0 ); /* * Create label and text field for XmNinitialDelay resource. */ string = XmStringCreateLtoR("Repeat Delay", XmFONTLIST_DEFAULT_TAG ); n = 0; XtSetArg( args[n], XmNlabelString, string ); n++; RepeatDelayLabel = XmCreateLabel( RowColumn, "RepeatDelayLabel", args, n ); XtManageChild( RepeatDelayLabel ); XmStringFree( string ); n = 0; XtSetArg( args[n], XmNvalue, "200" ); n++; RepeatDelayTF = XmCreateTextField( RowColumn, "RepeatDelayTF", args, n ); XtManageChild( RepeatDelayTF ); XtAddCallback( RepeatDelayTF, XmNactivateCallback, RepeatDelayCB, (XtPointer)0 ); return( RowColumn ); }