|
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-BC3207BF-9E9F-4BA0-8F01-B72228110A61" xml:lang="en"><title>Accessing |
|
13 the toolbar from applications or application views</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section> <p>To access the current toolbar (<xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknToolbar.html" format="application/java-archive"><codeph>CAknToolbar</codeph></xref>, defined in <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/akntoolbar_8h-source.html" format="application/java-archive"><codeph>akntoolbar.h</codeph></xref>) |
|
15 in applications, use the methods <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknAppUi.html#3fa2b237b46b9074374e352b912a4210" format="application/java-archive"><codeph>CAknAppUi::CurrentPopupToolbar()</codeph></xref> or <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCEikAppUiFactory.html#3fa2b237b46b9074374e352b912a4210" format="application/java-archive"><codeph>CEikAppUiFactory::CurrentPopupToolbar()</codeph></xref> in the case |
|
16 of a floating toolbar. For a fixed toolbar, use <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknAppUi.html#6542dafaefd94c9903fe12385c65a701" format="application/java-archive"><codeph>CAknAppUi::CurrentFixedToolbar()</codeph></xref> or <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCEikAppUiFactory.html#6542dafaefd94c9903fe12385c65a701" format="application/java-archive"><codeph>CEikAppUiFactory::CurrentFixedToolbar()</codeph></xref>. The methods |
|
17 return a pointer to either the application toolbar or a view-specific toolbar |
|
18 (if defined). </p><p>To access the application toolbar directly from applications, |
|
19 you can also call <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknAppUi.html#ed75774769dbeb3d960072e333eaa383" format="application/java-archive"><codeph>CAknAppUi::PopupToolbar()</codeph></xref> and <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCEikAppUiFactory.html#ed75774769dbeb3d960072e333eaa383" format="application/java-archive"><codeph>CEikAppUiFactory::PopupToolbar()</codeph></xref>. To access the view-specific toolbar as a client, call <xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknView.html#183e12214247e0b3ca27ed99b8aab396" format="application/java-archive"><codeph>CAknView::Toolbar()</codeph></xref>. These calls do not transfer |
|
20 the ownership of the toolbar, so the framework takes care of the toolbar destruction.</p></section> |
|
21 <section><p>The example below shows how to access the toolbar in the application |
|
22 AppUi class. (You can also use <codeph>CEikAppUiFactory</codeph> methods.)</p><codeblock xml:space="preserve">void CMyAppUi::DoSomethingToToolbar() |
|
23 { |
|
24 |
|
25 // Current fixed toolbar (if view has no fixed toolbar, returns application toolbar) |
|
26 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
27 |
|
28 // Current popup toolbar (if view has no popup toolbar, returns application toolbar) |
|
29 CAknToolbar* popupToolbar = CurrentPopupToolbar(); |
|
30 |
|
31 // Application toolbar |
|
32 CAknToolbar* appToolbar = PopupToolbar(); |
|
33 |
|
34 … |
|
35 |
|
36 }</codeblock><p>The example below shows how to access a view specific |
|
37 toolbar in the application view class.</p><codeblock xml:space="preserve"> |
|
38 void CMyView::DoSomethingToToolbar() |
|
39 { |
|
40 |
|
41 // View toolbar |
|
42 CAknToolbar* toolbar = Toolbar(); |
|
43 |
|
44 … |
|
45 |
|
46 } |
|
47 </codeblock></section> |
|
48 </conbody></concept> |