📄 mainpage.dox
字号:
*
* In this example, there are 4 MENU_TITLEs defined in the resource file.
*
* txt: - String data. It is not used to display, but should be defined.
*
* menu_pane: - Resource ID of MENU_PANE should be defined.
*
<div align=left><table style="width:70%;" cellspacing="4" width="70%" bgcolor="#DDDDDD" class="hcp24">
<tr>
<td style="width: 100%;"
width=100%><i class="hcp25"><b class="hcp14">MENU_PANE</b>
resource definition is as follows:</i></td></tr>
<tr>
<td style="width:100%;" bgcolor="#EEEEEE" width="100%" class="hcp26">
<p class=CodeInTable>--- AknExMenu.rss ---<br>
RESOURCE MENU_PANE r_aknexmenu_no_sub_context_menu<br>
{<br>
items=<br>
{<br>
MENU_ITEM<br>
{<br>
command = EAknExMenuCtxCmd1;<br>
txt = qtn_aknexmenu_menu_ctx_cmd1; // "Dim
AppCmd in order"<br>
//extratxt = "Dim AppCmd.";<br>
},<br>
MENU_ITEM<br>
{<br>
command = EAknExMenuCtxCmd2;<br>
txt = qtn_aknexmenu_menu_ctx_cmd2; // "Delete
StateCmd"<br>
flags = EEikMenuItemSeparatorAfter;<br>
//extratxt = "Delete StateCmd.";<br>
},<br>
MENU_ITEM<br>
{<br>
command = EAknExMenuCtxCmd3;<br>
txt = qtn_aknexmenu_menu_ctx_cmd3; // "Add
StateCmd"<br>
flags = EEikMenuItemSeparatorAfter;<br>
//extratxt = "Show StateCmd.";<br>
}<br>
};<br>
} </td></tr>
</table>
</div>
*
* MENU_TITLE resources are shown in the menu pane. The last defined MENU_TITLE is shown at the top of the menu pane. The first one is shown at the last position in the menu pane.
*
* Each MENU_ITEM is shown in normal order. In other words, the first defined MENU_ITEM is displayed first. The last defined MENU_ITEM is shown as last menu item.
*
* For example:
*
<p>4 <span class=CodeInText>MENU_TITLE</span>s (menu panes) are defined
in the <span class=CodeInText>MENU_BAR</span> resource. They are ordered
as <span class=CodeInText>MenuPan1</span>, <span class=CodeInText>MenuPan2</span>,
<span class=CodeInText>MenuPan3</span>, <span class=CodeInText>MenuPan4</span>.
<span class=CodeInText>MENU_ITEM</span>s are defined from item-1, item-2,
item3, ...<br>
Then the menu system will be shown as: </p>
<p>MenuPane4-Item1<br>
MenuPane4-Item2<br>
MenuPane4-Item3<br>
MenuPane3-Item1<br>
MenuPaine3-Item2<br>
...<br>
MenuPane2-Item1<br>
...<br>
MenuPane1-Item1<br>
... </p>
*
* The following table shows the items to be defined in MENU_ITEM:
*
<div align=center><table style="width:70%;" cellspacing="0" width="70%" border="1" class="hcp19">
<tr>
<td style="width:20%;" valign="top" width="20%" class="hcp23">
<p class=TableText>command</td>
<td style="width:80%;" width="80%" class="hcp29">
<p class=TableText>Command ID that is issued when the user selects a menu
item. (must)</td></tr>
<tr>
<td style="width:20%;" valign="top" width="20%" class="hcp23">
<p class=TableText>Txt</td>
<td style="width:80%;" width="80%" class="hcp29">
<p class=TableText>This text string is shown in the menu list. (must)</td></tr>
<tr>
<td style="width:20%;" valign="top" width="20%" class="hcp23">
<p class=TableText>flags</td>
<td style="width:80%;" width="80%" class="hcp29">
<p class=TableText>Sets the default status of a menu item. (default is
none).<br>
Please refer to details in "<span class=CodeInText>uikon.hrh</span>"</td></tr>
</table>
</div>
*
* \subsection Sub8 3.3.5 Menu code (Using the menu resource in C++ code)
*
* When the example application view is created, the resource definitions shown above are used in C++ code as follows:
*
<div align=left><table style="width:70%;" cellspacing="4" width="70%" bgcolor="#DDDDDD" class="hcp24">
<tr>
<td style="width:100%;" bgcolor="#EEEEEE" width="100%" class="hcp26">
<p class=CodeInTable>--- AknExMenuAppUi.cpp ---<br>
<br>
void CAknExMenuAppUi::ConstructL()<br>
{<br>
...<br>
CAknExMenuView* view1 = new(ELeave) CAknExMenuView;<br>
CleanupStack::PushL(view1);<br>
view1->ConstructL(R_AKNEXMENU_NO_SUB_MENU);<br>
CleanupStack::Pop(); // view1<br>
AddViewL(view1); //transfer ownership
to CAknViewAppUi<br>
...<br>
}</td></tr>
</table>
</div>
*
* This initialising code is common style as application view creation code. As this shows, the menu is usually defined in a resource file and it is commonly created in a view class instance phase.
*
* \subsection Sub9 3.3.6 Implementation of the command handler
*
* This section describes how command handlers in the view class handle the commands that are defined in the menu resource.
*
* Menu command handlers should be implemented in the application view class derived from the CAknView class. In the example application, the command handlers are implemented in the CAknExMenuView class.
*
<div align=left><table style="width:70%;" cellspacing="4" width="70%" bgcolor="#DDDDDD" class="hcp24">
<tr>
<td style="width:100%;" bgcolor="#EEEEEE" width="100%" class="hcp26">
<p class=CodeInTable>--- AknExMenuView.cpp ---<br>
<br>
void CAknExMenuView::HandleCommandL(TInt aCommand)<br>
{<br>
switch (aCommand)<br>
{<br>
case EAknExMenuCtxCmd1:<br>
...<br>
default:<br>
AppUi()->HandleCommandL(...); </td></tr>
</table>
</div>
*
* Application programmers usually add application commands and put them in the application menu. When the end user selects a menu command, HandleCommandL in the View class is called. This means that it is necessary to override the HandleCommandL function and implement the behaviours of these commands.
*
* As CAknExMenuView::HandleCommandL() is sometimes called with an unexpected command ID, "AppUi()->HandleCommandL(...);" should be called in this unexpected case. Then the HandleCommandL function in AppUi takes care of it using the system default command.
*
* \subsection Sub10 3.3.7 Changing the menu structure or status dynamically
*
* This section describes how to change the menu structure or status dynamically.
*
* It has already been described how to create a static menu structure. To create a menu, a menu resource should be defined and passed to View when it is initialised.
*
* However, it is sometimes necessary to change the menu structure (add/remove) or menu status(active/inactive). For example, in the mail application, the menu command (Send) needs to be set as inactive when the To: address is not set in mail data.
*
* To change the menu structure/status, override the following functions:
*
* MEikMenuObserver::DynInitMenuPaneL() : Change Menu pane.
*
* MEikMenuObserver::DynInitMenuBarL() : Change Menu bar.
*
* These function APIs are defined in the Mixin observer class, and are implemented in the concrete CAknExMenuView class in the example application.
*
* void CAknExMenuView::DynInitMenuPaneL()
*
* After the menu pane resources are read and the menu object is instantiated, this function is called. After this function call is finished, the menu is displayed. With this implementation of DynInitMenuPaneL(), the status of the menu as active/inactive can be changed and adding/removing menu items is possible.
*
* <HR>
* \section Hierarchy_sec 4. Class Hierarchy
*
This inheritance list is sorted roughly, but not completely, alphabetically:<ul>
<li><a class="el" href="class_c_akn_ex_menu_app.html">CAknExMenuApp</a>
<li><a class="el" href="class_c_akn_ex_menu_app_ui.html">CAknExMenuAppUi</a>
<li><a class="el" href="class_c_akn_ex_menu_container.html">CAknExMenuContainer</a>
<li><a class="el" href="class_c_akn_ex_menu_document.html">CAknExMenuDocument</a>
<li><a class="el" href="class_c_akn_ex_menu_ok_container.html">CAknExMenuOkContainer</a>
<li><a class="el" href="class_c_akn_ex_menu_ok_view.html">CAknExMenuOkView</a>
<li><a class="el" href="class_c_akn_ex_menu_sub_container.html">CAknExMenuSubContainer</a>
<li><a class="el" href="class_c_akn_ex_menu_sub_view.html">CAknExMenuSubView</a>
<li><a class="el" href="class_c_akn_ex_menu_view.html">CAknExMenuView</a>
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -