Symbian3/SDK/Source/GUID-6AD1DA34-EA3D-4EC9-A667-390507B4D6CB.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-6AD1DA34-EA3D-4EC9-A667-390507B4D6CB" xml:lang="en"><title>helloworldbasic.rss</title><prolog><metadata><keywords></keywords></metadata></prolog><conbody>
<p>In the Symbian platform, resource files are used to define UI components
such as status panes, <xref href="GUID-A4F3738C-CBFD-4151-9132-26FE05966715.dita">CBA
(Control Button Area) buttons</xref>, <xref href="GUID-5918ED8A-B26B-41A0-94A6-AB6D51BF80A1.dita">menu
bars</xref>, <xref href="GUID-DAC32BB9-C0EB-42FF-A596-C2F1A90A4BD7.dita">views</xref>,
dialogs, strings, and constants used in applications. The UI components consist
of data structures that are defined in resource files, and then are called
from the classes controlling the UI implementation. When UI component implementation
is split into these two approaches, it means that resources can be recompiled,
for example for new languages, without having to recompile the application
code.</p>
<p>For more information about resource files, see <xref href="GUID-0FB60233-993A-4BF2-9E8C-E03AD092359B.dita">Managing
resource files</xref>.</p>
<codeblock xml:space="preserve" id="GUID-5FFA294E-190E-41AE-BDA3-EE3F2E84F2E6">//  RESOURCE IDENTIFIER
NAME HEWB    // 4 letter ID

</codeblock>
<p>This NAME statement defines the mandatory identifier for this resource
file, which is unique within this application. For more information, see <xref href="GUID-EC49B54F-7724-433B-BD7F-201DE3B7DAA6.dita">Resource
file structure</xref>.</p>
<codeblock xml:space="preserve" id="GUID-6A156720-EBC9-4D2E-B6B7-196DFAEBB518">//  INCLUDES
#include &lt;eikon.rh&gt;
#include &lt;avkon.rh&gt;
</codeblock>
<p>These are preprocessor statements for <parmname>EIKON</parmname> and <parmname>AVKON</parmname> files
provided with the SDK in the <parmname>./Epoc32/include</parmname> subfolder
that are required for data structures used in the resource file. For more
on the available preprocessor statements in resource files, see <xref href="GUID-EC49B54F-7724-433B-BD7F-201DE3B7DAA6.dita">Resource
file structure</xref>.</p>
<codeblock xml:space="preserve" id="GUID-E27A3CE4-3058-4DEC-B298-675CB1028682">#include &lt;avkon.rsg&gt;
</codeblock>
<p>These is a preprocessor statement for a generated resource file provided
with the SDK in the <parmname>./Epoc32/include</parmname> subfolder that provides
a list of symbolic IDs that point to compiled resources. For more on Symbian
precompiled options, see <xref href="GUID-CBB00F6A-CBA7-4872-B0A1-A86A863725F5.dita">Precompiled
resource values available from the Symbian platform</xref>.</p>
<codeblock xml:space="preserve" id="GUID-DB2EF2AB-24B9-4B0A-B691-E2BB54214132">#include &lt;appinfo.rh&gt;
</codeblock>
<p>This is a preprocessor statement for an <parmname>AVKON</parmname> file
provided with the SDK in the <parmname>./Epoc32/include</parmname> subfolder
that is required for the data structure used for the localizable information
for the application registration resource file.</p>
<codeblock xml:space="preserve" id="GUID-3664CD24-DCE2-437F-B833-7E459CECD684">#include "HelloWorldBasic.hrh"</codeblock>
<p>This is a preprocessor statement for the <i>HelloWorldBasic</i> custom
command IDs. For more on custom command IDs, see <xref href="GUID-D52E98C3-F5EE-4CE1-A4F5-2EF41A066B8A.dita">Creating
resource header files</xref>.</p>
<codeblock xml:space="preserve" id="GUID-F434F19C-2BEF-4E95-BF16-35813A19FD0E">#include "HelloWorldBasic.rls"
</codeblock>
<p>This is a preprocessor statement for the file used to manage building
the localized strings for the <i>HelloWorldBasic</i> application. For more
on internationalization and localization, see <xref href="GUID-E111C4E8-1342-4E87-ACB4-5B630AF1501C.dita">Internationalization
and localization</xref>.</p>
<codeblock xml:space="preserve" id="GUID-51D40318-84BB-49A7-9D1E-E28118AD71A6">//  RESOURCE DEFINITIONS
// -----------------------------------------------------------------------------
//
//    Define the resource file signature
//    This resource should be empty.
//
// -----------------------------------------------------------------------------
//
RESOURCE RSS_SIGNATURE
    {
    }

