Symbian3/SDK/Source/GUID-E849C798-07A0-47B3-BDBF-203325062FBD.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 7 51a74ef9ed63
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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-E849C798-07A0-47B3-BDBF-203325062FBD" xml:lang="en"><title>Menu
bar resource statements</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>To define <xref href="GUID-5F749184-C804-41FC-BA81-038783BDC967.dita">resources</xref> for
an <b>Options</b> menu:</p>
<ol>
<li id="GUID-BD81AFF3-A049-40D9-9760-F2F085AED1A4"><p>Determine
the requirements of your application.</p></li>
<li id="GUID-94A35B51-023B-44BE-AAC9-F1CFF7BFF4CD"><p>Declare the <parmname>MENU_BAR</parmname> and <parmname>MENU_TITLE</parmname> resource
statements:</p>
<itemgroup>
<ul>
<li><p>Depending on your application's structure, declare <parmname>menubar
= r_name4</parmname> in either the <xref href="GUID-23A60DE7-B72D-41BD-9F1E-882D31A7E3C7.dita"><parmname>EIK_APP_INFO</parmname></xref> or <xref href="GUID-B238952B-1691-49F4-B8B9-9F755011A7DD.dita"><parmname>AVKON_VIEW</parmname></xref> statements,
where <parmname>r_name16</parmname> is a unique identifier in your application.</p>
</li>
<li id="GUID-B497E2C9-34D0-4037-A6B2-C097866F2F94"><p>Create a resource
statement for the menu bar.</p>
<itemgroup>
<p> The syntax is as follows:</p>
<codeblock id="GUID-61B67E85-1772-4164-9ACF-85B327C74DD7" xml:space="preserve">RESOURCE MENU_BAR r_name4
{
	titles = 
		{
		MENU_TITLE
			{
			menu_pane = r_name5;
			}
		};
	}</codeblock>
<p>,where:</p>
<ul>
<li><p><parmname>r_name4</parmname> is the resource name that uniquely
identifies this RESOURCE statement in the application.</p></li>
<li><p><parmname>titles</parmname> is the name defined for an array
that contains the menu titles for the menu bar.</p></li>
<li><p><parmname>MENU_TITLE</parmname> is a structure defined in <parmname>eikon.rh</parmname>.</p>
</li>
</ul>
<p>Note that you may add as many <parmname>MENU_TITLE</parmname> structures
as you desire. The application framework combines them together when constructing
the <parmname>Options</parmname> menu. This feature allows you to break your <parmname>Options</parmname> menu
up into different segments, which may be useful when constructing context
sensitive <parmname>Options</parmname> menus. For more information, see <xref href="GUID-48363190-6FFB-4230-84B4-2E521EA51365.dita">Using
menu sections in menu bar resource statements</xref></p>
</itemgroup>
</li>
</ul>
</itemgroup>
</li>
<li id="GUID-F7CFC868-BB05-4069-994F-C988D5AA0D80"><p>Create a resource
statement for the <parmname>MENU_PANE</parmname> resource:</p>
<itemgroup>
<p>The <parmname>MENU_PANE</parmname> resource is defined in <parmname>eikon.rh</parmname>,
and contains an array of items defined by the <parmname>MENU_ITEM</parmname> structure.
The syntax is as follows:</p>
<codeblock id="GUID-2C3D5C7A-6D34-42EB-9E3D-C9266F8678C4" xml:space="preserve">RESOURCE MENU_PANE r_name5
{
	items =
	{
	MENU_ITEM
		{
		command = enumerated command;
		txt = STRING_r_string1;
		},
	MENU_ITEM
		{
		command = enumerated command other;
		txt = STRING_r_string2;
		}
	};
}</codeblock>
<p>, where:</p>
<ul>
<li><p><parmname>r_name5</parmname> is the resource name that uniquely
identifies this resource statement in this application.</p></li>
<li><p><parmname>items</parmname> is the name defined for an array
that contains the items for the menu pane.</p></li>
<li><p><parmname>MENU_ITEM</parmname> is a structure defined in <parmname>eikon.rh</parmname>.
The <parmname>MENU_ITEM</parmname> structure is used to define the option
presented. The typical syntax is as follows:</p>
<itemgroup>
<codeblock id="GUID-475D1731-8639-4BD4-9F17-6FAC1EB215E9" xml:space="preserve">MENU_ITEM
	{
	command = enumerated command;
	txt = STRING_r_string1;
	}
</codeblock>
<p>, where:</p>
<ul>
<li><p><parmname>command</parmname> is an enumerated value for the
command that is associated with the button. The value used can be provided
either by the <xref href="GUID-CBB00F6A-CBA7-4872-B0A1-A86A863725F5.dita">underlying
S60 platform</xref> or by <xref href="GUID-D52E98C3-F5EE-4CE1-A4F5-2EF41A066B8A.dita">your
application</xref>. The are collected by the event loop of the application
framework and delivered to your application for <xref href="GUID-4941C035-C359-4968-9BD5-31F44EE5F810.dita">command
handling</xref></p></li>
<li><p><parmname>txt</parmname> defines the text that is displayed
in the <parmname>Options</parmname> menu.</p></li>
</ul>
</itemgroup>
</li>
</ul>
</itemgroup>
</li>
<li id="GUID-26312EAA-942A-4CD3-9A20-3EA99E1F296E"><p>Create submenus
as needed:</p>
<itemgroup>
<p>Menu panes can also be nested by using the cascade declaration. </p>
<p>The following example creates a menu pane with two items, each of which
opens up another menu pane as a submenu.</p>
<codeblock id="GUID-BD6B4F0B-652C-4214-BC0C-0045C130E905" xml:space="preserve">RESOURCE MENU_PANE r_name7
	{
	items =
		{
		MENU_ITEM
			{
			cascade = r_name8;
			txt = STRING_r_string3;
			},
		MENU_ITEM
			{
			cascade = r_name9;
			txt = STRING_r_string4;
			}
		};
	}</codeblock>
<p>The resource statements for <parmname>r_name8</parmname> and <parmname>r_name9</parmname> need
to be defined in a menu pane structure in the resource file.</p>
<p><parmname>txt</parmname> defines the text that is displayed in the <parmname>Options</parmname> menu.</p>
<p>Note that it is also possible to have icons associated with the menu
items in the pane.</p>
</itemgroup>
</li>
</ol>
<p>The <xref format="html" href="specs/guides/Options_Menu_API_Specification/Options_Menu_API_Specification.html" scope="peer">Options Menu API</xref> provides access to the <parmname>MENU_BAR</parmname> resource.</p>
</conbody></concept>