ui/motif/Grid.h

changeset 431
bb7da585debc
parent 426
3eb26df703bf
child 433
605bb5dc34f1
equal deleted inserted replaced
169:fe49cff3c571 431:bb7da585debc
1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 2024 Olaf Wintermann. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef GRID_H
30 #define GRID_H
31
32 #include <X11/Intrinsic.h>
33 #include <X11/IntrinsicP.h>
34 #include <Xm/XmAll.h>
35 #include <Xm/Primitive.h>
36 #include <Xm/PrimitiveP.h>
37 #include <Xm/ManagerP.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 // resources
44 #define gridColumnSpacing "gridColumnSpacing"
45 #define gridRowSpacing "gridRowSpacing"
46 #define gridMargin "gridMargin"
47
48 // constraints
49 #define gridColumn "gridColumn"
50 #define gridRow "gridRow"
51 #define gridColspan "gridColspan"
52 #define gridRowspan "gridRowspan"
53 #define gridHExpand "gridHExpand"
54 #define gridVExpand "gridVExpand"
55 #define gridHFill "gridHFill"
56 #define gridVFill "gridVFill"
57 #define gridMarginLeft "gridMarginLeft"
58 #define gridMarginRight "gridMarginRight"
59 #define gridMarginTop "gridMarginTop"
60 #define gridMarginBottom "gridMarginBottom"
61
62
63 typedef struct GridDef {
64 Dimension size;
65 Dimension pos;
66 Boolean expand;
67 } GridDef;
68
69 typedef struct GridClassPart {
70 int test;
71 } GridClassPart;
72
73 typedef struct GridClassRec {
74 CoreClassPart core_class;
75 CompositeClassPart composite_class;
76 ConstraintClassPart constraint_class;
77 XmManagerClassPart manager_class;
78 GridClassPart mywidgetclass;
79 } GridClassRec;
80
81
82 typedef struct GridPart {
83 int margin_left;
84 int margin_right;
85 int margin_top;
86 int margin_bottom;
87 int max_col;
88 int max_row;
89 Dimension columnspacing;
90 Dimension rowspacing;
91 Dimension margin;
92
93 Boolean sizerequest;
94 } GridPart;
95
96 typedef struct GridRec {
97 CorePart core;
98 CompositePart composite;
99 ConstraintPart constraint;
100 XmManagerPart manager;
101 GridPart mywidget;
102 } GridRec;
103
104 typedef struct GridContraintPart {
105 Dimension x;
106 Dimension y;
107 Dimension margin_left;
108 Dimension margin_right;
109 Dimension margin_top;
110 Dimension margin_bottom;
111 Boolean hexpand;
112 Boolean vexpand;
113 Boolean hfill;
114 Boolean vfill;
115 Dimension colspan;
116 Dimension rowspan;
117 Dimension pref_width;
118 Dimension pref_height;
119 } GridContraintPart;
120
121 typedef struct GridConstraintRec {
122 XmManagerConstraintPart manager;
123 GridContraintPart grid;
124 } GridConstraintRec;
125
126 typedef GridRec* MyWidget;
127
128 extern WidgetClass gridClass;
129
130 void grid_class_initialize();
131 void grid_initialize();
132 void grid_realize();
133 void grid_destroy();
134 void grid_resize();
135 void grid_expose();
136 Boolean grid_set_values();
137 Boolean grid_acceptfocus(Widget , Time*);
138
139 void grid_place_children(MyWidget w);
140
141 void grid_getfocus();
142 void grid_loosefocus();
143
144 void grid_constraint_init(
145 Widget request,
146 Widget neww,
147 ArgList args,
148 Cardinal* num_args
149 );
150
151 XtGeometryResult GridGeometryManager(Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *reply);
152 void GridChangeManaged(Widget widget);
153 Boolean ConstraintSetValues(Widget old, Widget request, Widget neww, ArgList args, Cardinal *num_args);
154
155
156 #ifdef __cplusplus
157 }
158 #endif
159
160 #endif /* GRID_H */
161

mercurial