进入和退出屏幕模板程序
2008-07-19 09:31
274 查看
// 文件名: 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( );
}
// 描述 : 进入和退出屏幕模板程序
// 函数 : 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( );
}
相关文章推荐
- 进入和退出屏幕模板程序
- windows屏幕保护opengl程序模板
- 某人在玩游戏的时候输入密码123456后成功进入游戏(输错5次则被强行退出),要求用程序实现密码验证的过程。
- WPF PasswordBox鼠标进入时程序异常退出的解决办法
- Android开发模板------再按一次退出程序 KeyEvent.KEYCODE_BACK
- ARM汇编中子程序进入和退出时数据的保存和恢复
- android 中Activity在程序运行过程中进入全屏和退出全屏
- 随时关闭显示器或进入屏幕保护的小程序
- Android中Activity频繁进入再退出时程序崩溃的解决方案
- iOS——退出App程序;进入设置页面
- 关于屏幕按钮点击后程序退出现象
- 选择分支语句,continue与break和return之间的区别,随机数,清除屏幕垃圾,退出程序
- 如何实现 画一个屏幕的渐变效果,并将其作为程序的背景模板
- Android按下返回键后,程序不退出,进入后台运行。使用moveTaskToBack(boolean nonRoot)
- Activity切换出现黑屏或无效果/点home键再进入程序回不到原来Activity/home 键退出程序会有Activity切换/EditText光标不显示
- 中断——中断处理程序的进入与退出 (基于3.16-rc4)
- 登录页重写返回键,防止退出登录后按返回键重新进入程序
- 在cmd命令行里进入和退出Python程序的方法
- 退出程序是跳过屏幕自检 比如 必输 EXIT-COMMAND
- C++程序进入main函数之前,退出main函数之后会做些什么?