|
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 --> <!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> |
|
10 <p>In the Symbian platform, resource files are used to define UI components |
|
11 such as status panes, <xref href="GUID-A4F3738C-CBFD-4151-9132-26FE05966715.dita">CBA |
|
12 (Control Button Area) buttons</xref>, <xref href="GUID-5918ED8A-B26B-41A0-94A6-AB6D51BF80A1.dita">menu |
|
13 bars</xref>, <xref href="GUID-DAC32BB9-C0EB-42FF-A596-C2F1A90A4BD7.dita">views</xref>, |
|
14 dialogs, strings, and constants used in applications. The UI components consist |
|
15 of data structures that are defined in resource files, and then are called |
|
16 from the classes controlling the UI implementation. When UI component implementation |
|
17 is split into these two approaches, it means that resources can be recompiled, |
|
18 for example for new languages, without having to recompile the application |
|
19 code.</p> |
|
20 <p>For more information about resource files, see <xref href="GUID-0FB60233-993A-4BF2-9E8C-E03AD092359B.dita">Managing |
|
21 resource files</xref>.</p> |
|
22 <codeblock xml:space="preserve" id="GUID-5FFA294E-190E-41AE-BDA3-EE3F2E84F2E6">// RESOURCE IDENTIFIER |
|
23 NAME HEWB // 4 letter ID |
|
24 |
|
25 </codeblock> |
|
26 <p>This NAME statement defines the mandatory identifier for this resource |
|
27 file, which is unique within this application. For more information, see <xref href="GUID-EC49B54F-7724-433B-BD7F-201DE3B7DAA6.dita">Resource |
|
28 file structure</xref>.</p> |
|
29 <codeblock xml:space="preserve" id="GUID-6A156720-EBC9-4D2E-B6B7-196DFAEBB518">// INCLUDES |
|
30 #include <eikon.rh> |
|
31 #include <avkon.rh> |
|
32 </codeblock> |
|
33 <p>These are preprocessor statements for <parmname>EIKON</parmname> and <parmname>AVKON</parmname> files |
|
34 provided with the SDK in the <parmname>./Epoc32/include</parmname> subfolder |
|
35 that are required for data structures used in the resource file. For more |
|
36 on the available preprocessor statements in resource files, see <xref href="GUID-EC49B54F-7724-433B-BD7F-201DE3B7DAA6.dita">Resource |
|
37 file structure</xref>.</p> |
|
38 <codeblock xml:space="preserve" id="GUID-E27A3CE4-3058-4DEC-B298-675CB1028682">#include <avkon.rsg> |
|
39 </codeblock> |
|
40 <p>These is a preprocessor statement for a generated resource file provided |
|
41 with the SDK in the <parmname>./Epoc32/include</parmname> subfolder that provides |
|
42 a list of symbolic IDs that point to compiled resources. For more on Symbian |
|
43 precompiled options, see <xref href="GUID-CBB00F6A-CBA7-4872-B0A1-A86A863725F5.dita">Precompiled |
|
44 resource values available from the Symbian platform</xref>.</p> |
|
45 <codeblock xml:space="preserve" id="GUID-DB2EF2AB-24B9-4B0A-B691-E2BB54214132">#include <appinfo.rh> |
|
46 </codeblock> |
|
47 <p>This is a preprocessor statement for an <parmname>AVKON</parmname> file |
|
48 provided with the SDK in the <parmname>./Epoc32/include</parmname> subfolder |
|
49 that is required for the data structure used for the localizable information |
|
50 for the application registration resource file.</p> |
|
51 <codeblock xml:space="preserve" id="GUID-3664CD24-DCE2-437F-B833-7E459CECD684">#include "HelloWorldBasic.hrh"</codeblock> |
|
52 <p>This is a preprocessor statement for the <i>HelloWorldBasic</i> custom |
|
53 command IDs. For more on custom command IDs, see <xref href="GUID-D52E98C3-F5EE-4CE1-A4F5-2EF41A066B8A.dita">Creating |
|
54 resource header files</xref>.</p> |
|
55 <codeblock xml:space="preserve" id="GUID-F434F19C-2BEF-4E95-BF16-35813A19FD0E">#include "HelloWorldBasic.rls" |
|
56 </codeblock> |
|
57 <p>This is a preprocessor statement for the file used to manage building |
|
58 the localized strings for the <i>HelloWorldBasic</i> application. For more |
|
59 on internationalization and localization, see <xref href="GUID-E111C4E8-1342-4E87-ACB4-5B630AF1501C.dita">Internationalization |
|
60 and localization</xref>.</p> |
|
61 <codeblock xml:space="preserve" id="GUID-51D40318-84BB-49A7-9D1E-E28118AD71A6">// RESOURCE DEFINITIONS |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 // Define the resource file signature |
|
65 // This resource should be empty. |
|
66 // |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 RESOURCE RSS_SIGNATURE |
|
70 { |
|
71 } |
|
72 |
|
73 </codeblock> |
|
74 <p>This is the required <parmname>RESOURCE</parmname> definition that indicates |
|
75 the version of this resource file. For this application, no version is defined.</p> |
|
76 <codeblock xml:space="preserve" id="GUID-C70BA7AA-2AD2-4876-8F14-AE4E73D2BB5E">// ----------------------------------------------------------------------------- |
|
77 // |
|
78 // Default Document Name |
|
79 // |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 RESOURCE TBUF r_default_document_name |
|
83 { |
|
84 buf="HEWB"; |
|
85 } |
|
86 |
|
87 </codeblock> |
|
88 <p>This is the required <parmname>RESOURCE</parmname> definition that defines |
|
89 the name used if the <parmname>helloworldbasicdocument</parmname> class needs |
|
90 to store a document.</p> |
|
91 <codeblock xml:space="preserve" id="GUID-B0907BE0-D5B4-47E9-86AB-730C67F2AC8E">// ----------------------------------------------------------------------------- |
|
92 // |
|
93 // Define default menu and CBA key. |
|
94 // |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 RESOURCE EIK_APP_INFO |
|
98 { |
|
99 menubar = r_helloworldbasic_menubar; |
|
100 cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; |
|
101 } |
|
102 |
|
103 |
|
104 </codeblock> |
|
105 <p>This is the required <parmname>RESOURCE</parmname> definition that defines |
|
106 the resource used for constructing the menu bar and the Control Button Area |
|
107 (CBA) buttons used in the application. The menu bar is constructed later in |
|
108 this resource file. The CBA buttons declaration uses a precompiled symbolic |
|
109 ID from the <parmname>avkon.rsg</parmname> file, which in turns points to |
|
110 a compiled resource that provides an <parmname>Options</parmname> text above |
|
111 the left softkey and an <parmname>Exit</parmname> text above the right softkey. |
|
112 The application framework handles the event generated by selection of the <parmname>Options</parmname> softkey |
|
113 and opens the <parmname>MENU_PANE</parmname> resource. Selection of the <parmname>Exit</parmname> softkey |
|
114 generates a <parmname>EAknSoftkeyExit</parmname> event that needs to be handled |
|
115 by your code. For more information on event handling, see <xref href="GUID-A9330FEF-C559-4E2B-B064-0151FDADEA8C.dita">Event |
|
116 handling</xref>.</p> |
|
117 <codeblock xml:space="preserve" id="GUID-1D25FC90-4454-4FE2-9306-60B8BC2AFBA3">// ----------------------------------------------------------------------------- |
|
118 // |
|
119 // r_helloworldbasic_menubar |
|
120 // Menubar for HelloWorldBasic example |
|
121 // |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 RESOURCE MENU_BAR r_helloworldbasic_menubar |
|
125 { |
|
126 titles = |
|
127 { |
|
128 MENU_TITLE { menu_pane = r_helloworldbasic_menu; } |
|
129 }; |
|
130 } |
|
131 |
|
132 |
|
133 </codeblock> |
|
134 <p>This <parmname>RESOURCE</parmname> definition defines the <parmname>r_helloworldbasic_menubar</parmname> menu |
|
135 bar declared in <parmname>EIK_APP_INFO</parmname>. The <parmname>MENU_TITLE</parmname> statement |
|
136 maps to the <parmname>Options</parmname> softkey, which opens the defined <parmname>MENU_PANE</parmname> resources |
|
137 when selected.</p> |
|
138 <codeblock xml:space="preserve" id="GUID-18A6F8CA-F09E-4E0F-8F36-424090D084D4">// ----------------------------------------------------------------------------- |
|
139 // |
|
140 // r_helloworldbasic_menu |
|
141 // Menu for "Options" |
|
142 // |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 RESOURCE MENU_PANE r_helloworldbasic_menu |
|
146 { |
|
147 items = |
|
148 { |
|
149 // added the new Options menu command here |
|
150 MENU_ITEM |
|
151 { |
|
152 command = EHelloWorldBasicCommand1; |
|
153 txt = STRING_hewb_command1; |
|
154 }, |
|
155 MENU_ITEM |
|
156 { |
|
157 command = EHelloWorldBasicCommand2; |
|
158 txt = STRING_hewb_command2; |
|
159 }, |
|
160 MENU_ITEM |
|
161 { |
|
162 command = EHelloWorldBasicCommand3; |
|
163 txt = STRING_r_hewb_command3; |
|
164 }, |
|
165 MENU_ITEM |
|
166 { |
|
167 command = EAknSoftkeyExit; |
|
168 txt = STRING_r_hewb_exit; |
|
169 } |
|
170 }; |
|
171 } |
|
172 |
|
173 </codeblock> |
|
174 <p>This <parmname>RESOURCE</parmname> definition defines the <parmname>r_helloworldbasic_menu</parmname> menu |
|
175 opened when <parmname>Option</parmname> is selected. Four menu items are offered: <parmname>Hello</parmname>, <parmname>Hello |
|
176 from file</parmname>, <parmname>Hello from edit</parmname>, and <parmname>Exit</parmname>. |
|
177 The <parmname>command</parmname> definitions indicate which event is returned |
|
178 by the application framework when the option is selected and the <parmname>txt</parmname> declarations |
|
179 provide the strings used in the menu. The enumerated <parmname>command</parmname> command |
|
180 IDs here are listed in the <parmname>helloworldbasic.hrh</parmname> file, |
|
181 with the exception of <parmname>EAknSoftkeyExit</parmname>, which is a command |
|
182 ID available from <parmname>avkon.hrh</parmname>.</p> |
|
183 <codeblock xml:space="preserve" id="GUID-D3AA64A7-6A43-426F-8D49-874283903FF1">// ----------------------------------------------------------------------------- |
|
184 // |
|
185 // Resources for messages. |
|
186 // |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 RESOURCE TBUF32 r_hewb_command1_text { buf=STRING_r_hewb_command1_text; } |
|
190 RESOURCE TBUF32 r_hewb_file_text { buf=STRING_r_hewb_file_text; } |
|
191 RESOURCE TBUF32 r_hewb_caption_string { buf=STRING_r_hewb_caption_string; } |
|
192 </codeblock> |
|
193 <p>These <parmname>RESOURCE</parmname> definitions define <parmname>TBUF32</parmname> resources |
|
194 that can be read in the application implementation code later with the <parmname>StringLoader</parmname> class.</p> |
|
195 <codeblock xml:space="preserve" id="GUID-4205A985-F5DD-4EFE-9EAB-56C2188802D4">// ---------------------------------------------------------------------------- |
|
196 // |
|
197 // r_helloworldbasic_localisable_app_info |
|
198 // |
|
199 // ---------------------------------------------------------------------------- |
|
200 // |
|
201 RESOURCE LOCALISABLE_APP_INFO r_helloworldbasic_localisable_app_info |
|
202 { |
|
203 short_caption = STRING_hewb_caption_string; |
|
204 caption_and_icon = |
|
205 CAPTION_AND_ICON_INFO |
|
206 { |
|
207 caption = STRING_hewb_caption_string; |
|
208 |
|
209 number_of_icons = 1; |
|
210 icon_file = "\\resource\\apps\\Helloworldbasic_aif.mif"; |
|
211 }; |
|
212 } |
|
213 </codeblock> |
|
214 <p>This <parmname>RESOURCE</parmname> definition defines the localizable |
|
215 information for the <i>HelloWorldBasic</i> registration file, where:</p> |
|
216 <ul> |
|
217 <li><p><parmname>r_helloworldbasic_localisable_app_info</parmname> is |
|
218 the resource identifier</p></li> |
|
219 <li><p><parmname>STRING_hewb_caption_string</parmname> is the symbolic |
|
220 ID for <parmname>HelloWorld</parmname>, which is used for both the short and |
|
221 long caption</p></li> |
|
222 <li><p>there is one icon for <i>HelloWorldBasic</i> and it is in |
|
223 the <parmname>\\resource\\apps\\Helloworldbasic_aif.mif</parmname> file</p> |
|
224 </li> |
|
225 </ul> |
|
226 <codeblock xml:space="preserve" id="GUID-730600E4-43F1-45ED-B713-FCFDD6F56FB3">// ---------------------------------------------------------------------------- |
|
227 // |
|
228 // r_dialog_text_edit_query |
|
229 // |
|
230 // ---------------------------------------------------------------------------- |
|
231 // |
|
232 RESOURCE DIALOG r_dialog_text_edit_query |
|
233 { |
|
234 flags = EGeneralQueryFlags; |
|
235 buttons = R_AVKON_SOFTKEYS_OK_CANCEL; |
|
236 items = |
|
237 { |
|
238 DLG_LINE |
|
239 { |
|
240 type = EAknCtQuery; |
|
241 id = EGeneralQuery; |
|
242 control = AVKON_DATA_QUERY |
|
243 { |
|
244 layout = EDataLayout; |
|
245 label = ""; |
|
246 control = EDWIN |
|
247 { |
|
248 width = 32; |
|
249 maxlength = 32; |
|
250 lines = 1; |
|
251 }; |
|
252 }; |
|
253 } |
|
254 }; |
|
255 } |
|
256 // End of File |
|
257 </codeblock> |
|
258 <p>This <parmname>RESOURCE</parmname> definition defines the resource required |
|
259 for a dialog used in the<i>HelloWorldBasic</i> application. For more information |
|
260 on defining <parmname>DIALOG</parmname> resources, see Using Dialog API.</p> |
|
261 </conbody></concept> |