mmi培訓(xùn)資料自定義模板_第1頁(yè)
mmi培訓(xùn)資料自定義模板_第2頁(yè)
mmi培訓(xùn)資料自定義模板_第3頁(yè)
免費(fèi)預(yù)覽已結(jié)束,剩余1頁(yè)可下載查看

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、mtk平臺(tái)mmi培訓(xùn)資料(中文)2008-06-06 21:48本文詳細(xì)說(shuō)明了如何建設(shè)一個(gè)自定義列表窗體模板。原理部分請(qǐng)參見MTK平臺(tái)(1)如何添加一個(gè)窗體模板。最終實(shí)現(xiàn)的是一個(gè)字典輸入界面。 布局為:該模板不包含業(yè)務(wù)邏輯,僅提供頁(yè)面 顯示和InputBox框輸入事件后的ListBox的Redraw事件的注冊(cè),以及基本的輸 入法設(shè)置、清空后的返回函數(shù)。一、添加用戶自定義列表模板的過(guò)程(一) 在 g_categories_controls_map中加入:,MMI_CATEGORY_CUSTOM_LIST,(U8*)custom_defi ne_list,(s16*)coordi nate_c u

2、sto mist,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_COORDINATE_FLAG,DM_CUSTOM_DEFINE_INPUTBOX, / 需要定義 DM_CUSTOM_DEFINE_LIST/ 需要定義;(二) 在 dm_get_coordinates ()函數(shù)中加入:/設(shè)定列表位置和大

3、小(不要忘記全局變量 MMI_custom_Listbox_x等的定義) else if( *UICtrlAccessPtr_p = DM_CUSTOM_DEFINE_LIST )dm_coordi nate_i nfo->s16X = MMI_custom_Listbox_x;dm_coordi nate_i nfo->s16Y =MMI_custom_Listbox_y;dm_co ordin ate_i nfo->s16Width =MMI_custom_Listbox_width;dm_coordi nate_i nfo->s16Height =MMI_cust

4、om_Listbox_height;dm_coordi nate_i nfo->Flags = DM_NO_FLAGS;UICtrlAccessPtr_p + ;/設(shè)定輸入框位置和大小else if( *UICtrlAccessPtr p = DM CUSTOM DEFINE INPUTBOX )dm_coordi nate_i nfo->s16X = MMI_custo mn putbox_x ; dm_coordi nate_i nfo->s16Y = MMI_custo mn putbox_y;dm_coordi nate_i nfo->s16Width = MM

5、I_custo mn putbox_width ; dm_coordi nate_i nfo->s16Height =MMI_custo mn putbox_height;dm_coord in ate_i nfo->Flags =DM_SINGLE_LINE_INPUTBOX_SPECIFIC_HEIGHT;UICtrlAccessPtr_p + ; _(三) 在 Wgui_category.c 中定義模板顯示函數(shù)void ShowCategoryCustomListScree n(U8 *title,U16 title_ico n,U16 left_softkey,U16 le

6、ft_softkey_ico n,U16 right_softkey,U16 right_softkey_ic on,S32 nu mber_of_items,U8 *list_of_items,U16 *list_of_ico ns,S32 flags,S32 highlighted_item,U8 *history_buffer) _/*/* LocalVariables*/*/dm_data_struct dm_data;S32 i;U8 h_flag;/*/* CodeBody*/*/gdiayer_lock_frame_buffer();SetupCategoryKeyHa ndle

7、rs();MMI_title_stri ng = (Ul_stri ng_type) title; MMI_title_icon = (PU8) get_image(title_ico n);cha nge_left_softkey(left_softkey, left_softkey_ic on); cha nge_right_softkey(right_softkey, right_softkey_ico n);/Create Listcreate_fixed_ic on text_me nu items(); associate_fixed_ic on text_list(); Show

8、ListCategoryScree n(UI_stri ng_type) title, get_image(title_ico n), get_stri ng(left_softkey), get_image(left_softkey_ic on), get_stri ng(right_softkey), get_image(right_softkey_ic on), nu mber_of_items);for (i = 0; i < nu mber_of_items; i+) 一一add_fixedcon text_item(UI_stri ng_type)list_of_itemsi

