MTK列表菜单绘制精.docx
《MTK列表菜单绘制精.docx》由会员分享,可在线阅读,更多相关《MTK列表菜单绘制精.docx(11页珍藏版)》请在冰豆网上搜索。
![MTK列表菜单绘制精.docx](https://file1.bdocx.com/fileroot1/2023-2/26/eec79174-5723-43f1-b503-32ffb176593e/eec79174-5723-43f1-b503-32ffb176593e1.gif)
MTK列表菜单绘制精
一、
//画做软键小列表菜单
//所对应的DM
Wgui_categories_enum.h(d:
\wh\c1068_c015\plutommi\mmi\gui\gui_inc
MMI_CATEGORYLSK_ID,
(CustCoordinates.c(d:
\wh\c1068_c015\plutommi\customer\custresource)
{MMI_CATEGORYLSK_ID,(U8*categoryLSK,(S16*coordinate_setLSK,NULL},
constU8categoryLSK[]=
{
6,
DM_BASE_LAYER_START,
DM_SCR_BG,
DM_RECTANGLE,
DM_CATEGORY_CONTROLLED_AREA,
DM_LIST1,
DM_BUTTON_BAR1
};
constS16coordinate_setLSK[]=
{
0,0,MAIN_LCD_DEVICE_WIDTH,MAIN_LCD_DEVICE_HEIGHT,DM_NO_FLAGS,/*CategoryScreenCoordinates*/
0,0,MAIN_LCD_DEVICE_WIDTH,MAIN_LCD_DEVICE_HEIGHT,DM_NO_FLAGS,/*greyscalerectangle*/
0,158,120,136,DM_NO_FLAGS,/*controlarea*/
1,160,120,136,DM_CENTRE_ALIGN_X|DM_CENTER_ALIGN_Y,
0,MAIN_LCD_DEVICE_HEIGHT-MMI_BUTTON_BAR_HEIGHT,MAIN_LCD_DEVICE_WIDTH,MMI_BUTTON_BAR_HEIGHT,DM_BUTTON_DISABLE_BACKGROUND,
MMI_SOFTKEY_WIDTH/*ButtonBar*/
};
/***********************code*****************************************/
voidDrawRectangle(
{
gui_draw_rectangle(0,158,121,296,UI_COLOR_BLACK;
gui_draw_rectangle(0,157,123,298,UI_COLOR_GREEN;
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1;
}
voidShowCategoryLSKScreen(
{
//左软键进入菜单项模板
dm_data_structdm_data;
S32i;
S32number_of_items;
U8*history_buffer=NULL;
colorc=UI_COLOR_GREEN;
gdi_layer_lock_frame_buffer(;
//DrawBackgroundBar(;
wgui_fixed_list_create_icontext_menu(8,0,0,MMI_CATEGORY10_ID,history_buffer;
wgui_fixed_list_begin_add_icontext_one_item(;
for(i=0;i<8;i++
{
wgui_fixed_list_add_icontext_one_item(i,L"进入",wgui_get_list_menu_icon(i,IMG_GLOBAL_L1+i,NULL;
}
wgui_fixed_list_end_add_icontext_one_item(;
wgui_fixed_list_resize_icontext_menu(120-1,get_menu_item_height(*number_of_items;
MMI_fixed_icontext_menuitem.focussed_without_sc_filler=current_MMI_theme->small_list_menu_highlight_without_scrollbar_filler;
//MMI_fixed_list_menu.flags|=UI_LIST_MENU_DISABLE_SCROLLBAR|UI_LIST_MENU_DISABLE_BACKGROUND;
gdi_layer_unlock_frame_buffer(;
dm_setup_category_functions(dm_redraw_category_screen,dm_get_category_history,dm_get_category_history_size;
dm_data.s32ScrId=(S32GetActiveScreenId(;
dm_data.s32CatId=MMI_CATEGORYLSK_ID;
dm_data.s32flags=0;
dm_add_rectangle(c,DM_RECTANGLE_FILL_GRAYSCALE;
dm_setup_data(&dm_data;
dm_redraw_category_screen(;
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1;
}
voidmmi_fmreadapp_LSK_entery(void
{
S32i;
U8*guiBuffer=NULL;
U16Iconlistt[5];
U16ItemListt[5];
EntryNewScreen(SCR_FMREADAPP_MAIN,NULL,NULL,NULL;
entry_full_screen(;
ShowCategoryLSKScreen(;
DrawTitleButtonBar(;
DrawRectangle(;
change_left_softkey(STR_GLOBAL_OK,NULL;
change_right_softkey(STR_GLOBAL_QUIT,NULL;
show_softkey(MMI_LEFT_SOFTKEY;
show_softkey(MMI_RIGHT_SOFTKEY;
SetLeftSoftkeyFunction(mmi_fmreadapp_FirstPage,KEY_EVENT_UP;
//SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP;
SetKeyHandler(GoBackHistory,KEY_RSK,KEY_EVENT_UP;
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1;
}
二、
//画列表菜单
//所对应的DM
Wgui_categories_enum.h(d:
\wh\c1068_c015\plutommi\mmi\gui\gui_inc
MMI_CATEGORYChapterList_ID,
(CustCoordinates.c(d:
\wh\c1068_c015\plutommi\customer\custresource)
{MMI_CATEGORYChapterList_ID,(U8*categoryChapterList,(S16*coordinate_setChapterList,NULL},
constU8categoryChapterList[]=
{
5,
DM_BASE_LAYER_START,
DM_SCR_BG,//没有这个高亮时会把整个字体盖住
DM_CATEGORY_CONTROLLED_AREA,
//DM_BASE_CONTROL_SET_SUBMENU,
DM_LIST1,
DM_BUTTON_BAR1
};
constS16coordinate_setChapterList[]=
{
DM_FULL_SCREEN_COORDINATE_FLAG,
DM_FULL_SCREEN_COORDINATE_FLAG,
//MMI_SUBMENU_CONTENT_X,MMI_SUBMENU_CONTENT_Y,MMI_SUBMENU_CONTENT_WIDTH,MMI_SUBMENU_CONTENT_HEIGHT,DM_CENTRE_ALIGN_X|DM_CENTER_ALIGN_Y
0,35,240,260,DM_CENTRE_ALIGN_X|DM_CENTER_ALIGN_Y,
0,MAIN_LCD_DEVICE_HEIGHT-MMI_BUTTON_BAR_HEIGHT,MAIN_LCD_DEVICE_WIDTH,MMI_BUTTON_BAR_HEIGHT,DM_BUTTON_DISABLE_BACKGROUND,
MMI_SOFTKEY_WIDTH
};
/********************************************code*************************/
voidMybookshelf_draw_text(S32item_index
{
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1;
}
voidcategory668_highlight_handler(S32item_index
{
Mybookshelf_draw_text(item_index;
}
/*voidRedrawCategory668Screen(void
{
gdi_layer_lock_frame_buffer(;
show_fixed_list(;
show_softkey(MMI_LEFT_SOFTKEY;
show_softkey(MMI_RIGHT_SOFTKEY;
gdi_layer_unlock_frame_buffer(;
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1;
}
*/
voidExitCategory668Screen(void
{
ClearHighlightHandler(;//清掉所有高亮响应函数
reset_softkeys(;//重置左右软键
reset_menu_shortcut_handler(;//重置快捷序号框
reset_fixed_list(;//重置列表菜单
}
voidShowCategoryChapterListScreen(
U16left_softkey,U16left_softkey_icon,
U16right_softkey,U16right_softkey_icon,
S32number_of_items,
U16*list_of_items,
U16*list_of_icons,
S32highlighted_item,
U8*history_buffer
{
S8i;
dm_data_structdm_data;
entry_full_screen(;
clear_screen(;
DrawTitleButtonBar(;
MMI_current_menu_type=LIST_MENU;
create_fixed_icontext_menuitems(;
associate_fixed_icontext_list(;
for(i=0;i{
add_fixed_icontext_item(L"大话西游",(PU8GetImage(IMG_GLOBAL_L1+i;
}
register_fixed_list_shortcut_handler(;
register_fixed_list_keys(;
register_fixed_list_highlight_handler(category668_highlight_handler;
fixed_list_goto_item_no_redraw(0;
show_fixed_list(;
//RedrawCategoryFunction=RedrawCategory668Screen;
dm_setup_category_functions(dm_redraw_category_screen,dm_get_category_history,dm_get_category_history_size;
dm_data.s32ScrId=(S32GetActiveScreenId(;
dm_data.s32CatId=MMI_CATEGORYChapterList_ID;
dm_data.s32flags=0;
dm_setup_data(&dm_data;
dm_redraw_category_screen(;
change_left_softkey(STR_GLOBAL_OK,NULL;
change_right_softkey(STR_GLOBAL_BACK,NULL;
show_softkey(MMI_LEFT_SOFTKEY;
show_softkey(MMI_RIGHT_SOFTKEY;
SetLeftSoftkeyFunction(mmi_fmreadapp_LSK_entery,KEY_EVENT_UP;
SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP;
}
voidmmi_fmreadapp_ChapterList_entery(void
{
S32i;
U16list_of_items[10];
U16list_of_icons[10];
U8*history_buffer;
//for(i=0;i<10;i++
///{
//list_of_items[i]=STR_GLOBAL_FILENAME+i;
//list_of_icons[i]=IMG_GLOBAL_L1+i;
//}
DrawTitleButtonBar(;
EntryNewScreen(SCR_FMREADAPP_MAIN,NULL,mmi_fmreadapp_ChapterList_entery,NULL;
ShowCategoryChapterListScreen(
(U8*GetString(STR_GLOBAL_OK,
0,
(U8*GetString(STR_GLOBAL_BACK,
0,
10,
(U8*list_of_items,
list_of_icons,
2,
(U8*history_buffer;
gui_BLT_double_buffer(0,0,UI_device_width-1,UI_device_height-1;
}
三、//搜索界面(暂时未写出)
/*
voidentry_search_result_screen(void
{
key_word=OslMalloc(FMREAD_SEARCH_LEN*2;
memset(key_word,0,FMREAD_SEARCH_LEN*2;
mmi_chset_convert(MMI_CHSET_UCS2,MMI_CHSET,(char*tmp_key_word,(char*key_word,FMREAD_SEARCH_LEN*2;
ui_gid=8;
fmread_popup(NULL,NULL,STR_GLOBAL_BACK,IMG_GLOBAL_BACK,(UI_string_typeGetString(STR_GLOBAL_LOADING,IMG_GLOBAL_LOADING,NULL;//加载中
}
voidshow_search_content_screen(void
{
U8*gui_buffer;
EntryNewScreen(SCR_FMREADAPP_MAIN,NULL,NULL,NULL;
SetParentHandler(0;
gui_buffer=GetCurrGuiBuffer(SCR_FMREADAPP_MAIN;
memset(tmp_key_word,0,FMREAD_SEARCH_LEN*2;
ShowCategory5Screen(
STR_GLOBAL_SUBJECT,
GetRootTitleIcon(ORGANIZER_TODOLIST_MENU,
STR_GLOBAL_OK,
IMG_GLOBAL_OK,
STR_GLOBAL_BACK,
IMG_GLOBAL_BACK,
IMM_INPUT_TYPE_SENTENCE,
(U8*tmp_key_word,
FMREAD_SEARCH_LEN,
gui_buffer;
ClearKeyHandler(KEY_END,KEY_EVENT_DOWN;
SetKeyHandler(GoBackHistory,KEY_END,KEY_EVENT_DOWN;
SetLeftSoftkeyFunction(entry_search_result_screen,KEY_EVENT_UP;
SetCategory5RightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP;
}
*/
注:
现在的问题:
1.添加“左软键”菜单之后,点击屏幕,也会直接进入左软键列表,正常效果为:
点击屏幕进入小说阅读界面,点击左软键“菜单”项进入列表。
2.“搜索”界面还是原来版本的界面,和现在界面不配套。