Q:
Are the root control, the root view, and the content view
the same entity?
A:
Not quite.
The Root View is returned by HIViewGetRoot . It only exists
on 10.2 and later. It is the outermost view in a window,
and it represents the total structure area of the window.
All windows have a Root View regardless of whether the kWindowCompositingAttribute
is set on the window.
The Content View is returned by HIViewFindByID + kHIViewWindowContentID .
It only exists on 10.2 and later. It is a child of the window's
Root View. It represents the content area of the window in
a way that only makes sense in compositing mode. All windows
have (with a few temporary exceptions such as the plain window
and the simple window) a Content View regardless of whether the kWindowCompositingAttribute
is set on the window. When the kWindowCompositingAttribute
is not set, do not attempt to embed views or controls within
the Content View of the window; this is unsupported and likely to cause problems.
The Root Control is returned by GetRootControl . The Root
Control is not the same as the Root View. The details of
the Root Control vary depending on whether the kWindowCompositingAttribute
is set on the window:
If the kWindowCompositingAttribute is not set, the Root Control
represents the content area of the window in a way that only
makes sense in non-compositing mode. On 10.2, it is a child
of the window's Content View. Prior to 10.2, it has no parent
and is associated with the window via an internal mechanism.
Windows only have a Root Control if one is explicitly created
by CreateRootControl or implicitly created by calling a CreateFooControl
API with a valid WindowRef .
If the kWindowCompositingAttribute is set, there really is
no Root Control. Instead, the GetRootControl API returns
the Content View of the window as a convenience to developers.
[Nov 12 2002]
|