|
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-81424A53-F598-4E25-BA0A-E2FFA8BCDF2B" xml:lang="en"><title>Controlling |
|
13 toolbar visibility</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section><title>Floating toolbar</title><p>You can define in your application |
|
15 view whether the floating toolbar is shown on view activation. By default, |
|
16 the floating toolbar is hidden. </p><p>You can also show or hide the toolbar |
|
17 by changing the toolbar visibility straight from the toolbar itself. In this |
|
18 case, however, remember that closing the application or deactivating the view |
|
19 resets the toolbar visibility state. So after e.g. view deactivation, the |
|
20 toolbar is set visible according to the default setting (defined by the view).</p></section> |
|
21 <section> <title>Fixed toolbar</title><p>The UI framework always sets the |
|
22 fixed toolbar visible when an application or view is activated. You can change |
|
23 the toolbar visibility straight from the toolbar itself, like in the case |
|
24 of a floating toolbar. However, when hiding the toolbar with the <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknToolbar.html#f48c9775e05e7a6130a7c3c0d2a91199" format="application/java-archive"><codeph>CAknToolbar::SetToolbarVisibility()</codeph></xref> method, you should |
|
25 note that with that method the toolbar window is completely hidden and some |
|
26 other control should draw to its area to keep the area updated. If this is |
|
27 not applicable, you can use another method: <codeph>HideItemsAndDrawOnlyBackground()</codeph>. |
|
28 This will hide the toolbar but draw its background in the toolbar area. </p></section> |
|
29 <section><p>The example below shows how to hide or show the toolbar. You can |
|
30 also use <codeph>SetToolbarVisibility()</codeph> with the fixed toolbar if |
|
31 you don't need to draw the toolbar background. </p><codeblock xml:space="preserve">void CMyAppView::ChangeToolbarVisibility( TBool aHide ) |
|
32 { |
|
33 |
|
34 CAknToolbar* toolbar = Toolbar(); |
|
35 |
|
36 if ( !toolbar ) |
|
37 { |
|
38 return; |
|
39 } |
|
40 |
|
41 // Fixed toolbar |
|
42 if ( toolbar->ToolbarFlags() & KAknToolbarFixed ) |
|
43 { |
|
44 if ( aHide ) |
|
45 { |
|
46 // Hide toolbar but draw background |
|
47 toolbar->HideItemsAndDrawOnlyBackground( ETrue ); |
|
48 } |
|
49 else |
|
50 { |
|
51 // Return situation to normal (toolbar as visible) |
|
52 toolbar->HideItemsAndDrawOnlyBackground( EFalse ); |
|
53 } |
|
54 } |
|
55 |
|
56 // Floating toolbar |
|
57 else |
|
58 { |
|
59 if ( aHide ) |
|
60 { |
|
61 // Hide floating toolbar |
|
62 toolbar->SetToolbarVisibility( EFalse ); |
|
63 } |
|
64 else |
|
65 { |
|
66 // Show floating toolbar |
|
67 toolbar->SetToolbarVisibility( ETrue ); |
|
68 } |
|
69 |
|
70 } |
|
71 } |
|
72 </codeblock></section> |
|
73 </conbody></concept> |