How to add resources and menus to the MTK Mobile Phone platform
1. Menu modification or addition:
The following is an example of how to add a menu:
Add a "My Settings" sub-menu under the "Settings" menu in the main menu. "My Settings" has two sub-menus: "I"
Set 1 "and" my settings 2 ", open these two menus and display an animation respectively.
The procedure is as follows:
1. Add the following content to the settingdefs. h file under the ../plutommi/MMI/setting/settinginc directory:
A. Enum str_setting_list adds the declaration of three string IDs at the end:
Str_my_setting,
Str_my_setting1,
Str_my_setting2,
B. Add the declaration of three screen IDs to the end of the enum scr_setting_list:
Scr_my_setting,
Scr_my_setting1,
Scr_my_setting2,
C. Enum img_setting_list add an image ID Declaration at the end:
Img_my_setting,
D. Enum globalmenuitemsid in the globalmenuitems. h file under the ../plutommi/MMI/INC directory
Add the declaration of three menu IDs: (some are declared in * defs. H of this AP or module)
Menu_my_setting,
Menu_my_setting1,
Menu_my_setting2,
2. Add three strings to ref_list.txt in the ../plutommi/customer/custresource/pluto_mmi directory:
Str_my_setting undefined 10 My setting my settings
Str_my_setting1 undefined 10 My setting1 my setting1 my settings 1 my settings 1
Str_my_setting2 undefined 10 My setting2 my setting2 my settings 2 my settings 2
3. Add the following in res_setting.c under the ../plutommi/customer/custresource/pluto_mmi/res_mmi directory:
Resource:
Add_application_menuitem (menu_my_setting, main_menu_settings_menuid, 2, menu_my_setting1, menu_my_setting2, show, moveablewithinparent,
Disp_list, str_my_setting, 0 ));
Add_application_menuitem (menu_my_setting1, menu_my_setting, 0, show,
Moveablewithinparent, disp_list, str_my_setting1, 0 ));
Add_application_menuitem (menu_my_setting2, menu_my_setting, 0, show,
Moveablewithinparent, disp_list, str_my_setting2, 0 ));
Add_application_image2 (img_my_setting, cust_img_path "// mainlcd // submenu // settings /// my_setting.gif", "My setting .");
Add_application_string2 (str_my_setting, "My setting", "mysetting ");
Add_application_string2 (str_my_setting1, "My setting1", "My setting1 ");
Add_application_string2 (str_my_setting2, "My setting2", "My setting2 ");
4. Modify res_mainmenu.c in the ../plutommi/customer/custresource/pluto_mmi/res_mmi directory as follows:
Add_application_menuitem (main_menu_settings_menuid, idle_screen _
Menu_id, 5,
Menu9102_initial_setup,
.
.
.
Changed:
Add_application_menuitem (main_menu_settings_menuid, idle_screen _
Menu_id, 6,
Menu_my_setting,
Menu9102_initial_setup,
5. Add the following function declaration to settingprot. h In the./plutommi/MMI/setting/settinginc/directory:
Void highlightmysetting (void );
Void highlightmysetting1 (void );
Void highlightmysetting2 (void );
Void entrymysetting (void );
Void entrymysetting1 (void );
Void entrymysetting2 (void );
6. Add the following function definitions in settingsrc. C under the ../plutommi/MMI/setting/settingsrc/directory:
Void highlightmysetting (void)
{
Setkeyhandler (gobackhistory, key_left_arrow, key_event_down );
Setrightsoftkeyfunction (gobackhistory, key_event_up );
Setkeyhandler (entrymysetting, key_right_arrow, key_event_down );
Setleftsoftkeyfunction (entrymysetting, key_event_up );
}
Void highlightmysetting1 (void)
{
Setkeyhandler (gobackhistory, key_left_arrow, key_event_down );
Setrightsoftkeyfunction (gobackhistory, key_event_up );
Setkeyhandler (entrymysetting1, key_right_arrow, key_event_down );
Setleftsoftkeyfunction (entrymysetting1, key_event_up );
}
Void highlightmysetting2 (void)
{
Setkeyhandler (gobackhistory, key_left_arrow, key_event_down );
Setrightsoftkeyfunction (gobackhistory, key_event_up );
Setkeyhandler (entrymysetting2, key_right_arrow, key_event_down );
Setleftsoftkeyfunction (entrymysetting2, key_event_up );
}
Void entrymysetting (void)
{
2010nstritemlist [max_sub_menus];/* stores the strings ID of submenus returned */
2010nnumofitem;/* stores no of children in the submenu */
U8 * guibuffer;/* buffer holding history data */
2010imagelist [max_sub_menus];
Entrynewscreen (scr_my_setting, null, entrymysetting, null );
/* 2 get current screen to guibuffer for history purposes */
Guibuffer = getcurrguibuffer (scr_my_setting );
/* 3. Retrieve no of child of menu item to be displayed */
Nnumofitem = getnumofchild (menu_my_setting );
/* 4. Retrieve string IDs in sequence of given menu item to be displayed */
Getsequencestringids (menu_my_setting, nstritemlist );
Getsequenceimageids (menu_my_setting, imagelist );
/* 5 set current parent ID */
Setparenthandler (menu_my_setting );
/* 6 register highlight handler to be called in menu screen */
Registerhighlighthandler (executecurrhilitehandler );
/* 7 display category1 screen */
Showcategory15screen (str_my_setting, struct, str_global_ OK, img_global_ OK, str_global_back, img_global_back, nnumofitem, nstritemlist, imagelist, list_menu, 0, guibuffer );
/* 8. Register function with right softkey */
Setrightsoftkeyfunction (gobackhistory, key_event_up );
}
Void entrymysetting1 (void)
{
S8 * string = getstring (str_my_setting1 );
2010imageid = img_my_setting;
Entrynewscreen (scr_my_setting1, null, entrymysetting1, null );
Showcategory65screen (u8 *) string, imageid, null );
Setrightsoftkeyfunction (gobackhistory, key_event_up );
}
Void entrymysetting2 (void)
{
S8 * string = getstring (str_my_setting2 );
2010imageid = img_my_setting;
Entrynewscreen (scr_my_setting2, null, entrymysetting2, null );
Showcategory65screen (u8 *) string, imageid, null );
Setrightsoftkeyfunction (gobackhistory, key_event_up );
}
7. Add the value of void initsettingapp (void) in settingsrc. C under the ../plutommi/MMI/setting/settingsrc/directory.
Add the following code:
Sethilitehandler (menu_my_setting, highlightmysetting );
Sethilitehandler (menu_my_setting1, highlightmysetting1 );
Sethilitehandler (menu_my_setting2, highlightmysetting2 );
It is summarized as follows:
A. Add resources in ref_list.txt and RES _ *. C;
B. Declare the IDs of all resources in * defs. H, including the string ID, image ID, menu ID, and window ID.
C. Add the processing code to the specific implementation code file.