</codeblock>
<p>This is the required <parmname>RESOURCE</parmname> definition that indicates
the version of this resource file. For this application, no version is defined.</p>
<codeblock xml:space="preserve" id="GUID-C70BA7AA-2AD2-4876-8F14-AE4E73D2BB5E">// -----------------------------------------------------------------------------
//
//    Default Document Name
//
// -----------------------------------------------------------------------------
//
RESOURCE TBUF r_default_document_name
    {
    buf="HEWB";
    }

</codeblock>
<p>This is the required <parmname>RESOURCE</parmname> definition that defines
the name used if the <parmname>helloworldbasicdocument</parmname> class needs
to store a document.</p>
<codeblock xml:space="preserve" id="GUID-B0907BE0-D5B4-47E9-86AB-730C67F2AC8E">// -----------------------------------------------------------------------------
//
//    Define default menu and CBA key.
//
// -----------------------------------------------------------------------------
//
RESOURCE EIK_APP_INFO
    {
    menubar = r_helloworldbasic_menubar;
    cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
    }


</codeblock>
<p>This is the required <parmname>RESOURCE</parmname> definition that defines
the resource used for constructing the menu bar and the Control Button Area
(CBA) buttons used in the application. The menu bar is constructed later in
this resource file. The CBA buttons declaration uses a precompiled symbolic
ID from the <parmname>avkon.rsg</parmname> file, which in turns points to
a compiled resource that provides an <parmname>Options</parmname> text above
the left softkey and an <parmname>Exit</parmname> text above the right softkey.
The application framework handles the event generated by selection of the <parmname>Options</parmname> softkey
and opens the <parmname>MENU_PANE</parmname> resource. Selection of the <parmname>Exit</parmname> softkey
generates a <parmname>EAknSoftkeyExit</parmname> event that needs to be handled
by your code. For more information on event handling, see <xref href="GUID-A9330FEF-C559-4E2B-B064-0151FDADEA8C.dita">Event
handling</xref>.</p>
<codeblock xml:space="preserve" id="GUID-1D25FC90-4454-4FE2-9306-60B8BC2AFBA3">// -----------------------------------------------------------------------------
//
//   r_helloworldbasic_menubar
//   Menubar for HelloWorldBasic example
//
// -----------------------------------------------------------------------------
//
RESOURCE MENU_BAR r_helloworldbasic_menubar
    {
    titles =
        {
        MENU_TITLE { menu_pane = r_helloworldbasic_menu; }
        };
    }


</codeblock>
<p>This <parmname>RESOURCE</parmname> definition defines the <parmname>r_helloworldbasic_menubar</parmname> menu
bar declared in <parmname>EIK_APP_INFO</parmname>. The <parmname>MENU_TITLE</parmname> statement
maps to the <parmname>Options</parmname> softkey, which opens the defined <parmname>MENU_PANE</parmname> resources
when selected.</p>
<codeblock xml:space="preserve" id="GUID-18A6F8CA-F09E-4E0F-8F36-424090D084D4">// -----------------------------------------------------------------------------
//
//   r_helloworldbasic_menu
//   Menu for "Options"
//
// -----------------------------------------------------------------------------
//
RESOURCE MENU_PANE r_helloworldbasic_menu
    {
    items =
        {
        // added the new Options menu command here
        MENU_ITEM
                {
                command = EHelloWorldBasicCommand1;
                txt = STRING_hewb_command1;
                },
        MENU_ITEM
                {
                command = EHelloWorldBasicCommand2;
                txt = STRING_hewb_command2;
                },
        MENU_ITEM
                {
                command = EHelloWorldBasicCommand3;
                txt = STRING_r_hewb_command3;
                },
	MENU_ITEM
                {
                command = EAknSoftkeyExit;
                txt = STRING_r_hewb_exit;
                }
        };
    }

