1Tk_MaintainGeometry(3)       Tk Library Procedures      Tk_MaintainGeometry(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_MaintainGeometry,  Tk_UnmaintainGeometry  - maintain geometry of one
9       window relative to another
10

SYNOPSIS

12       #include <tk.h>
13
14       Tk_MaintainGeometry(slave, master, x, y, width, height)
15
16       Tk_UnmaintainGeometry(slave, master)
17

ARGUMENTS

19       Tk_Window slave (in)           Window whose  geometry  is  to  be  con‐
20                                      trolled.
21
22       Tk_Window master (in)          Window  relative to which slave's geome‐
23                                      try will be controlled.
24
25       int x (in)                     Desired x-coordinate of slave in master,
26                                      measured  in  pixels  from the inside of
27                                      master's left border to the  outside  of
28                                      slave's left border.
29
30       int y (in)                     Desired y-coordinate of slave in master,
31                                      measured in pixels from  the  inside  of
32                                      master's  top  border  to the outside of
33                                      slave's top border.
34
35       int width (in)                 Desired width for slave, in pixels.
36
37       int height (in)                Desired height for slave, in pixels.
38______________________________________________________________________________
39

DESCRIPTION

41       Tk_MaintainGeometry and Tk_UnmaintainGeometry make it easier for geome‐
42       try  managers  to deal with slaves whose masters are not their parents.
43       Three problems arise if the master for a slave is not its parent:
44
45       [1]    The x- and y-position of the slave must be translated  from  the
46              coordinate  system  of  the  master to that of the parent before
47              positioning the slave.
48
49       [2]    If the master window, or any of its ancestors up to the  slave's
50              parent, is moved, then the slave must be repositioned within its
51              parent in order to maintain the correct position relative to the
52              master.
53
54       [3]    If  the  master  or  one of its ancestors is mapped or unmapped,
55              then the slave must be mapped or unmapped to correspond.
56
57       None of these problems is an issue if the parent  and  master  are  the
58       same.   For example, if the master or one of its ancestors is unmapped,
59       the slave is automatically removed by the screen by X.
60
61       Tk_MaintainGeometry deals with these problems for slaves whose  masters
62       are  not  their parents, as well as handling the simpler case of slaves
63       whose masters are  their  parents.   Tk_MaintainGeometry  is  typically
64       called  by a window manager once it has decided where a slave should be
65       positioned relative to its master.  Tk_MaintainGeometry translates  the
66       coordinates  to  the coordinate system of slave's parent and then moves
67       and resizes the slave appropriately.   Furthermore,  it  remembers  the
68       desired  position  and creates event handlers to monitor the master and
69       all of its ancestors up to (but not including) the slave's parent.   If
70       any  of  these windows is moved, mapped, or unmapped, the slave will be
71       adjusted so that it is mapped only when the master is  mapped  and  its
72       geometry  relative  to  the master remains as specified by x, y, width,
73       and height.
74
75       When a window manager relinquishes control over  a  window,  or  if  it
76       decides  that it does not want the window to appear on the screen under
77       any conditions, it calls Tk_UnmaintainGeometry.   Tk_UnmaintainGeometry
78       unmaps the window and cancels any previous calls to Tk_MaintainGeometry
79       for the master-slave pair, so that  the  slave's  geometry  and  mapped
80       state  are  no  longer maintained automatically.  Tk_UnmaintainGeometry
81       need not be called by a geometry manager if the slave, the  master,  or
82       any  of the master's ancestors is destroyed:  Tk will call it automati‐
83       cally.
84
85       If Tk_MaintainGeometry is called repeatedly for the  same  master-slave
86       pair,  the  information  from the most recent call supersedes any older
87       information.  If Tk_UnmaintainGeometry is  called  for  a  master-slave
88       pair that is is not currently managed, the call has no effect.
89

KEYWORDS

91       geometry manager, map, master, parent, position, slave, unmap
92
93
94
95Tk                                    4.0               Tk_MaintainGeometry(3)
Impressum