Debian Codegraph @

pod/pTk/MaintGeom.pod

raw
1 # Copyright (c) 1994 The Regents of the University of California.
2 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
3 # See the file "license.terms" for information on usage and redistribution
4 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 #
6 #
7
8 =head1 NAME
9
10 Tk_MaintainGeometry, Tk_UnmaintainGeometry - maintain geometry of one window relative to another
11
12 =for category C Programming
13
14 =head1 SYNOPSIS
15
16 B<#include E<lt>tk.hE<gt>>
17
18 B<Tk_MaintainGeometry>(I<slave, master, x, y, width, height>)
19
20 B<Tk_UnmaintainGeometry>(I<slave, master>)
21
22 =head1 ARGUMENTS
23
24 =over 4
25
26 =item Tk_Window slave (in)
27
28 Window whose geometry is to be controlled.
29
30 =item Tk_Window master (in)
31
32 Window relative to which I<slave>'s geometry will be controlled.
33
34 =item int x (in)
35
36 Desired x-coordinate of I<slave> in I<master>, measured in pixels
37 from the inside of I<master>'s left border to the outside of
38 I<slave>'s left border.
39
40 =item int y (in)
41
42 Desired y-coordinate of I<slave> in I<master>, measured in pixels
43 from the inside of I<master>'s top border to the outside of
44 I<slave>'s top border.
45
46 =item int width (in)
47
48 Desired width for I<slave>, in pixels.
49
50 =item int height (in)
51
52 Desired height for I<slave>, in pixels.
53
54 =back
55
56 =head1 DESCRIPTION
57
58 B<Tk_MaintainGeometry> and B<Tk_UnmaintainGeometry> make it
59 easier for geometry managers to deal with slaves whose masters are not
60 their parents.
61 Three problems arise if the master for a slave is not its parent:
62
63 =over 4
64
65 =item [1]
66
67 The x- and y-position of the slave must be translated from the
68 coordinate system of the master to that of the parent before
69 positioning the slave.
70
71 =item [2]
72
73 If the master window, or any of its ancestors up to the slave's
74 parent, is moved, then the slave must be repositioned within its
75 parent in order to maintain the correct position relative to the
76 master.
77
78 =item [3]
79
80 If the master or one of its ancestors is mapped or unmapped, then
81 the slave must be mapped or unmapped to correspond.
82
83 =back
84
85 None of these problems is an issue if the parent and master are
86 the same. For example, if the master or one of its ancestors
87 is unmapped, the slave is automatically removed by the screen
88 by X.
89
90 B<Tk_MaintainGeometry> deals with these problems for slaves
91 whose masters aren't their parents.
92 B<Tk_MaintainGeometry> is typically called by a window manager
93 once it has decided where a slave should be positioned relative
94 to its master.
95 B<Tk_MaintainGeometry> translates the coordinates to the
96 coordinate system of I<slave>'s parent and then moves and
97 resizes the slave appropriately.
98 Furthermore, it remembers the desired position and creates event
99 handlers to monitor the master and all of its ancestors up
100 to (but not including) the slave's parent.
101 If any of these windows is moved, mapped, or unmapped,
102 the slave will be adjusted so that it is mapped only when the
103 master is mapped and its geometry relative to the master
104 remains as specified by I<x>, I<y>, I<width>, and
105 I<height>.
106
107 When a window manager relinquishes control over a window, or
108 if it decides that it does not want the window to appear on the
109 screen under any conditions, it calls B<Tk_UnmaintainGeometry>.
110 B<Tk_UnmaintainGeometry> unmaps the window and cancels any
111 previous calls to B<Tk_MaintainGeometry> for the
112 I<master>-I<slave> pair, so that the slave's
113 geometry and mapped state are no longer maintained
114 automatically.
115 B<Tk_UnmaintainGeometry> need not be called by a geometry
116 manager if the slave, the master, or any of the master's ancestors
117 is destroyed: Tk will call it automatically.
118
119 If B<Tk_MaintainGeometry> is called repeatedly for the same
120 I<master>-I<slave> pair, the information from the most
121 recent call supersedes any older information.
122 If B<Tk_UnmaintainGeometry> is called for a I<master>-I<slave>
123 pair that is isn't currently managed, the call has no effect.
124
125 =head1 KEYWORDS
126
127 geometry manager, map, master, parent, position, slave, unmap