|
|
< Day Day Up > |
|
4.2 Client AreaThe client area of a Composite, List, or Text control[3] is a rectangle that describes the area within which content may be drawn. In this context, the term client refers to you, the programmer, viewed as a client of services offered by the control, so the client area is the area that you "own." Essentially, it is the area that is not covered by those parts of the control bounds that are considered to be "trimmings" such as borders, scroll bars, and the menu bar.[4] Areas outside of the client area are off limits. Figure 4.2 shows the bounds and client area of a group box.
Figure 4.2. The bounds and client area of a group box.
The client area is expressed in pixels, this time in the coordinate system of the control (unlike the bounds that are in the coordinate system of the parent). Very often, the location of the client area within the control is (0, 0), but this is not always the case. Figure 4.3 shows the client area of two group boxes from different platforms, with Windows on the left and GTK on the right. On Windows, the location of the client area is (3, 13). On GTK, it is (0, 0). Figure 4.3. The location of the client area of a group box on Windows and GTK.
The concept of client area allows SWT to hide these kinds of platform differences neatly. You can determine the client area of a composite using getClientArea().
The client area of a control cannot be modified directly. Instead, moving or resizing the control or changing the trimmings indirectly resizes it. For example, hiding a scroll bar causes the client area to become larger. |
|
|
< Day Day Up > |
|