/* -------------------------------------------------------------------- */ static void CreatePreferences() { int i; Cardinal n; Arg args[2]; Widget frame, RC, plRC, label, b[3]; PreferShell = XtCreatePopupShell("prefParmsShell", topLevelShellWidgetClass, AppShell, NULL, 0); PreferWindow = XmCreateRowColumn(PreferShell, (char *)"prefRC", NULL, 0); n = 0; frame = XmCreateFrame(PreferWindow, (char *)"prefFrame", args, n); XtManageChild(frame); n = 0; RC = XmCreateRowColumn(frame, (char *)"prefRC", args, n); for (i = 0; i < TOTAL_PREFERS; ++i) { plRC = XmCreateRowColumn(RC, (char *)"plRC", args, n); XtManageChild(plRC); sprintf(buffer, "prefer%d", i); label = XmCreateLabel(plRC, buffer, args, n); XtManageChild(label); prefText[i] = XmCreateTextField(plRC, (char *)"prefText", args, n); XtManageChild(prefText[i]); XtAddCallback(prefText[i], XmNlosingFocusCallback, ApplyPreferences, NULL); } /* Command buttons. */ n = 0; frame = XmCreateFrame(PreferWindow, (char *)"buttonFrame", args, 0); XtManageChild(frame); n = 0; plRC = XmCreateForm(frame, (char *)"buttonRC", args, n); n = 0; b[0] = XmCreatePushButton(plRC, (char *)"dismissButton", args, n); XtAddCallback(b[0], XmNactivateCallback, DismissWindow, PreferWindow); n = 0; b[1] = XmCreatePushButton(plRC, (char *)"saveButton", args, n); XtAddCallback(b[1], XmNactivateCallback, SavePreferences, NULL); XtManageChildren(b, 2); XtManageChild(plRC); XtManageChild(RC); } /* END CREATEPREFERENCES */
void create_savefit_popup(Widget w, XtPointer client_data, XtPointer call_data) { Widget fr, dialog; XmString dirmask; set_wait_cursor(); if (savefit_dialog == NULL) { savefit_dialog = XmCreateFileSelectionDialog(app_shell, "savefit_dialog", NULL, 0); XtVaSetValues(XtParent(savefit_dialog), XmNtitle, "Save fit parameter file", NULL); XtAddCallback(savefit_dialog, XmNcancelCallback, (XtCallbackProc) destroy_dialog, savefit_dialog); XtAddCallback(savefit_dialog, XmNokCallback, (XtCallbackProc) do_savefit_proc, 0); XtAddCallback(savefit_dialog, XmNhelpCallback, (XtCallbackProc) HelpCB, (XtPointer) NULL); fr = XmCreateFrame(savefit_dialog, "fr", NULL, 0); dialog = XmCreateRowColumn(fr, "dialog_rc", NULL, 0); save_title_item = CreateTextItem2(dialog, 25, "Title: "); XtManageChild(dialog); XtManageChild(fr); } XtManageChild(savefit_dialog); XtRaise(XtParent(savefit_dialog)); xv_setstr(save_title_item, nonl_opts.title); dirmask = XmStringCreateSimple(workingdir); XmFileSelectionDoSearch(savefit_dialog, dirmask); XmStringFree(dirmask); unset_wait_cursor(); }
int main(int argc, char **argv) { Widget toplevel, rc, one; XtAppContext app; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "BubbleButtonTest", NULL, 0, &argc, argv, NULL, NULL); rc = XmCreateRowColumn(toplevel, "RC", NULL, 0); one = XltCreateBubbleButton(rc, "BubbleButton1", NULL, 0); XtAddCallback(one, XmNactivateCallback, (XtCallbackProc)Callback, NULL); XtManageChild(one); one = XltCreateBubbleButton(rc, "BubbleButton2", NULL, 0); XtAddCallback(one, XmNactivateCallback, (XtCallbackProc)Callback, NULL); XtManageChild(one); XtManageChild(rc); XtRealizeWidget(toplevel); XtAppMainLoop(app); exit(0); }
Widget XmdsCreateXdBoxOnOffButton(Widget parent,String name,ArgList args,Cardinal argcount) { Widget w; Resources info = {0,0,1,0}; XmdsSetSubvalues(&info,resources,XtNumber(resources),args,argcount); w = XmCreateRowColumn(parent,name,args,argcount); XtVaSetValues(w,XmNpacking,XmPACK_TIGHT,XmNorientation,XmHORIZONTAL,XmNspacing,0,XmNadjustMargin,0,NULL); { Widget oo_w; Widget xd_w; XmString blank = XmStringCreateSimple(""); Arg arglist[] = {{XmdsNnid, 0}, {XmdsNnidOffset, 0}, {XmdsNputOnApply, 0}, {XmNlabelString, 0}}; arglist[0].value = info.nid; arglist[1].value = info.nid_offset; arglist[2].value = info.put_on_apply; arglist[3].value = (long) blank; XtManageChild(oo_w = XmdsCreateOnOffToggleButton(w,"xmds_xdbox_on_off",arglist,XtNumber(arglist))); arglist[3].value = (long) info.label; XtManageChild(xd_w = XmdsCreateXdBoxDialogButton(w,"xmds_xdbox_dialog_button",arglist,XtNumber(arglist))); xd_w = XmdsXdBoxDialogButtonGetXdBox(xd_w); XtAddCallback(oo_w,XmNvalueChangedCallback,(XtCallbackProc)SetXdState,xd_w); XtAddCallback(xd_w,XmdsNapplyCallback,(XtCallbackProc)SetTbState,oo_w); XtAddCallback(xd_w,XmdsNokCallback,(XtCallbackProc)SetTbState,oo_w); } return w; }
/* * Create the wparam Frame and the wparam Panel */ void create_wparam_frame(Widget, XtPointer, XtPointer) { Widget fr; set_wait_cursor(); if (wparam_frame == NULL) { wparam_frame = XmCreateFileSelectionDialog(app_shell, (char *)"wparam_frame", NULL, 0); XtVaSetValues(XtParent(wparam_frame), XmNtitle, "Write plot parameters", NULL); XtAddCallback(wparam_frame, XmNcancelCallback, (XtCallbackProc)destroy_dialog, wparam_frame); XtAddCallback(wparam_frame, XmNokCallback, (XtCallbackProc)wparam_apply_notify_proc, 0); /* may not be needed handle_close(wparam_frame); */ fr = XmCreateFrame(wparam_frame, (char *)"fr", NULL, 0); wparam_panel = XmCreateRowColumn(fr, (char *)"wparam_rc", NULL, 0); wparam_choice_item = CreateGraphChoice(wparam_panel, "Write parameters from graph: ", maxgraph, 2); XtManageChild(fr); XtManageChild(wparam_panel); } XtRaise(wparam_frame); unset_wait_cursor(); }
static Widget create_tictactoe(Widget parent) { static Widget board = 0; if (board != 0) return board; install_images(); Arg args[10]; int arg = 0; XtSetArg(args[arg], XmNorientation, XmHORIZONTAL); arg++; XtSetArg(args[arg], XmNpacking, XmPACK_COLUMN); arg++; XtSetArg(args[arg], XmNnumColumns, 3); arg++; board = XmCreateRowColumn(parent, XMST("board"), args, arg); for (int i = 1; i <= 9; i++) { arg = 0; buttons[i] = XmCreatePushButton(board, XMST("field"), args, arg); XtManageChild(buttons[i]); XtAddCallback(buttons[i], XmNactivateCallback, MakeMoveCB, XtPointer(i)); } XtManageChild(board); return board; }
static void do_axis_proc(Widget w, XtPointer client_data, XtPointer call_data) { Widget wlabel; int x, y; set_wait_cursor(); if (axis_frame == NULL) { char *label1[2]; label1[0] = "Accept"; label1[1] = "Close"; XmGetPos(app_shell, 0, &x, &y); axis_frame = XmCreateDialogShell(app_shell, "Axis props", NULL, 0); handle_close(axis_frame); XtVaSetValues(axis_frame, XmNx, x, XmNy, y, NULL); axis_panel = XmCreateRowColumn(axis_frame, "axis_rc", NULL, 0); wlabel = XtVaCreateManagedWidget("Axis offset (viewport coordinates):", xmLabelWidgetClass, axis_panel, NULL); offx = CreateTextItem2(axis_panel, 10, "Left or bottom:"); offy = CreateTextItem2(axis_panel, 10, "Right or top:"); XtVaCreateManagedWidget("sep", xmSeparatorWidgetClass, axis_panel, NULL); CreateCommandButtons(axis_panel, 2, but1, label1); XtAddCallback(but1[0], XmNactivateCallback, (XtCallbackProc) accept_axis_proc, (XtPointer) 0); XtAddCallback(but1[1], XmNactivateCallback, (XtCallbackProc) destroy_dialog, (XtPointer) axis_frame); XtManageChild(axis_panel); } XtRaise(axis_frame); update_axis_items(cg); unset_wait_cursor(); }
// // create a LABEL + Edit line + an apply button // void InvAnnotationEditor::createEditLine(Widget parent) { Arg args[5]; int i(0); Widget rc = XmCreateRowColumn(parent, (char *)"rc", NULL, 0); // XtSetArg(args[i], XmNlabelString, descStr); i++; i = 0; XmString descStr = XmStringCreateSimple((char *)"enter annotation text:"); XtSetArg(args[i], XmNlabelString, descStr); i++; Widget description = XmCreateLabel(rc, (char *)"description", args, 1); mTextField_ = XmCreateTextField(rc, (char *)"tf", NULL, 0); Widget applyBut = XmCreatePushButton(rc, (char *)"Apply", NULL, 0); XtAddCallback(applyBut, XmNactivateCallback, editApplyCB, (XtPointer) this); // manage all XtManageChild(rc); XtManageChild(description); XtManageChild(mTextField_); XtManageChild(applyBut); }
/* * Create the draw Frame and the draw Panel */ void create_draw_frame(Widget w, XtPointer client_data, XtPointer call_data) { int x, y; Widget buts[2]; Widget wlabel; set_wait_cursor(); if (draw_frame == NULL) { char *label1[2]; label1[0] = "Accept"; label1[1] = "Close"; XmGetPos(app_shell, 0, &x, &y); draw_frame = XmCreateDialogShell(app_shell, "Draw options", NULL, 0); handle_close(draw_frame); XtVaSetValues(draw_frame, XmNx, x, XmNy, y, NULL); draw_panel = XmCreateRowColumn(draw_frame, "draw_rc", NULL, 0); wlabel = XtVaCreateManagedWidget("Scroll %:", xmLabelWidgetClass, draw_panel, NULL); scrollper_item = XtVaCreateManagedWidget("scroll", xmScaleWidgetClass, draw_panel, XmNwidth, 200, XmNminimum, 0, XmNmaximum, 200, XmNvalue, 0, XmNshowValue, True, XmNprocessingDirection, XmMAX_ON_RIGHT, XmNorientation, XmHORIZONTAL, NULL); linkscroll_item = XtVaCreateManagedWidget("Linked scrolling", xmToggleButtonWidgetClass, draw_panel, NULL); autoredraw_type_item = XtVaCreateManagedWidget("Auto redraw", xmToggleButtonWidgetClass, draw_panel, NULL); autorefresh_type_item = XtVaCreateManagedWidget("Auto refresh", xmToggleButtonWidgetClass, draw_panel, NULL); cursor_type_item = XtVaCreateManagedWidget("Crosshair cursor", xmToggleButtonWidgetClass, draw_panel, NULL); XtVaCreateManagedWidget("sep", xmSeparatorWidgetClass, draw_panel, NULL); CreateCommandButtons(draw_panel, 2, buts, label1); XtAddCallback(buts[0], XmNactivateCallback, (XtCallbackProc) define_draw_proc, (XtPointer) 0); XtAddCallback(buts[1], XmNactivateCallback, (XtCallbackProc) destroy_dialog, (XtPointer) draw_frame); XtManageChild(draw_panel); } XtRaise(draw_frame); update_draw(); unset_wait_cursor(); }
static Widget create_box(Widget parent, const char *name) { Arg al[10]; int ac = 0; XtSetArg (al[ac], XmNnumColumns, 3); ac++; XtSetArg (al[ac], XmNpacking, XmPACK_COLUMN); ac++; XtSetArg (al[ac], XmNentryAlignment, XmALIGNMENT_CENTER); ac++; return XmCreateRowColumn (parent, (char *) name, al, ac); }
int main(int argc, char *argv[]) { int i, n; Arg args[10]; XtAppContext app; Widget toplevel, rowcol, sep, button; XmString str_months[12]; setlocale(LC_ALL, ""); //建立顶级窗口 toplevel = XtVaAppInitialize(&app, "Text", NULL, 0, &argc, argv, NULL, NULL); //建立rowcolumn 布局 n = 0; XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); n++; rowcol = XmCreateRowColumn(toplevel, "rowcol", args, n); XtManageChild(rowcol); //建立输入条 n = 0; XtSetArg(args[n], XmNvalue, "输入条"); n++; textf = XmCreateTextField(rowcol, "textf", args, n); XtManageChild(textf); //建立回调 XtAddCallback(textf, XmNactivateCallback, (XtCallbackProc)checkit, NULL); //建立输入区 n = 0; XtSetArg(args[n], XmNrows, 10); n++; XtSetArg(args[n], XmNcolumns, 40); n++; XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; XtSetArg(args[n], XmNvalue, "输入区域\n请测试"); n++; text = XmCreateScrolledText(rowcol, "text", args, n); //text = XmCreateText(rowcol, "text", args, n); XtManageChild(text); //建立分隔符 sep = XmCreateSeparator(rowcol, "separator", NULL, 0); XtManageChild(sep); //建立一个普通按钮 button = XmCreatePushButton(rowcol, "打印输入条和文本区内容", NULL, 0); XtManageChild(button); XtAddCallback(button, XmNactivateCallback, (XtCallbackProc)checkit, NULL); //显示窗口 XtRealizeWidget(toplevel); //进入事件循环 XtAppMainLoop(app); }
int main (int argc, char **argv) { XtAppContext theApp; Widget dialog, rc, label; XmString xmstr; toplevel = XtVaAppInitialize (&theApp, "drawingArea", NULL, 0, &argc, argv, NULL, NULL); XtVaSetValues(toplevel, XmNallowShellResize, True, NULL); dialog = XmCreateMessageBox(toplevel, "MyDialog", NULL, 0); xmstr = XmStringCreateLtoR("Hello World\n\nIf you hit OK on this dialog, another one" "\nshould appear, positioned to the lower right of this one.", XmFONTLIST_DEFAULT_TAG); XtVaSetValues(dialog, XmNmessageString, xmstr, NULL); #if 1 rc = XmCreateRowColumn(dialog, "rc", NULL, 0); #else rc = XmCreateForm(dialog, "rc", NULL, 0); #endif label = XmCreateLabel(rc, "label", NULL, 0); XtVaSetValues(label, XmNborderWidth, 1, NULL); XtManageChild(label); XtManageChild(rc); XtManageChild (dialog); XtRealizeWidget (toplevel); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight , 56, 72, 368, 176, 0,0,0, /* MyDialog */ CWWidth | CWHeight | CWX | CWY, 0, 0, 4, 4, 0,0,0, /* Symbol */ CWWidth | CWHeight | CWX | CWY, 11, 11, 346, 56, 0,0,0, /* Message */ CWWidth | CWHeight | CWX | CWY, 0, 112, 368, 2, 0,0,0, /* Separator */ CWWidth | CWHeight | CWX | CWY, 11, 124, 64, 41, 0,0,0, /* OK */ CWWidth | CWHeight | CWX | CWY, 152, 124, 64, 41, 0,0,0, /* Cancel */ CWWidth | CWHeight | CWX | CWY, 293, 124, 64, 41, 0,0,0, /* Help */ CWWidth | CWHeight | CWX | CWY, 11, 77, 346, 25, 0,0,0, /* rc */ CWWidth | CWHeight | CWX | CWY, 3, 3, 338, 17, 0,0,0, /* label */ }; /* toplevel should be replaced with to correct applicationShell */ PrintDetails(toplevel, Expected); } LessTifTestMainLoop(toplevel); exit (0); }
static void TswShell(Widget shell, Ph_Object obj) { Widget pane; /* RowColumn */ pane = XmCreateRowColumn(shell, "woldPane", NULL, 0); TextVar(pane, obj, "cutoff"); TextVar(pane, obj, "keep"); XtManageChild(pane); }
int main(int argc, char *argv[]) { int i, n; Arg args[10]; XtAppContext app; Widget toplevel, rowcol, textf, text; XmString str_months[12]; setlocale(LC_ALL, ""); //建立顶级窗口 toplevel = XtVaAppInitialize(&app, "Edit", NULL, 0, &argc, argv, NULL, NULL); //建立rowcolumn 布局 n = 0; XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); n++; rowcol = XmCreateRowColumn(toplevel, "rowcol", args, n); XtManageChild(rowcol); //建立输入条 n = 0; XtSetArg(args[n], XmNvalue, "输入条"); n++; textf = XmCreateTextField(rowcol, "textf", args, n); XtManageChild(textf); //建立文本区 n = 0; XtSetArg(args[n], XmNrows, 10); n++; XtSetArg(args[n], XmNcolumns, 40); n++; XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; XtSetArg(args[n], XmNwordWrap, True); n++; XtSetArg(args[n], XmNvalue, "输入区域\n请测试"); n++; text = XmCreateScrolledText(rowcol, "text", args, n); XtManageChild(text); //显示窗口 XtRealizeWidget(toplevel); //edit XmTextSetInsertionPosition(text, 3); XmTextInsert(text, 5, "测试插入"); XmTextSetSelection(text, 5, 8, CurrentTime); XmTextCopy(text, CurrentTime); XmTextSetInsertionPosition(text, 1); XmTextPaste(text); //进入事件循环 XtAppMainLoop(app); }
static void PeaksShell(Widget shell, Ph_Object obj) { Widget pane; int n; /* RowColumn */ pane = XmCreateRowColumn(shell, "peaksPane", NULL, 0); TextVar(pane, obj, "nbr-size"); TextVar(pane, obj, "peaks"); XtManageChild(pane); }
static void ViewBarShell(Widget shell, Ph_Object obj) { Widget pane; /* RowColumn */ pane = XmCreateRowColumn(shell, "woldPane", NULL, 0); TextVar(pane, obj, "minimum"); TextVar(pane, obj, "maximum"); TextVar(pane, obj, "color"); XtManageChild(pane); }
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 create_editp_frame(Widget w, XtPointer client_data, XtPointer call_data) { int x, y; static Widget top; Widget dialog; set_wait_cursor(); if (top == NULL) { Widget but1[3]; char *label1[3]; label1[0] = "Edit"; label1[1] = "Formula"; label1[2] = "Close"; XmGetPos(app_shell, 0, &x, &y); top = XmCreateDialogShell(app_shell, "Edit/Create set", NULL, 0); handle_close(top); XtVaSetValues(top, XmNx, x, XmNy, y, NULL); dialog = XmCreateRowColumn(top, "dialog_rc", NULL, 0); editp_set_item = CreateSetSelector(dialog, "Edit set:", SET_SELECT_NEXT, FILTER_SELECT_NONE, GRAPH_SELECT_CURRENT, SELECTION_TYPE_SINGLE); XtVaCreateManagedWidget("sep", xmSeparatorWidgetClass, dialog, NULL); #ifdef HAVE_LIBXBAE ext_editor_item = XtVaCreateManagedWidget("Use external editor", xmToggleButtonWidgetClass, dialog, NULL); XmToggleButtonSetState( ext_editor_item, False, False ); XtVaCreateManagedWidget("sep", xmSeparatorWidgetClass, dialog, NULL); #endif CreateCommandButtons(dialog, 3, but1, label1); XtAddCallback(but1[0], XmNactivateCallback, (XtCallbackProc) edit_set_proc, NULL); XtAddCallback(but1[1], XmNactivateCallback, (XtCallbackProc) create_leval_frame, NULL); XtAddCallback(but1[2], XmNactivateCallback, (XtCallbackProc) destroy_dialog, (XtPointer) top); XtAddCallback(editp_set_item.list, XmNsingleSelectionCallback, (XtCallbackProc) setsel_cred_cb, (XtPointer)but1[1] ); XtManageChild(dialog); } XtRaise(top); unset_wait_cursor(); }
void XFE_LdapSearchView::buildResult() { Widget ldapCommands; Arg argv[10]; Cardinal ac = 0; XFE_MNSearchView::buildResult(); ac = 0; XtSetArg(argv[ac], XmNorientation, XmHORIZONTAL); ac++; ldapCommands = XmCreateRowColumn(m_result.container, "ldapCommands", argv, ac); XtVaSetValues(ldapCommands, XmNtopAttachment, XmATTACH_NONE, XmNbottomAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, 0); ac = 0; m_toCompose = XmCreatePushButtonGadget(ldapCommands, "toCompose", argv,ac); m_toAddrBook = XmCreatePushButtonGadget(ldapCommands, "toAddrBook", argv,ac); XtSetSensitive(m_toAddrBook, False); XtSetSensitive(m_toCompose,False); XtManageChild(m_toAddrBook); XtManageChild(m_toCompose); XtAddCallback(m_toAddrBook, XmNactivateCallback, XFE_LdapSearchView::toAddrBookCallback, this); XtAddCallback(m_toCompose, XmNactivateCallback, XFE_LdapSearchView::toComposeCallback, this); Dimension h, mh; XtVaGetValues(m_toAddrBook, XmNheight, &h, 0 ); XtVaGetValues(ldapCommands, XmNmarginHeight, &mh, 0 ); h = h + mh *2; XtVaSetValues(m_outliner->getBaseWidget(), XmNbottomOffset, h, 0); XtManageChild(ldapCommands); }
int main(int argc, char **argv) { XtAppContext appc; Widget top, rc, t1, t2, t3; top = XtAppInitialize(&appc, "test", NULL, 0, &argc, argv, NULL, NULL, 0); argcount = 0; XtSetArg(args[argcount], XmNradioBehavior, True); argcount++; rc = XmCreateRowColumn(top, "rowc", args, argcount); XtManageChild(rc); argcount = 0; t1 = XmCreateToggleButton(rc, "t_b_1", args, argcount); XtManageChild(t1); argcount = 0; t2 = XmCreateToggleButton(rc, "Toggle_button_2", args, argcount); XtManageChild(t2); argcount = 0; t3 = XmCreateToggleButton(rc, "Third_toggle_button", args, argcount); XtManageChild(t3); XtAddCallback(t1, XmNvalueChangedCallback, VC, NULL); XtAddCallback(t2, XmNvalueChangedCallback, VC, NULL); XtAddCallback(t3, XmNvalueChangedCallback, VC, NULL); XtRealizeWidget(top); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight, 0, 0, 145, 87, 0,0,0, CWWidth | CWHeight | CWX | CWY, 3, 3, 139, 25, 0,0,0, CWWidth | CWHeight | CWX | CWY, 3, 31, 139, 25, 0,0,0, CWWidth | CWHeight | CWX | CWY, 3, 59, 139, 25, 0,0,0, }; PrintDetails(top, Expected); } LessTifTestMainLoop(top); /* XtAppMainLoop(appc); */ exit(0); }
/* -------------------------------------------------------------------- */ static void CreateStatsWindow() { Arg args[8]; Cardinal n; Widget drFrame, drRC, b[3]; n = 0; StatsShell = XtCreatePopupShell("statsShell", topLevelShellWidgetClass, AppShell, args, n); n = 0; StatsWindow = XmCreateForm(StatsShell, (char *)"statsForm", args, n); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; drFrame = XmCreateFrame(StatsWindow, (char *)"buttonFrame", args, n); XtManageChild(drFrame); n = 0; drRC = XmCreateRowColumn(drFrame, (char *)"buttonRC", args, n); XtManageChild(drRC); n = 0; b[0] = XmCreatePushButton(drRC, (char *)"dismissButton", args, n); b[1] = XmCreatePushButton(drRC, (char *)"printButton", args, n); b[2] = XmCreatePushButton(drRC, (char *)"parmsButton", args, n); XtManageChildren(b, 3); XtAddCallback(b[0], XmNactivateCallback, DismissStats, StatsWindow); XtAddCallback(b[1], XmNactivateCallback, PrintStats, NULL); XtAddCallback(b[2], XmNactivateCallback, EditStatsParms, NULL); n = 0; XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++; XtSetArg(args[n], XmNtopWidget, drFrame); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++; statsText = XmCreateScrolledText(StatsWindow, (char *)"statsText", args, n); XtManageChild(statsText); } /* END CREATESTATSWINDOW */
static void EuclideanShell(Widget shell, Ph_Object obj) { Widget pane; int n; /* RowColumn */ pane = XmCreateRowColumn(shell, "euclideanPane", NULL, 0); if(Ph_ObjGet(obj, "vector-size", &n) == PH_ERROR) { fprintf(stderr, "Error getting vector-size of %s\n", Ph_ObjName(obj)); } else { ScaleVar(pane, obj, "from", 0, n-1, 0); ScaleVar(pane, obj, "to", 0, n-1, 0); } XtManageChild(pane); }
static void do_axisbar_proc(Widget w, XtPointer client_data, XtPointer call_data) { int x, y; set_wait_cursor(); if (axisbar_frame == NULL) { char *label1[2]; label1[0] = "Accept"; label1[1] = "Close"; XmGetPos(app_shell, 0, &x, &y); axisbar_frame = XmCreateDialogShell(app_shell, "Axis bar", NULL, 0); handle_close(axisbar_frame); XtVaSetValues(axisbar_frame, XmNx, x, XmNy, y, NULL); axisbar_panel = XmCreateRowColumn(axisbar_frame, "axisbar_rc", NULL, 0); barcolor = CreateColorChoice(axisbar_panel, "Color:", 0); barlinew = CreatePanelChoice(axisbar_panel, "Line width:", 10, "1", "2", "3", "4", "5", "6", "7", "8", "9", 0, 0); barlines = (Widget *) CreatePanelChoice(axisbar_panel, "Line style:", 6, "Solid line", "Dotted line", "Dashed line", "Long Dashed", "Dot-dashed", NULL, NULL); XtVaCreateManagedWidget("sep", xmSeparatorWidgetClass, axisbar_panel, NULL); CreateCommandButtons(axisbar_panel, 2, but1, label1); XtAddCallback(but1[0], XmNactivateCallback, (XtCallbackProc) accept_axisbar_proc, (XtPointer) 0); XtAddCallback(but1[1], XmNactivateCallback, (XtCallbackProc) destroy_dialog, (XtPointer) axisbar_frame); XtManageChild(axisbar_panel); } XtRaise(axisbar_frame); update_axisbar_items(cg); unset_wait_cursor(); }
static void RankComboShell(Widget shell, Ph_Object obj) { Widget pane; int n; /* RowColumn */ pane = XmCreateRowColumn(shell, "woldPane", NULL, 0); if(Ph_ObjGet(obj, "num-metrics", &n) == PH_ERROR) { fprintf(stderr, "Error getting num-metrics of %s\n", Ph_ObjName(obj)); } else { TextVar(pane, obj, "num-metrics"); TextVar(pane, obj, "metrics"); TextVar(pane, obj, "weights"); } XtManageChild(pane); }
static void WoldShell(Widget shell, Ph_Object obj) { Widget pane; List items; /* RowColumn */ pane = XmCreateRowColumn(shell, "woldPane", NULL, 0); TextVar(pane, obj, "nbr-size"); TextVar(pane, obj, "alt-metric"); TextVar(pane, obj, "orien-label"); items = ListCreate(NULL); ListAddRear(items, "none"); ListAddRear(items, "gorkani"); ListAddRear(items, "tamura"); MenuVar(pane, obj, "orien-type", items, NULL); ListFree(items); XtManageChild(pane); }
int main(int argc, char **argv) { Widget toplevel; Widget Form; Widget Label; XtAppContext app; XtSetLanguageProc(NULL, NULL, NULL); toplevel = XtVaAppInitialize(&app, "test5", NULL, 0, &argc, argv, FallBack, NULL); printf("\nCreate a RowColumn\n"); Label = XmCreateRowColumn(toplevel, "TestWidget", NULL, 0); DoTests(Label); printf("\nManage the RowColumn\n"); XtManageChild(Label); DoTests(Label); printf("\nRealize the RowColumn\n"); XtRealizeWidget(toplevel); DoTests(Label); printf("%s\n",GlobalResult ? "All Passed" : "One or more Failed"); { static XtWidgetGeometry Expected[] = { CWWidth | CWHeight, 500, 500, 16, 16, 0,0,0, }; PrintDetails(toplevel, Expected); } LessTifTestMainLoop(toplevel); /* XtAppMainLoop(app); */ exit(GlobalResult ? 0 : 1); }
int main(int argc, char *argv[]) { XtAppContext app; Widget root_widget; Widget row_column; Widget update_button; Widget close_button; NodeInfoWidget *node_info_widget; int i; void update_callback(Widget, XtPointer, XtPointer); void close_callback(Widget, XtPointer, XtPointer); XtSetLanguageProc(NULL, NULL, NULL); root_widget = XtVaOpenApplication(&app, "Node Info", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); row_column = XmCreateRowColumn(root_widget, "MainRowCol", NULL, 0); node_info_widget = create_node_info_widget(&row_column); update_button = XmCreatePushButton(row_column, "Update", NULL, 0); XtAddCallback(update_button, XmNactivateCallback, update_callback, node_info_widget); close_button = XmCreatePushButton(row_column, "Close", NULL, 0); XtAddCallback(close_button, XmNactivateCallback, close_callback, NULL); XtManageChild(update_button); XtManageChild(close_button); XtManageChild(row_column); XtRealizeWidget(root_widget); XtAppMainLoop(app); free(node_info_widget); return 0; }
void setmag(Widget iw_temp, XtPointer data, XtPointer call_data) { Widget iw_but, ipushc, ipusha, rowcolh; Arg args[MAX_ARGS]; /* Arg list */ int n; if (iw_setmag <= (Widget)0) { iw_setmag = wid_dialog( iw_main, 0, "setmag", 0, 0 ); /* Create the labels of magsize and magfac */ wid_labelg(iw_setmag, 0, "size",60, 30); wid_labelg(iw_setmag, 0, "x",40, 60); wid_labelg(iw_setmag, 0, "y",120, 60); wid_labelg(iw_setmag, 0, "factor ", 180, 30); /* Create the magsize scale */ iw_magx = scalev(iw_setmag,0, 2,512,magsizx,50,200, 10,80); iw_magy = scalev(iw_setmag,0, 2,512,magsizy,50, 200,90,80); iw_magf = scalev(iw_setmag,0, 2,32,magfac,55, 210,180, 70); /* Create standard buttons for set mag varibles */ /* Set the position for standard buttons */ n = 0; Setbgfg(args, MAX_ARGS, &n); // Handles BGFG Args XtSetArg(args[n], XmNx, 10); n++; XtSetArg(args[n], XmNy, 300); n++; XtSetArg(args[n], XmNdefaultPosition, False ); n++; rowcolh = XmCreateRowColumn(iw_setmag, "sss", args, n); XtManageChild( rowcolh ); /* Create the buttons */ iw_but = wid_stdbut(rowcolh,iw_setmag, &ipushc,&ipushc, &ipusha,"CA",fin_cb,fin_cb,pushbuta,NULL); } XtManageChild(iw_setmag); }
int main(int argc, char **argv) { XtAppContext app; Widget Shell; Widget Form; Widget BottomLabel; Widget TopLabel; XtSetLanguageProc(NULL, NULL, NULL); Shell = XtVaAppInitialize(&app, "Shell", NULL, 0, &argc, argv, FallBack, NULL); Form = XmCreateRowColumn(Shell,"RowColumn",NULL,0); TopLabel = XmCreateLabel(Form,"TopLabel",NULL,0); XtManageChild(TopLabel); BottomLabel = XmCreateLabel(Form,"BottomLabel",NULL,0); XtManageChild(BottomLabel); { Arg args[10]; int n = 0; XtSetArg(args[n], XmNdropProc, (XtCallbackProc)DropProc); n++; /* XtSetArg(args[n], XmNdragProc, (XtCallbackProc)DragProc); n++; */ XmDropSiteRegister(BottomLabel, args, n); } XtManageChild(Form); XtRealizeWidget(Shell); LessTifTestMainLoop(Shell); exit(0); }
Control::Control (Widget &parent) { // Instantiate the sub-components of the Control this->frame_ = XmCreateFrame (parent, (char *) "frame", 0, 0 ); this->rowcolumn_ = XmCreateRowColumn (this->frame_, (char *)"rwc", 0, 0 ); this->startwidget_ = XmCreatePushButton (this->rowcolumn_, (char *) "Start", 0, 0); this->stopwidget_ = XmCreatePushButton (this->rowcolumn_, (char *) "Stop", 0, 0); }