For more information about the general usage of DM templates, see <MMI instance training tutorial>. Here we will only discuss some of my experiences.
1. Many ShowCategoryXXXScreen functions call ShowListCategoryScreen. You can use the function to simplify template creation,
Now let's analyze what ShowListCategoryScreen has done:
(1) set Title
Set the title text and Icon data --> global variable MMI_title_string, MMI_title_icon
(2) shortcut
(3) Softkeys
In fact, the re-painting of the Left and Right soft keys is completed.
(4) List
Edit menu style
Register direction keys
......
2. Create a DM Template
Step1. Wgui_categories_enum.h
Location: ../plutommi/gui/gui_src/Wgui_categories
Create a template ID: MMI_CATEGORYWTXYZ2_ID
Step2. CustCoordinates. c
Location: ../plitommi/customer/custresource/CustCoordinates. c
A. Add the following to g_categories_controls_map:
{MMI_CATEGORYWTXTZ2_ID, (U8 *) categoryWTXYZ2, (S16 *) coordinate_setWTXYZ2, NULL}
B. Create a control array for the new template
Const U8 categoryWTXYZ2 [] =
{
5,
DM_BASE_LAYER_START,
DM_SCR_BG,
DM_BASE_CONTROL_SET1,
DM_SINGLELINE_INPUTBOX1,
DM_LIST1
};
C. Create an attribute set for the new template
Const S16 coordinate_setWTXYZ2 [] =
{
DM_FULL_SCREEN_COORDINATE_FLAG,
DM_CUSTOM_DEFINE_INPUTBOX, // shocould be defined
DM_CUSTOM_DEFINE_LIST // shocould be defined
};
Step3. Wgui_draw_manager.h
Location: ../plutommi/gui/gui_inc/Wgui_draw_manager.h
Define a new property in the mmi_dm_control_ids_enum enumeration: DM_CUSTOM_DEFINE_INPUTBOX, DM_CUSTOM_DEFINE_LIST
Step4. Wgui_draw_manager.c
Location: ../plutommi/gui/gui_src/Wgui_draw_manager.c
Update the dm_get_coordinates () function ()
Add the processing for new attributes in dm_get_coordinates:
Else if (* UICtrlAccessPtr_p = DM_CUSTOM_DEFINE_LIST)
{
Dm_coordinate_info-> s16X = (S16) MMI_custom_listbox_x;
Dm_coordinate_info-> s16Y = (S16) MMI_custom_listbox_y;
Dm_coordinate_info-> s16Width = (S16) MMI_custom_listbox_width;
Dm_coordinate_info-> s16Height = (S16) MMI_custom_listbox_height;
Dm_coordinate_info-> Flags = DM_NO_FLAGS;
UICtrlAccessPtr_p ++;
}
Else if (* UICtrlAccessPtr_p = DM_CUSTOM_DEFINE_INPUTBOX)
{
Dm_coordinate_info-> s16X = (S16) MMI_custom_inputbox_x;
Dm_coordinate_info-> s16Y = (S16) MMI_custom_inputbox_y;
Dm_coordinate_info-> s16Width = (S16) MMI_custom_inputbox_width;
Dm_coordinate_info-> s16Height = (S16) MMI_custom_inputbox_height;
Dm_coordinate_info-> Flags = DM_SINGLE_LINE_INPUTBOX_SPECIFIC_HEIGHT;
UICtrlAccessPtr_p ++;
}
Step 5. Wgui. h
Location: ../plutommi/gui/gui_inc/Wgui. h
Define new attributes: MMI_custom_listbox_x, MMI_custom_listbox_y ,...
Step6. Wgui_category.c
Location: ../sw/plutommi/gui/gui_src/Wgui_category.c
A. Compile template-related functions
B. Add the user event definition interface (wgui_category.h)