欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

MTK的DM應(yīng)用實例

系統(tǒng) 1805 0

一直想寫一篇有關(guān)DM的文章,一直沒有時間。DM是Draw Manager的簡稱。DM和History機制是MTK窗口設(shè)計的兩大核心,掌握了DM和History,你就可以隨心所欲的對MTK的各種控件如LIST,INPUT,status BAR,TITLE等任意任意組合,創(chuàng)建出符合自己需要的窗口。今天偶讀一位網(wǎng)上朋友的文章,對其在DM上的功底十分佩服,借花獻佛,共同學(xué)習(xí)。

文章轉(zhuǎn)自: http://blog.163.com/lyzaily@126/blog/static/4243883720092127125286/

本文詳細說明了如何建設(shè)一個自定義列表窗體模板。原理部分請參見《MTK平臺(1)——如何添加一個窗體模板》。

最終實現(xiàn)的是一個字典輸入界面。布局為:

該模板不 含業(yè)務(wù)邏輯,僅提供頁面顯示和InputBox框輸入事件后的ListBox的Redraw事件的注冊,以及基本的輸入法設(shè)置、清空后的返回函數(shù)。

一、添加用戶自定義列表模板的過程

(一)在g_categories_controls_map[]中加入:

,{ MM I_CATEGORY_CUSTOM_LIST,(U8*)custom_define_list,(s16*)coordinate_custom_list,NULL}

const U8 custom_define_list[]=

{

5,

DM_BASE_LAYER_START,

DM_SCR_BG,

DM_BASE_CONTROL_SET1,

DM_SINGLELINE_INPUTBOX1,

DM_LIST1

};

const S16 coordinate_custom_list[]=

{

DM_FULL_SCREEN_ COO RDINATE_FLAG,

DM_CUSTOM_DEFINE_INPUTBOX, //需要定義

DM_CUSTOM_DEFINE_LIST //需要定義

};

(二)在dm_get_coordinates()函數(shù)中加入:

//設(shè)定列表位置和大小(不要忘記全局變量 MMI_custom_Listbox_x 等的定義)

else if( *UICtrlAccessPtr_p == DM_CUSTOM_DEFINE_LIST )

{

dm_coordinate_info->s16X = MMI_custom_Listbox_x;

dm_coordinate_info->s16Y = MMI_custom_Listbox_y; dm_coordinate_info->s16Width = MMI_custom_Listbox_width; dm_coordinate_info->s16Height = MMI_custom_Listbox_height;

dm_coordinate_info->Flags = DM_NO_FLAGS;

UICtrlAccessPtr_p ++ ;

}

//設(shè)定輸入框位置和大小

else if( *UICtrlAccessPtr_p == DM_CUSTOM_DEFINE_INPUTBOX )

{

dm_coordinate_info->s16X = MMI_custom_inputbox_x ;

dm_coordinate_info->s16Y = MMI_custom_inputbox_y;

dm_coordinate_info->s16Width = MMI_custom_inputbox_width ;

dm_coordinate_info->s16Height = MMI_custom_inputbox_height; dm_coordinate_info->Flags = DM_SINGLE_LINE_INPUTBOX_SPECIFIC_HEIGHT;

UICtrlAccessPtr_p ++ ;

}

(三)在Wgui_category.c中定義模板顯示函數(shù)

void ShowCategoryCustomListScreen(

U8 *title,

U16 title_icon,

U16 left_softkey,

U16 left_softkey_icon,

U16 right_softkey,

U16 right_softkey_icon,

S32 number_of_items,

U8 **list_of_items,

U16 *list_of_icons,

S32 flags,

S32 highlighted_item,

U8 *history_buffer)

{

/*----------------------------------------------------------------*/

/* Local Variables */

/*----------------------------------------------------------------*/

dm_data_struct dm_data;

S32 i;

U8 h_flag;

/*----------------------------------------------------------------*/

/* Code Body */

/*----------------------------------------------------------------*/

gdi_layer_lock_frame_buffer();

SetupCategoryKeyHandlers();

MMI_title_string = (UI_string_type) title;

MMI_title_icon = (PU8) get_image(title_icon);

change_left_softkey(left_softkey, left_softkey_icon);

change_right_softkey(right_softkey, right_softkey_icon);

//Create List

create_fixed_icontext_menuitems();

associate_fixed_icontext_list();

ShowListCategoryScreen(

(UI_string_type) title,

get_image(title_icon),

get_string(left_softkey),

get_image(left_softkey_icon),

get_string(right_softkey),

get_image(right_softkey_icon),

number_of_items);

for (i = 0; i < number_of_items; i++)

{

add_fixed_icontext_item((UI_string_type) list_of_items[i], wgui_get_list_menu_icon(i, list_of_icons[i]));

}

h_flag = set_list_menu_category_history(MMI_CATEGORY_CUSTOM_LIST, history_buffer);

if (h_flag)

{

fixed_list_goto_item_no_redraw(MMI_fixed_list_menu.highlighted_item);

}

else

{

fixed_list_goto_item_no_redraw(highlighted_item);

}

//Create Inputbox

memset(custom_single_input_buffer,0,100);

pfnUnicodeStrcpy(custom_single_input_buffer,L"Custom Category");

wgui_setup_singleline_inputbox(

0,

0,

240,

320,

custom_single_input_buffer,

pfnUnicodeStrlen(custom_single_input_buffer),

MMI_CATEGORY_CUSTOM_LIST,

get_string(right_softkey),

get_image(right_softkey_icon),

INPUT_TYPE_ALPHANUMERIC_LOWERCASE| INPUT_TYPE_USE_ONLY_ENGLISH_MODES,

history_buffer,

0);

register_hide_multitap(wgui_hide_multitap);

gdi_layer_unlock_frame_buffer();

ExitCategoryFunction = ExitCategoryCustomListScreen;

dm_setup_category_functions(dm_redraw_category_screen, dm_get_category_history, dm_get_category_history_size);

dm_data.s32ScrId = (S32) GetActiveScreenId();

dm_data.s32CatId = MMI_CATEGORY_CUSTOM_LIST;

//不要忘記該常量MMI_CATEGORY_CUSTOM_LIST的定義

dm_data.s32flags |= DM_CLEAR_SCREEN_BACKGROUND;

//dm_data.s32flags |= DM_SHOW_VKPAD;

dm_register_vkpad_callback(CustomList_virtual_keypad_callback);

dm_setup_data(&dm_data);

dm_redraw_category_screen();

} /* end of ShowCategory353Screen */

void CustomList_virtual_keypad_callback(void)

{

#if defined(__MMI_TOUCH_SCREEN__)

mmi_pen_editor_clear_and_show_virtual_keyboard_area();

#endif

gui_show_transparent_image(0,200,GetImage(IMG_H_SELECT_LEFT),0);

}

void ExitCategoryCustomListScreen()

{

wgui_close_singleline_inputbox();

}

(四)在singleline_inputbox_multitap_input()函數(shù)中添加用戶處理key_0~key_9的按鍵事件的函數(shù):

void (*singleline_inputbox_custom_input_callback) (void) = UI_dummy_function;

void singleline_inputbox_multitap_input(UI_character_type c)

{

/*----------------------------------------------------------------*/

/* Local Variables */

/*----------------------------------------------------------------*/

/*----------------------------------------------------------------*/

/* Code Body */

/*----------------------------------------------------------------*/

if (MMI_singleline_inputbox.flags & UI_SINGLE_LINE_INPUT_BOX_PLUS_CHARACTER_HANDLING)

{

if ((MMI_singleline_inputbox.text[0] == '+') &&

(MMI_singleline_inputbox.current_text_p == MMI_singleline_inputbox.text) &&

(MMI_singleline_inputbox.text_length >= (MMI_singleline_inputbox.available_length - ENCODING_LENGTH)))

{

return;

}

}

gui_single_line_input_box_insert_multitap_character(&MMI_singleline_inputbox, c);

redraw_singleline_inputbox();

singleline_inputbox_input_callback();

singleline_inputbox_custom_input_callback();

}

(五)Wgui_Category.c中添加用戶事件定義接口

//右鍵事件注冊

void SetCategoryCustomListRightSoftkeyFunction(void (*f) (void))

{

wgui_singleline_inputbox_RSK_function = f;

}

//key_0到key_9按下時的事件注冊

extern void (*singleline_inputbox_custom_input_callback) (void);

