|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-24039DCE-B5C4-46CB-9E02-AB421C64FB87" xml:lang="en"><title>Relationship |
|
13 between window controls</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>When a control draws in the window of another control, the position |
|
15 is relative to that window. If a control owns a window that is a child of |
|
16 another window, that control's position is relative to the parent window; |
|
17 however, if that control is a compound control, its child control's coordinates |
|
18 are relative to its own parent control window position. Top-level window-owning |
|
19 controls are displayed using a position relative to the display. In other |
|
20 words, it uses the physical coordinates of the display.</p> |
|
21 <p>The following figure illustrates this relationship.</p> |
|
22 <fig id="GUID-9D373EB7-096D-4C84-8060-577F33D462EE"><title>Relative positions of three controls where the top-level parent owns |
|
23 the window</title><image href="GUID-61C340D0-9058-45C2-9A90-4AB8E0612872_d0e67731_href.png"/></fig> |
|
24 <p>Consider three controls, <b>A</b>, <b>B</b>, and <b>C</b> (shown in |
|
25 the figure above):</p> |
|
26 <ul> |
|
27 <li><p><b>A</b> is a top-level control and owns a window</p> |
|
28 </li> |
|
29 <li><p>Child controls <b>B</b> and <b>C</b> do not create their |
|
30 own windows in this example.</p></li> |
|
31 <li><p><b>B</b>, a child control of <b>A</b>, does not create a |
|
32 window, and it has a child control, <b>C</b>. </p> |
|
33 <itemgroup> |
|
34 <p><b>B</b>'s window is set calling the <parmname>CCoeControl::SetContainerWindowL(A)</parmname> method |
|
35 and <b>C</b>'s window is set with <parmname>CCoeControl::SetContainerWindowL(B)</parmname>. |
|
36 Then <b>C</b>'s position (p) is relative to <b>A</b>, since it is the actual |
|
37 window owner. <b>A</b>'s position (m) is relative to the display position.</p> |
|
38 </itemgroup> |
|
39 </li> |
|
40 </ul> |
|
41 <p>However, if <b>B</b> is a child control of <b>A</b> but also has a window |
|
42 of its own, it is a child window of <b>A</b>'s window (as shown in the following |
|
43 figure). Then if <b>C</b> is a child of <b>B</b> and sets its window by calling <parmname>CCoeControl::SetContainerWindowL(B)</parmname>, |
|
44 the position of <b>C</b> (p') is relative to <b>B</b>'s window.</p> |
|
45 <fig id="GUID-5884BDB6-6ED0-4EF6-A64F-3EEAAAEE2FF0"><title>Relative positions of three controls where a child owns a window</title><image href="GUID-3A506E2A-2999-458B-BBA2-DCC4D2EA5492_d0e67834_href.png"/></fig> |
|
46 <p>As the example illustrates, a control position depends on the window |
|
47 in which it is drawn. Therefore, you need to know the drawing window for each |
|
48 control. It is an important issue when designing a UI layout. There are some |
|
49 common controls that optionally may have their own window, such as menus, |
|
50 dialogs, and scroll bars. The application framework handles drawing these |
|
51 controls, as long as the appropriate resources and flags have been set. The <xref href="jar:GUID-35228542-8C95-4849-A73F-2B4F082F0C44.jar!/sdk/doc_source/reference/reference-cpp/Control_Environment/CCoeControlClass.html#%3a%3aCCoeControl%3a%3aOwnsWindow%28%29const" format="application/java-archive"><parmname>CCoeControl::OwnsWindow</parmname></xref> call can be used |
|
52 to detect whether a control owns a window or not.</p> |
|
53 </conbody></concept> |