ui/motif/Grid.c

Sun, 15 Dec 2024 11:59:30 +0100

author
Olaf Winermann <olaf.wintermann@gmail.com>
date
Sun, 15 Dec 2024 11:59:30 +0100
branch
newapi
changeset 416
89ad8467c39f
parent 408
b06e43f1edd4
permissions
-rw-r--r--

implement motif menu/menu item

406
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2024 Olaf Wintermann. All rights reserved.
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
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
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 /*
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 *
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33 #define _GNU_SOURCE
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 #include <stdio.h>
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 #include <stdlib.h>
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #include <string.h>
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 #include "Grid.h"
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 #include <X11/Xlib.h>
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44 static XtActionsRec actionslist[] = {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 {"getfocus",grid_getfocus},
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 {"loosefocus",grid_loosefocus},
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 {"NULL",NULL}
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 };
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 //static char defaultTranslations[] = "<BtnDown>: mousedown()\n";
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51 static char defaultTranslations[] = "\
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 <EnterWindow>: getfocus()\n\
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53 <LeaveWindow>: loosefocus()\n";
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56 ///*
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 static XtResource constraints[] =
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60 gridColumn,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 gridColumn,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 XmRDimension,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 sizeof (Dimension),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65 grid.x),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70 gridRow,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 gridRow,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 XmRDimension,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 sizeof (Dimension),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 grid.y),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 gridColspan,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 gridColspan,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 XmRDimension,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 sizeof (Dimension),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85 grid.colspan),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
86 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
87 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
88 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
89 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
90 gridRowspan,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
91 gridRowspan,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
92 XmRDimension,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
93 sizeof (Dimension),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
94 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95 grid.rowspan),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
96 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
97 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
98 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
99 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
100 gridMarginLeft,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
101 gridMarginLeft,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
102 XmRDimension,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
103 sizeof (Dimension),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
104 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
105 grid.margin_left),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
106 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
107 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
109 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
110 gridMarginRight,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
111 gridMarginRight,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
112 XmRDimension,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
113 sizeof (Dimension),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
114 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
115 grid.margin_right),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
116 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
119 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
120 gridMarginTop,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
121 gridMarginTop,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 XmRDimension,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123 sizeof (Dimension),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
124 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
125 grid.margin_top),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
126 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
127 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
128 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
129 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
130 gridMarginBottom,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
131 gridMarginBottom,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
132 XmRDimension,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
133 sizeof (Dimension),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
134 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
135 grid.margin_bottom),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
136 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
137 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
138 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
139 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
140 gridHExpand,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
141 gridHExpand,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
142 XmRBoolean,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
143 sizeof (Boolean),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
144 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
145 grid.hexpand),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
146 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
147 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
148 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
149 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
150 gridVExpand,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
151 gridVExpand,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
152 XmRBoolean,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
153 sizeof (Boolean),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
154 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
155 grid.vexpand),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
156 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
157 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
158 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
159 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
160 gridHFill,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
161 gridHFill,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
162 XmRBoolean,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
163 sizeof (Boolean),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
164 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
165 grid.hfill),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
166 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
167 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
168 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
169 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
170 gridVFill,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
171 gridVFill,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
172 XmRBoolean,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
173 sizeof (Boolean),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
174 XtOffsetOf( GridConstraintRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
175 grid.vfill),
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
176 XmRImmediate,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
177 (XtPointer) 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
178 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
179
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
180 };
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
181 //*/
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
182 //static XtResource constraints[] = {};
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
183
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
184 GridClassRec gridClassRec = {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
185 // Core Class
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
186 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
187 //(WidgetClass)&constraintClassRec, // superclass
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
188 (WidgetClass)&xmManagerClassRec,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
189 "Grid", // class_name
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
190 sizeof(GridRec), // widget_size
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
191 grid_class_initialize, // class_initialize
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
192 NULL, // class_part_initialize
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
193 FALSE, // class_inited
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
194 (XtInitProc)grid_initialize, // initialize
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
195 NULL, // initialize_hook
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
196 grid_realize, // realize
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
197 actionslist, // actions
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
198 XtNumber(actionslist), // num_actions
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
199 NULL, // resources
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
200 0, // num_resources
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
201 NULLQUARK, // xrm_class
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
202 True, // compress_motion
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
203 True, // compress_exposure
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
204 True, // compress_enterleave
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
205 False, // visible_interest
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
206 (XtWidgetProc)grid_destroy, // destroy
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
207 (XtWidgetProc)grid_resize, // resize
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
208 (XtExposeProc)grid_expose, // expose
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
209 grid_set_values, // set_values
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
210 NULL, // set_values_hook
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
211 XtInheritSetValuesAlmost, // set_values_almost
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
212 NULL, // get_values_hook
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
213 (XtAcceptFocusProc)grid_acceptfocus, // accept_focus
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
214 XtVersion, // version
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
215 NULL, // callback_offsets
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
216 //NULL, // tm_table
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
217 defaultTranslations,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
218 XtInheritQueryGeometry, // query_geometry
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
219 NULL, // display_accelerator
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
220 NULL, // extension
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
221 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
222 // Composite Class
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
223 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
224 GridGeometryManager, /* geometry_manager */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
225 GridChangeManaged, /* change_managed */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
226 XtInheritInsertChild, /* insert_child */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
227 XtInheritDeleteChild, /* delete_child */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
228 NULL, /* extension */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
229 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
230 // Constraint Class
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
231 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
232 constraints, /* resources */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
233 XtNumber(constraints), /* num_resources */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
234 sizeof(GridConstraintRec), /* constraint_size */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
235 grid_constraint_init, /* initialize */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
236 NULL, /* destroy */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
237 ConstraintSetValues, /* set_values */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
238 NULL, /* extension */
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
239 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
240 // XmManager Class
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
241 ///*
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
242 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
243 NULL,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
244 NULL,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
245 0,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
246 NULL,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
247 0,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
248 NULL,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
249 NULL
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
250 },
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
251 //*/
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
252 // MyWidget Class
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
253 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
254 0
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
255 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
256 };
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
257
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
258 WidgetClass gridClass = (WidgetClass)&gridClassRec;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
259
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
260
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
261 void grid_class_initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
262
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
263 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
264 void grid_initialize(Widget request, Widget new, ArgList args, Cardinal num_args) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
265 MyWidget mn = (MyWidget)new;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
266
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
267 mn->mywidget.max_col = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
268 mn->mywidget.max_row = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
269
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
270 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
271 void grid_realize(MyWidget w,XtValueMask *valueMask,XSetWindowAttributes *attributes) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
272 XtMakeResizeRequest((Widget)w, 400, 400, NULL, NULL);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
273 (coreClassRec.core_class.realize)((Widget)w, valueMask, attributes);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
274 grid_place_children(w);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
275 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
276
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
277
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
278 void grid_destroy(MyWidget widget) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
279
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
280 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
281 void grid_resize(MyWidget widget) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
282 grid_place_children(widget);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
283 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
284
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
285 void grid_expose(MyWidget widget, XEvent *event, Region region) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
286
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
287 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
288
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
289
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
290 Boolean grid_set_values(Widget old, Widget request, Widget neww, ArgList args, Cardinal *num_args) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
291 return False;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
292 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
293
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
294 Boolean grid_acceptfocus(Widget w, Time *t) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
295
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
296 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
297
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
298 void grid_getfocus(MyWidget myw, XEvent *event, String *params, Cardinal *nparam) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
299
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
300 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
301
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
302 void grid_loosefocus(MyWidget myw, XEvent *event, String *params, Cardinal *nparam) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
303
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
304 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
305
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
306
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
307
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
308 XtGeometryResult GridGeometryManager(Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *reply) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
309 GridRec *grid = (GridRec*)XtParent(widget);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
310 GridConstraintRec *constraints = widget->core.constraints;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
311 //XtVaSetValues(widget, XmNwidth, request->width, XmNheight, request->height, NULL);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
312 if((request->request_mode & CWWidth) == CWWidth) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
313 widget->core.width = request->width;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
314 constraints->grid.pref_width = request->width;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
315 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
316 if((request->request_mode & CWHeight) == CWHeight) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
317 widget->core.height = request->height;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
318 constraints->grid.pref_height = request->height;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
319 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
320 grid_place_children((MyWidget)XtParent(widget));
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
321 return XtGeometryYes;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
322 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
323
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
324 void GridChangeManaged(Widget widget) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
325
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
326 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
327
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
328 Boolean ConstraintSetValues(Widget old, Widget request, Widget neww, ArgList args, Cardinal *num_args) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
329 GridConstraintRec *constraints = neww->core.constraints;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
330 MyWidget grid = (MyWidget)XtParent(neww);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
331 if(constraints->grid.x > grid->mywidget.max_col) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
332 grid->mywidget.max_col = constraints->grid.x;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
333 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
334 if(constraints->grid.y > grid->mywidget.max_row) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
335 grid->mywidget.max_row = constraints->grid.y;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
336 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
337 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
338
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
339
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
340 void grid_constraint_init(
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
341 Widget request,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
342 Widget neww,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
343 ArgList args,
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
344 Cardinal* num_args
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
345 )
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
346 {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
347 GridConstraintRec *constraints = neww->core.constraints;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
348
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
349 MyWidget grid = (MyWidget)XtParent(neww);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
350 if(constraints->grid.x > grid->mywidget.max_col) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
351 grid->mywidget.max_col = constraints->grid.x;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
352 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
353 if(constraints->grid.y > grid->mywidget.max_row) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
354 grid->mywidget.max_row = constraints->grid.y;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
355 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
356 constraints->grid.pref_width = neww->core.width;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
357 constraints->grid.pref_height = neww->core.height;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
358 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
359
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
360 void grid_place_children(MyWidget w) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
361 int ncols = w->mywidget.max_col+1;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
362 int nrows = w->mywidget.max_row+1;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
363 GridDef *cols = calloc(ncols, sizeof(GridDef));
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
364 GridDef *rows = calloc(nrows, sizeof(GridDef));
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
365 int num_cols_expanding = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
366 int num_rows_expanding = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
367 int req_width = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
368 int req_height = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
369
408
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
370 // calculate the minimum size requirements for all columns and rows
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
371 // we need to run this 2 times: for widgets without colspan/rowspan first
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
372 // and then again for colspan/rowspan > 1
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
373 int span_max = 1;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
374 for(int r=0;r<2;r++) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
375 for(int i=0;i<w->composite.num_children;i++) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
376 Widget child = w->composite.children[i];
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
377 GridConstraintRec *constraints = child->core.constraints;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
378
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
379 if(constraints->grid.colspan > span_max || constraints->grid.rowspan > span_max) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
380 continue;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
381 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
382
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
383 int x = constraints->grid.x;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
384 int y = constraints->grid.y;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
385 // make sure ncols/nrows is correct
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
386 // errors shouldn't happen, unless someone messes up the grid internals
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
387 if(x >= ncols) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
388 fprintf(stderr, "Error: widget x out of bounds\n");
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
389 continue;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
390 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
391 if(y >= nrows) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
392 fprintf(stderr, "Error: widget y out of bounds\n");
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
393 continue;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
394 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
395 GridDef *col = &cols[x];
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
396 GridDef *row = &rows[y];
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
397
406
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
398 if(constraints->grid.hexpand) {
408
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
399 if(constraints->grid.colspan > 1) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
400 // check if any column in the span is expanding
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
401 // if not, make the last column expanding
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
402 GridDef *last_col = col;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
403 for(int c=x;c<ncols;c++) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
404 last_col = &cols[c];
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
405 if(last_col->expand) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
406 break;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
407 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
408 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
409 last_col->expand = TRUE;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
410 } else {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
411 col->expand = TRUE;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
412 }
406
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
413 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
414 if(constraints->grid.vexpand) {
408
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
415 if(constraints->grid.rowspan > 1) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
416 GridDef *last_row = row;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
417 for(int c=x;c<nrows;c++) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
418 last_row = &rows[c];
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
419 if(last_row->expand) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
420 break;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
421 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
422 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
423 last_row->expand = TRUE;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
424 } else {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
425 row->expand = TRUE;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
426 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
427 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
428
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
429 // column size
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
430 if(constraints->grid.colspan > 1) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
431 // check size of all columns in span
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
432 Dimension span_width = col->size;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
433 GridDef *last_col = col;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
434 for(int s=x+1;s<ncols;s++) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
435 last_col = &cols[s];
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
436 span_width = last_col->size;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
437
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
438 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
439 int diff = constraints->grid.pref_width - span_width;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
440 if(diff > 0) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
441 last_col->size += diff;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
442 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
443 } else if(constraints->grid.pref_width > col->size) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
444 col->size = constraints->grid.pref_width;
406
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
445 }
408
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
446 // row size
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
447 if(constraints->grid.rowspan > 1) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
448 Dimension span_height = row->size;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
449 GridDef *last_row = row;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
450 for(int s=x+1;s<nrows;s++) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
451 last_row = &rows[s];
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
452 span_height = last_row->size;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
453
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
454 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
455 int diff = constraints->grid.pref_height - span_height;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
456 if(diff > 0) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
457 last_row->size += diff;
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
458 }
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
459 } else if(constraints->grid.pref_height > row->size) {
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
460 row->size = constraints->grid.pref_height;
406
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
461 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
462 }
408
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
463 span_max = 50000; // not sure if this is unreasonable low or high
406
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
464 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
465
408
b06e43f1edd4 fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 407
diff changeset
466
406
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
467 for(int i=0;i<ncols;i++) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
468 if(cols[i].expand) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
469 num_cols_expanding++;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
470 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
471 req_width += cols[i].size;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
472 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
473 for(int i=0;i<nrows;i++) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
474 if(rows[i].expand) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
475 num_rows_expanding++;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
476 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
477 req_height += rows[i].size;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
478 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
479
407
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
480 if(req_width > 0 && req_height > 0) {
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
481 Widget parent = w->core.parent;
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
482 Dimension rwidth = req_width;
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
483 Dimension rheight = req_height;
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
484 if(rwidth < w->core.width) {
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
485 //rwidth = w->core.width;
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
486 }
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
487 if(rheight < w->core.height) {
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
488 //rheight = w->core.height;
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
489 }
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
490
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
491 if(!w->mywidget.sizerequest) {
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
492 Dimension actual_width, actual_height;
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
493 w->mywidget.sizerequest = TRUE;
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
494 XtMakeResizeRequest((Widget)w, req_width, req_height, &actual_width, &actual_height);
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
495 w->mywidget.sizerequest = FALSE;
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
496 //printf("size request: %d %d\n", (int)actual_width, (int)actual_height);
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
497 }
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
498
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
499
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
500
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
501 }
8ea123dd89db semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 406
diff changeset
502
406
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
503 int hexpand = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
504 int width_diff = (int)w->core.width - req_width;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
505 int hexpand2 = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
506 if(width_diff > 0 && num_cols_expanding > 0) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
507 hexpand = width_diff / num_cols_expanding;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
508 hexpand2 = width_diff-hexpand*num_cols_expanding;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
509 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
510 int x = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
511 for(int i=0;i<ncols;i++) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
512 cols[i].pos = x;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
513 if(cols[i].expand) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
514 cols[i].size += hexpand + hexpand2;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
515 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
516 x += cols[i].size;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
517
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
518 hexpand2 = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
519 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
520
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
521 int vexpand = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
522 int height_diff = (int)w->core.height - req_height;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
523 int vexpand2 = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
524 if(height_diff > 0 && num_rows_expanding > 0) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
525 vexpand = height_diff / num_rows_expanding;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
526 vexpand2 = height_diff-vexpand*num_rows_expanding;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
527 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
528 int y = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
529 for(int i=0;i<nrows;i++) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
530 rows[i].pos = y;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
531 if(rows[i].expand) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
532 rows[i].size += vexpand + vexpand2;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
533 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
534 y += rows[i].size;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
535
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
536 vexpand2 = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
537 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
538
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
539 for(int i=0;i<w->composite.num_children;i++) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
540 Widget child = w->composite.children[i];
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
541 GridConstraintRec *constraints = child->core.constraints;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
542 GridDef c = cols[constraints->grid.x];
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
543 GridDef r = rows[constraints->grid.y];
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
544 int x = c.pos;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
545 int y = r.pos;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
546 int width = constraints->grid.pref_width;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
547 int height = constraints->grid.pref_height;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
548 if(constraints->grid.hfill) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
549 if(constraints->grid.colspan > 1) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
550 Dimension cwidth = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
551 for(int j=0;j<constraints->grid.colspan;j++) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
552 if(constraints->grid.x+j < ncols) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
553 cwidth += cols[constraints->grid.x+j].size;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
554 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
555 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
556 width = cwidth;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
557 } else {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
558 width = c.size;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
559 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
560 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
561 if(constraints->grid.vfill) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
562 if(constraints->grid.rowspan > 1) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
563 Dimension cheight = 0;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
564 for(int j=0;j<constraints->grid.rowspan;j++) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
565 if(constraints->grid.y+j < nrows) {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
566 cheight += rows[constraints->grid.y+j].size;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
567 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
568 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
569 height = cheight;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
570 } else {
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
571 height = r.size;
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
572 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
573 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
574
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
575 XtConfigureWidget(child, x, y, width, height, child->core.border_width);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
576 //printf("child %d %d - %d %d\n", (int)child->core.x, (int)child->core.y, (int)child->core.width, (int)child->core.height);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
577 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
578
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
579 free(cols);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
580 free(rows);
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
581 }
0ebf9d7b23e8 add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
582

mercurial