|
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 id="GUID-6DF3CACC-8A4F-437E-B4A9-59BA7D8974A3"> <p>To access |
|
15 the current toolbar (<xref href="jar:GUID-759FBC7F-5384-4487-8457-A8D4B76F6AA6.jar!/html/classCAknToolbar.html" format="application/java-archive"><codeph>CAknToolbar</codeph></xref>, |
|
16 defined in <codeph>akntoolbar.h</codeph>) in applications, use |
|
17 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 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 return a pointer to either the application toolbar or |
|
18 a view-specific toolbar (if defined). </p><p>To access the application toolbar |
|
19 directly from applications, 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 |
|
20 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 the ownership |
|
21 of the toolbar, so the framework takes care of the toolbar destruction.</p></section> |
|
22 <section id="GUID-CE4304AF-E891-472E-8B30-46ECFE50276B"><p>The example below |
|
23 shows how to access the toolbar in the application AppUi class. (You can also |
|
24 use <codeph>CEikAppUiFactory</codeph> methods.)</p><codeblock xml:space="preserve">void CMyAppUi::DoSomethingToToolbar() |
|
25 { |
|
26 |
|
27 // Current fixed toolbar (if view has no fixed toolbar, returns application toolbar) |
|
28 CAknToolbar* fixedToolbar = CurrentFixedToolbar(); |
|
29 |
|
30 // Current popup toolbar (if view has no popup toolbar, returns application toolbar) |
|
31 CAknToolbar* popupToolbar = CurrentPopupToolbar(); |
|
32 |
|
33 // Application toolbar |
|
34 CAknToolbar* appToolbar = PopupToolbar(); |
|
35 |
|
36 … |
|
37 |
|
38 }</codeblock><p>The example below shows how to access a view specific |
|
39 toolbar in the application view class.</p><codeblock xml:space="preserve"> |
|
40 void CMyView::DoSomethingToToolbar() |
|
41 { |
|
42 |
|
43 // View toolbar |
|
44 CAknToolbar* toolbar = Toolbar(); |
|
45 |
|
46 … |
|
47 |
|
48 } |
|
49 </codeblock></section> |
|
50 </conbody></concept> |