Symbian3/SDK/Source/GUID-BC3207BF-9E9F-4BA0-8F01-B72228110A61.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-BC3207BF-9E9F-4BA0-8F01-B72228110A61" xml:lang="en"><title>Accessing
the toolbar from applications or application views</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<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>)
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
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 a view-specific toolbar
(if defined). </p><p>To access the application toolbar 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 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 of the toolbar, so the framework takes care of the toolbar destruction.</p></section>
<section><p>The example below shows how to access the toolbar in the application
AppUi class. (You can also use <codeph>CEikAppUiFactory</codeph> methods.)</p><codeblock xml:space="preserve">void CMyAppUi::DoSomethingToToolbar()
    {
    
    // Current fixed toolbar (if view has no fixed toolbar, returns application toolbar)
    CAknToolbar* fixedToolbar = CurrentFixedToolbar();
    
    // Current popup toolbar (if view has no popup toolbar, returns application toolbar)
    CAknToolbar* popupToolbar = CurrentPopupToolbar();
    
    // Application toolbar
    CAknToolbar* appToolbar = PopupToolbar();



    }</codeblock><p>The example below shows how to access a view specific
toolbar in the application view class.</p><codeblock xml:space="preserve">
void CMyView::DoSomethingToToolbar()
    {
    
    // View toolbar
    CAknToolbar* toolbar = Toolbar();
    


    }
</codeblock></section>
</conbody></concept>