-
Notifications
You must be signed in to change notification settings - Fork 0
/
testedit.c
87 lines (71 loc) · 2.03 KB
/
testedit.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**** testedit.c ****/ /**** formatted with 4-column tabs ****/
#include "editor.h"
/*
Functions:
*/
static void Quit();
/*
Private data:
*/
static Editor edit;
static char *startup_text =
"Line one of the text\n\
Line two of the text\n\
Line three of the text\n\
Line four of the text\n\
Line five of the text\n\
Line six of the text\n\
Line seven of the text\n\
Line eight of the text\n\
one two three four five six\n\
seven eight nine ten eleven twelve";
/*
main() creates a top-level window with an application "Quit"
button and an edit window/object.
*/
void main(argc, argv)
int argc;
char *argv[];
{
Widget topLevel, pane, buttonBox, buttonQuit;
Arg args[10];
int i;
XtAppContext app;
topLevel = XtAppInitialize(&app, "TestEdit",
(XrmOptionDescList) NULL, 0,
&argc, argv, (String *) NULL, (ArgList) NULL, 0);
pane = XtCreateManagedWidget("pane",
xmPanedWindowWidgetClass, topLevel, NULL, 0);
i = 0;
XtSetArg(args[i], XmNorientation, (XtArgVal) XmHORIZONTAL); i++;
XtSetArg(args[i], XmNentryAlignment,
(XtArgVal) XmALIGNMENT_CENTER); i++;
buttonBox = XtCreateManagedWidget("buttonBox",
xmRowColumnWidgetClass, pane, args, i);
i = 0;
XtSetArg(args[i], XmNlabelString, XmStringCreateLtoR("Quit",
XmSTRING_DEFAULT_CHARSET)); i++;
buttonQuit = XtCreateManagedWidget("buttonQuit",
xmPushButtonWidgetClass, buttonBox, args, i);
XtAddCallback(buttonQuit, XmNactivateCallback, Quit, NULL);
edit = editor_create(pane, "TestEdit", "edit", 10, 40, 40,
/* editor_SCROLL_LEFT_ONLY, startup_text, XmSTRING_DEFAULT_CHARSET,*/
editor_SCROLL_DEFAULT, startup_text, XmSTRING_DEFAULT_CHARSET,
/* "testedit", "Search and Replace", editor_WIN_MGR_DECOR, editor_MENU_BAR);*/
"testedit", "Search and Replace", editor_WIN_MGR_DECOR, editor_POPUP_MENU);
XtRealizeWidget(topLevel);
editor_realize(edit);
XtAppMainLoop(app);
} /* main */
/*
Quit() terminates the application.
*/
/*ARGSUSED*/
static void Quit(w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
{
editor_destroy(edit);
exit(0);
} /* Quit */