ui/motif/graphics.c

Sun, 29 Sep 2024 18:56:26 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 29 Sep 2024 18:56:26 +0200
branch
newapi
changeset 316
e15ff2183b43
parent 120
49bc645df8b7
permissions
-rw-r--r--

don't add the headerbar to simple windows (GTK)

96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2015 Olaf Wintermann. All rights reserved.
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #include <stdio.h>
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #include <stdlib.h>
119
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
31 #include <X11/Intrinsic.h>
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
32 #include <X11/IntrinsicP.h>
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 #include "graphics.h"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #include "container.h"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 static void ui_drawingarea_expose(Widget widget, XtPointer u, XtPointer c) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 UiDrawEvent *drawevent = u;
120
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
40 //XmDrawingAreaCallbackStruct *cbs = (XmDrawingAreaCallbackStruct *)c;
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
41 //XEvent *event = cbs->event;
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 Display *dpy = XtDisplay(widget);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 UiEvent ev;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 ev.obj = drawevent->obj;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 ev.window = drawevent->obj->window;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 ev.document = drawevent->obj->ctx->document;
103
6a6718269c22 added drawing area (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 98
diff changeset
48 ev.eventdata = NULL;
6a6718269c22 added drawing area (Qt)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 98
diff changeset
49 ev.intval = 0;
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 XtVaGetValues(
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 widget,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 XmNwidth,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 &drawevent->gr.g.width,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 XmNheight,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 &drawevent->gr.g.height,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 NULL);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 XGCValues gcvals;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 gcvals.foreground = BlackPixelOfScreen(XtScreen(widget));
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 drawevent->gr.gc = XCreateGC(dpy, XtWindow(widget), (GCForeground), &gcvals);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 drawevent->callback(&ev, &drawevent->gr.g, drawevent->userdata);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 UIWIDGET ui_drawingarea(UiObject *obj, ui_drawfunc f, void *userdata) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 UiContainer *ct = uic_get_current_container(obj);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 int n = 0;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 Arg args[16];
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 Widget parent = ct->prepare(ct, args, &n, TRUE);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 Widget drawingarea = XmCreateDrawingArea(parent, "drawingarea", args, n);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 if(f) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 UiDrawEvent *event = malloc(sizeof(UiDrawEvent));
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 event->obj = obj;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 event->callback = f;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 event->userdata = userdata;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 event->gr.display = XtDisplay(drawingarea);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 event->gr.widget = drawingarea;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 Colormap colormap;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 XtVaGetValues(drawingarea, XmNcolormap, &colormap, NULL);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 event->gr.colormap = colormap;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 XtAddCallback(
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 drawingarea,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 XmNexposeCallback,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 ui_drawingarea_expose,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 event);
120
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
93
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
94 XtVaSetValues(drawingarea, XmNuserData, event, NULL);
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 XtManageChild(drawingarea);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 return drawingarea;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100
98
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
101 static void ui_drawingarea_input(Widget widget, XtPointer u, XtPointer c) {
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
102 XmDrawingAreaCallbackStruct *cbs = (XmDrawingAreaCallbackStruct*)c;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
103 XEvent *xevent = cbs->event;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
104 UiMouseEventData *event = u;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
105
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
106 if (cbs->reason == XmCR_INPUT) {
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
107 if (xevent->xany.type == ButtonPress) {
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
108 UiMouseEvent me;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
109 me.x = xevent->xbutton.x;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
110 me.y = xevent->xbutton.y;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
111 // TODO: configurable double click time
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
112 me.type = xevent->xbutton.time - event->last_event > 300 ? UI_PRESS : UI_PRESS2;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
113
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
114 UiEvent e;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
115 e.obj = event->obj;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
116 e.window = event->obj->window;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
117 e.document = event->obj->ctx->document;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
118 e.eventdata = &me;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
119 e.intval = 0;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
120 event->callback(&e, event->userdata);
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
121
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
122
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
123 event->last_event = me.type == UI_PRESS2 ? 0 : xevent->xbutton.time;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
124 }
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
125 }
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
126
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
127 }
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
128
115
102fc0b8fe3e improved context menus
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 114
diff changeset
129 void ui_drawingarea_mousehandler(UiObject *obj, UIWIDGET widget, ui_callback f, void *u) {
98
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
130 if(f) {
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
131 UiMouseEventData *event = malloc(sizeof(UiMouseEventData));
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
132 event->obj = obj;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
133 event->callback = f;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
134 event->userdata = u;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
135 event->last_event = 0;
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
136
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
137 XtAddCallback(widget, XmNinputCallback, ui_drawingarea_input, event);
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
138 }
efaae97bd95b added mouse event handler (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 97
diff changeset
139 }
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140
119
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
141 void ui_drawingarea_getsize(UIWIDGET drawingarea, int *width, int *height) {
120
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
142 XtVaGetValues(
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
143 drawingarea,
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
144 XmNwidth,
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
145 width,
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
146 XmNheight,
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
147 height,
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
148 NULL);
119
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
149 }
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
150
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
151 void ui_drawingarea_redraw(UIWIDGET drawingarea) {
120
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
152 //XClearArea(XtDisplay(drawingarea), drawingarea->core.window, 0, 0, drawingarea->core.width, drawingarea->core.height, True);
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
153 UiDrawEvent *event;
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
154 XtVaGetValues(drawingarea, XmNuserData, &event, NULL);
49bc645df8b7 added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 119
diff changeset
155 ui_drawingarea_expose(drawingarea, event, NULL);
119
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
156 }
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
157
d7a7fb79b5f7 added scrollbar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 115
diff changeset
158
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 /* -------------------- text layout functions -------------------- */
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 UiTextLayout* ui_text(UiGraphics *g) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 UiTextLayout *text = malloc(sizeof(UiTextLayout));
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
162 memset(text, 0, sizeof(UiTextLayout));
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 text->text = NULL;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 text->length = 0;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 text->widget = ((UiXlibGraphics*)g)->widget;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 text->fontset = NULL;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 return text;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 static void create_default_fontset(UiTextLayout *layout) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 char **missing = NULL;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 int num_missing = 0;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 char *def = NULL;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 Display *dpy = XtDisplay(layout->widget);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 XFontSet fs = XCreateFontSet(
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 dpy,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 "-dt-interface system-medium-r-normal-s*utf*:,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-iso8859-1,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-iso8859-10,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-iso8859-15,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-iso8859-2,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-iso8859-3,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-iso8859-4,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-iso8859-5,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-iso8859-9,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-koi8-e,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-koi8-r,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-koi8-ru,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-koi8-u,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 "-misc-liberation sans-medium-r-normal--0-0-0-0-p-0-koi8-uni,"
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 "-misc-fixed-medium-r-normal--14-130-75-75-c-140-jisx0208",
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 &missing, &num_missing, &def);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 layout->fontset = fs;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 void ui_text_free(UiTextLayout *text) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197 // TODO
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200 void ui_text_setstring(UiTextLayout *layout, char *str) {
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
201 ui_text_setstringl(layout, str, strlen(str));
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 void ui_text_setstringl(UiTextLayout *layout, char *str, int len) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 layout->text = str;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 layout->length = len;
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
207 layout->changed = 1;
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210 void ui_text_setfont(UiTextLayout *layout, char *font, int size) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211 create_default_fontset(layout);//TODO
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
212 layout->changed = 1;
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 void ui_text_getsize(UiTextLayout *layout, int *width, int *height) {
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
216 if(layout->changed) {
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
217 XRectangle ext, lext;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
218 XmbTextExtents(layout->fontset, layout->text, layout->length, &ext, &lext);
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
219 layout->width = ext.width;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
220 layout->height = ext.height;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
221 layout->changed = 0;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
222 }
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
223 *width = layout->width;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
224 *height = layout->height;
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227 void ui_text_setwidth(UiTextLayout *layout, int width) {
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
228 layout->maxwidth = width;
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 /* -------------------- drawing functions -------------------- */
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234 void ui_graphics_color(UiGraphics *g, int red, int green, int blue) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235 UiXlibGraphics *gr = (UiXlibGraphics*)g;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236 XColor color;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237 color.flags= DoRed | DoGreen | DoBlue;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238 color.red = red * 257;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 color.green = green * 257;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240 color.blue = blue * 257;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241 XAllocColor(gr->display, gr->colormap, &color);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 XSetForeground(gr->display, gr->gc, color.pixel);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244
114
909fe96e5659 added ui_draw_line function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 103
diff changeset
245 void ui_draw_line(UiGraphics *g, int x1, int y1, int x2, int y2) {
909fe96e5659 added ui_draw_line function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 103
diff changeset
246 UiXlibGraphics *gr = (UiXlibGraphics*)g;
909fe96e5659 added ui_draw_line function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 103
diff changeset
247 XDrawLine(gr->display, XtWindow(gr->widget), gr->gc, x1, y1, x2, y2);
909fe96e5659 added ui_draw_line function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 103
diff changeset
248 }
909fe96e5659 added ui_draw_line function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 103
diff changeset
249
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 void ui_draw_rect(UiGraphics *g, int x, int y, int w, int h, int fill) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 UiXlibGraphics *gr = (UiXlibGraphics*)g;
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252 if(fill) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253 XFillRectangle(gr->display, XtWindow(gr->widget), gr->gc, x, y, w, h);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 } else {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 XDrawRectangle(gr->display, XtWindow(gr->widget), gr->gc, x, y, w, h);
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257 }
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259 void ui_draw_text(UiGraphics *g, int x, int y, UiTextLayout *text) {
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260 UiXlibGraphics *gr = (UiXlibGraphics*)g;
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
261 int width, height;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
262 ui_text_getsize(text, &width, &height);
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
263 if(text->maxwidth > 0) {
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
264 XRectangle clip;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
265 clip.x = x;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
266 clip.y = y;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
267 clip.width = text->maxwidth;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
268 clip.height = height;
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
269 XSetClipRectangles(gr->display, gr->gc, 0, 0, &clip, 1, Unsorted);
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
270 }
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
271
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 XmbDrawString(
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 gr->display,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274 XtWindow(gr->widget),
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
275 text->fontset,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
276 gr->gc,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277 x,
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
278 y + height,
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279 text->text,
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280 text->length);
97
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
281
1a786201465f implemented text layout functions (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 96
diff changeset
282 XSetClipMask(gr->display, gr->gc, None);
96
93785a7bda56 added drawing area (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
283 }

mercurial