</codeblock>
<p>This <parmname>RESOURCE</parmname> definition defines the <parmname>r_helloworldbasic_menu</parmname> menu
opened when <parmname>Option</parmname> is selected. Four menu items are offered: <parmname>Hello</parmname>, <parmname>Hello
from file</parmname>, <parmname>Hello from edit</parmname>, and <parmname>Exit</parmname>.
The <parmname>command</parmname> definitions indicate which event is returned
by the application framework when the option is selected and the <parmname>txt</parmname> declarations
provide the strings used in the menu. The enumerated <parmname>command</parmname> command
IDs here are listed in the <parmname>helloworldbasic.hrh</parmname> file,
with the exception of <parmname>EAknSoftkeyExit</parmname>, which is a command
ID available from <parmname>avkon.hrh</parmname>.</p>
<codeblock xml:space="preserve" id="GUID-D3AA64A7-6A43-426F-8D49-874283903FF1">// -----------------------------------------------------------------------------
//
// Resources for messages.
//
// -----------------------------------------------------------------------------
//
RESOURCE TBUF32 r_hewb_command1_text { buf=STRING_r_hewb_command1_text; }
RESOURCE TBUF32 r_hewb_file_text { buf=STRING_r_hewb_file_text; }
RESOURCE TBUF32 r_hewb_caption_string { buf=STRING_r_hewb_caption_string; }
</codeblock>
<p>These <parmname>RESOURCE</parmname> definitions define <parmname>TBUF32</parmname> resources
that can be read in the application implementation code later with the <parmname>StringLoader</parmname> class.</p>
<codeblock xml:space="preserve" id="GUID-4205A985-F5DD-4EFE-9EAB-56C2188802D4">// ---------------------------------------------------------------------------- 
//
// r_helloworldbasic_localisable_app_info
//
// ---------------------------------------------------------------------------- 
//
RESOURCE LOCALISABLE_APP_INFO r_helloworldbasic_localisable_app_info
    {
    short_caption = STRING_hewb_caption_string;
    caption_and_icon = 
    CAPTION_AND_ICON_INFO
        {
        caption = STRING_hewb_caption_string;

        number_of_icons = 1;
	   	icon_file = "\\resource\\apps\\Helloworldbasic_aif.mif";
	    };
    }
</codeblock>
<p>This <parmname>RESOURCE</parmname> definition defines the localizable
information for the <i>HelloWorldBasic</i> registration file, where:</p>
<ul>
<li><p><parmname>r_helloworldbasic_localisable_app_info</parmname> is
the resource identifier</p></li>
<li><p><parmname>STRING_hewb_caption_string</parmname> is the symbolic
ID for <parmname>HelloWorld</parmname>, which is used for both the short and
long caption</p></li>
<li><p>there is one icon for <i>HelloWorldBasic</i> and it is in
the <parmname>\\resource\\apps\\Helloworldbasic_aif.mif</parmname> file</p>
</li>
</ul>
<codeblock xml:space="preserve" id="GUID-730600E4-43F1-45ED-B713-FCFDD6F56FB3">// ----------------------------------------------------------------------------
//
// r_dialog_text_edit_query
//
// ----------------------------------------------------------------------------
//
RESOURCE DIALOG r_dialog_text_edit_query
    {
    flags = EGeneralQueryFlags;
    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
    items =
        {
        DLG_LINE
            {
            type = EAknCtQuery;
            id = EGeneralQuery;
            control = AVKON_DATA_QUERY
                {
                layout = EDataLayout;
                label = "";
                control = EDWIN
                    {
                    width = 32;
                    maxlength = 32;
                     lines = 1;
                    };
                };
            }
        };
    }
// End of File
</codeblock>
<p>This <parmname>RESOURCE</parmname> definition defines the resource required
for a dialog used in the<i>HelloWorldBasic</i> application. For more information
on defining <parmname>DIALOG</parmname> resources, see Using Dialog API.</p>
</conbody></concept>