November 1999
Intermediate to advanced
832 pages
19h 28m
English
There are two parts to a widget's display. First, the size must be determined. This is done at configuration time, and then that space is requested from the geometry manager. When the widget is later displayed, it should use the Tk_Width and Tk_Height calls to find out how much space was actually allocated to it by the geometry manager. Example 46-13 shows ComputeGeometry. This procedure is identical in both versions of the widget.
static void ComputeGeometry(Clock *clockPtr) { int width, height; Tk_FontMetrics fm; /* Font size information */ struct tm *tmPtr; /* Time info split into fields */ struct timeval tv; /* BSD-style time value */ int bd; /* Padding from borders ... |
Read now
Unlock full access