helloworldbasic.rss

In the S60 platform, resource files are used to define UI components such as status panes, CBA (Control Button Area) buttons, menu bars, views, 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.

For more information about resource files, see Managing resource files.

//  RESOURCE IDENTIFIER
NAME HEWB    // 4 letter ID

This NAME statement defines the mandatory identifier for this resource file, which is unique within this application. For more information, see Resource file structure.

//  INCLUDES
#include <eikon.rh>
#include <avkon.rh>

These are preprocessor statements for EIKON and AVKON files provided with the SDK in the ./Epoc32/include subfolder that are required for data structures used in the resource file. For more on the available preprocessor statements in resource files, see Resource file structure.

#include <avkon.rsg>

These is a preprocessor statement for a generated resource file provided with the SDK in the ./Epoc32/include subfolder that provides a list of symbolic IDs that point to compiled resources. For more on S60 precompiled options, see Precompiled resource values available from the S60 platform.

#include <appinfo.rh>

This is a preprocessor statement for an AVKON file provided with the SDK in the ./Epoc32/include subfolder that is required for the data structure used for the localizable information for the application registration resource file.

#include "HelloWorldBasic.hrh"

This is a preprocessor statement for the HelloWorldBasic custom command IDs. For more on custom command IDs, see Creating resource header files.

#include "HelloWorldBasic.rls"

This is a preprocessor statement for the file used to manage building the localized strings for the HelloWorldBasic application. For more on internationalization and localization, see Internationalization and localization.

//  RESOURCE DEFINITIONS
// -----------------------------------------------------------------------------
//
//    Define the resource file signature
//    This resource should be empty.
//
// -----------------------------------------------------------------------------
//
RESOURCE RSS_SIGNATURE
    {
    }

This is the required RESOURCE definition that indicates the version of this resource file. For this application, no version is defined.

// -----------------------------------------------------------------------------
//
//    Default Document Name
//
// -----------------------------------------------------------------------------
//
RESOURCE TBUF r_default_document_name
    {
    buf="HEWB";
    }

This is the required RESOURCE definition that defines the name used if the helloworldbasicdocument class needs to store a document.

// -----------------------------------------------------------------------------
//
//    Define default menu and CBA key.
//
// -----------------------------------------------------------------------------
//
RESOURCE EIK_APP_INFO
    {
    menubar = r_helloworldbasic_menubar;
    cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
    }


This is the required RESOURCE 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 avkon.rsg file, which in turns points to a compiled resource that provides an Options text above the left softkey and an Exit text above the right softkey. The application framework handles the event generated by selection of the Options softkey and opens the MENU_PANE resource. Selection of the Exit softkey generates a EAknSoftkeyExit event that needs to be handled by your code. For more information on event handling, see Event handling.

// -----------------------------------------------------------------------------
//
//   r_helloworldbasic_menubar
//   Menubar for HelloWorldBasic example
//
// -----------------------------------------------------------------------------
//
RESOURCE MENU_BAR r_helloworldbasic_menubar
    {
    titles =
        {
        MENU_TITLE { menu_pane = r_helloworldbasic_menu; }
        };
    }


This RESOURCE definition defines the r_helloworldbasic_menubar menu bar declared in EIK_APP_INFO. The MENU_TITLE statement maps to the Options softkey, which opens the defined MENU_PANE resources when selected.

// -----------------------------------------------------------------------------
//
//   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;
                }
        };
    }

This RESOURCE definition defines the r_helloworldbasic_menu menu opened when Option is selected. Four menu items are offered: Hello, Hello from file, Hello from edit, and Exit. The command definitions indicate which event is returned by the application framework when the option is selected and the txt declarations provide the strings used in the menu. The enumerated command command IDs here are listed in the helloworldbasic.hrh file, with the exception of EAknSoftkeyExit, which is a command ID available from avkon.hrh.

// -----------------------------------------------------------------------------
//
// 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; }

These RESOURCE definitions define TBUF32 resources that can be read in the application implementation code later with the StringLoader class.

// ---------------------------------------------------------------------------- 
//
// 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";
	    };
    }

This RESOURCE definition defines the localizable information for the HelloWorldBasic registration file, where:

  • r_helloworldbasic_localisable_app_info is the resource identifier

  • STRING_hewb_caption_string is the symbolic ID for HelloWorld, which is used for both the short and long caption

  • there is one icon for HelloWorldBasic and it is in the \\resource\\apps\\Helloworldbasic_aif.mif file

// ----------------------------------------------------------------------------
//
// 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

This RESOURCE definition defines the resource required for a dialog used in theHelloWorldBasic application. For more information on defining DIALOG resources, see Using Dialog API.