博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
进入和退出屏幕模板程序
阅读量:4045 次
发布时间:2019-05-24

本文共 4363 字,大约阅读时间需要 14 分钟。

// 文件名:  EntryAndExitFunciton

// 描述  :  进入和退出屏幕模板程序

// 函数  :  EntryNewMenu

//          ExitMyAppMenu
//          ExitNewMenu

// 以下是模板中使用的ID

// 菜单ID:  MENU_ID_MYAPP_NEW
// 图标ID:  ICON_ID_MYAPP_NEW
// 字串ID:  STR_ID_MYAPP_NEW
// 屏幕ID: SCR_ID_MYAPP_NEW
// 模板ID:  MMI_CATEGORYWTXYZ1_ID(ShowCategoryWTXYZ1Screen)

// 关于加载菜单: 我们需要知道的是,加载实际只是对菜单项的说明,在程序中没有实际意义,实际上菜单项的加载最后是

//               通过模板加载的,模板读取菜单项数据,然后在屏幕上显示出来

#define  MAX_NEW_MENU_ITEMS  20         // 声明新菜单中的项目数最大值: 50

// 函数名:  EntryNewMenu

// 功能  :  进入新的屏幕
// 输入  :  无
// 输出  :  无
// 说明  :  1. attributes与GetDispAttributeOfItem
//             A.  GetDispAttributeOfItem返回当前菜单的属性(attributes),原文说明如下:
//                 This is a display attribute flag like 1-list,2-Circular,3-Tab..etc.
//             B.  attributes来源 CUSTOM_MENU结构中的nDispAttribute项目
//             C.  GetDispAttributeOfItem有一个防止溢出错误的流程,具体看源程序
//          2. SetParentHandler
//             似乎跟Task那块有关……
//          3. ExecuteCurrExitHandler Function:
//             This old ExecuteCurrExiHandler function already merged into EntryNewScreen.
//             The detail migrated information please check the coding covention.
//          4. ExecuteCurrHiliteHandler
//             用来设置高亮句柄,在WGUI控件设置POPUP相关函数(句柄)时很有用
//          5. GetSequenceStringIds, GetSequenceImageIds
//             用在Res_Organizer.c中添加菜单时使用的资源(image_id,string_id)初始化子菜单,
//             否则需要手动设置,手动可设置任意ID
void  EntryNewMenu( void )
{
     /* Standard Local Variables */
     U8 * guiBuffer ;
     S32  attributes ;
     S32  num_of_items ;
     /* shold be modified */
     S32  i ;
     U16  list_of_items[MAX_NEW_MENU_ITEMS] ;
     U16  list_of_icons[MAX_NEW_MENU_ITEMS] ;
    
     /* Standard Code Body */
     /* Before displaying the new screen over previous screen the following must be excuted */
     // 1. Save the contents of previous screen
     EntryNewScreen( SCR_ID_MYAPP_NEW, NULL, EntryNewMenu, NULL ) ;  
     //EntryNewScreen( SCR_ID_MYAPP_NEW, ExitNewScreen, NULL, NULL ) ;
     // 2. Get the buffer to store the contents of screen to be displayed
     guiBuffer = GetCurrGuiBuffer(SCR_ID_MYAPP_NEW) ;            // Buffer holding history data
     // 3. Get Display attribute for the following scree           
     attributes = GetDispAttributeOfItem(MENU_ID_MYAPP_NEW) ;    // Stores diaplay attribute
     // 4. Recive number of submenu items to be displayed( if this entry function is to display a list menu
     num_of_items = GetNumOfChild(MENU_ID_MYAPP_NEW);            // Stores no of children in the subment
     // 5. Set the parent of new screen to be diplayed, so that the framework knows where this menu item appears   
     SetParentHandler(MENU_ID_MYAPP_NEW);
     // 6. Recevice strings and images(icons) id, in sequence, of given menu item to be displayed.
     //    The sequence of strings or images is defined as per the registration of string items in the populate function
     //    as described in Section 6.
     //    In my mind, its optional subject.
     GetSequenceStringIds(MAIN_MENU_ORGANIZER_MENUID, item_list) ;
     GetSequenceImageIds(MAIN_MENU_ORGANIZER_MENUID, item_icon) ;
     // 7. Set the subment item to be displayed highlighted, on the next screen
     // 8. Set the function to be excuted on pressing right or left soft key
     // Register highlight handler to be called in menu screen
     //    Its in depend on the category code, so in my mind, its also optional subject
     RegisterHighlightHandler(ExecuteCurrHiliteHandler) ;
     /* should be modified */
     // 9. Set the function to be called on exiting the next screen
     for( i=0; i<num_of_items; i++ )
     {
          list_of_items[i] = STR_ID_MYAPP_NEW+i ;
          list_of_icons[i] = ICON_ID_MYAPP_NEW+i ;
     }
     ShowCategoryWT001Screen(
          STR_GLOBAL_OK,   IMG_GLOBAL_OK,
          STR_GLOBAL_BACK, IMG_GLOBAL_BACK,
          num_of_items,
          list_of_items,
          list_of_icons,
          0,
          guiBuffer
     )
     // 10.Rigister function with right softkey
     // 一般情况下注册按键的操作如:
     // SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
     // SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
     SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);                // 注册右软键响应函数
     SetLeftSoftkeyFunction(mmi_myapp_category_popup,KEY_EVENT_UP);      // 注册左软键响应函数
}

