]>
git.zerfleddert.de Git - micropolis/blob - src/tk/tkgeo.c
974faebb918e2a8febea897777bbc4e6d1b2f293
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
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.
20 static char rcsid
[] = "$Header: /user6/ouster/wish/RCS/tkGeometry.c,v 1.18 92/05/13 16:51:17 ouster Exp $ SPRITE (Berkeley)";
27 *--------------------------------------------------------------
29 * Tk_ManageGeometry --
31 * Arrange for a particular procedure to handle geometry
32 * requests for a given window.
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:
45 * proc(clientData, tkwin)
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.
58 *--------------------------------------------------------------
62 Tk_ManageGeometry(tkwin
, proc
, clientData
)
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
70 register TkWindow
*winPtr
= (TkWindow
*) tkwin
;
72 winPtr
->geomProc
= proc
;
73 winPtr
->geomData
= clientData
;
77 *--------------------------------------------------------------
79 * Tk_GeometryRequest --
81 * This procedure is invoked by widget code to indicate
82 * its preferences about the size of a window it manages.
83 * In general, widget code should call this procedure
84 * rather than Tk_ResizeWindow.
90 * The geometry manager for tkwin (if any) is invoked to
91 * handle the request. If possible, it will reconfigure
92 * tkwin and/or other windows to satisfy the request. The
93 * caller gets no indication of success or failure, but it
94 * will get X events if the window size was actually
97 *--------------------------------------------------------------
101 Tk_GeometryRequest(tkwin
, reqWidth
, reqHeight
)
102 Tk_Window tkwin
; /* Window that geometry information
104 int reqWidth
, reqHeight
; /* Minimum desired dimensions for
105 * window, in pixels. */
107 register TkWindow
*winPtr
= (TkWindow
*) tkwin
;
109 if ((reqWidth
== winPtr
->reqWidth
) && (reqHeight
== winPtr
->reqHeight
)) {
112 winPtr
->reqWidth
= reqWidth
;
113 winPtr
->reqHeight
= reqHeight
;
114 if (winPtr
->geomProc
!= NULL
) {
115 (*winPtr
->geomProc
)(winPtr
->geomData
, tkwin
);
120 *----------------------------------------------------------------------
122 * Tk_SetInternalBorder --
124 * Notify relevant geometry managers that a window has an internal
125 * border of a given width and that child windows should not be
126 * placed on that border.
132 * The border width is recorded for the window, and all geometry
133 * managers of all children are notified so that can re-layout, if
136 *----------------------------------------------------------------------
140 Tk_SetInternalBorder(tkwin
, width
)
141 Tk_Window tkwin
; /* Window that will have internal border. */
142 int width
; /* Width of internal border, in pixels. */
144 register TkWindow
*winPtr
= (TkWindow
*) tkwin
;
146 if (width
== winPtr
->internalBorderWidth
) {
152 winPtr
->internalBorderWidth
= width
;
153 for (winPtr
= winPtr
->childList
; winPtr
!= NULL
;
154 winPtr
= winPtr
->nextPtr
) {
155 if (winPtr
->geomProc
!= NULL
) {
156 (*winPtr
->geomProc
)(winPtr
->geomData
, (Tk_Window
) winPtr
);