|
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-270FC83E-1D47-4CF9-A560-FB5DDA53111E" xml:lang="en"><title>Showing |
|
13 or hiding the toolbar extension</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>The toolbar extension is automatically shown when the extension button |
|
15 is pressed. </p> |
|
16 <p>The extension button is in a latched down state when the extension is open. |
|
17 If the extension button is pressed again, the extension closes and the extension |
|
18 button returns to normal state. This also happens if the user clicks somewhere |
|
19 outside the extension area. </p> |
|
20 <p>By default, the extension is left open when the user selects an item from |
|
21 the extension. You can change this by defining suitable flags to the button.</p> |
|
22 <p>The example below shown the definition of a toolbar extension with the |
|
23 button closing the extension when selected.</p> |
|
24 <codeblock xml:space="preserve">RESOURCE AVKON_TOOLBAR_EXTENSION r_myapp_toolbar_extension |
|
25 { |
|
26 items = |
|
27 { |
|
28 TBAR_CTRL |
|
29 { |
|
30 type = EAknCtButton; |
|
31 id = ECmdExtFirst; |
|
32 control = AVKON_BUTTON |
|
33 { |
|
34 flags = KAknButtonRequestExitOnButtonUpEvent; |
|
35 states = |
|
36 { |
|
37 AVKON_BUTTON_STATE |
|
38 { |
|
39 extension = r_myapp_toolbar_ext_first; |
|
40 } |
|
41 }; |
|
42 }; |
|
43 }, |
|
44 … |
|
45 } |
|
46 }; |
|
47 } |
|
48 </codeblock> |
|
49 <p>You can also show or hide the toolbar extension in your application using |
|
50 the methods in the class <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknToolbarExtension.html" format="application/java-archive"><codeph>CAknToolbarExtension</codeph></xref>.</p> |
|
51 <p>The example below shows how to hide or show the toolbar extension.</p> |
|
52 <codeblock xml:space="preserve">void CMyAppView::ChangeToolbarExtensionVisibility( TBool aHide ) |
|
53 { |
|
54 CAknToolbar* toolbar = Toolbar(); |
|
55 if ( toolbar ) |
|
56 { |
|
57 CAknToolbarExtension* toolbarExtension = toolbar->ToolbarExtension(); |
|
58 if ( toolbarExtension ) |
|
59 { |
|
60 if ( aHide ) |
|
61 { |
|
62 toolbarExtension->SetShown( EFalse ); |
|
63 } |
|
64 else |
|
65 { |
|
66 toolbarExtension->SetShown( ETrue ); |
|
67 } |
|
68 } |
|
69 } |
|
70 } |
|
71 </codeblock> |
|
72 </conbody></concept> |