1 #include <Xm/Xm.h>
2 #include <Xm/Form.h>
3 #include <Xm/RowColumn.h>
4 #include <Xm/CascadeB.h>
5 #include <Xm/CascadeBG.h>
6 #include <Xm/PushB.h>
7 #include <Xm/PushBG.h>
8 #include <Xm/SeparatoG.h>
9 #include <Xm/MenuShell.h>
10 #include <Xm/MainW.h>
11 #include <Xm/MessageB.h>
12 #include <Xm/Command.h>
13 #include <stdio.h>
14 
15 int
main(int argc,char ** argv)16 main(int argc, char **argv)
17 {
18     XtAppContext theApp;
19     Widget shell, toplevel, menubar, filepane;
20     Widget button, button1, button2, sep;
21     Widget saveAsPane, button3, button4, button5;
22     Widget button6, button7, editpane;
23     Widget mb, com;
24     Widget one, two, three;
25     XmString xmstr;
26 
27     shell = XtVaAppInitialize(&theApp, "mainW", NULL, 0,
28 				 &argc, argv, NULL, NULL);
29 
30     toplevel = XmCreateMainWindow(shell, "MainWindow", NULL, 0);
31     XtVaSetValues(toplevel,
32 		  XmNshowSeparator, True,
33 		  XmNcommandWindowLocation, XmCOMMAND_BELOW_WORKSPACE,
34 		  NULL);
35     XtManageChild(toplevel);
36 
37     menubar = XmCreateMenuBar(toplevel,
38 			      "menuBar",
39 			      NULL,0);
40     XtManageChild(menubar);
41 
42     filepane = XmCreatePulldownMenu(menubar,
43 				    "pane",
44 				    NULL,0);
45 
46     xmstr = XmStringCreateSimple("File");
47 
48     button = XtVaCreateManagedWidget("File",
49 				     xmCascadeButtonWidgetClass,
50 				     menubar,
51 				     XmNsubMenuId, filepane,
52                                      XmNlabelString, xmstr,
53 				     NULL);
54 
55     editpane = XmCreatePulldownMenu(menubar,
56 				    "pane2",
57 				    NULL, 0);
58 
59     button6 = XtVaCreateManagedWidget("Edit",
60 				      xmCascadeButtonGadgetClass,
61 				      menubar,
62 				      XmNsubMenuId, editpane,
63 				      NULL);
64 
65     button7 = XtVaCreateManagedWidget("Cut",
66 				      xmPushButtonGadgetClass,
67 				      editpane,
68 				      NULL);
69 
70     button1 = XtVaCreateManagedWidget("Open",
71 				      xmPushButtonGadgetClass,
72 				      filepane,
73 				      NULL);
74 
75     sep = XtVaCreateManagedWidget("sep",
76 				  xmSeparatorGadgetClass,
77                                   filepane,
78                                   NULL);
79 
80     button2 = XtVaCreateManagedWidget("Close",
81 				      xmPushButtonWidgetClass,
82 				      filepane,
83 				      NULL);
84 
85     saveAsPane = XmCreatePulldownMenu(filepane,
86 				      "save_as",
87 				      NULL, 0);
88 
89     button3 = XtVaCreateManagedWidget("Save As",
90 				      xmCascadeButtonWidgetClass,
91 				      filepane,
92 				      XmNsubMenuId, saveAsPane,
93 				      NULL);
94 
95     button4 = XtVaCreateManagedWidget("MS Word",
96 				      xmPushButtonWidgetClass,
97 				      saveAsPane,
98 				      NULL);
99 
100     button5 = XtVaCreateManagedWidget("LaTeX",
101 				      xmPushButtonWidgetClass,
102 				      saveAsPane,
103 				      NULL);
104 
105     mb = XtVaCreateManagedWidget("mb", xmMessageBoxWidgetClass, toplevel, NULL);
106     XtVaSetValues(toplevel, XmNmessageWindow, mb, NULL);
107 
108     com = XtVaCreateManagedWidget("com", xmCommandWidgetClass, toplevel, NULL);
109 
110     one = XtVaCreateManagedWidget("form", xmFormWidgetClass, toplevel,
111 				  NULL);
112 
113     two = XtVaCreateManagedWidget("two", xmPushButtonWidgetClass, one,
114 				  XmNtopAttachment, XmATTACH_FORM,
115 				  XmNbottomAttachment, XmATTACH_FORM,
116 				  XmNleftAttachment, XmATTACH_NONE,
117 				  XmNrightAttachment, XmATTACH_FORM,
118 				  NULL);
119 
120     three = XtVaCreateManagedWidget("three", xmPushButtonWidgetClass, one,
121 				    XmNtopAttachment, XmATTACH_FORM,
122 				    XmNbottomAttachment, XmATTACH_FORM,
123 				    XmNleftAttachment, XmATTACH_FORM,
124 				    XmNrightAttachment, XmATTACH_WIDGET,
125 				    XmNrightWidget, two,
126 				    NULL);
127 
128     XmMainWindowSetAreas(toplevel, menubar, com, NULL, NULL, one);
129 
130     XtRealizeWidget(shell);
131 
132 
133 {
134     static XtWidgetGeometry Expected[] = {
135    CWWidth | CWHeight            ,  508,  524,  212,  362, 0,0,0, /* MainWindow */
136    CWWidth | CWHeight | CWX | CWY,    0,   31,  212,    2, 0,0,0, /* Separator1 */
137    CWWidth | CWHeight | CWX | CWY,    0,   58,  212,    2, 0,0,0, /* Separator2 */
138    CWWidth | CWHeight | CWX | CWY,    0,  273,  212,    2, 0,0,0, /* Separator3 */
139    CWWidth | CWHeight | CWX | CWY,    0,    0,  212,   31, 0,0,0, /* menuBar */
140    CWWidth | CWHeight | CWX | CWY,    5,    5,   40,   21, 0,0,0, /* File */
141    CWWidth | CWHeight | CWX | CWY,   45,    5,   40,   21, 0,0,0, /* Edit */
142    CWWidth | CWHeight | CWX | CWY,    0,  275,  212,   87, 0,0,0, /* mb */
143    CWWidth | CWHeight | CWX | CWY,    0,    0,    4,    4, 0,0,0, /* Symbol */
144    CWWidth | CWHeight | CWX | CWY,   10,   10,  192,    4, 0,0,0, /* Message */
145    CWWidth | CWHeight | CWX | CWY,    0,   24,  212,    2, 0,0,0, /* Separator */
146    CWWidth | CWHeight | CWX | CWY,   10,   36,   64,   41, 0,0,0, /* OK */
147    CWWidth | CWHeight | CWX | CWY,   74,   36,   64,   41, 0,0,0, /* Cancel */
148    CWWidth | CWHeight | CWX | CWY,  138,   36,   64,   41, 0,0,0, /* Help */
149    CWWidth | CWHeight | CWX | CWY,    0,   60,  212,  213, 0,0,0, /* com */
150    CWWidth | CWHeight | CWX | CWY,   10,   10,  192,  135, 0,0,0, /* ItemsListSW */
151    CWWidth | CWHeight | CWX | CWY,    0,    0,  192,  135, 0,0,0, /* ItemsList */
152    CWWidth | CWHeight | CWX | CWY,   10,  155,  192,   17, 0,0,0, /* Selection */
153    CWWidth | CWHeight | CWX | CWY,   10,  172,  192,   31, 0,0,0, /* Text */
154    CWWidth | CWHeight | CWX | CWY,    0,   33,  212,   25, 0,0,0, /* form */
155    CWWidth | CWHeight | CWX | CWY,  182,    0,   30,   25, 0,0,0, /* two */
156    CWWidth | CWHeight | CWX | CWY,    0,    0,  182,   25, 0,0,0, /* three */
157     };
158     PrintDetails(shell,Expected);
159 };
160   LessTifTestMainLoop(shell);
161 
162     exit(0);
163 }
164 
165