9、, wgui_get_list_me nu_icon (i, list_of_ic on si);_ 一h_flag =set_list_me nu_category_history(MMI_CATEGORY_CUSTOM_LIST, history_buffer);if (h_flag) fixed list goto item no redraw(MMI fixed list menu.highlightedtem); elsefixedist_goto_item _n o_redraw(highlighted _item);/Create In putboxmemset(custom_s

10、i ngle_i nput_buffer,O,1OO);pfnU nicodeStrcpy(custom_si ngle_i nput_buffer,L"Custom Category");wgui_setup_s in gleli ne_in putbox(0,0,240,320,custom_s in gle_i nput_buffer,pfnUni codeStrle n( custom_s in gle_i nput_buffer),MMI_CATEGORY_CUSTOM_LIST,get_stri ng(right_softkey), get_image(righ

11、t_softkey_ic on),INPUT_TYPE_ALPHANUMERIC_LOWERCASE| INPUT_TYPE_USE_ONLY_ENGLISH_MODES,history_buffer,0);register_hide_multitap(wgui_hide_multitap);gdiayer_ un lock_frame_buffer();ExitCategoryF un ctio n = ExitCategoryCustomListScree n; dm_setup_category_fu nctio ns(dm_redraw_category_scree n, dm_get

12、_category_history, dm_get_category_history_size);dm_data.s32Scrld = (S32) GetActiveScree nld(); dm_data.s32Catld = MMI_CATEGORY_CUSTOM_LIST;/不要忘記該常量MMI_CATEGORY_CUSTOM_6定義dm_data.s32flags |= DM_CLEAR_SCREEN_BACKGROUND;dm_data.s32flags |= DM_SHOW_VKPAD; dm_register_vkpad_callback(CustomList_virtual_k

13、eypad_callback)Jdm_setup_data(&dm_data); dm_redraw_category_scree n();/* end of ShowCategory353Screen */void CustomList_virtual_keypad_callback(void) #if defi ned(_MMI_TOUCH_SCREEN_)mmi_pe n_editor_clear_a nd_show_virtual_keyboard_area();#en difgui_show_tra nspare nt_image(0,200,Getlmage(IMG_H_S

14、ELECT_LEFT),0); 一一 一 "" -void ExitCategoryCustomListScree n() wgui_close_si ngleli ne_in putbox(); 一一 一(四) 在 singleline_inputbox_multitap_input()函數(shù)中添加用戶處理key_0key_9的按鍵事件的函數(shù):void (*si ngleli ne_in putbox_custo mn put_callback) (void)=UI_dum my_fun ctio n;void singleline inputbox multitap in

15、put(UI character type c)/*/* LocalVariables*/*/*/* CodeBody*/*/if (MMI_si ngleli ne_in putbox.flags &UI_SINGLE_LINE_INPUT_BOX_PLUS_CHARACTER_HANDLING)if (MMI_si ngleli ne_in putbox.text0 = '+') &&(MMI_si ngleli ne_in putbox.curre nt_text_p =MMI_si ngleli ne_in putbox.text) &&

16、amp;(MMI_si ngleli ne_in putbox.text_le ngth >=(MMI_si ngleli ne_in putbox.available_le ngth - ENCODING_LENGTH)return;gui_si ngle_li ne_in put_box_i nsert_multitap_character(&MM I_si ngl eli ne_in putbox, c);redraw_si ngleli ne_in putbox();sin gleli ne_in putbox_i nput_callback();sin gleli ne

17、_in putbox_customn put_callback(); (五) Wgui_Category.c中添加用戶事件定義接口/右鍵事件注冊(cè)void SetCategoryCustomListRightSoftkeyFu nctio n(void (*f) (void)wgui_si ngleli ne_in putbox_RSK_fu nctio n = f; key 0 至U key 9 按下時(shí)的事件注冊(cè)extern void (*singleline_inputbox_custom_input_callback) (void);void SetCategoryCustomListNu

18、mKeyFu nctio n(void (*f) (void)sin gleli ne_in putbox_custom_i nput_callback = f ; 一 /設(shè)置InputBox大小void SetCustomListnputbox_Size(S32 p_x , S32 p_y , S32 p_width , S32 p_height )MMI_custo mn putbox_x = p_x ;MMI_custo mn putbox_y = p_y ;MMI_custo mn putbox_width = p_width ;MMI_custo mn putbox_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

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論