/* Create the Xt client widgets * */ static void xt_client_create ( XtClient* xtclient , Window embedderid, int height, int width ) { int n; Arg args[6]; Widget child_widget; Widget top_widget; #ifdef DEBUG_XTBIN printf("xt_client_create() \n"); #endif top_widget = XtAppCreateShell("drawingArea", "Wrapper", applicationShellWidgetClass, xtclient->xtdisplay, NULL, 0); xtclient->top_widget = top_widget; /* set size of Xt window */ n = 0; XtSetArg(args[n], XtNheight, height);n++; XtSetArg(args[n], XtNwidth, width);n++; XtSetValues(top_widget, args, n); child_widget = XtVaCreateWidget("form", compositeWidgetClass, top_widget, NULL); n = 0; XtSetArg(args[n], XtNheight, height);n++; XtSetArg(args[n], XtNwidth, width);n++; XtSetArg(args[n], XtNvisual, xtclient->xtvisual ); n++; XtSetArg(args[n], XtNdepth, xtclient->xtdepth ); n++; XtSetArg(args[n], XtNcolormap, xtclient->xtcolormap ); n++; XtSetArg(args[n], XtNborderWidth, 0); n++; XtSetValues(child_widget, args, n); XSync(xtclient->xtdisplay, FALSE); xtclient->oldwindow = top_widget->core.window; top_widget->core.window = embedderid; /* this little trick seems to finish initializing the widget */ #if XlibSpecificationRelease >= 6 XtRegisterDrawable(xtclient->xtdisplay, embedderid, top_widget); #else _XtRegisterWindow( embedderid, top_widget); #endif XtRealizeWidget(child_widget); /* listen to all Xt events */ XSelectInput(xtclient->xtdisplay, XtWindow(top_widget), 0x0FFFFF); xt_client_set_info (child_widget, 0); XtManageChild(child_widget); xtclient->child_widget = child_widget; /* set the event handler */ XtAddEventHandler(child_widget, 0x0FFFFF & ~ResizeRedirectMask, TRUE, (XtEventHandler)xt_client_event_handler, xtclient); XtAddEventHandler(child_widget, SubstructureNotifyMask | ButtonReleaseMask, TRUE, (XtEventHandler)xt_client_focus_listener, xtclient); XSync(xtclient->xtdisplay, FALSE); }
void create_bill_cycle_shell (Widget parent) { Widget children[24]; /* Children to manage */ Arg al[64]; /* Arg List */ register int ac = 0; /* Arg Count */ Widget widget4 = (Widget)NULL; Widget widget5 = (Widget)NULL; Widget widget23 = (Widget)NULL; Widget widget49 = (Widget)NULL; XtSetArg(al[ac], XmNwidth, 522); ac++; XtSetArg(al[ac], XmNtitle, "Arbor BILL_CYCLE"); ac++; XtSetArg(al[ac], XmNiconName, "BILL_CYCLE"); ac++; bill_cycle_shell = XtCreatePopupShell ( "bill_cycle_shell", topLevelShellWidgetClass, parent, al, ac ); ac = 0; /* begin pre-creation code */ XtVaSetValues(bill_cycle_shell, XmNiconPixmap, abp_icon, NULL) ; /* end pre-creation code */ XtSetArg(al[ac], XmNwidth, 522); ac++; bill_cycle_form = XmCreateForm ( bill_cycle_shell, "bill_cycle_form", al, ac ); ac = 0; bill_cycle_summ_form = XmCreateForm ( bill_cycle_form, "bill_cycle_summ_form", al, ac ); bill_cycle_list_label = XmCreateLabel ( bill_cycle_summ_form, "bill_cycle_list_label", al, ac ); XtSetArg(al[ac], XmNvisibleItemCount, 7); ac++; bill_cycle_summlist = XmCreateScrolledList ( bill_cycle_summ_form, "bill_cycle_summlist", al, ac ); ac = 0; widget4 = XtParent ( bill_cycle_summlist ); XtSetArg(al[ac], XmNhorizontalScrollBar, &widget5 ); ac++; XtGetValues(widget4, al, ac ); ac = 0; bill_cycle_list_label2 = XmCreateLabel ( bill_cycle_summ_form, "bill_cycle_list_label2", al, ac ); bill_cycle_button_form = XmCreateForm ( bill_cycle_form, "bill_cycle_button_form", al, ac ); bill_cycle_save_btn = XmCreatePushButton ( bill_cycle_button_form, "bill_cycle_save_btn", al, ac ); bill_cycle_clear_btn = XmCreatePushButton ( bill_cycle_button_form, "bill_cycle_clear_btn", al, ac ); bill_cycle_update_btn = XmCreatePushButton ( bill_cycle_button_form, "bill_cycle_update_btn", al, ac ); bill_cycle_close_btn = XmCreatePushButton ( bill_cycle_button_form, "bill_cycle_close_btn", al, ac ); bill_cycle_delete_btn = XmCreatePushButton ( bill_cycle_button_form, "bill_cycle_delete_btn", al, ac ); bill_cycle_scripts_btn = XmCreatePushButton ( bill_cycle_button_form, "bill_cycle_scripts_btn", al, ac ); XtSetArg(al[ac], XmNshadowThickness, 2); ac++; bill_cycle_tgl_form = XmCreateForm ( bill_cycle_form, "bill_cycle_tgl_form", al, ac ); ac = 0; bill_cycle_edit_mode_label = XmCreateLabel ( bill_cycle_tgl_form, "bill_cycle_edit_mode_label", al, ac ); XtSetArg(al[ac], XmNnumColumns, 4); ac++; XtSetArg(al[ac], XmNpacking, XmPACK_TIGHT); ac++; bill_cycle_toggle_btn = XmCreateRadioBox ( bill_cycle_tgl_form, "bill_cycle_toggle_btn", al, ac ); ac = 0; bill_cycle_create_toggle = XmCreateToggleButtonGadget ( bill_cycle_toggle_btn, "bill_cycle_create_toggle", al, ac ); bill_cycle_modify_toggle = XmCreateToggleButtonGadget ( bill_cycle_toggle_btn, "bill_cycle_modify_toggle", al, ac ); bill_cycle_delete_toggle = XmCreateToggleButtonGadget ( bill_cycle_toggle_btn, "bill_cycle_delete_toggle", al, ac ); bill_cycle_view_toggle = XmCreateToggleButtonGadget ( bill_cycle_toggle_btn, "bill_cycle_view_toggle", al, ac ); widget23 = XmCreateForm ( bill_cycle_form, "widget23", al, ac ); XtSetArg(al[ac], XmNshadowThickness, 2); ac++; bill_cycle_detailform = XmCreateForm ( widget23, "bill_cycle_detailform", al, ac ); ac = 0; bill_cycle_bill_period_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_bill_period_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 3); ac++; bill_cycle_bill_period_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_bill_period_text", al, ac ); ac = 0; bill_cycle_billing_frequency_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_billing_frequency_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 4); ac++; bill_cycle_billing_frequency_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_billing_frequency_text", al, ac ); ac = 0; bill_cycle_ppdd_date_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_ppdd_date_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 8); ac++; bill_cycle_ppdd_date_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_ppdd_date_text", al, ac ); ac = 0; bill_cycle_next_ppdd_date_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_next_ppdd_date_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 5); ac++; bill_cycle_ppdd_time_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_ppdd_time_text", al, ac ); ac = 0; bill_cycle_ppdd_time_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_ppdd_time_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 8); ac++; bill_cycle_next_ppdd_date_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_next_ppdd_date_text", al, ac ); ac = 0; bill_cycle_statement_date_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_statement_date_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 5); ac++; bill_cycle_next_ppdd_time_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_next_ppdd_time_text", al, ac ); ac = 0; bill_cycle_next_ppdd_time_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_next_ppdd_time_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 5); ac++; bill_cycle_statement_time_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_statement_time_text", al, ac ); ac = 0; bill_cycle_cutoff_date_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_cutoff_date_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 8); ac++; bill_cycle_statement_date_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_statement_date_text", al, ac ); ac = 0; bill_cycle_statement_time_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_statement_time_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 8); ac++; bill_cycle_cutoff_date_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_cutoff_date_text", al, ac ); ac = 0; bill_cycle_prep_delay_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_prep_delay_label", al, ac ); XtSetArg(al[ac], XmNmaxLength, 5); ac++; bill_cycle_cutoff_time_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_cutoff_time_text", al, ac ); ac = 0; bill_cycle_cutoff_time_label = XmCreateLabel ( bill_cycle_detailform, "bill_cycle_cutoff_time_label", al, ac ); bill_cycle_prep_delay_text = XmCreateText ( bill_cycle_detailform, "bill_cycle_prep_delay_text", al, ac ); bill_cycle_bill_period_btn = XmCreatePushButton ( bill_cycle_detailform, "bill_cycle_bill_period_btn", al, ac ); bill_cycle_billing_frequency_btn = XmCreatePushButton ( bill_cycle_detailform, "bill_cycle_billing_frequency_btn", al, ac ); widget49 = XmCreateLabel ( widget23, "mps_detail_label", al, ac ); XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 50); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 4); ac++; XtSetArg(al[ac], XmNbottomWidget, widget23); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 4); ac++; XtSetValues ( bill_cycle_summ_form,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetValues ( bill_cycle_button_form,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 8); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -48); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -432); ac++; XtSetValues ( bill_cycle_tgl_form,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNbottomOffset, 4); ac++; XtSetArg(al[ac], XmNbottomWidget, bill_cycle_button_form); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetValues ( widget23,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -24); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -704); ac++; XtSetValues ( bill_cycle_list_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 42); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetValues ( widget4,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 24); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetValues ( bill_cycle_list_label2,al, ac ); ac = 0; XtAddCallback (bill_cycle_summlist, XmNsingleSelectionCallback, bill_cycle_summlist_cb,NULL); XtManageChild(bill_cycle_summlist); children[ac++] = bill_cycle_list_label; children[ac++] = bill_cycle_list_label2; XtManageChildren(children, ac); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNleftPosition, 8); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 23); ac++; XtSetValues ( bill_cycle_save_btn,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNleftPosition, 31); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 46); ac++; XtSetValues ( bill_cycle_clear_btn,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNleftPosition, 8); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 23); ac++; XtSetValues ( bill_cycle_update_btn,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNleftPosition, 77); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 92); ac++; XtSetValues ( bill_cycle_close_btn,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNleftPosition, 8); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 23); ac++; XtSetValues ( bill_cycle_delete_btn,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNleftPosition, 54); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 69); ac++; XtSetValues ( bill_cycle_scripts_btn,al, ac ); ac = 0; XtAddCallback (bill_cycle_save_btn, XmNactivateCallback, bill_cycle_save_btn_cb,NULL); XtAddCallback (bill_cycle_clear_btn, XmNactivateCallback, bill_cycle_clear_btn_cb,NULL); XtAddCallback (bill_cycle_update_btn, XmNactivateCallback, bill_cycle_update_btn_cb,NULL); XtAddCallback (bill_cycle_close_btn, XmNactivateCallback, bill_cycle_close_btn_cb,NULL); XtAddCallback (bill_cycle_delete_btn, XmNactivateCallback, bill_cycle_delete_btn_cb,bill_cycle_shell); XtAddCallback (bill_cycle_scripts_btn, XmNactivateCallback, bill_cycle_scripts_btn_cb,bill_cycle_shell); children[ac++] = bill_cycle_save_btn; children[ac++] = bill_cycle_clear_btn; children[ac++] = bill_cycle_update_btn; children[ac++] = bill_cycle_close_btn; children[ac++] = bill_cycle_delete_btn; children[ac++] = bill_cycle_scripts_btn; XtManageChildren(children, ac); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -36); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -92); ac++; XtSetValues ( bill_cycle_edit_mode_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -36); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 92); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -424); ac++; XtSetValues ( bill_cycle_toggle_btn,al, ac ); ac = 0; XtAddCallback (bill_cycle_create_toggle, XmNarmCallback, bill_cycle_create_toggle_cb,NULL); XtAddCallback (bill_cycle_modify_toggle, XmNarmCallback, bill_cycle_modify_toggle_cb,NULL); XtAddCallback (bill_cycle_delete_toggle, XmNarmCallback, bill_cycle_delete_toggle_cb,NULL); XtAddCallback (bill_cycle_view_toggle, XmNarmCallback, bill_cycle_view_toggle_cb,NULL); children[ac++] = bill_cycle_create_toggle; children[ac++] = bill_cycle_modify_toggle; children[ac++] = bill_cycle_delete_toggle; children[ac++] = bill_cycle_view_toggle; XtManageChildren(children, ac); ac = 0; children[ac++] = bill_cycle_edit_mode_label; children[ac++] = bill_cycle_toggle_btn; XtManageChildren(children, ac); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 28); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -180); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 4); ac++; XtSetValues ( bill_cycle_detailform,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++; XtSetValues ( widget49,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -28); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 20); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -148); ac++; XtSetValues ( bill_cycle_bill_period_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -28); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 148); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -204); ac++; XtSetValues ( bill_cycle_bill_period_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -28); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 244); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -356); ac++; XtSetValues ( bill_cycle_billing_frequency_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -28); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 356); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -420); ac++; XtSetValues ( bill_cycle_billing_frequency_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 28); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -52); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -148); ac++; XtSetValues ( bill_cycle_ppdd_date_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 28); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -52); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 148); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -240); ac++; XtSetValues ( bill_cycle_ppdd_date_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 52); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -76); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -148); ac++; XtSetValues ( bill_cycle_next_ppdd_date_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 28); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -52); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 356); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -440); ac++; XtSetValues ( bill_cycle_ppdd_time_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 28); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -52); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 300); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -356); ac++; XtSetValues ( bill_cycle_ppdd_time_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 52); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -76); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 148); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -240); ac++; XtSetValues ( bill_cycle_next_ppdd_date_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 76); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -100); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -148); ac++; XtSetValues ( bill_cycle_statement_date_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 52); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -76); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 356); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -440); ac++; XtSetValues ( bill_cycle_next_ppdd_time_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 52); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -76); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 300); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -356); ac++; XtSetValues ( bill_cycle_next_ppdd_time_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 76); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -100); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 356); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -440); ac++; XtSetValues ( bill_cycle_statement_time_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 100); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -124); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -148); ac++; XtSetValues ( bill_cycle_cutoff_date_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 76); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -100); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 148); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -240); ac++; XtSetValues ( bill_cycle_statement_date_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 76); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -100); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 300); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -356); ac++; XtSetValues ( bill_cycle_statement_time_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 100); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -124); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 148); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -240); ac++; XtSetValues ( bill_cycle_cutoff_date_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 124); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -148); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 4); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -148); ac++; XtSetValues ( bill_cycle_prep_delay_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 100); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -124); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 356); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -440); ac++; XtSetValues ( bill_cycle_cutoff_time_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 100); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -124); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 300); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -356); ac++; XtSetValues ( bill_cycle_cutoff_time_label,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 124); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -148); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 148); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -232); ac++; XtSetValues ( bill_cycle_prep_delay_text,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -28); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 204); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -228); ac++; XtSetValues ( bill_cycle_bill_period_btn,al, ac ); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 4); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, -28); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 420); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_OPPOSITE_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, -444); ac++; XtSetValues ( bill_cycle_billing_frequency_btn,al, ac ); ac = 0; children[ac++] = bill_cycle_bill_period_label; children[ac++] = bill_cycle_bill_period_text; children[ac++] = bill_cycle_billing_frequency_label; children[ac++] = bill_cycle_billing_frequency_text; children[ac++] = bill_cycle_ppdd_date_label; children[ac++] = bill_cycle_ppdd_date_text; children[ac++] = bill_cycle_next_ppdd_date_label; children[ac++] = bill_cycle_ppdd_time_text; children[ac++] = bill_cycle_ppdd_time_label; children[ac++] = bill_cycle_next_ppdd_date_text; children[ac++] = bill_cycle_statement_date_label; children[ac++] = bill_cycle_next_ppdd_time_text; children[ac++] = bill_cycle_next_ppdd_time_label; children[ac++] = bill_cycle_statement_time_text; children[ac++] = bill_cycle_cutoff_date_label; children[ac++] = bill_cycle_statement_date_text; children[ac++] = bill_cycle_statement_time_label; children[ac++] = bill_cycle_cutoff_date_text; children[ac++] = bill_cycle_prep_delay_label; children[ac++] = bill_cycle_cutoff_time_text; children[ac++] = bill_cycle_cutoff_time_label; children[ac++] = bill_cycle_prep_delay_text; children[ac++] = bill_cycle_bill_period_btn; children[ac++] = bill_cycle_billing_frequency_btn; XtManageChildren(children, ac); ac = 0; children[ac++] = bill_cycle_detailform; children[ac++] = widget49; XtManageChildren(children, ac); ac = 0; children[ac++] = bill_cycle_summ_form; children[ac++] = bill_cycle_button_form; children[ac++] = bill_cycle_tgl_form; children[ac++] = widget23; XtManageChildren(children, ac); ac = 0; XtManageChild ( bill_cycle_form); }
int main(int argc, char *argv[]) { Arg al[20]; int ac; int canvaswidth, canvasheight; /* read command line options */ if (Read_options (argc, argv) != 0) exit (-1); /* create the toplevel shell */ toplevel = XtAppInitialize(&context, "", NULL, 0, &argc, argv, NULL, NULL, 0); CS_error((void (*) ()) printf); printf("We serve line %d\n", Cur_link_ind); SIM_init (In_lb, Out_lb); /* default window size. */ ac = 0; canvaswidth = 400; canvasheight = 700; XtSetArg(al[ac], XmNheight, canvaswidth); ac++; XtSetArg(al[ac], XmNwidth, canvasheight); ac++; XtSetValues(toplevel, al, ac); /* create a form widget. */ ac = 0; form = XmCreateForm(toplevel, "form", al, ac); XtManageChild(form); /* create a menu bar and attach it to the form. */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; menu_bar = XmCreateMenuBar(form, "menu_bar", al, ac); XtManageChild(menu_bar); /* create a textshow widget and attach it to the form. */ ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, menu_bar); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNleftPosition, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNbottomPosition, 93); ac++; XtSetArg(al[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++; textshow = XmCreateScrolledText(form, "text", al, ac); XtManageChild(textshow); XmTextSetEditable(textshow, False); Create_menus(menu_bar); XtAppAddTimeOut(context, 950, (XtTimerCallbackProc) timer_callback, (XtPointer) NULL); XtRealizeWidget(toplevel); XtAppMainLoop(context); return (0); }
void Jump_location(/*@unused@*/ Widget w, /*@unused@*/ XtPointer clientData, /*@unused@*/ XtPointer callData) { static Widget pane,form, button_ok, button_add, button_delete, button_cancel, locdata, location_name; int n; Arg al[50]; /* Arg List */ unsigned int ac = 0; /* Arg Count */ Atom delw; char location_db_path[MAX_VALUE]; get_user_base_dir("data/locations_db.dat", location_db_path, sizeof(location_db_path)); if(!location_dialog) { begin_critical_section(&location_dialog_lock, "location_gui.c:Jump_location" ); location_dialog = XtVaCreatePopupShell(langcode("JMLPO00001"), xmDialogShellWidgetClass, appshell, XmNdeleteResponse,XmDESTROY, XmNdefaultPosition, FALSE, XmNresize, FALSE, XmNfontList, fontlist1, NULL); pane = XtVaCreateWidget("Jump_location pane", xmPanedWindowWidgetClass, location_dialog, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, NULL); form = XtVaCreateWidget("Jump_location form", xmFormWidgetClass, pane, XmNfractionBase, 5, XmNautoUnmanage, FALSE, XmNshadowThickness, 1, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, NULL); /*set args for color */ ac=0; XtSetArg(al[ac], XmNvisibleItemCount, 11); ac++; XtSetArg(al[ac], XmNtraversalOn, TRUE); ac++; XtSetArg(al[ac], XmNshadowThickness, 3); ac++; XtSetArg(al[ac], XmNbackground, colors[0x0ff]); ac++; XtSetArg(al[ac], XmNselectionPolicy, XmSINGLE_SELECT); ac++; XtSetArg(al[ac], XmNscrollBarPlacement, XmBOTTOM_RIGHT); ac++; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNtopOffset, 5); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 5); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 5); ac++; XtSetArg(al[ac], XmNforeground, MY_FG_COLOR); ac++; XtSetArg(al[ac], XmNbackground, MY_BG_COLOR); ac++; XtSetArg(al[ac], XmNfontList, fontlist1); ac++; location_list = XmCreateScrolledList(form, "Jump_location list", al, ac); n=1; clear_sort_file(location_db_path); jump_sort(); sort_list(location_db_path,200,location_list,&n); locdata = XtVaCreateManagedWidget(langcode("JMLPO00003"), xmLabelWidgetClass, form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, XtParent(location_list), XmNtopOffset, 10, XmNbottomAttachment, XmATTACH_NONE, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 5, XmNrightAttachment, XmATTACH_NONE, MY_FOREGROUND_COLOR, MY_BACKGROUND_COLOR, XmNfontList, fontlist1, NULL); location_name = XtVaCreateManagedWidget("Jump_location Location_name", xmTextFieldWidgetClass, form, XmNeditable, TRUE, XmNcursorPositionVisible, TRUE, XmNsensitive, TRUE, XmNshadowThickness, 1, XmNcolumns,21, XmNwidth,((21*7)+2), XmNbackground, colors[0x0f], XmNtopAttachment,XmATTACH_WIDGET, XmNtopWidget, XtParent(location_list), XmNtopOffset, 5, XmNbottomAttachment,XmATTACH_NONE, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget,locdata, XmNrightAttachment,XmATTACH_FORM, XmNrightOffset, 5, XmNfontList, fontlist1, NULL); button_ok = XtVaCreateManagedWidget(langcode("JMLPO00002"), xmPushButtonGadgetClass, form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, locdata, XmNtopOffset,15, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset,5, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, XmNleftOffset, 3, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 1, XmNnavigationType, XmTAB_GROUP, XmNfontList, fontlist1, NULL); button_add = XtVaCreateManagedWidget(langcode("UNIOP00007"), xmPushButtonGadgetClass, form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, locdata, XmNtopOffset,15, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset,5, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 1, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 2, XmNnavigationType, XmTAB_GROUP, XmNfontList, fontlist1, NULL); button_delete = XtVaCreateManagedWidget(langcode("UNIOP00008"), xmPushButtonGadgetClass, form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, locdata, XmNtopOffset,15, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset,5, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 2, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 3, XmNnavigationType, XmTAB_GROUP, XmNfontList, fontlist1, NULL); button_cancel = XtVaCreateManagedWidget(langcode("UNIOP00003"), xmPushButtonGadgetClass, form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, locdata, XmNtopOffset,15, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset,5, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 5, XmNrightOffset, 3, XmNnavigationType, XmTAB_GROUP, XmNfontList, fontlist1, NULL); XtAddCallback(button_cancel, XmNactivateCallback, location_destroy_shell, location_dialog); XtAddCallback(button_ok, XmNactivateCallback, location_view, NULL); XtAddCallback(button_add, XmNactivateCallback, location_add, location_name); XtAddCallback(button_delete, XmNactivateCallback, location_delete, NULL); pos_dialog(location_dialog); delw = XmInternAtom(XtDisplay(location_dialog),"WM_DELETE_WINDOW", FALSE); XmAddWMProtocolCallback(location_dialog, delw, location_destroy_shell, (XtPointer)location_dialog); XtManageChild(form); XtManageChild(location_list); XtVaSetValues(location_list, XmNbackground, colors[0x0f], NULL); XtManageChild(pane); end_critical_section(&location_dialog_lock, "location_gui.c:location_destroy_shell" ); XtPopup(location_dialog,XtGrabNone); fix_dialog_size(location_dialog); // Move focus to the Close 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(location_dialog); XmProcessTraversal(button_cancel, XmTRAVERSE_CURRENT); } else { XtPopup(location_dialog,XtGrabNone); (void)XRaiseWindow(XtDisplay(location_dialog), XtWindow(location_dialog)); } }
GeCurveMotif::GeCurveMotif( void *gc_parent_ctx, Widget parent_widget, char *curve_name, char *filename, GeCurveData *curve_data, int pos_right, int gc_width, int gc_height, unsigned int gc_options) : GeCurve( gc_parent_ctx, curve_name, filename, curve_data, pos_right, gc_width, gc_height, gc_options) { char uid_filename[120] = {"xtt_curve.uid"}; char *uid_filename_p = uid_filename; Arg args[20]; pwr_tStatus sts; int i; MrmHierarchy s_DRMh; MrmType dclass; Widget ge_curve_widget; char name[] = "PwR GeCurve"; static MrmRegisterArg reglist[] = { {(char*) "gec_ctx", 0 }, {(char*) "gec_activate_exit",(caddr_t)activate_exit }, {(char*) "gec_activate_configure",(caddr_t)activate_configure }, {(char*) "gec_activate_print",(caddr_t)activate_print }, {(char*) "gec_activate_zoomin",(caddr_t)activate_zoomin }, {(char*) "gec_activate_zoomout",(caddr_t)activate_zoomout }, {(char*) "gec_activate_zoomreset",(caddr_t)activate_zoomreset }, {(char*) "gec_activate_background",(caddr_t)activate_background }, {(char*) "gec_activate_showname",(caddr_t)activate_showname }, {(char*) "gec_activate_filledcurves",(caddr_t)activate_filledcurves }, {(char*) "gec_activate_xlimits",(caddr_t)activate_xlimits }, {(char*) "gec_activate_help",(caddr_t)activate_help }, {(char*) "gec_create_pane",(caddr_t)create_pane }, {(char*) "gec_create_growform",(caddr_t)create_growform }, {(char*) "gec_create_nameform",(caddr_t)create_nameform }, {(char*) "gec_create_curveform",(caddr_t)create_curveform }, {(char*) "gec_create_minmax_textmin",(caddr_t)create_minmax_textmin }, {(char*) "gec_create_minmax_textmax",(caddr_t)create_minmax_textmax }, {(char*) "gec_activate_minmax_ok",(caddr_t)activate_minmax_ok } }; static int reglist_num = (sizeof reglist / sizeof reglist[0]); Lng::get_uid( uid_filename, uid_filename); // Motif MrmInitialize(); cdh_StrncpyCutOff( title, curve_name, sizeof(title), 1); reglist[0].value = (caddr_t) this; toplevel = XtCreatePopupShell(title, topLevelShellWidgetClass, parent_widget, args, 0); // Save the context structure in the widget XtSetArg (args[0], XmNuserData, (XtPointer) this); sts = MrmOpenHierarchy( 1, &uid_filename_p, NULL, &s_DRMh); if (sts != MrmSUCCESS) printf("can't open %s\n", uid_filename); MrmRegisterNames(reglist, reglist_num); sts = MrmFetchWidgetOverride( s_DRMh, (char*) "ge_curve_window", toplevel, name, NULL, 0, &ge_curve_widget, &dclass); if (sts != MrmSUCCESS) printf("can't fetch %s\n", name); sts = MrmFetchWidget(s_DRMh, (char*) "minmax_dialog", toplevel, &minmax_widget, &dclass); if (sts != MrmSUCCESS) printf("can't fetch input dialog\n"); MrmCloseHierarchy(s_DRMh); if ( gc_width == 0) gc_width = 800; if ( gc_height == 0) gc_height = 600; i = 0; XtSetArg(args[i],XmNwidth,gc_width);i++; XtSetArg(args[i],XmNheight,gc_height);i++; XtSetArg(args[i], XmNdeleteResponse, XmDO_NOTHING);i++; XtSetValues( toplevel ,args,i); XtManageChild( ge_curve_widget); Widget w; grownames_main_widget = ScrolledGrowCreate( nameform_widget, (char*) "GeCurveNames", NULL, 0, init_grownames_cb, this, &w); i = 0; XtSetArg(args[i],XmNwidth,200);i++; XtSetValues( grownames_main_widget, args,i); XtManageChild( grownames_main_widget); growaxis_main_widget = GrowCreate( axisform_widget, (char*) "GeCurveAxis", NULL, 0, init_growaxis_cb, this); i = 0; XtSetArg(args[i],XmNwidth,200);i++; XtSetValues( growaxis_main_widget, args,i); XtManageChild( growaxis_main_widget); growcurve_main_widget = CurveCreate( curveform_widget, (char*) "GeCurve", NULL, 0, init_growcurve_cb, this); XtManageChild( growcurve_main_widget); i = 0; XtSetArg(args[i],XmNwidth,200);i++; XtSetArg(args[i],XmNheight,200);i++; XtSetArg(args[i],XmNpaneMinimum,75);i++; XtSetArg(args[i],XmNpaneMaximum,100);i++; nav_widget = CurveCreateNav( pane_widget, (char*) "navigator", args, i, growcurve_main_widget); XtManageChild( nav_widget); XtPopup( toplevel, XtGrabNone); XtRealizeWidget( toplevel); wow = new CoWowMotif( toplevel); // Connect the window manager close-button to exit flow_AddCloseVMProtocolCb( toplevel, (XtCallbackProc)activate_exit, this); }
void AutoDragSliderValue( int location, int XCoord, int YCoord, int mask, int XButton ) { int x, y, widget_class_code, n; int maximum, minimum, value; Boolean invalid = False; XisObjectRecord *object; Widget widget, tmp_widget; CompositeWidget cw; XmScrollBarWidget sb_widget; Boolean IsScale = False; Arg args[5]; short s_x1, s_y1, s_width1, s_height1; short s_x2, s_y2, s_width2, s_height2; short change_x, change_y; int value1, value2, slider_size, slidersize; xisGetPointerLocation(&x,&y); object = xisFindObjectAtLocation(x, y); widget = (Widget) object->id.widget; if (widget == NULL) AutoError(_AutoMessages[SCRMSG18]); tmp_widget = XtParent(widget); widget_class_code = mvsGetClassCode(tmp_widget); if (widget_class_code == mvsXmScaleWidgetClass) { widget = tmp_widget; IsScale = True; } widget_class_code = mvsGetClassCode(widget); if (widget_class_code != mvsXmScaleWidgetClass) if (widget_class_code != mvsXmScrollBarWidgetClass) { AutoMessage(_AutoMessages[SCRMSG19]); return; } n = 0; XtSetArg(args[n], XmNvalue, &value); n++; XtSetArg(args[n], XmNminimum, &minimum); n++; XtSetArg(args[n], XmNmaximum, &maximum); n++; XtSetArg(args[n], XmNsliderSize, &slidersize); n++; XtGetValues(widget, args, n); if (! IsScale && XCoord == AUTOMAX) XCoord = maximum - slidersize; else if (! IsScale && XCoord != AUTOMIN) XCoord = (int) (((maximum - slidersize) * XCoord) / 100); if (XCoord == AUTOMAX && IsScale) XCoord = maximum; if (XCoord == AUTOMIN) XCoord = minimum; /* We know that the second composite child is the Scrollbar child */ if (IsScale) { cw = (CompositeWidget) widget; sb_widget = (XmScrollBarWidget) cw->composite.children[SCROLLBAR_CHILD]; widget_class_code = mvsGetClassCode((Widget) sb_widget); if (widget_class_code != mvsXmScrollBarWidgetClass) AutoError(_AutoMessages[SCRMSG20]); CalcScrollBarData((XmScaleWidget)widget, value, &value1, &slider_size); CalcScrollBarData((XmScaleWidget)widget, XCoord, &value2, &slider_size); CalcSliderRect(sb_widget, &s_x1, &s_y1, &s_width1, &s_height1, value1); CalcSliderRect(sb_widget, &s_x2, &s_y2, &s_width2, &s_height2, value2); } else { CalcSliderRect((XmScrollBarWidget)widget, &s_x1, &s_y1, &s_width1, &s_height1, value); CalcSliderRect((XmScrollBarWidget)widget, &s_x2, &s_y2, &s_width2, &s_height2, XCoord); } change_x = abs(s_x2 - s_x1); change_y = abs(s_y2 - s_y1); switch(location) { case DOWN: x = 0; y = change_y; break; case UP: x = 0; y = -change_y; break; case RIGHT: y = 0; x = change_x; break; case LEFT: y = 0; x = -change_x; break; default: invalid = True; AutoMessage(_AutoMessages[SCRMSG3]); break; } if (!invalid) { xisPressMouseButton(mask, XButton); xisMovePointerRelative(x, y); xisReleaseMouseButton(mask, XButton); } }
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; }
void WmPanelistShow (Widget w) { SwitchData * switch_data; Dimension switch_rc_height; Dimension switch_button_height; Dimension width = XtWidth(panel.shell); Dimension height = XtHeight(panel.shell); Position x = XtX(panel.shell); Position y = XtY(panel.shell); Dimension screen_width; Display * display; CompositeWidget cw; Widget * widget_list; DtWmHints vHints; String shell_geometry = NULL; char geometry_buffer[32]; XSizeHints hints; long supplied; int i; Arg al[20]; int ac; /* Find the switch data for later processing */ switch_data = NULL; for (i = 0; i < panel.box_data_count; i++) { if (panel.box_data[i]->switch_data != NULL) { switch_data = panel.box_data[i]->switch_data; break; } } /* Realize the shell so that it is sized properly for later */ /* positioning and child repositioning. */ XtRealizeWidget (panel.shell); /* See if a geometry has been set. */ ac = 0; XtSetArg (al[ac], XmNgeometry, &shell_geometry); ac++; XtGetValues (panel.shell, al, ac); /* If the shell has no default geometry, construct a default */ /* which will center the panel along the bottom of the display */ width = XtWidth (panel.shell); screen_width = WidthOfScreen (XtScreen (panel.shell)); display = XtDisplay (panel.shell); if (shell_geometry == NULL) { Position x; char geometry_buffer[32]; if (panel.element_values[PANEL_GEOMETRY].string_value != NULL) { shell_geometry = panel.element_values[PANEL_GEOMETRY].parsed_value; } else { x = (screen_width > width) ? (Position)(screen_width - width) / 2 : 0; sprintf (geometry_buffer, "+%d-0", x); shell_geometry = geometry_buffer; } XtSetArg (al[0], XmNgeometry, shell_geometry); XtSetValues (panel.shell, al, 1); } /* Adjust the positions of the buttons within the switch */ /* so that they are spaced nicely. */ if (switch_data != NULL) { UpdateSwitchGeometry (switch_data->box_data); /* Reposition or adjust the front panel if it is either off */ /* the right edge of the screen or larger than the screen */ if (width > screen_width) { Arg al[1]; while (width > screen_width && panel.switch_row_count < switch_data->switch_count) { panel.switch_row_count++; XtSetArg (al[0], XmNnumColumns, panel.switch_row_count); XtSetValues (switch_data->rc, al, 1); width = XtWidth (panel.shell); } } } SetGeometry (panel.shell, shell_geometry, &x, &y); WorkspaceAdjustPanelPosition (x, y, XtWidth (panel.shell), XtHeight (panel.shell)); /* Set hints to avoid interactive placement */ if (XGetWMNormalHints(display, XtWindow(panel.shell), &hints, &supplied) != 0) { hints.flags |= USPosition|USSize; XSetWMNormalHints(display, XtWindow(panel.shell), &hints); } /* Set the shells icon and title for when it is minimized */ if (switch_data != NULL) { int current_workspace = switch_data->active_switch; XtSetArg (al[0], XmNiconName, switch_data->switch_names[current_workspace]); XtSetArg (al[1], XmNtitle, switch_data->switch_names[current_workspace]); XtSetValues (panel.shell, al, 2); } /* Set panel's window manager hints. */ vHints.flags = DtWM_HINTS_BEHAVIORS; vHints.behaviors = DtWM_BEHAVIOR_PANEL; _DtWsmSetDtWmHints (XtDisplay(panel.shell), XtWindow (panel.shell), &vHints); /* Set the subpanel's transientShell to update transientFor and */ /* Set the subpanel hints. */ vHints.behaviors |= DtWM_BEHAVIOR_SUBPANEL; vHints.flags |= DtWM_HINTS_ATTACH_WINDOW; vHints.attachWindow = XtWindow (panel.shell); for (i = 0, widget_list = M_PopupList (panel.shell); i < M_NumPopups (panel.shell); i++) { cw = (CompositeWidget) widget_list[i]; ac = 0; XtSetArg (al[ac], XmNtransientFor, NULL); ac++; XtSetValues ((Widget) cw, al, ac); ac = 0; XtSetArg (al[ac], XmNtransientFor, panel.shell); ac++; XtSetValues ((Widget) cw, al, ac); if (M_NumChildren (cw) > 0) { XtRealizeWidget ((M_Children (cw))[0]); _DtWsmSetDtWmHints (XtDisplay (panel.shell), XtWindow (widget_list[i]), &vHints); } } /* Set the push recall list and count into the window manager's */ /* screen global data. */ PushRecallSetData (); /* Set up the callback ot the workspace management API for */ /* catching changes in workspace configuration. */ DtWsmAddWorkspaceModifiedCallback(panel.shell, WorkspaceModifyCB, (XtPointer)switch_data); /* Get the front panel displayed */ XtSetMappedWhenManaged (panel.shell, True); XtPopup (panel.shell, XtGrabNone); /* Restore the session information */ SessionRestoreData (); /* Set up the window and geometry information for the embedded clients */ for (i = 0; i < panel.embedded_client_count; i++) EmbeddedClientSetGeometry (&(((WmFpEmbeddedClientList) panel.embedded_client_list)[i])); /* Set the embedded client list and count into the window manager's */ /* screen global data. */ EmbeddedClientSetData (); }
static PlotWindowInfo *new_decoration(const string& name) { PlotWindowInfo *plot = 0; // Check whether we can reuse an existing decoration for (int i = 0; i < plot_infos.size(); i++) { PlotWindowInfo *info = (PlotWindowInfo *)plot_infos[i]; if (info->plotter == 0) { // Shell is unused - use this one plot = info; break; } } if (plot == 0) { plot = new PlotWindowInfo; // Create decoration windows Arg args[10]; Cardinal arg = 0; XtSetArg(args[arg], XmNallowShellResize, True); arg++; XtSetArg(args[arg], XmNdeleteResponse, XmDO_NOTHING); arg++; // Mark shell as `used' XtSetArg(args[arg], XmNuserData, XtPointer(True)); arg++; plot->shell = verify(XtCreateWidget("plot", topLevelShellWidgetClass, find_shell(), args, arg)); AddDeleteWindowCallback(plot->shell, CancelPlotCB, XtPointer(plot)); arg = 0; Widget main_window = XmCreateMainWindow(plot->shell, XMST("main_window"), args, arg); XtManageChild(main_window); MMcreateMenuBar(main_window, "menubar", menubar); MMaddCallbacks(file_menu, XtPointer(plot)); MMaddCallbacks(simple_edit_menu); MMaddCallbacks(view_menu, XtPointer(plot)); MMaddCallbacks(plot_menu, XtPointer(plot)); MMaddCallbacks(scale_menu, XtPointer(plot)); MMaddCallbacks(contour_menu, XtPointer(plot)); MMaddCallbacks(simple_help_menu); MMaddHelpCallback(menubar, ImmediateHelpCB); arg = 0; XtSetArg(args[arg], XmNscrollingPolicy, XmAPPLICATION_DEFINED); arg++; XtSetArg(args[arg], XmNvisualPolicy, XmVARIABLE); arg++; Widget scroll = XmCreateScrolledWindow(main_window, XMST("scroll"), args, arg); XtManageChild(scroll); // Create work window Widget work; string plot_term_type = downcase(app_data.plot_term_type); if (plot_term_type.contains("xlib", 0)) { // xlib type - create plot area to draw plot commands arg = 0; work = XmCreateDrawingArea(scroll, XMST(PLOT_AREA_NAME), args, arg); XtManageChild(work); plot->area = new PlotArea(work, make_font(app_data, FixedWidthDDDFont)); XtVaSetValues(work, XmNuserData, XtPointer(plot->area), XtPointer(0)); } else if (plot_term_type.contains("x11", 0)) { // x11 type - swallow Gnuplot window arg = 0; work = plot->swallower = XtCreateManagedWidget(SWALLOWER_NAME, swallowerWidgetClass, scroll, args, arg); } else { // Unknown terminal type post_error("Unknown plot terminal type " + quote(app_data.plot_term_type), "unknown_plot_term_type_error"); return 0; } // Create scroll bars const int slider_size = 20; arg = 0; XtSetArg(args[arg], XmNorientation, XmHORIZONTAL); arg++; XtSetArg(args[arg], XmNminimum, 0); arg++; XtSetArg(args[arg], XmNmaximum, 360 + slider_size); arg++; plot->hsb = XmCreateScrollBar(scroll, XMST("hsb"), args, arg); XtManageChild(plot->hsb); arg = 0; XtSetArg(args[arg], XmNorientation, XmVERTICAL); arg++; XtSetArg(args[arg], XmNminimum, 0); arg++; XtSetArg(args[arg], XmNmaximum, 180 + slider_size); arg++; plot->vsb = XmCreateScrollBar(scroll, XMST("vsb"), args, arg); XtManageChild(plot->vsb); XtAddCallback(plot->hsb, XmNvalueChangedCallback, SetViewCB, XtPointer(plot)); XtAddCallback(plot->vsb, XmNvalueChangedCallback, SetViewCB, XtPointer(plot)); #if 0 XtAddCallback(plot->hsb, XmNdragCallback, SetViewCB, XtPointer(plot)); XtAddCallback(plot->vsb, XmNdragCallback, SetViewCB, XtPointer(plot)); #endif XmScrolledWindowSetAreas(scroll, plot->hsb, plot->vsb, work); Delay::register_shell(plot->shell); InstallButtonTips(plot->shell); plot_infos += plot; } string title = DDD_NAME ": " + name; XtVaSetValues(plot->shell, XmNtitle, title.chars(), XmNiconName, title.chars(), XtPointer(0)); if (plot->swallower != 0) { XtRemoveAllCallbacks(plot->swallower, XtNwindowCreatedCallback); XtAddCallback(plot->swallower, XtNwindowCreatedCallback, SwallowCB, XtPointer(plot)); XtRemoveAllCallbacks(plot->swallower, XtNwindowGoneCallback); XtAddCallback(plot->swallower, XtNwindowGoneCallback, SwallowAgainCB, XtPointer(plot)); if (plot->swallow_timer != 0) XtRemoveTimeOut(plot->swallow_timer); plot->swallow_timer = XtAppAddTimeOut(XtWidgetToApplicationContext(plot->swallower), app_data.plot_window_delay, SwallowTimeOutCB, XtPointer(plot)); } plot->active = false; return plot; }
// Answer GDB question static void select_from_gdb(const string& question, string& reply) { int count = question.freq('\n') + 1; string *choices = new string[count]; bool *selected = new bool[count]; split(question, choices, count, '\n'); // Highlight choice #1 by default for (int i = 0; i < count; i++) { if (!has_nr(choices[i])) { // Choice has no number (prompt) - remove it for (int j = i; j < count - 1; j++) choices[j] = choices[j + 1]; count--; i--; } else { selected[i] = (get_positive_nr(choices[i]) == 1); } } if (count < 2) { // Nothing to choose from if (count == 1) { // Take the first choice. reply = itostring(atoi(choices[0].chars())) + "\n"; } delete[] choices; delete[] selected; return; } // Popup selection dialog static string selection_reply; if (gdb_selection_dialog == 0) { Arg args[10]; Cardinal arg = 0; XtSetArg(args[arg], XmNautoUnmanage, False); arg++; gdb_selection_dialog = verify(XmCreateSelectionDialog(find_shell(gdb_w), XMST("gdb_selection_dialog"), args, arg)); Delay::register_shell(gdb_selection_dialog); XtUnmanageChild(XmSelectionBoxGetChild(gdb_selection_dialog, XmDIALOG_TEXT)); XtUnmanageChild(XmSelectionBoxGetChild(gdb_selection_dialog, XmDIALOG_SELECTION_LABEL)); XtUnmanageChild(XmSelectionBoxGetChild(gdb_selection_dialog, XmDIALOG_APPLY_BUTTON)); gdb_selection_list_w = XmSelectionBoxGetChild(gdb_selection_dialog, XmDIALOG_LIST); XtVaSetValues(gdb_selection_list_w, XmNselectionPolicy, XmSINGLE_SELECT, XtPointer(0)); XtAddCallback(gdb_selection_dialog, XmNokCallback, SelectCB, &selection_reply); XtAddCallback(gdb_selection_dialog, XmNcancelCallback, CancelCB, &selection_reply); XtAddCallback(gdb_selection_dialog, XmNhelpCallback, ImmediateHelpCB, 0); } setLabelList(gdb_selection_list_w, choices, selected, count, false, false); delete[] choices; delete[] selected; manage_and_raise(gdb_selection_dialog); selection_reply = ""; while (selection_reply.empty() && gdb->running() && !gdb->isReadyWithPrompt()) XtAppProcessEvent(XtWidgetToApplicationContext(gdb_w), XtIMAll); // Found a reply - return reply = selection_reply; }
static void DoExportCB(Widget w, XtPointer client_data, XtPointer call_data) { SelectPlotCB(w, client_data, call_data); PlotWindowInfo *plot = (PlotWindowInfo *)client_data; string target = get_file(w, client_data, call_data); if (target.empty()) return; const StringArray& titles = plot->plotter->data_titles(); const StringArray& sources = plot->plotter->data_files(); string source = ""; string title = ""; for (int i = 0; source.empty() && i < sources.size(); i++) { if (!sources[i].empty()) { source = sources[i]; title = titles[i]; } } if (source.empty()) return; // This should not happen if (access(target.chars(), W_OK) == 0 && is_regular_file(target)) { // File exists - request confirmation static Widget confirm_overwrite_dialog = 0; if (confirm_overwrite_dialog != 0) DestroyWhenIdle(confirm_overwrite_dialog); Arg args[10]; Cardinal arg = 0; XtSetArg(args[arg], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); arg++; confirm_overwrite_dialog = verify(XmCreateQuestionDialog(plot->shell, XMST("confirm_overwrite_dialog"), args, arg)); Delay::register_shell(confirm_overwrite_dialog); bool yes = false; bool no = false; XtAddCallback(confirm_overwrite_dialog, XmNokCallback, SetCB, XtPointer(&yes)); XtAddCallback(confirm_overwrite_dialog, XmNcancelCallback, SetCB, XtPointer(&no)); XtAddCallback(confirm_overwrite_dialog, XmNhelpCallback, ImmediateHelpCB, 0); MString question = rm("Overwrite existing file " + quote(target) + "?"); XtVaSetValues (confirm_overwrite_dialog, XmNmessageString, question.xmstring(), XtPointer(0)); manage_and_raise(confirm_overwrite_dialog); XtAppContext app_context = XtWidgetToApplicationContext(plot->shell); while (!yes && !no) XtAppProcessEvent(app_context, XtIMAll); if (no) return; } StatusDelay delay("Saving " + title + " data to " + quote(target)); // Copy SOURCE to TARGET std::ifstream is(source.chars()); std::ofstream os(target.chars()); if (os.bad()) { FILE *fp = fopen(target.chars(), "w"); post_error(string("Cannot open ") + quote(target) + ": " + strerror(errno), "export_failed_error", plot->shell); if (fp) fclose(fp); delay.outcome = strerror(errno); return; } int c; while ((c = is.get()) != EOF) os.put((unsigned char) c); XtUnmanageChild(plot->export_dialog); }
static void ProcessComponentList( Widget parent, Widget mainRC ) { int count=0; int j=0; int n, n2; Arg args[MAX_ARGS]; Widget componentWidget; int s; char *string; char *resString, *resString2; XmString cmp_string; int helpTag; char *dtIcon; int len; style.workProcs = False; if (style.xrdb.componentList == NULL) return; n = 0; XtSetArg(args[n], XmNalignment, XmALIGNMENT_CENTER); n++; XtSetArg(args[n], XmNpixmapPosition, XmPIXMAP_TOP); n++; XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++; n2 = 3; /* number of preset args for creating Icons */ resString = strdup (style.xrdb.componentList); resString2 = resString; len = strlen(resString); string = strtok(resString, " "); s = 0; while (string != NULL) { /* check for valid name, duplicate name *** */ /* create Icon in Dtstyle main window */ n = n2; XtSetArg(args[n], XmNfillMode, XmFILL_SELF); n++; if (colorUse == XmCO_BLACK_WHITE) { XtSetArg(args[n], XmNuseEmbossedText, False); n++; } XtSetArg(args[n], XmNpixmapForeground, style.primBSCol); n++; XtSetArg(args[n], XmNpixmapBackground, style.primTSCol); n++; if (strcmp(string, COLOR) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 27, "Color")); helpTag = HELP_COLOR_BUTTON; dtIcon = _DtGetIconFileName(style.screen, COLOR_ICON, NULL, NULL, NULL); style.workProcs = True; } else if (strcmp(string, FONT) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 28, "Font")); dtIcon = _DtGetIconFileName(style.screen, FONT_ICON, NULL, NULL, NULL); helpTag = HELP_FONT_BUTTON; } else if (strcmp(string, BACKDROP) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 29, "Backdrop")); dtIcon = _DtGetIconFileName(style.screen, BACKDROP_ICON, NULL, NULL, NULL); helpTag = HELP_BACKDROP_BUTTON; } else if (strcmp(string, KEYBOARD) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 30, "Keyboard")); dtIcon = _DtGetIconFileName(style.screen, KEYBOARD_ICON, NULL, NULL, NULL); helpTag = HELP_KEYBOARD_BUTTON; } else if (strcmp(string, MOUSE) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 31, "Mouse")); dtIcon = _DtGetIconFileName(style.screen, MOUSE_ICON, NULL, NULL, NULL); helpTag = HELP_MOUSE_BUTTON; } else if (strcmp(string, BEEP) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 32, "Beep")); dtIcon = _DtGetIconFileName(style.screen, BEEP_ICON, NULL, NULL, NULL); helpTag = HELP_AUDIO_BUTTON; } else if (strcmp(string, SCREEN) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 33, "Screen")); dtIcon = _DtGetIconFileName(style.screen, SCREEN_ICON, NULL, NULL, NULL); helpTag = HELP_SCREEN_BUTTON; } else if (strcmp(string, DTWM) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 38, "Window")); dtIcon = _DtGetIconFileName(style.screen, DTWM_ICON, NULL, NULL, NULL); helpTag = HELP_DTWM_BUTTON; } else if (strcmp(string, STARTUP) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 35, "Startup")); dtIcon = _DtGetIconFileName(style.screen, STARTUP_ICON, NULL, NULL, NULL); helpTag = HELP_STARTUP_BUTTON; } else if (strcmp(string, I18N) == 0) { cmp_string = CMPSTR(GETMESSAGE(4, 34, "Intl'")); dtIcon = _DtGetIconFileName(style.screen, I18N_ICON, NULL, NULL, NULL); helpTag = HELP_I18N_BUTTON; } else { s += strlen(string) +1; if (resString+s >= resString2 + len) string = NULL; else string = strtok(resString+s, " "); continue; } XtSetArg(args[n], XmNimageName, dtIcon); n++; XtSetArg(args[n], XmNstring, cmp_string); n++; componentWidget = _DtCreateControl(mainRC, string, args, n); XtManageChild (componentWidget); XtAddCallback(componentWidget, XmNcallback, activateCB, string); XtAddCallback(componentWidget, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)helpTag); XmStringFree(cmp_string); XtFree(dtIcon); s += strlen(string) +1; if (resString+s >= resString2 + len) string = NULL; else string = strtok(resString+s, " "); } /* while */ }
/*+++++++++++++++++++++++++++++++++++++++++++++*/ static void build_mainWindow( Widget shell ) { int count, n, n2; Arg args[MAX_ARGS]; Widget WidgList[10]; Widget frame; Widget mainMenu; Widget mainRC; Widget filePulldown; Widget helpPulldown; Widget exitBtn; char *mnemonic; char *tmpStr; Pixmap pixmap; XmString labelString; Pixmap ditherPix; XmPixelSet pixelSet[XmCO_NUM_COLORS]; Pixel bg; short a,i,p,s; /* saveRestore * Note that save.poscnt has been initialized elsewhere. * save.posArgs may contain information from restoreAudio().*/ XtSetArg(save.posArgs[save.poscnt], XmNnoResize, True); save.poscnt++; XtSetArg(save.posArgs[save.poscnt], XmNresizePolicy, XmRESIZE_NONE); save.poscnt++; style.mainWindow= XmCreateMainWindow(shell,"mainWindow", save.posArgs, save.poscnt); XtAddCallback(style.mainWindow, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MAIN_WINDOW); n = 0; tmpStr = (char *)XtMalloc(strlen(GETMESSAGE(4, 1, "Style Manager"))+1); sprintf(tmpStr, GETMESSAGE(4, 1, "Style Manager")); XtSetArg(args[n], XmNtitle, tmpStr); n++; XtSetArg(args[n], XmNiconName, (char *)GETMESSAGE(4, 37, "Style")); n++; XtSetValues(XtParent(style.mainWindow), args, n); XtFree(tmpStr); n = 0; mainMenu= XmCreateMenuBar(style.mainWindow,"mainMenu", args, n); XtAddCallback(mainMenu, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_MENUBAR); XtManageChild(mainMenu); /* create the pulldown widgets */ n = 0; filePulldown= XmCreatePulldownMenu(mainMenu,"fileMenu", args, n ); XtAddCallback(filePulldown, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU); n = 0; helpPulldown= XmCreatePulldownMenu(mainMenu, "helpMenu" , args, n ); XtAddCallback(helpPulldown, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU); /* create the cascade butons */ count = 0; n = 0; mnemonic = ((char *)GETMESSAGE(4, 2, "F")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 3, "File")); XtSetArg(args[n], XmNlabelString, labelString); n++; XtSetArg(args[n], XmNsubMenuId, filePulldown); n++; XtSetArg (args[n], XmNmarginWidth, LB_MARGIN_WIDTH); n++; WidgList[count++]= XmCreateCascadeButton(mainMenu, "fileCascadeButton", args, n ); XtAddCallback(WidgList[count-1], XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_FILE_MENU); XmStringFree(labelString); n = 0; mnemonic = ((char *)GETMESSAGE(4, 4, "H")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 5, "Help")); XtSetArg(args[n], XmNlabelString, labelString); n++; XtSetArg(args[n], XmNsubMenuId, helpPulldown); n++; XtSetArg (args[n], XmNmarginWidth, 6); n++; WidgList[count++]= XmCreateCascadeButton(mainMenu, "helpCascadeButton", args, n ); XtAddCallback(WidgList[count-1], XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_HELP_MENU); XmStringFree(labelString); n = 0; XtSetArg(args[n], XmNmenuHelpWidget, WidgList[count-1]); n++; XtSetValues (mainMenu, args, n); XtManageChildren (WidgList, count); /* create the File menu pane's buttons */ n = 0; mnemonic = ((char *)GETMESSAGE(4, 53, "x")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 7, "Exit")); XtSetArg(args[n], XmNlabelString, labelString); n++; exitBtn= XmCreatePushButton(filePulldown, "exit", args, n ); XtAddCallback(exitBtn, XmNactivateCallback, activateCB_exitBtn, NULL); XtAddCallback(exitBtn, XmNhelpCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_EXIT); XtManageChild(exitBtn); XmStringFree(labelString); /* create the Help menu pane's buttons */ count =0; n = 0; mnemonic = ((char *)GETMESSAGE(4, 54, "v")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 55, "Overview")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "overview", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_INTRODUCTION); XmStringFree(labelString); n = 0; WidgList[count++]= XmCreateSeparatorGadget(helpPulldown,"separator",args,n); n = 0; mnemonic = ((char *)GETMESSAGE(4, 43, "T")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 56, "Tasks")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "tasks", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_TASKS); XmStringFree(labelString); n = 0; mnemonic = ((char *)GETMESSAGE(4, 45, "R")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 57, "Reference")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "reference", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_REFERENCE); XmStringFree(labelString); n = 0; mnemonic = ((char *)GETMESSAGE(4, 47, "O")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 48, "On Item")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "onItem", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpModeCB, (XtPointer)NULL); XmStringFree(labelString); n = 0; WidgList[count++] = XmCreateSeparatorGadget(helpPulldown,"separator",args,n); n = 0; mnemonic = ((char *)GETMESSAGE(4, 49, "U")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 58, "Using Help")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "usingHelp", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_USING); XmStringFree(labelString); n = 0; WidgList[count++] = XmCreateSeparatorGadget(helpPulldown,"separator",args,n); n = 0; mnemonic = ((char *)GETMESSAGE(4, 59, "A")); XtSetArg(args[n], XmNmnemonic, mnemonic[0]); n++; labelString = CMPSTR((char *)GETMESSAGE(4, 60, "About Style Manager")); XtSetArg(args[n], XmNlabelString, labelString); n++; WidgList[count++]= XmCreatePushButton(helpPulldown, "stylemanager", args, n ); XtAddCallback(WidgList[count-1], XmNactivateCallback, (XtCallbackProc)HelpRequestCB, (XtPointer)HELP_VERSION); XmStringFree(labelString); XtManageChildren(WidgList, count); /* create frame and row column for icon gadgets */ n = 0; XtSetArg(args[n], XmNresizePolicy, XmRESIZE_NONE); n++; XtSetArg(args[n], XmNshadowType, XmSHADOW_OUT); n++; XtSetArg(args[n], XmNshadowThickness, 1); n++; frame = XmCreateFrame(style.mainWindow, "frame", args, n); XtManageChild(frame); /* Save pixels for later use */ /* primary top/bottom shadow -> fg/bg for pixmaps in primary areas */ /* secondary top/bottom shadow -> fg/bg for pixmaps in secondary areas */ /* secondary select color -> backgrounds of editable text areas */ /* secondary foreground -> fill color on toggle indicators */ /* Get the primary colors to be used later */ n = 0; XtSetArg(args[n], XmNbackground, &bg); n++; XtGetValues(style.mainWindow, args, n); XmGetColors (style.screen, style.colormap, bg, NULL, &style.primTSCol, &style.primBSCol, NULL); /* Get the secondary colors to be used later */ n = 0; XtSetArg(args[n], XmNbackground, &style.secBgCol); n++; XtGetValues(exitBtn, args, n); XmGetColors (style.screen, style.colormap, style.secBgCol, &style.tgSelectColor, &style.secTSCol, &style.secBSCol, &style.secSelectColor); if ((style.secTSCol == style.secBSCol) || /* B_W or shadowPixmaps==True */ (!style.useMultiColorIcons)) /* multiColorIcons turned off */ { /* force TS = White, BS = Black */ style.secTSCol = style.primTSCol = WhitePixelOfScreen(style.screen); style.secBSCol = style.primBSCol = BlackPixelOfScreen(style.screen); } XmeGetPixelData(style.screenNum, &colorUse, pixelSet, &a, &i, &p, &s); n = 0; if (colorUse == XmCO_BLACK_WHITE) { ditherPix = XmGetPixmap (style.screen, "50_foreground", style.primBSCol,style.primTSCol); XtSetArg(args[n], XmNbackgroundPixmap, ditherPix); n++; } XtSetArg(args[n], XmNallowOverlap, False); n++; XtSetArg(args[n], XmNadjustLast, False); n++; XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); n++; XtSetArg(args[n], XmNspacing, style.horizontalSpacing); n++; mainRC = XmCreateRowColumn(frame, "mainRC", args, n); XtManageChild(mainRC); n = 0; XtSetArg(args[n], XmNmenuBar, mainMenu); n++; XtSetArg(args[n], XmNcommandWindow, NULL); n++; XtSetArg(args[n], XmNworkWindow, frame); n++; XtSetValues (style.mainWindow, args, n); ProcessComponentList (shell, mainRC); }
main (int argc, char *argv[]) { Widget toplevel, text_w, form, rowcol, label_w; XtAppContext app; int i; void print_result(Widget, XtPointer, XtPointer); Arg args[8]; int n; XtSetLanguageProc (NULL, NULL, NULL); toplevel = XtVaAppInitialize (&app, "Demos", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); rowcol = XmCreateRowColumn (toplevel, "rowcol", NULL, 0); for (i = 0; i < XtNumber (labels); i++) { n = 0; XtSetArg (args[n], XmNfractionBase, 10); n++; XtSetArg (args[n], XmNnavigationType, XmNONE); n++; form = XmCreateForm (rowcol, "form", args, n); n = 0; XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_POSITION); n++; XtSetArg (args[n], XmNrightPosition, 3); n++; XtSetArg (args[n], XmNalignment, XmALIGNMENT_END); n++; XtSetArg (args[n], XmNnavigationType, XmNONE); n++; label_w = XmCreateLabelGadget (form, labels[i], args, n); XtManageChild (label_w); n = 0; XtSetArg (args[n], XmNtraversalOn, True); n++; XtSetArg (args[n], XmNleftAttachment, XmATTACH_POSITION); n++; XtSetArg (args[n], XmNleftPosition, 4); n++; XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg (args[n], XmNnavigationType, XmTAB_GROUP); n++; text_w = XmCreateTextField (form, "text_w", args, n); XtManageChild (text_w); /* When user hits return, print the label+value of text_w */ XtAddCallback (text_w, XmNactivateCallback, print_result, (XtPointer) labels[i]); XtManageChild (form); } XtManageChild (rowcol); XtRealizeWidget (toplevel); XtAppMainLoop (app); }
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); } }
int do_hello_world( int argc, char *argv[], const char *printername, const char *toFile, const char *sample_string ) { XtAppContext app; Widget toplevel, shell, print_shell, hello; long dpi_x = 0L, dpi_y = 0L; char fontname[256]; /* BUG: is this really big enougth ? */ XFontStruct *textFont; XmFontList textFontList; Cardinal n; Arg args[10]; MyPrintCallbackData mpcd; if( doPrint ) { /* Get printer, either by "name" (foobar) or "name@display" (foobar@gaja:5) */ if( XpuGetPrinter(printername, &pdpy, &pcontext) != 1 ) Error(("XpuGetPrinter failure.\n")); /* Configure the print context (paper size, title etc.) * We must do this before creating any Xt widgets - otherwise they will * make wrong assuptions about fonts, resultions etc. ... */ XpuSetJobTitle(pdpy, pcontext, "Simple Xprint XawPrintShell widget demo"); /* Configuration done, set the context */ XpSetContext(pdpy, pcontext); /* Get default printer resolution */ if( XpuGetResolution(pdpy, pcontext, &dpi_x, &dpi_y) != 1 ) { fprintf(stderr, "No default resolution for printer '%s'\n", printername); XpuClosePrinterDisplay(pdpy, pcontext); return(EXIT_FAILURE); } pscreen = XpGetScreenOfContext(pdpy, pcontext); } else { pdpy = XOpenDisplay(NULL); if( !pdpy ) Error(("XOpenDisplay failure.\n")); dpi_x = dpi_y = 0L; pscreen = XDefaultScreenOfDisplay(pdpy); } toplevel = XawOpenApplication(&app, pdpy, pscreen, "xpawprintshelldemo", "XpXawPrintShellDemo", applicationShellWidgetClass, &argc, argv); if( !toplevel ) Error(("XawOpenApplication failure.\n")); if( doPrint ) { n = 0; /* Override any geometry resource settings as XawPrintShell adjusts it's size * to the current page siue when |XawPrintLAYOUTMODE_DRAWABLEAREA| or * |XawPrintLAYOUTMODE_PAGESIZE| are used. */ XtSetArg(args[n], XtNgeometry, "+0+0"); n++; XtSetArg(args[n], XawNlayoutMode, XawPrintLAYOUTMODE_DRAWABLEAREA); n++; print_shell = XtCreatePopupShell("myprintshell", xawPrintShellWidgetClass, toplevel, args, n); /* we're mapping/unmapping at start/end page time */ XtSetMappedWhenManaged(print_shell, False); shell = print_shell; } else { shell = toplevel; } sprintf(fontname, "-adobe-courier-medium-r-normal--40-*-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y); textFont = XLoadQueryFont(pdpy, fontname); if( !textFont ) { sprintf(fontname, "-*-*-*-*-*-*-*-160-%ld-%ld-*-*-iso8859-1", dpi_x, dpi_y); textFont = XLoadQueryFont(pdpy, fontname); } if( !textFont ) Error(("XLoadQueryFont failure.\n")); textFontList = XmFontListCreate(textFont, XmSTRING_DEFAULT_CHARSET); n = 0; /* Make sure the cursor is off, current Xprt servers do not seem to like * blinking cursors that much... ;-/ */ XtSetArg(args[n], XmNcursorPositionVisible, False); n++; XtSetArg(args[n], XmNvalue, sample_string); n++; XtSetArg(args[n], XmNfontList, textFontList); n++; XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; hello = XmCreateText(shell, "mytext", args, n); if( !hello ) Error(("XmCreateText failure.\n")); XtManageChild(hello); XtRealizeWidget(toplevel); XtRealizeWidget(shell); if( doPrint ) { int num_total_rows; short num_visible_rows; int num_pages; pdpy = XtDisplay(toplevel); pdrawable = XtWindow(toplevel); if( !pdpy || !pdrawable ) Error(("No display.\n")); /* Make sure that the Xt machinery is really using the right screen (assertion) */ if( XpGetScreenOfContext(XtDisplay(toplevel), pcontext) != XtScreen(toplevel) ) Error(("Widget's screen != print screen. BAD.\n")); /* Get number of rows visible per page and the number of total rows * in the whole text widget... */ n = 0; XtSetArg(args[n], XmNrows, &num_visible_rows); n++ ; XtSetArg(args[n], XmNtotalLines, &num_total_rows); n++ ; XtGetValues(hello, args, n); /* Take away one row to match the one-line overlapping used by the * "next-page" action proc */ num_visible_rows -= 1; /* Calculate the number of pages */ num_pages = (num_total_rows+num_visible_rows-1) / num_visible_rows; Log(("Printing %d pages (num_total_rows=%d, num_visible_rows=%d)...\n", num_pages, num_total_rows, num_visible_rows)); /* Prepare our own context data for the print shell callbacks */ mpcd.num_pages = num_pages; mpcd.printshell_content = hello; mpcd.num_visible_rows = num_visible_rows; mpcd.appcontext = app; /* Setup the print shell callbacks... */ XtAddCallback(print_shell, XawNpageSetupCallback, PrintOnePageCB, (XtPointer)&mpcd); XtAddCallback(print_shell, XawNstartJobCallback, PrintStartJobCB, NULL); XtAddCallback(print_shell, XawNendJobCallback, PrintEndJobCB, (XtPointer)&mpcd); /* ... and finally start the print job. */ if( toFile ) { printtofile_handle = XpuStartJobToFile(pdpy, pcontext, toFile); if( !printtofile_handle ) { perror("XpuStartJobToFile failure"); Error(("XpuStartJobToFile failure.")); } } else { XpuStartJobToSpooler(pdpy); } } XtAppMainLoop(app); if( doPrint ) { if( toFile ) { if( XpuWaitForPrintFileChild(printtofile_handle) != XPGetDocFinished ) { fprintf(stderr, "%s: Error while printing to file.\n", ProgramName); } } PrintSpoolerCommandResults(pdpy, pcontext); /* We have to use XpDestroyContext() and XtCloseDisplay() instead * of XpuClosePrinterDisplay() to make libXt happy... */ if( pcontext != None ) XpDestroyContext(pdpy, pcontext); XtCloseDisplay(pdpy); } return EXIT_SUCCESS; }
int MessageAvertissement(char *message, int typeMessage) { XEvent avrtEvent; Arg args[2]; XmString label; Widget avrtWidgetParent; label = XmStringCreateLtoR(message, XmSTRING_DEFAULT_CHARSET); XtSetArg(args[0], XmNmessageString, label); switch(typeMessage) { case INFO: XtSetValues(infoWidget, args, 1); widgetCourant = infoWidget; break; case AVERTISSEMENT: XtSetValues(avrtWidget, args, 1); widgetCourant = avrtWidget; break; case OK_CANCEL: XtSetValues(okCancelWidget, args, 1); widgetCourant = okCancelWidget; break; } XmStringFree(label); avrtSelectionTerminee = False; DesactiverWidgetsControle(); AjusterPositionForme(widgetCourant, xc.topLevel); XtManageChild(widgetCourant); FlusherTousLesEvenements(); CheckColormap(widgetCourant); while (!avrtSelectionTerminee) { XtAppPeekEvent(SuperWidget.contexte, &(avrtEvent)); switch(avrtEvent.type) { case ButtonPress: avrtWidgetParent =(Widget) TrouverWidgetParent(avrtEvent.xbutton.window); if (avrtWidgetParent == xc.topLevel) { XtAppNextEvent(SuperWidget.contexte, &(avrtEvent)); XtDispatchEvent(&(avrtEvent)); } else { XtAppNextEvent(SuperWidget.contexte, &(avrtEvent)); } break; default: XtAppNextEvent(SuperWidget.contexte, &(avrtEvent)); XtDispatchEvent(&(avrtEvent)); break; } } ActiverWidgetsControle(); return okCancel; }
void xtbin::xtbin_realize() { Arg args[2]; int n; Widget top_widget; Widget embedded; XSetWindowAttributes attr; unsigned long mask; attr.bit_gravity = NorthWestGravity; attr.event_mask = ButtonMotionMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | ExposureMask | KeyPressMask | KeyReleaseMask | LeaveWindowMask | PointerMotionMask | StructureNotifyMask | VisibilityChangeMask | FocusChangeMask; attr.colormap = xxlib_rgb_get_cmap(mXlibRgbHandle); attr.background_pixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, 0xFFC0C0C0); attr.border_pixel = xxlib_rgb_xpixel_from_rgb(mXlibRgbHandle, 0xFF646464); #ifdef DEBUG printf("attr.background_pixel = %lx, attr.border_pixel = %lx, parent_window = %x\n", (long)attr.background_pixel, (long)attr.border_pixel, (int)parent_window); #endif /* DEBUG */ mask = CWBitGravity | CWEventMask | CWBorderPixel | CWBackPixel; if (attr.colormap) mask |= CWColormap; window = XCreateWindow(xtdisplay, parent_window, x, y, width, height, 0, xxlib_rgb_get_depth(mXlibRgbHandle), InputOutput, xxlib_rgb_get_visual(mXlibRgbHandle), mask, &attr); XSetWindowBackgroundPixmap(xtdisplay, window, None); XSelectInput(xtdisplay, window, ExposureMask); XMapWindow(xtdisplay, window); XFlush(xtdisplay); top_widget = XtAppCreateShell("drawingArea", "Wrapper", applicationShellWidgetClass, xtdisplay, NULL, 0); xtwidget = top_widget; n = 0; XtSetArg(args[n], XtNheight, height); n++; XtSetArg(args[n], XtNwidth, width); n++; XtSetValues(top_widget, args, n); embedded = XtVaCreateWidget("form", compositeWidgetClass, top_widget, NULL); n = 0; XtSetArg(args[n], XtNheight, height); n++; XtSetArg(args[n], XtNwidth, width); n++; XtSetValues(embedded, args, n); oldwindow = top_widget->core.window; top_widget->core.window = window; XtRegisterDrawable(xtdisplay, window, top_widget); XtRealizeWidget(embedded); XtRealizeWidget(top_widget); XtManageChild(embedded); /* Now fill out the xtbin info */ xtwindow = XtWindow(embedded); /* Suppress background refresh flashing */ XSetWindowBackgroundPixmap(xtdisplay, XtWindow(top_widget), None); XSetWindowBackgroundPixmap(xtdisplay, XtWindow(embedded), None); /* Listen to all Xt events */ XSelectInput(xtdisplay, XtWindow(top_widget), 0x0fffff); XSelectInput(xtdisplay, XtWindow(embedded), 0x0fffff); sync(); }
int main(int argc, char **argv) { Widget toplevel, form, mb, tf, sl, st, cb, menu, pb; XtAppContext app; Arg al[10]; int ac; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "Phone", NULL, 0, &argc, argv, NULL, NULL); form = XtVaCreateManagedWidget("form", xmFormWidgetClass, toplevel, XmNwidth, 450, XmNheight, 300, XmNresizable, True, XmNfractionBase, 3, NULL); mb = XtVaCreateManagedWidget("mb", xmRowColumnWidgetClass, form, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 0, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 0, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 0, XmNrowColumnType, XmMENU_BAR, NULL); tf = XtVaCreateManagedWidget("tf", xmTextFieldWidgetClass, form, XmNtopAttachment, XmATTACH_WIDGET, XmNtopOffset, 0, XmNtopWidget, mb, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 0, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 0, NULL); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, tf); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_POSITION); ac++; XtSetArg(al[ac], XmNrightPosition, 1); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; sl = XmCreateScrolledList(form, "sl", al, ac); XtManageChild(sl); ac = 0; XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNtopWidget, tf); ac++; XtSetArg(al[ac], XmNtopOffset, 0); ac++; XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++; XtSetArg(al[ac], XmNleftWidget, XtParent(sl)); ac++; XtSetArg(al[ac], XmNleftOffset, 0); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 0); ac++; XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNbottomOffset, 0); ac++; st = XmCreateScrolledText(form, "st", al, ac); XtManageChild(st); ac = 0; menu = XmCreatePulldownMenu(mb, "menu", al, ac); cb = XtVaCreateManagedWidget("cb", xmCascadeButtonGadgetClass, mb, XmNsubMenuId, menu, NULL); pb = XtVaCreateManagedWidget("quit", xmPushButtonGadgetClass, menu, NULL); XtAddCallback(pb, XmNactivateCallback, Quit, NULL); XtRealizeWidget(toplevel); { static XtWidgetGeometry Expected[] = { {CWWidth | CWHeight, 0, 0, 450, 300, 0,0,0, /* Form */}, {CWWidth | CWHeight | CWX | CWY, 0, 0, 450, 31, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 5, 5, 28, 21, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 0, 31, 450, 31, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 0, 62, 150, 238, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 0, 0, 150, 238, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 150, 62, 300, 238, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 0, 223, 300, 15, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 0, 0, 300, 219, 0,0,0, /* two */}, {CWWidth | CWHeight | CWX | CWY, 0, 0, 0, 0, 0,0,0, /* two */}, }; PrintDetails(toplevel, Expected); } XtAddCallback(st, XmNfocusCallback, Focus, "in"); XtAddCallback(st, XmNlosingFocusCallback, Focus, "out"); XtAddCallback(tf, XmNfocusCallback, Focus, "in"); XtAddCallback(tf, XmNlosingFocusCallback, Focus, "out"); LessTifTestMainLoop(toplevel); exit(0); }
/* * Implementation */ XtPointer MonitorConfig(XtPointer conf) { XF86ConfMonitorPtr monitor = (XF86ConfMonitorPtr)conf; char monitor_name[48]; Arg args[1]; current_monitor = monitor; xf86info.cur_list = MONITOR; XtSetSensitive(back, xf86info.lists[MONITOR].cur_function > 0); XtSetSensitive(next, xf86info.lists[MONITOR].cur_function < xf86info.lists[MONITOR].num_functions - 1); (xf86info.lists[MONITOR].functions[xf86info.lists[MONITOR].cur_function]) (&xf86info); XawListUnhighlight(hlist); XawListUnhighlight(vlist); if (monitor != NULL) { XF86ConfScreenPtr screen = XF86Config->conf_screen_lst; char str[PARSER_RANGE_SIZE]; XtSetArg(args[0], XtNstring, monitor->mon_identifier); XtSetValues(ident_widget, args, 1); while (screen != NULL) { if (screen->scrn_monitor == monitor) break; screen = (XF86ConfScreenPtr)(screen->list.next); } if (screen != NULL) { oldcard = card = screen->scrn_device; XtSetArg(args[0], XtNlabel, card->dev_identifier); } else { oldcard = card = NULL; XtSetArg(args[0], XtNlabel, ""); } XtSetValues(cmenu, args, 1); mon_n_hsync = monitor->mon_n_hsync; memcpy(mon_hsync, monitor->mon_hsync, sizeof(parser_range) * mon_n_hsync); *str = '\0'; parser_range_to_string(str, mon_hsync, mon_n_hsync); XtSetArg(args[0], XtNstring, str); XtSetValues(hsync, args, 1); mon_n_vrefresh = monitor->mon_n_vrefresh; memcpy(mon_vrefresh, monitor->mon_vrefresh, sizeof(parser_range) * mon_n_vrefresh); *str = '\0'; parser_range_to_string(str, mon_vrefresh, mon_n_vrefresh); XtSetArg(args[0], XtNstring, str); XtSetValues(vsync, args, 1); } else { XF86ConfMonitorPtr monitor = XF86Config->conf_monitor_lst; int nmonitors = 0; oldcard = card = NULL; while (monitor != NULL) { ++nmonitors; monitor = (XF86ConfMonitorPtr)(monitor->list.next); } do { XmuSnprintf(monitor_name, sizeof(monitor_name), "Monitor%d", nmonitors); ++nmonitors; } while (xf86findMonitor(monitor_name, XF86Config->conf_monitor_lst)); XtSetArg(args[0], XtNstring, monitor_name); XtSetValues(ident_widget, args, 1); XtSetArg(args[0], XtNstring, ""); XtSetValues(hsync, args, 1); XtSetValues(vsync, args, 1); XtSetArg(args[0], XtNlabel, ""); XtSetValues(cmenu, args, 1); } if (ConfigLoop(MonitorConfigCheck) == True) { if (monitor == NULL) { monitor = (XF86ConfMonitorPtr) XtCalloc(1, sizeof(XF86ConfMonitorRec)); monitor->mon_identifier = XtNewString(ident_string); } memcpy(monitor->mon_hsync, mon_hsync, sizeof(parser_range) * (monitor->mon_n_hsync = mon_n_hsync)); memcpy(monitor->mon_vrefresh, mon_vrefresh, sizeof(parser_range) * (monitor->mon_n_vrefresh = mon_n_vrefresh)); if (strcasecmp(monitor->mon_identifier, ident_string)) xf86renameMonitor(XF86Config, monitor, ident_string); if (oldcard != card) { int i; for (i = 0; i < computer.num_devices; i++) if (computer.devices[i]->widget == config) break; if (computer.devices[i]->config == NULL) XF86Config->conf_monitor_lst = xf86addMonitor(XF86Config->conf_monitor_lst, monitor); computer.devices[i]->config = (XtPointer)monitor; ChangeScreen(monitor, monitor, card, oldcard); DrawCables(); } return (monitor); } return (NULL); }
void MonitorLayout(XF86SetupInfo *info) { static int first = 1, men; static Widget layout, menu; XF86ConfDevicePtr device = XF86Config->conf_device_lst; Widget sme; Arg args[1]; char *menuname; if (first) { Widget viewport; first = 0; layout = XtCreateWidget("monitorl", formWidgetClass, configp, NULL, 0); XtCreateManagedWidget("hlabel", labelWidgetClass, layout, NULL, 0); hsync = XtVaCreateManagedWidget("hsync", asciiTextWidgetClass, layout, XtNeditType, XawtextEdit, NULL, 0); viewport = XtCreateManagedWidget("hviewport", viewportWidgetClass, layout, NULL, 0); hlist = XtVaCreateManagedWidget("hlist", listWidgetClass, viewport, XtNlist, hmodes, XtNnumberStrings, sizeof(hmodes) / sizeof(hmodes[0]), NULL, 0); XtAddCallback(hlist, XtNcallback, MonitorHsyncCallback, NULL); XtCreateManagedWidget("vlabel", labelWidgetClass, layout, NULL, 0); vsync = XtVaCreateManagedWidget("vsync", asciiTextWidgetClass, layout, XtNeditType, XawtextEdit, NULL, 0); viewport = XtCreateManagedWidget("vviewport", viewportWidgetClass, layout, NULL, 0); vlist = XtVaCreateManagedWidget("vlist", listWidgetClass, viewport, XtNlist, vmodes, XtNnumberStrings, sizeof(vmodes) / sizeof(vmodes[0]), NULL, 0); XtAddCallback(vlist, XtNcallback, MonitorVsyncCallback, NULL); XtCreateManagedWidget("clabel", labelWidgetClass, layout, NULL, 0); cmenu = XtCreateManagedWidget("cmenu", menuButtonWidgetClass, layout, NULL, 0); XtRealizeWidget(layout); } if (menu != NULL) XtDestroyWidget(menu); /* * swaps names because XtDestroyWidget will only really destroy it * when the code returns to XtAppMainLoop */ menuname = men & 1 ? "mena" : "menb"; menu = XtCreatePopupShell(menuname, simpleMenuWidgetClass, cmenu, NULL, 0); XtSetArg(args[0], XtNmenuName, menuname); XtSetValues(cmenu, args, 1); ++men; sme = XtVaCreateManagedWidget("none", smeBSBObjectClass, menu, NULL, 0); XtAddCallback(sme, XtNcallback, MonitorSelectCardCallback, NULL); while (device != NULL) { XF86ConfScreenPtr screen = XF86Config->conf_screen_lst; Widget sme; Bool sensitive = True; while (screen != NULL) { if (screen->scrn_device == device) { sensitive = screen->scrn_monitor == NULL || screen->scrn_monitor == current_monitor; break; } screen = (XF86ConfScreenPtr)(screen->list.next); } sme = XtCreateManagedWidget(device->dev_identifier, smeBSBObjectClass, menu, NULL, 0); if (sensitive) XtAddCallback(sme, XtNcallback, MonitorSelectCardCallback, device); XtSetSensitive(sme, sensitive); device = (XF86ConfDevicePtr)(device->list.next); } XtRealizeWidget(menu); XtChangeManagedSet(¤t, 1, NULL, NULL, &layout, 1); current = layout; }
static void CreateAnotherContainer() { Widget PopupShell; Widget MainW2, menubar2, pulldown2, menu_btn2; Widget CutPB2, CopyPB2, CopyLinkPB2, PastePB2, PasteLinkPB2; Widget OtherContainer4; Widget IconGad6, IconGad7, IconGad8, IconGad9, IconGad10; Cardinal n; XmString Label; Arg args[MAX_ARGS]; /* * Create a Dialog Shell */ n = 0; XtSetArg(args[n], XtNgeometry, "=375x375+400+300"); n++; XtSetArg(args[n], XtNallowShellResize, True); n++; PopupShell = XtCreatePopupShell("OtherContainer", topLevelShellWidgetClass, Shell1, args, n); /* * Create a main window */ n = 0; XtSetArg(args[n], XmNborderWidth, 2); n++; MainW2 = XmCreateMainWindow(PopupShell, "MainW2", args, n); XtManageChild(MainW2); /* * Create a menu bar with a pulldown menu for interacting with the * clipboard */ n = 0; menubar2 = XmCreateMenuBar(MainW2, "menubar2", args, n); XtManageChild(menubar2); n = 0; pulldown2 = XmCreatePulldownMenu(menubar2, "pulldown2", args, n); Label = XmStringCreate("Edit", XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNsubMenuId, pulldown2); n++; menu_btn2 = XmCreateCascadeButton(menubar2, "menu_btn2", args, n); XtManageChild(menu_btn2); XmStringFree(Label); n = 0; Label = XmStringCreate("Cut", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CutPB2 = XmCreatePushButtonGadget(pulldown2, "CutPB2", args, n); XtManageChild(CutPB2); XmStringFree(Label); n = 0; Label = XmStringCreate("Copy", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CopyPB2 = XmCreatePushButtonGadget(pulldown2, "CopyPB2", args, n); XtManageChild(CopyPB2); XmStringFree(Label); n = 0; Label = XmStringCreate("Copy Link", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CopyLinkPB2 = XmCreatePushButtonGadget(pulldown2, "CopyLinkPB2", args, n); XtManageChild(CopyLinkPB2); XmStringFree(Label); n = 0; Label = XmStringCreate("Paste", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; PastePB2 = XmCreatePushButtonGadget(pulldown2, "PastePB2", args, n); XtManageChild(PastePB2); XmStringFree(Label); n = 0; Label = XmStringCreate("Paste Link", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; PasteLinkPB2= XmCreatePushButtonGadget(pulldown2, "PasteLinkPB2", args, n); XtManageChild(PasteLinkPB2); XmStringFree(Label); /* * Create the container */ n = 0; XtSetArg(args[n], XmNwidth, 450); n++; XtSetArg(args[n], XmNheight, 450); n++; XtSetArg(args[n], XmNentryViewType, XmANY_ICON); n++; XtSetArg(args[n], XmNlayoutType, XmSPATIAL); n++; XtSetArg(args[n], XmNspatialStyle, XmNONE); n++; XtSetArg(args[n], XmNautomaticSelection, XmNO_AUTO_SELECT); n++; OtherContainer4 = XmCreateContainer(MainW2, "OtherContainer", args, n); XtManageChild(OtherContainer4); XtAddCallback(OtherContainer4, XmNconvertCallback, ConvertCB, NULL); XtAddCallback(OtherContainer4, XmNdestinationCallback, DestinationCB, NULL); XtAddCallback(CutPB2, XmNactivateCallback, CutCB, (XtPointer) OtherContainer4); XtAddCallback(CopyPB2, XmNactivateCallback, CopyCB, (XtPointer) OtherContainer4); XtAddCallback(CopyLinkPB2, XmNactivateCallback, CopyLinkCB, (XtPointer) OtherContainer4); XtAddCallback(PastePB2, XmNactivateCallback, PasteCB, (XtPointer) OtherContainer4); XtAddCallback(PasteLinkPB2, XmNactivateCallback, PasteLinkCB, (XtPointer) OtherContainer4); n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, 50); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad6 = XmCreateIconGadget(OtherContainer4, "IconGad6", args, n); XtManageChild(IconGad6); n = 0; XtSetArg(args[n], XmNx, 150); n++; XtSetArg(args[n], XmNy, 150); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; IconGad7 = XmCreateIconGadget(OtherContainer4, "IconGad7", args, n); XtManageChild(IconGad7); n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, 300); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad8 = XmCreateIconGadget(OtherContainer4, "IconGad8", args, n); XtManageChild(IconGad8); n = 0; XtSetArg(args[n], XmNx, 300); n++; XtSetArg(args[n], XmNy, 300); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad9 = XmCreateIconGadget(OtherContainer4, "IconGad9", args, n); XtManageChild(IconGad9); n = 0; XtSetArg(args[n], XmNx, 200); n++; XtSetArg(args[n], XmNy, 50); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; IconGad10 = XmCreateIconGadget(OtherContainer4, "IconGad10", args, n); XtManageChild(IconGad10); XmMainWindowSetAreas(MainW2, menubar2, NULL, NULL, NULL, OtherContainer4); XtPopup(PopupShell, XtGrabNone); }
XFE_ABNameGenTabView::XFE_ABNameGenTabView(XFE_Component *top, XFE_View *view): XFE_PropertyTabView(top, view, XFE_AB_NAME_GENERAL_TAB) { int ac, numForms = AB_LAST+2; Arg av[20]; Widget topForm = getBaseWidget(), label = NULL, stripForm[AB_LAST+2]; char *genTabLabels[AB_LAST+1]; Dimension width; genTabLabels[AB_FIRST_NAME] = XP_GetString(XFE_AB_FIRSTNAME); genTabLabels[AB_LAST_NAME] = XP_GetString(XFE_AB_LASTNAME); genTabLabels[AB_DISPLAY_NAME] = XP_GetString(XFE_AB_DISPLAYNAME); genTabLabels[AB_EMAIL] = XP_GetString(XFE_AB_EMAIL); genTabLabels[AB_NICKNAME] = XP_GetString(XFE_AB_NICKNAME); genTabLabels[AB_TITLE] = XP_GetString(XFE_AB_TITLE); genTabLabels[AB_COMPANY_NAME] = XP_GetString(XFE_AB_COMPANY); genTabLabels[AB_LAST] = XP_GetString(XFE_AB_NOTES); int i; // for use in multiple for loops... // without breaking newer ANSI C++ rules for (i=0; i < numForms; i++) { ac = 0; stripForm[i] = XmCreateForm(topForm, "strip", av, ac); if (i < (AB_LAST+1)) { /* Create labels */ label = XtVaCreateManagedWidget (genTabLabels[i], xmLabelGadgetClass, stripForm[i], XmNalignment, XmALIGNMENT_END, NULL); m_labels[i] = label; XtVaSetValues(label, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_NONE, XmNbottomAttachment, XmATTACH_FORM, 0); XtVaGetValues(label, XmNwidth, &width, 0); m_labelWidth = (m_labelWidth < width)?width:m_labelWidth; /* TextF / Text */ if (i < AB_LAST) { /* TextF */ ac = 0; m_textFs[i] = fe_CreateTextField(stripForm[i], (char *) genTabLabels[i], av, ac); XtVaSetValues(m_textFs[i], XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, label, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, 0); XtManageChild(m_textFs[i]); }/* if */ else { /* Text */ ac = 0; XtSetArg (av[ac], XmNheight, 100); ac++; XtSetArg (av[ac], XmNeditMode, XmMULTI_LINE_EDIT); ac++; m_notesTxt = fe_CreateText(stripForm[i], "notesText", av, ac); XtVaSetValues(m_notesTxt, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, label, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, 0); XtManageChild(m_notesTxt); }/* else */ }/* if */ else { /* the toggle */ XmString xmstr; xmstr = XmStringCreate(XP_GetString(XFE_AB_PREFHTML), XmFONTLIST_DEFAULT_TAG); ac = 0; XtSetArg (av[ac], XmNlabelString, xmstr); ac++; m_prefHTMLTog = XmCreateToggleButton(stripForm[i], "prefHTMLTog", av, ac); XtVaSetValues(m_prefHTMLTog, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, m_labelWidth, XmNtopAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_NONE, XmNbottomAttachment, XmATTACH_FORM, 0); XtManageChild(m_prefHTMLTog); }/* else */ if (i == 0) XtVaSetValues(stripForm[i], XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 10, 0); else XtVaSetValues(stripForm[i], XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, stripForm[i-1], XmNtopOffset, (i == AB_TITLE || i == AB_EMAIL || i == AB_LAST)?10:3, 0); XtManageChild(stripForm[i]); }/* for i */ for (i=0; i < (AB_LAST+1); i++) { XtVaSetValues(m_labels[i], XmNwidth, m_labelWidth, 0); }/* for i */ }
/************************************************************** * DaCreateGui: **************************************************************/ Widget DaCreateGui(char * name, char * aclass, int argc, char ** argv, Display * display) { Arg args[15]; Widget widget_array[10]; int n; /***************** object of type : ApplicationShell *****************/ n = 0; /* Setup argc & argv attribute */ XtSetArg(args[n], XtNargc, argc); n++; XtSetArg(args[n], XtNargv, argv); n++; widget_array[WI_DAINPUT] = XtAppCreateShell(name, aclass, applicationShellWidgetClass, display, args, n); /***************** mainWindow : XmMainWindow *****************/ widget_array[WI_MAINWINDOW] = XmCreateMainWindow(widget_array[WI_DAINPUT], "mainWindow", NULL, 0); /***************** menuBar : XmMenuBar *****************/ widget_array[WI_MENUBAR] = XmCreateMenuBar(widget_array[WI_MAINWINDOW], "menuBar", NULL, 0); /***************** File : XmCascadeButton *****************/ widget_array[WI_FILE] = XmCreateCascadeButton(widget_array[WI_MENUBAR], "File", NULL, 0); /***************** fileMenu : XmPulldownMenu *****************/ widget_array[WI_FILEMENU] = XmCreatePulldownMenu(widget_array[WI_MENUBAR], "fileMenu", NULL, 0); { Arg args[1]; XtSetArg(args[0], XmNsubMenuId, widget_array[WI_FILEMENU]); XtSetValues(widget_array[WI_FILE], args, 1); } /***************** Exit : XmPushButton *****************/ widget_array[WI_EXIT] = XmCreatePushButton(widget_array[WI_FILEMENU], "Exit", NULL, 0); XtAddCallback(widget_array[WI_EXIT], XmNactivateCallback, DaExit, NULL); /***************** Help : XmCascadeButton *****************/ widget_array[WI_HELP] = XmCreateCascadeButton(widget_array[WI_MENUBAR], "Help", NULL, 0); /***************** helpMenu : XmPulldownMenu *****************/ widget_array[WI_HELPMENU] = XmCreatePulldownMenu(widget_array[WI_MENUBAR], "helpMenu", NULL, 0); { Arg args[1]; XtSetArg(args[0], XmNsubMenuId, widget_array[WI_HELPMENU]); XtSetValues(widget_array[WI_HELP], args, 1); } /***************** Overview : XmPushButton *****************/ widget_array[WI_OVERVIEW] = XmCreatePushButton(widget_array[WI_HELPMENU], "Overview", NULL, 0); XtAddCallback(widget_array[WI_OVERVIEW], XmNactivateCallback, DaOverView, NULL); /***************** workArea : XmDrawingArea *****************/ n = 0; XtSetArg(args[n], XmNwidth, 300); n++; XtSetArg(args[n], XmNheight, 35); n++; widget_array[WI_WORKAREA] = XmCreateDrawingArea(widget_array[WI_MAINWINDOW], "workArea", args, n); /* * Register drawing area for input method support and set input * context values. */ XmImRegister(widget_array[WI_WORKAREA], 0); { Pixel bg, fg; Pixmap bg_pixmap; n = 0; XtSetArg(args[n], XmNbackground, &bg); n++; XtSetArg(args[n], XmNforeground, &fg); n++; XtSetArg(args[n], XmNbackgroundPixmap, &bg_pixmap);n++; XtGetValues(widget_array[WI_WORKAREA], args, n); n = 0; XtSetArg(args[n], XmNbackground, bg); n++; XtSetArg(args[n], XmNforeground, fg); n++; XtSetArg(args[n], XmNbackgroundPixmap, bg_pixmap);n++; XmImSetValues(widget_array[WI_WORKAREA], args, n); } /* * Add event handler for focus events. This is needed for the * input method to correctly display the input area. */ XtAddEventHandler(widget_array[WI_WORKAREA], EnterWindowMask|LeaveWindowMask|FocusChangeMask, False, DaFocusHandler, NULL); XtAddCallback(widget_array[WI_WORKAREA], XmNexposeCallback, DaRedrawText, NULL); XtAddCallback(widget_array[WI_WORKAREA], XmNinputCallback, DaInputText, NULL); XtAddCallback(widget_array[WI_WORKAREA], XmNresizeCallback, DaResizedText, NULL); /***************** menuBar : XmMenuBar *****************/ n = 0; XtSetArg(args[n], XmNmenuHelpWidget, widget_array[WI_HELP]); n++; XtSetValues(widget_array[WI_MENUBAR], args, n); XtManageChild(widget_array[WI_EXIT]); XtManageChild(widget_array[WI_FILE]); XtManageChild(widget_array[WI_OVERVIEW]); XtManageChild(widget_array[WI_HELP]); XtManageChild(widget_array[WI_MENUBAR]); XtManageChild(widget_array[WI_WORKAREA]); XtManageChild(widget_array[WI_MAINWINDOW]); /* * Return the first created widget. */ return widget_array[WI_DAINPUT]; }
void main(int argc, char **argv) { int i,j; Cardinal n; XmString Label; Arg args[MAX_ARGS]; int test_num; char test_char; char ContainerName[NAME_LEN + 1]; ContainerName[0] = '\0'; test_num = 0; test_char = '\0'; CommonTestInit(argc, argv); if (UserData != NULL) { if (strcmp(UserData, "a") == 0) test_num = 1; else if (strcmp(UserData, "b") == 0) test_num = 2; else if (strcmp(UserData, "c") == 0) test_num = 3; else if (strcmp(UserData, "d") == 0) test_num = 4; test_char = *UserData; free(UserData); } sprintf(ContainerName, "Container4%c", test_char); /* * Create a main window */ n = 0; XtSetArg(args[n], XmNborderWidth, 2); n++; MainW1 = XmCreateMainWindow(Shell1, "MainW1", args, n); XtManageChild(MainW1); /* * Create a menu bar with a pulldown menu for interacting with the * clipboard */ n = 0; menubar1 = XmCreateMenuBar(MainW1, "menubar1", args, n); XtManageChild(menubar1); n = 0; pulldown1 = XmCreatePulldownMenu(menubar1, "pulldown1", args, n); Label = XmStringCreate("Edit", XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNsubMenuId, pulldown1); n++; menu_btn1 = XmCreateCascadeButton(menubar1, "menu_btn1", args, n); XtManageChild(menu_btn1); XmStringFree(Label); n = 0; Label = XmStringCreate("Cut", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CutPB1 = XmCreatePushButtonGadget(pulldown1, "CutPB1", args, n); XtManageChild(CutPB1); XmStringFree(Label); n = 0; Label = XmStringCreate("Copy", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CopyPB1 = XmCreatePushButtonGadget(pulldown1, "CopyPB1", args, n); XtManageChild(CopyPB1); XmStringFree(Label); n = 0; Label = XmStringCreate("Copy Link", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CopyLinkPB1 = XmCreatePushButtonGadget(pulldown1, "CopyLinkPB1", args, n); XtManageChild(CopyLinkPB1); XmStringFree(Label); n = 0; Label = XmStringCreate("Paste", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; PastePB1 = XmCreatePushButtonGadget(pulldown1, "PastePB1", args, n); XtManageChild(PastePB1); XmStringFree(Label); n = 0; Label = XmStringCreate("Paste Link", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; PasteLinkPB1= XmCreatePushButtonGadget(pulldown1, "PasteLinkPB1", args, n); XtManageChild(PasteLinkPB1); XmStringFree(Label); /* * Create the container */ ColumnHeadings = (XmStringTable) XtMalloc(NUM_COL * sizeof(XmString)); for (i = 0; i < NUM_COL; i++) ColumnHeadings[i] = XmStringGenerate(ColumnHeadingText[i], NULL, XmCHARSET_TEXT, NULL); n = 0; XtSetArg(args[n], XmNdetailColumnHeading, ColumnHeadings); n++; XtSetArg(args[n], XmNdetailColumnHeadingCount, NUM_COL); n++; XtSetArg(args[n], XmNdetailOrderCount, NUM_COL-1); n++; Container4 = XmCreateContainer(MainW1, ContainerName, args, n); XtManageChild(Container4); XtAddCallback(Container4, XmNdefaultActionCallback, PrintChildrenCB, NULL); XtAddCallback(Container4, XmNconvertCallback, ConvertCB, NULL); XtAddCallback(Container4, XmNdestinationCallback, DestinationCB, NULL); XtAddCallback(CutPB1, XmNactivateCallback, CutCB, (XtPointer) Container4); XtAddCallback(CopyPB1, XmNactivateCallback, CopyCB, (XtPointer)Container4); XtAddCallback(CopyLinkPB1, XmNactivateCallback, CopyLinkCB, (XtPointer) Container4); XtAddCallback(PastePB1, XmNactivateCallback, PasteCB, (XtPointer) Container4); XtAddCallback(PasteLinkPB1, XmNactivateCallback, PasteLinkCB, (XtPointer) Container4); for (i=0; i<NUM_COL; i++) XmStringFree(ColumnHeadings[i]); XtFree((XtPointer) ColumnHeadings); EntryDetails = (XmStringTable *) XtMalloc(NUM_OBJ * sizeof(XmStringTable)); for (i = 0; i < NUM_OBJ; i++) { ColumnHeadings = (XmStringTable)XtMalloc((NUM_COL-1) * sizeof(XmString)); ColumnHeadings[0] = XmStringGenerate(FullTitleText[i], NULL, XmCHARSET_TEXT, NULL); ColumnHeadings[1] = XmStringGenerate(FlavorText[i], NULL, XmCHARSET_TEXT, NULL); ColumnHeadings[2] = XmStringGenerate(AgeText[i], NULL, XmCHARSET_TEXT, NULL); EntryDetails[i] = ColumnHeadings; } n = 0; XtSetArg(args[n], XmNx, 100); n++; XtSetArg(args[n], XmNy, 100); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[0]); n++; IconGad1 = XmCreateIconGadget(Container4, "IconGad1", args, n); XtManageChild(IconGad1); n = 0; XtSetArg(args[n], XmNx, 200); n++; XtSetArg(args[n], XmNy, 200); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[1]); n++; IconGad2 = XmCreateIconGadget(Container4, "IconGad2", args, n); XtManageChild(IconGad2); n = 0; XtSetArg(args[n], XmNx, 300); n++; XtSetArg(args[n], XmNy, 100); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[2]); n++; IconGad3 = XmCreateIconGadget(Container4, "IconGad3", args, n); XtManageChild(IconGad3); n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, 400); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[3]); n++; IconGad4 = XmCreateIconGadget(Container4, "IconGad4", args, n); XtManageChild(IconGad4); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetail, EntryDetails[4]); n++; IconGad31 = XmCreateIconGadget(Container4, "IconGad31", args, n); XtManageChild(IconGad31); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[5]); n++; IconGad32 = XmCreateIconGadget(Container4, "IconGad32", args, n); XtManageChild(IconGad32); n = 0; XtSetArg(args[n], XmNentryParent, IconGad32); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[6]); n++; IconGad321 = XmCreateIconGadget(Container4, "IconGad321", args, n); XtManageChild(IconGad321); n = 0; XtSetArg(args[n], XmNentryParent, IconGad321); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[7]); n++; IconGad3211 = XmCreateIconGadget(Container4, "IconGad3211", args, n); XtManageChild(IconGad3211); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[8]); n++; IconGad33 = XmCreateIconGadget(Container4, "IconGad33", args, n); XtManageChild(IconGad33); n = 0; XtSetArg(args[n], XmNx, 70); n++; XtSetArg(args[n], XmNy, 420); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[9]); n++; IconGad5 = XmCreateIconGadget(Container4, "IconGad5", args, n); XtManageChild(IconGad5); XmMainWindowSetAreas(MainW1, menubar1, NULL, NULL, NULL, Container4); for (i = 0; i < NUM_OBJ; i++) { ColumnHeadings = EntryDetails[i]; for (j = 0; j < NUM_COL-1; j++) XmStringFree(ColumnHeadings[j]); XtFree((XtPointer)ColumnHeadings); } XtFree((XtPointer)EntryDetails); XtRealizeWidget(Shell1); CommonPause(); CommonPause(); XmContainerRelayout(Container4); CommonPause(); if ((test_num == 1) || (test_num == 2)) { TestContainerReorder(); CommonPause(); } /* * Create another Container for UTM testing */ CreateAnotherContainer(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); XtAppMainLoop(app_context); }
void display_tabular_data () { Widget form; Widget rowcol; Widget page; Arg args [10]; XmString str; int i; void ttab_page_callback (Widget w, XtPointer client_data, XtPointer call_data); if (ttab_dialog != (Widget) NULL) { XmListDeleteAllItems (ttab_list); } else { ttab_dialog = XtVaCreatePopupShell ("Product Tabular Data", xmDialogShellWidgetClass, draw_widget, XmNdeleteResponse, XmDESTROY, NULL); form = XtVaCreateWidget ("tabular_form", xmFormWidgetClass, ttab_dialog, XmNforeground, white_color, XmNbackground, steelblue_color, NULL); rowcol = XtVaCreateWidget ("tabular_rowcol", xmRowColumnWidgetClass, form, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNorientation, XmHORIZONTAL, XmNforeground, white_color, XmNbackground, steelblue_color, NULL); page = XtVaCreateManagedWidget ("Previous Page", xmPushButtonWidgetClass, rowcol, XmNforeground, white_color, XmNbackground, steelblue_color, NULL); XtAddCallback (page, XmNactivateCallback, ttab_page_callback, (XtPointer) -1); page = XtVaCreateManagedWidget ("Next Page", xmPushButtonWidgetClass, rowcol, XmNforeground, white_color, XmNbackground, steelblue_color, NULL); XtAddCallback (page, XmNactivateCallback, ttab_page_callback, (XtPointer) 1); XtManageChild (rowcol); XtSetArg (args [0], XmNvisibleItemCount, ttab->number_of_lines [0]); XtSetArg (args [1], XmNtopWidget, rowcol); XtSetArg (args [2], XmNtopAttachment, XmATTACH_WIDGET); XtSetArg (args [3], XmNleftAttachment, XmATTACH_WIDGET); XtSetArg (args [4], XmNrightAttachment, XmATTACH_WIDGET); XtSetArg (args [5], XmNbottomAttachment, XmATTACH_WIDGET); XtSetArg (args [6], XmNfontList, fontlist); XtSetArg (args [7], XmNforeground, white_color); XtSetArg (args [8], XmNbackground, seagreen_color); XtSetArg (args [9], XmNwidth, 720); ttab_list = XmCreateScrolledList (form, "ttab_scrolled_list", args, 10); XtManageChild (ttab_list); XtManageChild (form); XtPopup (ttab_dialog, XtGrabNone); } current_page = 0; for (i=0;i<=ttab->number_of_lines [current_page];i++) { str = XmStringCreate (ttab->text [current_page][i], "ttab_font"); XmListAddItemUnselected (ttab_list, str, i+1); XmStringFree (str); } }
int main (int argc, char **argv) { int nTic1,nTic2,width,height; float smin,smax,bclip,wclip,x1beg,x1end,x2beg,x2end; char *edgecolor="cyan",*tricolor="yellow",*cmap="gray", *label1="",*label2="",*title="", *labelFont="",*titleFont="", *axesColor="",*gridColor="",*titleColor="", *style="seismic",*grid1="none",*grid2="none"; Model *model; XrmValue from,to; ExposeCD exposeCD; Widget toplevel,axes; Display *dpy; Window win; Arg args[100]; int nargs; float bhue=0,whue=240,sat=1,bright=1; /* initialize getpar */ initargs(argc,argv); requestdoc(0); /* read model */ model = readModel(stdin); /* determine minimum and maximum s(x,y) */ minmax(model,&smin,&smax); /* get optional parameters */ getparstring("edgecolor",&edgecolor); getparstring("tricolor",&tricolor); bclip = smin; getparfloat("bclip",&bclip); wclip = smax; getparfloat("wclip",&wclip); getparstring("cmap",&cmap); /* initialize toolkit intrinsics and set toplevel parameters */ toplevel = XtInitialize(argv[0],"Sxplot",NULL,0,&argc,argv); nargs = 0; if (getparint("width",&width)) {XtSetArg(args[nargs],XtNwidth,width); nargs++;} if (getparint("height",&height)) {XtSetArg(args[nargs],XtNheight,height); nargs++;} XtSetValues(toplevel,args,nargs); /* create axes and set axes parameters */ axes = XtCreateManagedWidget("axes",xtcwpAxesWidgetClass, toplevel,NULL,0); nargs = 0; if (getparstring("grid1",&grid1)) { from.addr = (char *)grid1; XtConvertAndStore(axes,XtRString,&from,XtcwpRAxesGrid,&to); if (to.addr) XtSetArg(args[nargs],XtNgrid1,*((int*)to.addr)); nargs++; } if (getparstring("grid2",&grid2)) { from.addr = (char *)grid2; XtConvertAndStore(axes,XtRString,&from,XtcwpRAxesGrid,&to); if (to.addr) XtSetArg(args[nargs],XtNgrid2,*((int*)to.addr)); nargs++; } if (getparint("nTic1",&nTic1)) {XtSetArg(args[nargs],XtNnTic1,nTic1); nargs++;} if (getparint("nTic2",&nTic2)) {XtSetArg(args[nargs],XtNnTic2,nTic2); nargs++;} if (getparstring("label1",&label1)) {XtSetArg(args[nargs],XtNlabel1,label1); nargs++;} if (getparstring("label2",&label2)) {XtSetArg(args[nargs],XtNlabel2,label2); nargs++;} if (getparstring("title",&title)) {XtSetArg(args[nargs],XtNtitle,title); nargs++;} if (getparstring("style",&style)) { from.size = (unsigned int) strlen(style); from.addr = (char *)style; XtConvertAndStore(axes,XtRString,&from,XtcwpRAxesStyle,&to); if (to.addr) XtSetArg(args[nargs],XtNstyle,*((int*)to.addr)); nargs++; } if (getparstring("axesColor",&axesColor)) { from.addr = (char *)axesColor; XtConvertAndStore(axes,XtRString,&from,XtRPixel,&to); if (to.addr) XtSetArg(args[nargs],XtNaxesColor, *((unsigned long*)to.addr)); nargs++; } if (getparstring("gridColor",&gridColor)) { from.addr = (char *)gridColor; XtConvertAndStore(axes,XtRString,&from,XtRPixel,&to); if (to.addr) XtSetArg(args[nargs],XtNgridColor, *((unsigned long*)to.addr)); nargs++; } if (getparstring("titleColor",&titleColor)) { from.addr = (char *)titleColor; XtConvertAndStore(axes,XtRString,&from,XtRPixel,&to); if (to.addr) XtSetArg(args[nargs],XtNtitleColor, *((unsigned long*)to.addr)); nargs++; } if (getparstring("labelFont",&labelFont)) { from.addr = (char *)labelFont; XtConvertAndStore(axes,XtRString,&from,XtRFont,&to); if (to.addr) XtSetArg(args[nargs],XtNlabelFont, *((Font*)to.addr)); nargs++; } if (getparstring("titleFont",&titleFont)) { from.addr = (char *)titleFont; XtConvertAndStore(axes,XtRString,&from,XtRFont,&to); if (to.addr) XtSetArg(args[nargs],XtNtitleFont, *((Font*)to.addr)); nargs++; } XtSetValues(axes,args,nargs); x1beg = model->xmin; getparfloat("x1beg",&x1beg); x1end = model->xmax; getparfloat("x1end",&x1end); x2beg = model->ymin; getparfloat("x2beg",&x2beg); x2end = model->ymax; getparfloat("x2end",&x2end); XtcwpSetAxesValues(axes,x1beg,x1end,x2beg,x2end); /* add callbacks to axes widget */ XtAddCallback(axes,XtNresizeCallback,(XtCallbackProc) resizeCB,NULL); exposeCD.model = model; exposeCD.edgecolor = edgecolor; exposeCD.tricolor = tricolor; exposeCD.bclip = bclip; exposeCD.wclip = wclip; XtAddCallback(axes,XtNexposeCallback,(XtCallbackProc) exposeCB,&exposeCD); XtAddCallback(axes,XtNinputCallback,(XtCallbackProc) inputCB,NULL); /* realize widgets */ XtRealizeWidget(toplevel); /* if necessary, create private colormap */ dpy = XtDisplay(toplevel); win = XtWindow(toplevel); if (STREQ(cmap,"gray")) { XSetWindowColormap(dpy,win,XtcwpCreateGrayColormap(dpy,win)); } else if (STREQ(cmap,"hue")) { XSetWindowColormap(dpy,win,XtcwpCreateHueColormap(dpy,win, bhue,whue,sat,bright)); /* see Note below */ } /* go */ XtMainLoop(); return EXIT_SUCCESS; }
void getStartupPrefs(Widget mainWin) { Widget prefForm; Widget portLabel; Widget child; XmString labelString; Arg args[4]; int argcount; FILE *confFile; char serverPortNum[6]; char *confFilePath; argcount = 0; labelString = XM_STRING_CREATE("Startup Prefs"); XtSetArg(args[argcount], XmNdialogTitle, labelString); argcount++; XtSetArg(args[argcount], XmNautoUnmanage, True); argcount++; startPrefDiag = XmCreatePromptDialog(mainWin, "startup_prefs", args, argcount); XmStringFree(labelString); /* Now get rid of the things we don't want */ child = XmSelectionBoxGetChild(startPrefDiag, XmDIALOG_SELECTION_LABEL); XtUnmanageChild(child); child = XmSelectionBoxGetChild(startPrefDiag, XmDIALOG_TEXT); XtUnmanageChild(child); prefForm = XtVaCreateWidget("form", xmFormWidgetClass, startPrefDiag, XmNfractionBase, 18, NULL); labelString = XM_STRING_CREATE("Name:"); XtVaCreateManagedWidget("name_label", xmLabelWidgetClass, prefForm, XmNlabelString, labelString, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 0, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, NULL); XmStringFree(labelString); labelString = XM_STRING_CREATE("Nick:"); XtVaCreateManagedWidget("nick_label", xmLabelWidgetClass, prefForm, XmNlabelString, labelString, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 6, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, NULL); XmStringFree(labelString); labelString = XM_STRING_CREATE("Server:"); XtVaCreateManagedWidget("server_label", xmLabelWidgetClass, prefForm, XmNlabelString, labelString, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 0, NULL); XmStringFree(labelString); nameTextForm = XtVaCreateManagedWidget("name_form", xmTextFieldWidgetClass, prefForm, XmNmaxLength, MAX_NAME_LEN, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 0, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 18, NULL); nickTextForm = XtVaCreateManagedWidget("nick_form", xmTextFieldWidgetClass, prefForm, XmNmaxLength, MAX_NICK_LEN, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 6, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 18, NULL); portTextForm = XtVaCreateManagedWidget("port_form", xmTextFieldWidgetClass, prefForm, XmNmaxLength, 5, XmNcolumns, 5, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12, XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 18, NULL); labelString = XM_STRING_CREATE("Port: "); portLabel = XtVaCreateManagedWidget("port_label", xmLabelWidgetClass, prefForm, XmNlabelString, labelString, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, portTextForm, NULL); XmStringFree(labelString); serverTextForm = XtVaCreateManagedWidget("server_form", xmTextFieldWidgetClass, prefForm, XmNmaxLength, MAX_SERVERNAME_LEN, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 12, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 4, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, portLabel, NULL); XtAddCallback(startPrefDiag, XmNokCallback, okButtStartupCbk, NULL); XtAddCallback(startPrefDiag, XmNhelpCallback, helpButtStartupCbk, NULL); XtManageChild(prefForm); XtManageChild(startPrefDiag); /* read configuration file */ if (confFilePath = getPreferencesFilePath()) { confFile = fopen (confFilePath, "r"); if (confFile) { char buff[FILE_BUFF_SIZE]; char *pos; fgets(buff, FILE_BUFF_SIZE, confFile); if (buff[strlen(buff)-1] == '\n') buff[strlen(buff)-1] = '\0'; if(!strncmp(buff, "DefaultNick", strlen("DefaultNick"))) if (pos = strchr(buff, ' ')) strcpy(sysState.myNick, pos+1); fgets(buff, FILE_BUFF_SIZE, confFile); if (buff[strlen(buff)-1] == '\n') buff[strlen(buff)-1] = '\0'; if(!strncmp(buff, "DefaultName", strlen("DefaultName"))) if (pos = strchr(buff, ' ')) strcpy(sysState.myName, pos+1); fgets(buff, FILE_BUFF_SIZE, confFile); if (buff[strlen(buff)-1] == '\n') buff[strlen(buff)-1] = '\0'; if(!strncmp(buff, "DefaultServer", strlen("DefaultServer"))) if (pos = strchr(buff, ' ')) strcpy(sysState.serverName, pos+1); fgets(buff, FILE_BUFF_SIZE, confFile); if (buff[strlen(buff)-1] == '\n') buff[strlen(buff)-1] = '\0'; if(!strncmp(buff, "DefaultPortNum", strlen("DefaultPortNum"))) if (pos = strchr(buff, ' ')) strcpy(serverPortNum, pos+1); fclose(confFile); } else { printf("config file not found.\n"); strcpy(sysState.myNick, "nebula_user"); strcpy(sysState.myName, "Nebula User"); strcpy(sysState.serverName, "irc.freenode.org"); strcpy(serverPortNum, "6666"); } free(confFilePath); } XmTextSetString(nickTextForm, sysState.myNick); XmTextSetString(nameTextForm, sysState.myName); XmTextSetString(serverTextForm, sysState.serverName); XmTextSetString(portTextForm, serverPortNum); }
int wxMessageDialog::ShowModal() { WX_HOOK_MODAL_DIALOG(); const long style = GetMessageDialogStyle(); DialogCreateFunction dialogCreateFunction; if ( style & wxYES_NO ) { // if we have [Yes], it must be a question dialogCreateFunction = XmCreateQuestionDialog; } else if ( style & wxICON_STOP ) { // error dialog is the one with error icon... dialogCreateFunction = XmCreateErrorDialog; } else if ( style & wxICON_EXCLAMATION ) { // ...and the warning dialog too dialogCreateFunction = XmCreateWarningDialog; } else { // finally, use the info dialog by default dialogCreateFunction = XmCreateInformationDialog; } Widget wParent = m_parent ? GetWidget(m_parent) : (Widget) 0; if ( !wParent ) { wxWindow *window = wxTheApp->GetTopWindow(); if ( !window ) { wxFAIL_MSG("can't show message box without parent window"); return wxID_CANCEL; } wParent = GetWidget(window); } // prepare the arg list Arg args[10]; int ac = 0; wxXmString text(GetFullMessage()); wxXmString title(m_caption); XtSetArg(args[ac], XmNmessageString, text()); ac++; XtSetArg(args[ac], XmNdialogTitle, title()); ac++; Display* dpy = XtDisplay(wParent); if (m_backgroundColour.IsOk()) { wxComputeColours (dpy, & m_backgroundColour, NULL); XtSetArg(args[ac], XmNbackground, g_itemColors[wxBACK_INDEX].pixel); ac++; XtSetArg(args[ac], XmNtopShadowColor, g_itemColors[wxTOPS_INDEX].pixel); ac++; XtSetArg(args[ac], XmNbottomShadowColor, g_itemColors[wxBOTS_INDEX].pixel); ac++; XtSetArg(args[ac], XmNforeground, g_itemColors[wxFORE_INDEX].pixel); ac++; } wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); #if __WXMOTIF20__ && !__WXLESSTIF__ XtSetArg(args[ac], XmNbuttonRenderTable, font.GetFontTypeC(dpy)); ac++; XtSetArg(args[ac], XmNlabelRenderTable, font.GetFontTypeC(dpy)); ac++; XtSetArg(args[ac], XmNtextRenderTable, font.GetFontTypeC(dpy)); ac++; #else XtSetArg(args[ac], XmNbuttonFontList, font.GetFontTypeC(dpy)); ac++; XtSetArg(args[ac], XmNlabelFontList, font.GetFontTypeC(dpy)); ac++; XtSetArg(args[ac], XmNtextFontList, font.GetFontTypeC(dpy)); ac++; #endif // do create message box Widget wMsgBox = (*dialogCreateFunction)(wParent, wxMOTIF_STR(""), args, ac); wxCHECK_MSG( wMsgBox, wxID_CANCEL, "msg box creation failed" ); // get the buttons which we might either remove or rename // depending on the requested style // Widget wBtnOk = XmMessageBoxGetChild(wMsgBox, XmDIALOG_OK_BUTTON); Widget wBtnHelp = XmMessageBoxGetChild(wMsgBox, XmDIALOG_HELP_BUTTON); Widget wBtnCancel = XmMessageBoxGetChild(wMsgBox, XmDIALOG_CANCEL_BUTTON); if ( style & wxYES_NO ) { wxXmString yes(_("Yes")), no(_("No")), cancel(_("Cancel")); if ( style & wxCANCEL ) { // use the cancel button for No and the help button for // Cancel Yuk :-) MB // XtVaSetValues(wBtnOk, XmNlabelString, yes(), NULL); XtVaSetValues(wBtnCancel, XmNlabelString, no(), NULL); XtVaSetValues(wBtnHelp, XmNlabelString, cancel(), NULL); } else { // no cancel button requested... // remove the help button and use cancel for no // XtVaSetValues(wBtnCancel, XmNlabelString, no(), NULL); XtUnmanageChild(wBtnHelp); } } else { // remove the help button and the cancel button (unless it was // requested) // XtUnmanageChild(wBtnHelp); if ( !(style & wxCANCEL ) ) XtUnmanageChild(wBtnCancel); } // set the callbacks for the message box buttons XtAddCallback(wMsgBox, XmNokCallback, (XtCallbackProc)msgboxCallBackOk, (XtPointer)this); XtAddCallback(wMsgBox, XmNcancelCallback, (XtCallbackProc)msgboxCallBackCancel, (XtPointer)this); XtAddCallback(wMsgBox, XmNhelpCallback, (XtCallbackProc)msgboxCallBackHelp, (XtPointer)this); XtAddCallback(wMsgBox, XmNunmapCallback, (XtCallbackProc)msgboxCallBackClose, (XtPointer)this); // show it as a modal dialog XtManageChild(wMsgBox); XtAddGrab(wMsgBox, True, False); // the m_result will be changed when message box goes away m_result = -1; // local message loop XtAppContext context = XtWidgetToApplicationContext(wParent); XEvent event; while ( m_result == -1 ) { XtAppNextEvent(context, &event); XtDispatchEvent(&event); } // translate the result if necessary if ( style & wxYES_NO ) { if ( m_result == wxID_OK ) m_result = wxID_YES; else if ( m_result == wxID_CANCEL ) m_result = wxID_NO; else if ( m_result == wxID_HELP ) m_result = wxID_CANCEL; } return m_result; }
main(int argc, char *argv[]) { toplevel = XtAppInitialize(&app, "Paperplane", NULL, 0, &argc, argv, fallbackResources, NULL, 0); dpy = XtDisplay(toplevel); /* find an OpenGL-capable RGB visual with depth buffer */ vi = glXChooseVisual(dpy, DefaultScreen(dpy), dblBuf); if (vi == NULL) { vi = glXChooseVisual(dpy, DefaultScreen(dpy), snglBuf); if (vi == NULL) XtAppError(app, "no RGB visual with depth buffer"); doubleBuffer = GL_FALSE; } /* create an OpenGL rendering context */ cx = glXCreateContext(dpy, vi, /* no display list sharing */ None, /* favor direct */ GL_TRUE); if (cx == NULL) XtAppError(app, "could not create rendering context"); /* create an X colormap since probably not using default visual */ #ifdef noGLwidget cmap = XCreateColormap(dpy, RootWindow(dpy, vi->screen), vi->visual, AllocNone); /* * Establish the visual, depth, and colormap of the toplevel * widget _before_ the widget is realized. */ XtVaSetValues(toplevel, XtNvisual, vi->visual, XtNdepth, vi->depth, XtNcolormap, cmap, NULL); #endif XtAddEventHandler(toplevel, StructureNotifyMask, False, map_state_changed, NULL); mainw = XmCreateMainWindow(toplevel, "mainw", NULL, 0); XtManageChild(mainw); /* create menu bar */ menubar = XmCreateMenuBar(mainw, "menubar", NULL, 0); XtManageChild(menubar); #ifdef noGLwidget /* Hack around Xt's unfortunate default visual inheritance. */ XtSetArg(menuPaneArgs[0], XmNvisual, vi->visual); menupane = XmCreatePulldownMenu(menubar, "menupane", menuPaneArgs, 1); #else menupane = XmCreatePulldownMenu(menubar, "menupane", NULL, 0); #endif btn = XmCreatePushButton(menupane, "Quit", NULL, 0); XtAddCallback(btn, XmNactivateCallback, quit, NULL); XtManageChild(btn); XtSetArg(args[0], XmNsubMenuId, menupane); cascade = XmCreateCascadeButton(menubar, "File", args, 1); XtManageChild(cascade); #ifdef noGLwidget menupane = XmCreatePulldownMenu(menubar, "menupane", menuPaneArgs, 1); #else menupane = XmCreatePulldownMenu(menubar, "menupane", NULL, 0); #endif btn = XmCreateToggleButton(menupane, "Motion", NULL, 0); XtAddCallback(btn, XmNvalueChangedCallback, (XtCallbackProc)toggle, NULL); XtManageChild(btn); btn = XmCreatePushButton(menupane, "Add plane", NULL, 0); XtAddCallback(btn, XmNactivateCallback, (XtCallbackProc)add_plane, NULL); XtManageChild(btn); btn = XmCreatePushButton(menupane, "Remove plane", NULL, 0); XtAddCallback(btn, XmNactivateCallback, (XtCallbackProc)remove_plane, NULL); XtManageChild(btn); XtSetArg(args[0], XmNsubMenuId, menupane); cascade = XmCreateCascadeButton(menubar, "Planes", args, 1); XtManageChild(cascade); /* create framed drawing area for OpenGL rendering */ frame = XmCreateFrame(mainw, "frame", NULL, 0); XtManageChild(frame); #ifdef noGLwidget glxarea = XtVaCreateManagedWidget("glxarea", xmDrawingAreaWidgetClass, frame, NULL); #else #ifdef noMotifGLwidget /* notice glwDrawingAreaWidgetClass lacks an 'M' */ glxarea = XtVaCreateManagedWidget("glxarea", glwDrawingAreaWidgetClass, #else glxarea = XtVaCreateManagedWidget("glxarea", glwMDrawingAreaWidgetClass, #endif frame, GLwNvisualInfo, vi, NULL); #endif XtAddCallback(glxarea, XmNexposeCallback, (XtCallbackProc)draw, NULL); XtAddCallback(glxarea, XmNresizeCallback, resize, NULL); XtAddCallback(glxarea, XmNinputCallback, input, NULL); /* set up application's window layout */ XmMainWindowSetAreas(mainw, menubar, NULL, NULL, NULL, frame); XtRealizeWidget(toplevel); /* * Once widget is realized (ie, associated with a created X window), we * can bind the OpenGL rendering context to the window. */ glXMakeCurrent(dpy, XtWindow(glxarea), cx); made_current = GL_TRUE; /* setup OpenGL state */ glClearDepth(1.0); glClearColor(0.0, 0.0, 0.0, 0.0); glMatrixMode(GL_PROJECTION); glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 20); glMatrixMode(GL_MODELVIEW); /* add three initial random planes */ srandom(getpid()); add_plane(); add_plane(); add_plane(); add_plane(); add_plane(); /* start event processing */ toggle(); XtAppMainLoop(app); }