]> cvs.zerfleddert.de Git - micropolis/blob - src/tk/tkgeo.c
Fixes for compilation with gcc 15
[micropolis] / src / tk / tkgeo.c
1 /*
2 * tkGeometry.c --
3 *
4 * This file contains code generic Tk code for geometry
5 * management, plus code to manage the geometry of top-level
6 * windows (by reflecting information up to the window
7 * manager).
8 *
9 * Copyright 1990 Regents of the University of California.
10 * Permission to use, copy, modify, and distribute this
11 * software and its documentation for any purpose and without
12 * fee is hereby granted, provided that the above copyright
13 * notice appear in all copies. The University of California
14 * makes no representations about the suitability of this
15 * software for any purpose. It is provided "as is" without
16 * express or implied warranty.
17 */
18
19 #ifndef lint
20 static char rcsid[] = "$Header: /user6/ouster/wish/RCS/tkGeometry.c,v 1.18 92/05/13 16:51:17 ouster Exp $ SPRITE (Berkeley)";
21 #endif
22
23 #include "tkconfig.h"
24 #include "tkint.h"
25 \f
26 /*
27 *--------------------------------------------------------------
28 *
29 * Tk_ManageGeometry --
30 *
31 * Arrange for a particular procedure to handle geometry
32 * requests for a given window.
33 *
34 * Results:
35 * None.
36 *
37 * Side effects:
38 * Proc becomes the new geometry manager for tkwin, replacing
39 * any previous geometry manager. In the future, whenever
40 * Tk_GeometryRequest is called for tkwin, proc will be
41 * invoked to handle the request. Proc should have the
42 * following structure:
43 *
44 * void
45 * proc(clientData, tkwin)
46 * {
47 * }
48 *
49 * The clientData argument will be the same as the clientData
50 * argument to this procedure, and the tkwin arguments will
51 * be the same as the corresponding argument to
52 * Tk_GeometryRequest. Information about the desired
53 * geometry for tkwin is avilable to proc using macros such
54 * as Tk_ReqWidth. Proc should do the best it can to meet
55 * the request within the constraints of its geometry-management
56 * algorithm, but it is not obligated to meet the request.
57 *
58 *--------------------------------------------------------------
59 */
60
61 void
62 Tk_ManageGeometry (
63 Tk_Window tkwin, /* Window whose geometry is to
64 * be managed by proc. */
65 Tk_GeometryProc *proc, /* Procedure to manage geometry.
66 * NULL means make tkwin unmanaged. */
67 ClientData clientData /* Arbitrary one-word argument to
68 * pass to proc. */
69 )
70 {
71 register TkWindow *winPtr = (TkWindow *) tkwin;
72
73 winPtr->geomProc = proc;
74 winPtr->geomData = clientData;
75 }
76 \f
77 /*
78 *--------------------------------------------------------------
79 *
80 * Tk_GeometryRequest --
81 *
82 * This procedure is invoked by widget code to indicate
83 * its preferences about the size of a window it manages.
84 * In general, widget code should call this procedure
85 * rather than Tk_ResizeWindow.
86 *
87 * Results:
88 * None.
89 *
90 * Side effects:
91 * The geometry manager for tkwin (if any) is invoked to
92 * handle the request. If possible, it will reconfigure
93 * tkwin and/or other windows to satisfy the request. The
94 * caller gets no indication of success or failure, but it
95 * will get X events if the window size was actually
96 * changed.
97 *
98 *--------------------------------------------------------------
99 */
100
101 void
102 Tk_GeometryRequest (
103 Tk_Window tkwin, /* Window that geometry information
104 * pertains to. */
105 int reqWidth,
106 int reqHeight /* Minimum desired dimensions for
107 * window, in pixels. */
108 )
109 {
110 register TkWindow *winPtr = (TkWindow *) tkwin;
111
112 if ((reqWidth == winPtr->reqWidth) && (reqHeight == winPtr->reqHeight)) {
113 return;
114 }
115 winPtr->reqWidth = reqWidth;
116 winPtr->reqHeight = reqHeight;
117 if (winPtr->geomProc != NULL) {
118 (*winPtr->geomProc)(winPtr->geomData, tkwin);
119 }
120 }
121 \f
122 /*
123 *----------------------------------------------------------------------
124 *
125 * Tk_SetInternalBorder --
126 *
127 * Notify relevant geometry managers that a window has an internal
128 * border of a given width and that child windows should not be
129 * placed on that border.
130 *
131 * Results:
132 * None.
133 *
134 * Side effects:
135 * The border width is recorded for the window, and all geometry
136 * managers of all children are notified so that can re-layout, if
137 * necessary.
138 *
139 *----------------------------------------------------------------------
140 */
141
142 void
143 Tk_SetInternalBorder (
144 Tk_Window tkwin, /* Window that will have internal border. */
145 int width /* Width of internal border, in pixels. */
146 )
147 {
148 register TkWindow *winPtr = (TkWindow *) tkwin;
149
150 if (width == winPtr->internalBorderWidth) {
151 return;
152 }
153 if (width < 0) {
154 width = 0;
155 }
156 winPtr->internalBorderWidth = width;
157 for (winPtr = winPtr->childList; winPtr != NULL;
158 winPtr = winPtr->nextPtr) {
159 if (winPtr->geomProc != NULL) {
160 (*winPtr->geomProc)(winPtr->geomData, (Tk_Window) winPtr);
161 }
162 }
163 }
Impressum, Datenschutz