Mercurial > kinput2.yaz
annotate lib/ICLabel.c @ 21:7a454839a6de default tip
add some missing header files
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 09 Mar 2010 19:02:39 +0900 |
parents | 92745d501b9a |
children |
rev | line source |
---|---|
0
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
1 #ifndef lint |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
2 static char *rcsid = "$Id: ICLabel.c,v 1.11 1991/09/23 04:01:20 ishisone Rel $"; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
3 #endif |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
4 /* |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
5 * Copyright (c) 1990 Software Research Associates, Inc. |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
6 * |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
7 * Permission to use, copy, modify, and distribute this software and its |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
8 * documentation for any purpose and without fee is hereby granted, provided |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
9 * that the above copyright notice appear in all copies and that both that |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
10 * copyright notice and this permission notice appear in supporting |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
11 * documentation, and that the name of Software Research Associates not be |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
12 * used in advertising or publicity pertaining to distribution of the |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
13 * software without specific, written prior permission. Software Research |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
14 * Associates makes no representations about the suitability of this software |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
15 * for any purpose. It is provided "as is" without express or implied |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
16 * warranty. |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
17 * |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
18 * Author: Makoto Ishisone, Software Research Associates, Inc., Japan |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
19 */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
20 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
21 #include <X11/IntrinsicP.h> |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
22 #include <X11/StringDefs.h> |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
23 #include <X11/Xmu/Converters.h> |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
24 #if XtSpecificationRelease > 4 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
25 #include <X11/Xfuncs.h> |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
26 #endif |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
27 #include "ICLabelP.h" |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
28 #include "ConvDisp.h" |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
29 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
30 static XtResource resources[] = { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
31 #define offset(field) XtOffset(ICLabelWidget, iclabel.field) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
32 { XtNhorizontalSpacing, XtCSpacing, XtRDimension, sizeof(Dimension), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
33 offset(hspace), XtRString, "1" }, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
34 { XtNverticalSpacing, XtCSpacing, XtRDimension, sizeof(Dimension), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
35 offset(vspace), XtRString, "1" }, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
36 { XtNlabel, XtCLabel, XtRPointer, sizeof(ICString*), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
37 offset(label), XtRImmediate, NULL }, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
38 { XtNjustify, XtCJustify, XtRJustify, sizeof(XtJustify), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
39 offset(justify), XtRImmediate, (XtPointer)XtJustifyCenter }, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
40 { XtNcursor, XtCCursor, XtRCursor, sizeof(Cursor), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
41 offset(cursor), XtRImmediate, (XtPointer)None }, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
42 #undef offset |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
43 }; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
44 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
45 static void ClassInitialize(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
46 static void Initialize(), Destroy(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
47 static void Realize(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
48 static void Redisplay(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
49 static Boolean SetValues(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
50 static XtGeometryResult QueryGeometry(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
51 static void InsertChild(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
52 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
53 static void computeSize(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
54 static ICString *copyString(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
55 static void freeString(); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
56 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
57 static CompositeClassExtensionRec CompositeExtension = { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
58 /* next_extension */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
59 /* record_type */ NULLQUARK, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
60 /* version */ XtCompositeExtensionVersion, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
61 /* record_size */ sizeof(CompositeClassExtensionRec), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
62 /* accept_objects */ True, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
63 }; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
64 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
65 ICLabelClassRec icLabelClassRec = { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
66 { /* core fields */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
67 /* superclass */ (WidgetClass) &compositeClassRec, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
68 /* class_name */ "ICLabel", |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
69 /* widget_size */ sizeof(ICLabelRec), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
70 /* class_initialize */ ClassInitialize, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
71 /* class_part_initialize */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
72 /* class_inited */ FALSE, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
73 /* initialize */ Initialize, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
74 /* initialize_hook */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
75 /* realize */ Realize, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
76 /* actions */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
77 /* num_actions */ 0, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
78 /* resources */ resources, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
79 /* num_resources */ XtNumber(resources), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
80 /* xrm_class */ NULLQUARK, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
81 /* compress_motion */ TRUE, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
82 /* compress_exposure */ TRUE, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
83 /* compress_enterleave */ TRUE, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
84 /* visible_interest */ FALSE, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
85 /* destroy */ Destroy, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
86 /* resize */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
87 /* expose */ Redisplay, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
88 /* set_values */ SetValues, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
89 /* set_values_hook */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
90 /* set_values_almost */ XtInheritSetValuesAlmost, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
91 /* get_values_hook */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
92 /* accept_focus */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
93 /* version */ XtVersion, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
94 /* callback_private */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
95 /* tm_table */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
96 /* query_geometry */ QueryGeometry, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
97 /* display_accelerator */ XtInheritDisplayAccelerator, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
98 /* extension */ NULL |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
99 }, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
100 { /* composite fields */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
101 /* geometry_manager */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
102 /* change_managed */ NULL, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
103 /* insert_child */ InsertChild, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
104 /* delete_child */ XtInheritDeleteChild, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
105 /* extension */ (XtPointer)&CompositeExtension, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
106 }, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
107 { /* iclabel fields */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
108 /* empty */ 0 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
109 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
110 }; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
111 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
112 WidgetClass icLabelWidgetClass = (WidgetClass)&icLabelClassRec; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
113 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
114 static void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
115 ClassInitialize() |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
116 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
117 XtAddConverter(XtRString, XtRJustify, XmuCvtStringToJustify, NULL, 0); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
118 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
119 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
120 /* ARGSUSED */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
121 static void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
122 Initialize(req, new, args, num_args) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
123 Widget req; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
124 Widget new; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
125 ArgList args; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
126 Cardinal *num_args; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
127 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
128 ICLabelWidget iclw = (ICLabelWidget)new; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
129 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
130 if (iclw->iclabel.label != NULL) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
131 iclw->iclabel.label = copyString(iclw->iclabel.label); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
132 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
133 iclw->iclabel.width = 0; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
134 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
135 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
136 static void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
137 Destroy(w) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
138 Widget w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
139 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
140 ICLabelWidget iclw = (ICLabelWidget)w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
141 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
142 if (iclw->iclabel.label != NULL) freeString(iclw->iclabel.label); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
143 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
144 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
145 static void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
146 Realize(w, maskp, attr) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
147 Widget w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
148 XtValueMask *maskp; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
149 XSetWindowAttributes *attr; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
150 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
151 ICLabelWidget iclw = (ICLabelWidget)w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
152 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
153 if (iclw->iclabel.cursor != None) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
154 *maskp |= CWCursor; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
155 attr->cursor = iclw->iclabel.cursor; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
156 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
157 (*icLabelWidgetClass->core_class.superclass->core_class.realize)(w, maskp, attr); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
158 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
159 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
160 /* ARGSUSED */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
161 static void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
162 Redisplay(w, ev, region) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
163 Widget w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
164 XEvent *ev; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
165 Region region; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
166 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
167 ICLabelWidget iclw = (ICLabelWidget)w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
168 Widget dispobj = iclw->iclabel.displayobj; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
169 int x, y; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
170 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
171 if (iclw->iclabel.label == NULL || iclw->iclabel.displayobj == NULL) return; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
172 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
173 switch (iclw->iclabel.justify) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
174 case XtJustifyLeft: |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
175 x = iclw->iclabel.hspace; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
176 break; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
177 case XtJustifyRight: |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
178 x = iclw->core.width - (iclw->iclabel.vspace + iclw->iclabel.width); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
179 break; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
180 case XtJustifyCenter: |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
181 default: |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
182 x = (iclw->core.width - iclw->iclabel.width) / 2; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
183 break; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
184 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
185 y = (iclw->core.height - iclw->iclabel.fontheight) / 2; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
186 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
187 CDDrawString(dispobj, w, iclw->iclabel.label, 0, -1, x, y); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
188 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
189 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
190 /* ARGSUSED */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
191 static Boolean |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
192 SetValues(cur, req, wid, args, num_args) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
193 Widget cur; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
194 Widget req; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
195 Widget wid; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
196 ArgList args; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
197 Cardinal *num_args; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
198 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
199 ICLabelWidget old = (ICLabelWidget)cur; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
200 ICLabelWidget new = (ICLabelWidget)wid; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
201 Boolean widthspecified = False; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
202 Boolean heightspecified = False; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
203 Boolean redisplay = False; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
204 Boolean label_changed = False; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
205 int i; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
206 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
207 for (i = 0; i < *num_args; i++) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
208 if (!strcmp(args->name, XtNwidth)) widthspecified = True; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
209 else if (!strcmp(args->name, XtNheight)) heightspecified = True; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
210 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
211 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
212 if (new->iclabel.label != old->iclabel.label) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
213 /* compute maximum pixel width of the list items */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
214 if (old->iclabel.label != NULL) freeString(old->iclabel.label); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
215 if (new->iclabel.label != NULL) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
216 new->iclabel.label = copyString(new->iclabel.label); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
217 if (new->iclabel.displayobj != NULL) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
218 new->iclabel.width = CDStringWidth(new->iclabel.displayobj, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
219 new->iclabel.label, 0, -1); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
220 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
221 } else { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
222 new->iclabel.width = 0; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
223 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
224 label_changed = True; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
225 redisplay = True; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
226 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
227 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
228 if (new->iclabel.hspace != old->iclabel.hspace || |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
229 new->iclabel.vspace != old->iclabel.vspace || |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
230 label_changed) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
231 computeSize(new, widthspecified, heightspecified); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
232 redisplay = True; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
233 } else if (new->iclabel.justify != old->iclabel.justify) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
234 redisplay = True; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
235 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
236 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
237 if (new->iclabel.cursor != old->iclabel.cursor && XtIsRealized(wid)) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
238 XDefineCursor(XtDisplay(wid), XtWindow(wid), new->iclabel.cursor); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
239 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
240 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
241 return redisplay; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
242 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
243 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
244 static XtGeometryResult |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
245 QueryGeometry(w, req, ret) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
246 Widget w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
247 XtWidgetGeometry *req; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
248 XtWidgetGeometry *ret; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
249 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
250 ICLabelWidget iclw = (ICLabelWidget)w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
251 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
252 ret->request_mode = CWWidth | CWHeight; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
253 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
254 ret->width = iclw->iclabel.width + iclw->iclabel.hspace * 2; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
255 ret->height = iclw->iclabel.fontheight + iclw->iclabel.vspace * 2; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
256 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
257 if ((!(req->request_mode & CWWidth) || ret->width == req->width) && |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
258 (!(req->request_mode & CWHeight) || ret->height == req->height)) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
259 return XtGeometryYes; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
260 } else if (ret->width == iclw->core.width && |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
261 ret->height == iclw->core.height) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
262 return XtGeometryNo; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
263 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
264 return XtGeometryAlmost; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
265 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
266 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
267 static void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
268 InsertChild(w) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
269 Widget w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
270 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
271 ICLabelWidget iclw = (ICLabelWidget)XtParent(w); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
272 CompositeWidgetClass super = (CompositeWidgetClass)XtClass(iclw)->core_class.superclass; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
273 String params[1]; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
274 Cardinal num_params; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
275 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
276 if (!XtIsSubclass(w, convDisplayObjectClass)) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
277 params[0] = XtClass(iclw)->core_class.class_name; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
278 num_params = 1; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
279 XtAppErrorMsg(XtWidgetToApplicationContext(w), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
280 "childError", "class", "WidgetError", |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
281 "%s: child must be subclass of ConvDisplayObject", |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
282 params, &num_params); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
283 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
284 if (iclw->composite.num_children != 0) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
285 params[0] = XtClass(iclw)->core_class.class_name; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
286 num_params = 1; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
287 XtAppErrorMsg(XtWidgetToApplicationContext(w), |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
288 "childError", "number", "WidgetError", |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
289 "%s: can only take one child", |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
290 params, &num_params); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
291 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
292 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
293 (*super->composite_class.insert_child)(w); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
294 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
295 iclw->iclabel.displayobj = w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
296 iclw->iclabel.fontheight = CDLineHeight(w, (Position *)NULL); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
297 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
298 if (iclw->iclabel.label != NULL) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
299 iclw->iclabel.width = CDStringWidth(iclw->iclabel.displayobj, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
300 iclw->iclabel.label, 0, -1); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
301 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
302 computeSize(iclw, iclw->core.width != 0, iclw->core.height != 0); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
303 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
304 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
305 static void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
306 computeSize(iclw, fixwidth, fixheight) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
307 ICLabelWidget iclw; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
308 Boolean fixwidth; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
309 Boolean fixheight; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
310 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
311 if (!fixwidth) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
312 iclw->core.width = iclw->iclabel.width + iclw->iclabel.hspace * 2; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
313 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
314 if (!fixheight) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
315 iclw->core.height = iclw->iclabel.fontheight + iclw->iclabel.vspace * 2; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
316 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
317 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
318 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
319 static ICString * |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
320 copyString(from) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
321 ICString *from; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
322 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
323 ICString *to = XtNew(ICString); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
324 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
325 to->nbytes = from->nbytes; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
326 to->nchars = from->nchars; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
327 to->attr = from->attr; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
328 to->data = XtMalloc(from->nbytes); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
329 (void)bcopy(from->data, to->data, from->nbytes); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
330 return to; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
331 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
332 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
333 static void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
334 freeString(s) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
335 ICString *s; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
336 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
337 XtFree(s->data); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
338 XtFree((char *)s); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
339 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
340 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
341 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
342 /* |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
343 * public function |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
344 */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
345 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
346 void |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
347 ICLRecomputeSize(w) |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
348 Widget w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
349 { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
350 ICLabelWidget iclw = (ICLabelWidget)w; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
351 Dimension width, height; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
352 |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
353 if (iclw->iclabel.displayobj != NULL) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
354 iclw->iclabel.fontheight = CDLineHeight(iclw->iclabel.displayobj, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
355 (Position *)NULL); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
356 if (iclw->iclabel.label != NULL) { |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
357 iclw->iclabel.width = CDStringWidth(iclw->iclabel.displayobj, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
358 iclw->iclabel.label, 0, -1); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
359 } |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
360 width = iclw->iclabel.width + iclw->iclabel.hspace * 2; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
361 height = iclw->iclabel.fontheight + iclw->iclabel.vspace * 2; |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
362 XtMakeResizeRequest(w, width, height, |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
363 (Dimension *)NULL, (Dimension *)NULL); |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
364 } /* else do nothing */ |
92745d501b9a
initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
365 } |