// 函数名:  ExitMyAppMenu

// 功能  :  退出屏幕的基本函数
// 输入  :  无
// 输出  :  无
static void  ExitMyAppMenu( void * entry_screen_pfunc, U16 screen_id )
{
     history  currHistory ;
     S16  nHistory=0 ;
    
     currHistory.scrnID = screen_id ;
     currHistory.entryFuncPtr = entry_screen_pfunc ;
     pfnUnicodeStrcpy((S8*)currHistory.inputBuffer,(S8*)&nHistory);
     GetCategoryHistory( currHistory.guiBuffer );
     AddHistory( currHistory );
}

// 函数名:  ExitNewMenu

// 功能  :  进入新的屏幕
// 输入  :  无
// 输出  :  无
// 调用  :  ExitMyAppMenu
void  ExitNewMenu( void )
{
     /* Standard Code Body */
     ExitMyAppMenu( EntryNewMenu, SCR_ID_MYAPP_NEW );
     /* should be modified */
     gui_fixed_icontext_menuitem_stop_scroll( );

转载地址:http://mwedi.baihongyu.com/

你可能感兴趣的文章
GitHub 万星推荐:黑客成长技术清单
查看>>
可以在线C++编译的工具站点
查看>>
关于无人驾驶的过去、现在以及未来,看这篇文章就够了!
查看>>
所谓的进步和提升,就是完成认知升级
查看>>
为什么读了很多书,却学不到什么东西?
查看>>
长文干货:如何轻松应对工作中最棘手的13种场景?
查看>>
如何用好碎片化时间,让思维更有效率?
查看>>
No.147 - LeetCode1108
查看>>
No.174 - LeetCode1305 - 合并两个搜索树
查看>>
No.175 - LeetCode1306
查看>>
No.176 - LeetCode1309
查看>>
No.182 - LeetCode1325 - C指针的魅力
查看>>
mysql:sql alter database修改数据库字符集
查看>>
mysql:sql truncate (清除表数据)
查看>>
yuv to rgb 转换失败呀。天呀。谁来帮帮我呀。
查看>>
yuv420 format
查看>>
YUV420只绘制Y通道
查看>>
yuv420 还原为RGB图像
查看>>
LED恒流驱动芯片
查看>>
驱动TFT要SDRAM做为显示缓存
查看>>