comparison lib/Canvas.c @ 0:92745d501b9a

initial import from kinput2-v3.1
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 08 Mar 2010 04:44:30 +0900
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92745d501b9a
1 #ifndef lint
2 static char *rcsid = "$Id: Canvas.c,v 1.3 1991/09/23 03:57:20 ishisone Rel $";
3 #endif
4 /*
5 * Copyright (c) 1990 Software Research Associates, Inc.
6 *
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation for any purpose and without fee is hereby granted, provided
9 * that the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Software Research Associates not be
12 * used in advertising or publicity pertaining to distribution of the
13 * software without specific, written prior permission. Software Research
14 * Associates makes no representations about the suitability of this software
15 * for any purpose. It is provided "as is" without express or implied
16 * warranty.
17 *
18 * Author: Makoto Ishisone, Software Research Associates, Inc., Japan
19 */
20
21 #include <X11/IntrinsicP.h>
22 #include <X11/StringDefs.h>
23 #include "CanvasP.h"
24
25 static XtResource resources[] = {
26 #define offset(field) XtOffset(CanvasWidget, canvas.field)
27 { XtNexposeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
28 offset(exposecallback), XtRCallback, (XtPointer)NULL },
29 { XtNresizeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
30 offset(resizecallback), XtRCallback, (XtPointer)NULL },
31 #undef offset
32 };
33
34 static void Redisplay();
35 static void Resize();
36
37 CanvasClassRec canvasClassRec = {
38 { /* core fields */
39 /* superclass */ (WidgetClass) &widgetClassRec,
40 /* class_name */ "Canvas",
41 /* widget_size */ sizeof(CanvasRec),
42 /* class_initialize */ NULL,
43 /* class_part_initialize */ NULL,
44 /* class_inited */ FALSE,
45 /* initialize */ NULL,
46 /* initialize_hook */ NULL,
47 /* realize */ XtInheritRealize,
48 /* actions */ NULL,
49 /* num_actions */ 0,
50 /* resources */ resources,
51 /* num_resources */ XtNumber(resources),
52 /* xrm_class */ NULLQUARK,
53 /* compress_motion */ TRUE,
54 /* compress_exposure */ TRUE,
55 /* compress_enterleave */ TRUE,
56 /* visible_interest */ FALSE,
57 /* destroy */ NULL,
58 /* resize */ Resize,
59 /* expose */ Redisplay,
60 /* set_values */ NULL,
61 /* set_values_hook */ NULL,
62 /* set_values_almost */ XtInheritSetValuesAlmost,
63 /* get_values_hook */ NULL,
64 /* accept_focus */ NULL,
65 /* version */ XtVersion,
66 /* callback_private */ NULL,
67 /* tm_table */ NULL,
68 /* query_geometry */ XtInheritQueryGeometry,
69 /* display_accelerator */ XtInheritDisplayAccelerator,
70 /* extension */ NULL
71 },
72 { /* canvas fields */
73 /* empty */ 0
74 }
75 };
76
77 WidgetClass canvasWidgetClass = (WidgetClass)&canvasClassRec;
78
79 /* ARGSUSED */
80 static void
81 Redisplay(w, event, region)
82 Widget w;
83 XEvent *event;
84 Region region;
85 {
86 CanvasWidget csw = (CanvasWidget)w;
87
88 XtCallCallbackList(w, csw->canvas.exposecallback, (XtPointer)event);
89 }
90
91 static void
92 Resize(w)
93 Widget w;
94 {
95 CanvasWidget csw = (CanvasWidget)w;
96
97 XtCallCallbackList(w, csw->canvas.resizecallback, (XtPointer)NULL);
98 }