DM模板的一般使用方法见某牛人所著<<MMI实例培训教程>>,这里仅讨论一些零碎的使用心得
1. 很多ShowCategoryXXXScreen函数都调用ShowListCategoryScreen,使用改函数可简化模板的绘制工作,
现在分析一下ShowListCategoryScreen到底做了什么工作:
(1) 设置Title
将title文本及图标数据-->全局变量MMI_title_string,MMI_title_icon
(2) shortcut
(3) Softkeys
实际上是完成了对左右软键的重画
(4) List
编辑菜单样式
注册方向键
......
2. 新建DM模板
Step1. Wgui_categories_enum.h
位置: ..\plutommi\gui\gui_src\Wgui_categories
新建一个模板ID: MMI_CATEGORYWTXYZ2_ID
Step2. CustCoordinates.c
位置: ..\plitommi\customer\custresource\CustCoordinates.c
A. 在g_categories_controls_map[]中加入:
{MMI_CATEGORYWTXTZ2_ID,(U8*)categoryWTXYZ2,(S16*)coordinate_setWTXYZ2,NULL}
B. 创建新模板的控件数组
const U8 categoryWTXYZ2[]=
{
5,
DM_BASE_LAYER_START,
DM_SCR_BG,
DM_BASE_CONTROL_SET1,
DM_SINGLELINE_INPUTBOX1,
DM_LIST1
};
C. 创建新模板的属性集
const S16 coordinate_setWTXYZ2[]=
{
DM_FULL_SCREEN_COORDINATE_FLAG,
DM_CUSTOM_DEFINE_INPUTBOX, // should be defined
DM_CUSTOM_DEFINE_LIST // should be defined
};
Step3. Wgui_draw_manager.h
位置: ..\plutommi\gui\gui_inc\Wgui_draw_manager.h
在mmi_dm_control_ids_enum枚举中定义新的属性: DM_CUSTOM_DEFINE_INPUTBOX, DM_CUSTOM_DEFINE_LIST
Step4. Wgui_draw_manager.c
位置: ..\plutommi\gui\gui_src\Wgui_draw_manager.c
更新函数 dm_get_coordinates( )
在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 ++ ;
}
Step5. Wgui.h
位置: ..\plutommi\gui\gui_inc\Wgui.h
定义新的属性信息: MMI_custom_listbox_x, MMI_custom_listbox_y, ...
Step6. Wgui_category.c
位置: ..\sw\plutommi\gui\gui_src\Wgui_category.c
A. 编写模板相关函数
B. 添加用户事件定义接口(wgui_category.h)
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=2151043