1 /* Header$ */
2
3 #include <stdlib.h>
4 #include <stdio.h>
5
6 #include <Xm/Xm.h>
7 #include <Xm/PushB.h>
8 #include <Xm/PushBG.h>
9 #include <Xm/PanedW.h>
10 #include <Xm/RowColumn.h>
11 #include <Xm/Form.h>
12 #include <Xm/Frame.h>
13 #include <Xm/Label.h>
14 #include <Xm/LabelG.h>
15 #include <Xm/TextF.h>
16 #include <Xm/List.h>
17 #include <Xm/SeparatoG.h>
18 #include <Xm/DialogS.h>
19
20 #include "../../common/Test.h"
21
22
23 static char *FallBack[] = {
24 "*.geometrySlop: 0",
25 "*label_0.background: red",
26 "*label_1.background: green",
27 "*text_0.background: green",
28 "*text_1.background: red",
29 NULL
30 };
31
32 Widget dialog;
33
createTickDialog(Widget Button)34 Widget createTickDialog (Widget Button)
35 {
36 Widget form, pane, row, list, button, text, option;
37
38 Dimension width, height, border;
39
40 int num;
41 Arg args[10];
42
43 char *labels[] = { "label_0", "label_1"};
44 char *texts[] = { "text_0", "text_1"};
45
46 dialog = XtVaCreatePopupShell( "OptionTick",
47 xmDialogShellWidgetClass,
48 XtParent(Button),
49 XmNx, 75,
50 XmNy, 75,
51 NULL );
52
53 pane = XtVaCreateWidget ( "StockPane", xmPanedWindowWidgetClass,
54 dialog,
55 XmNsashWidth, 1,
56 XmNsashHeight, 1,
57 NULL );
58
59 /* form to hold rowcolumn form, scrolled list */
60 form = XtVaCreateWidget ( "TickForm", xmFormWidgetClass, pane, NULL );
61
62 num = 0;
63 XtSetArg(args[num], XmNscrollBarDisplayPolicy, XmSTATIC); num++;
64 XtSetArg(args[num], XmNvisibleItemCount, 5); num++;
65 XtSetArg(args[num], XmNselectionPolicy, XmSINGLE_SELECT); num++;
66 XtSetArg(args[num], XmNtopAttachment, XmATTACH_FORM); num++;
67 XtSetArg(args[num], XmNleftAttachment, XmATTACH_FORM); num++;
68 XtSetArg(args[num], XmNrightAttachment, XmATTACH_FORM); num++;
69 XtSetArg(args[num], XmNbottomAttachment, XmATTACH_FORM); num++;
70 list = XmCreateScrolledList ( form, "StockList", args, num);
71 XtManageChild ( list );
72
73 XtManageChild (form);
74 XtManageChild (pane);
75 XtManageChild(dialog);
76 return (dialog);
77 }
78
79 int
main(int argc,char ** argv)80 main(int argc, char **argv)
81 {
82 XtAppContext app;
83 Widget Shell, Button;
84
85 XtSetLanguageProc(NULL, NULL, NULL);
86
87 Shell = XtVaAppInitialize(&app, "Shell", NULL, 0, &argc, argv, FallBack, NULL);
88 Button = XmCreatePushButton(Shell, "PushMePlease", NULL, 0);
89 XtVaSetValues(Button,
90 XmNrecomputeSize, False,
91 XmNwidth, 84,
92 XmNheight, 25,
93 NULL);
94 XtManageChild(Button);
95 XtAddCallback (Button, XmNactivateCallback, (XtCallbackProc)createTickDialog, (XtPointer)NULL);
96
97 XtRealizeWidget(Shell);
98 LessTifTestWaitForIt(Shell);
99 LessTifTestPushButton(Button);
100
101 /* Note: the following values are the result of
102 * querying the current geometry.
103 */
104 {
105 XtWidgetGeometry Expected[] = {
106 CWWidth | CWHeight , 75, 75, 73, 93, 0,0,0, /* OptionTick */
107 CWWidth | CWHeight , 75, 75, 73, 93, 0,0,0, /* StockPane */
108 CWWidth | CWHeight | CWX | CWY, 3, 3, 67, 87, 0,0,0, /* TickForm */
109 CWWidth | CWHeight | CWX | CWY, 0, 0, 67, 87, 0,0,0, /* StockListSW */
110 CWWidth | CWHeight | CWX | CWY, 52, 0, 15, 87, 0,0,0, /* VertScrollBar */
111 CWWidth | CWHeight | CWX | CWY, 0, 0, 48, 87, 0,0,0, /* StockList */
112 };
113 /* toplevel should be replaced with to correct applicationShell */
114 PrintDetails(dialog, Expected);
115 }
116 LessTifTestMainLoop(Shell);
117 exit(0);
118 }
119