void SetCategoryCustomListNumKeyFunction(void (*f) (void))

{

singleline_inputbox_custom_input_callback = f ;

}

//設(shè)置InputBox大小

void SetCustomList_Inputbox_Size(S32 p_x , S32 p_y , S32 p_width , S32 p_height )

{

MMI_custom_inputbox_x = p_x ;

MMI_custom_inputbox_y = p_y ;

MMI_custom_inputbox_width = p_width ;

MMI_custom_inputbox_height = p_height ;

}

//設(shè)置ListBox大小

void SetCustomList_Listbox_Size(S32 p_x , S32 p_y , S32 p_width , S32 p_height )

{

MMI_custom_Listbox_x = p_x ;

MMI_custom_Listbox_y = p_y ;

MMI_custom_Listbox_width = p_width ;

MMI_custom_Listbox_height = p_height ;

}

二、自定義列表模板的使用方法

1、 調(diào)用SetCustomList_Inputbox_Size 和 SetCustomList_Listbox_Size 設(shè)置列表框和輸入框的大小。

2、 調(diào)用顯示窗體的接口 ShowCategoryCustomListScreen。

3、 調(diào)用右鍵事件注冊函數(shù),注冊文本框被清空后的事件(如返回等)SetCategoryCustomListRightSoftkeyFunction。

4、 調(diào)用key_0至key_9的事件注冊函數(shù),SetCategoryCustomListNumKeyFunction()。

三、參數(shù)詳細說明

① void SetCustomList_Inputbox_Size(S32 p_x , S32 p_y , S32 p_width , S32 p_height ) 與

void SetCustomList_Listbox_Size(S32 p_x , S32 p_y , S32 p_width , S32 p_height )

p_x , p_y :起始位置

p_width , p_height : 大小。

② void SetCategoryCustomListRightSoftkeyFunction(void (*f) (void))

void SetCategoryCustomListNumKeyFunction(void (*f) (void))

f(void) :函數(shù)地址。

③ void ShowCategoryCustomListScreen(

U8 *title, // 標題文本指針

U16 title_icon, // 標題圖標ID

U16 left_softkey, // 左鍵文本ID

U16 left_softkey_icon, // 左鍵圖標ID

U16 right_softkey, // 右鍵文本ID

U16 right_softkey_icon, // 右鍵圖標ID

U8* custom_single_input_buffer, // Input輸入Buffer

S32 number_of_items, // 列表條目數(shù)

U8 **list_of_items, // 列表項文本指針數(shù)組

U16 *list_of_icons, // 列表項Icon

S32 highlighted_item, // 當(dāng)前高亮顯示的列表條目

U8 *history_buffer) // 歷史記錄Buffer

附:所需更改的文件

wgui.c

wgui_categories.c

wgui_draw_manager.c

wgui_inputs.c

wgui.h

wgui_categories_defs.h

wgui_draw_manager.h

CustCoordinate.c

MTK的DM應(yīng)用實例


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。?!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产黄视频在线观看 | 欧美极品一区二区 | 91网视频在线观看 | 久久一区视频 | 欧美日韩国产在线人成dvd | 草久久久 | 九九九久久久久久久爱 | 最新精品在线 | 国产精品亚洲综合色拍 | 短视频网站免费观看 | 黄色综合| 精久久久久 | 色视频免费版高清在线观看 | 色综色天天综合网 | www.日本在线播放 | 亚洲一区2区三区4区5区 | 国产毛片久久精品 | 你懂的91| 国产一级视频 | 性久久久久久久久久 | 日本在线你懂的 | 奇米777四色影视在线看 | 在线色网站 | 久久中文字幕2021精品 | 日韩成人 | 久久成人一区二区 | 一级a级国产不卡毛片 | 亚洲激情一区二区 | a级成人毛片久久 | 91青青国产在线观看免费 | 男女进进出出动态图啪啪 | 欧美成人手机在线 | 亚洲成人免费网站 | 国产精品片aa在线观看 | 亚洲av毛片久久久久 | 色天天综合网 | 精品免费久久久久久成人影院 | 日韩大片在线永久观看视频网站免费 | 国产伦理久久精品久久久久 | 亚洲欧美一区二区三区在线 | 久久99精品国产99久久 |