Symbian3/PDK/Source/GUID-402C3EE7-8852-49B6-BE62-8588753FAC8F.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     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-402C3EE7-8852-49B6-BE62-8588753FAC8F" xml:lang="en"><title>Constructing
       
    13 the toolbar</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <section><p>Construct the toolbar either for your entire application or for
       
    15 an application view. If a view has no toolbar specified, the application specific
       
    16 toolbar is used for the view.</p>        <p> The UI framework creates the
       
    17 toolbar automatically during application initialization when it is properly
       
    18 defined in the resource files. After the toolbar has been created, you can
       
    19 receive a pointer to it using <codeph>CAknAppUi</codeph>, <codeph>CEikAppUiFactory</codeph> or <codeph>CAknView</codeph> methods.
       
    20 The method to use depends on whether the application specific or view specific
       
    21 toolbar pointer should be received. For more information, see <xref href="GUID-BC3207BF-9E9F-4BA0-8F01-B72228110A61.dita">Accessing
       
    22 the toolbar from applications or application views</xref>.</p><p>The toolbar
       
    23 destruction is also handled by the framework when the application execution
       
    24 ends. </p><p>The <codeph>EIK_APP_INFO</codeph> structure’s <codeph>custom_app_info_extension</codeph> refers
       
    25 to the <codeph>EIK_APP_INFO_EXT</codeph> element. The element contains links
       
    26 to the resource structure of the toolbar. The contents of the application-specific
       
    27 toolbar can be defined in the <codeph>AVKON_TOOLBAR</codeph> resource definition.
       
    28 The toolbar can also be specified to be view-specific by linking to its resource
       
    29 structure from the <codeph>AVKON_VIEW</codeph> resource structure. If a view
       
    30 has no toolbar specified, the application-specific toolbar is used for the
       
    31 view.</p><p>Use the <codeph>AVKON_TOOLBAR</codeph> resource definition to
       
    32 define the toolbar contents. </p><p>If the toolbar is application specific,
       
    33 refer to the toolbar definition from the <codeph>EIK_APP_INFO_EXT</codeph> resource
       
    34 structure. In case of a view specific toolbar, refer to the toolbar definition
       
    35 from the <codeph>AVKON_VIEW</codeph> structure.</p>           <p>The <codeph>AVKON_TOOLBAR</codeph> resource
       
    36 definition contains a list of toolbar items. Each item is defined as <codeph>TBAR_CTRL</codeph> structure.</p> 
       
    37          <p>The example below shows how to define an application toolbar in
       
    38 resources.</p>           <codeblock xml:space="preserve">RESOURCE EIK_APP_INFO
       
    39     {
       
    40     cba = r_softkeys_options_next;
       
    41     menubar = r_myapp_menubar;
       
    42     custom_app_info_extension = r_myapp_info_extension;
       
    43     }
       
    44 
       
    45 RESOURCE EIK_APP_INFO_EXT r_myapp_info_extension
       
    46     {
       
    47     popup_toolbar = r_myapp_fixed_toolbar;
       
    48     }</codeblock><p>The example below shows how to define a toolbar for an
       
    49 application view in resources.</p>           <codeblock xml:space="preserve">RESOURCE AVKON_VIEW r_myapp_fixed_view
       
    50     {
       
    51     menubar = r_myapp_menubar;
       
    52     toolbar = r_myapp_fixed_toolbar;
       
    53     cba = r_softkeys_options_next;
       
    54     }</codeblock><p>Use the <codeph>TBAR_CTRL</codeph> resource definition
       
    55 to define toolbar controls. You can also <xref href="GUID-58318BAB-2EC4-4C9E-A7CA-580E701EE54F.dita">add
       
    56 controls later dynamically</xref> in your application code. </p> <p>The example
       
    57 below shows how to define a fixed toolbar with three buttons in resources.</p><codeblock xml:space="preserve">RESOURCE AVKON_TOOLBAR r_myapp_fixed_toolbar
       
    58     {
       
    59     flags = KAknToolbarFixed;
       
    60     items =
       
    61         {
       
    62         TBAR_CTRL
       
    63             {
       
    64             type = EAknCtButton;
       
    65             id = ECmdFirst;
       
    66             control = AVKON_BUTTON
       
    67                 {
       
    68                 flags = 0;
       
    69                 states =
       
    70                     {
       
    71                     AVKON_BUTTON_STATE
       
    72                         {
       
    73                         txt = "First";
       
    74                         helptxt = "First help";
       
    75                         }  
       
    76                     };
       
    77                 };
       
    78             },
       
    79         TBAR_CTRL
       
    80             {
       
    81             type = EAknCtButton;
       
    82             id = ECmdSecond;
       
    83             control = AVKON_BUTTON
       
    84                 {
       
    85                 flags = 0;
       
    86                 states =
       
    87                     {
       
    88                     AVKON_BUTTON_STATE
       
    89                         {
       
    90                         txt = "Second";
       
    91                         helptxt = "Second help";
       
    92                         }  
       
    93                     };
       
    94                 };
       
    95             },
       
    96         TBAR_CTRL
       
    97             {
       
    98             type = EAknCtButton;
       
    99             id = ECmdThird;
       
   100             control = AVKON_BUTTON
       
   101                 {
       
   102                 flags = 0;
       
   103                 states =
       
   104                     {
       
   105                     AVKON_BUTTON_STATE
       
   106                         {
       
   107                         txt = "Third";
       
   108                         helptxt = "Third help";
       
   109                         }  
       
   110                     };
       
   111                 };
       
   112             }
       
   113         };
       
   114     }
       
   115 </codeblock><p>The example below shows how to define a floating toolbar with
       
   116 items to be added dynamically at runtime.</p><codeblock xml:space="preserve">RESOURCE AVKON_TOOLBAR r_myapp_floating_toolbar
       
   117     {
       
   118     flags = KAknToolbarWithoutCba;
       
   119     items =
       
   120         {
       
   121         // Created dynamically
       
   122         };
       
   123     }
       
   124 </codeblock></section>
       
   125 </conbody></concept>