📄 widget_ctk.c
字号:
widget_ctk_leave_screen_param_struct param;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
WIDGET_LOG("widget_ctk_leave_screen_if_present()");
WAP_DBG_ASSERT(widget_ctk_appid);
if (widget_current_ctk == NULL)
{
return;
}
if (to_remove_handle != NULL)
{
if (to_remove_handle != _H(widget_current_ctk))
{
return;
}
}
else if (to_remove_modId >= 0)
{
if (widget_current_ctk->module_id != (kal_uint8) to_remove_modId)
{
return;
}
}
/*
* We need to handle End key and idle screen specially.
*
* In EntryIdleScreen(), MMI task invoke widget_MMI_on_enter_idle_screen()
* and widget_MMI_check_and_display_new_msg() respectively, which both wait
* WAP task in blocking mode. As a result, we should avoid widget_execute_MMI_xxx()
* in idle screen to avoid deadlock.
*
* Assume that history is as follows:
* 1. MMI screen
* 2. CTK screen
* 3. widget screen
*
* widget_current_ctk != NULL after user press End key and returns to idle screen.
*
*/
if (_CTK(widget_current_ctk)->idlescreen_seq_no != WIPC_CTX->idlescreen_seq_no)
{
/* The screen does not exist in history after user returns to idle screen. */
widget_current_ctk->ctk_state = WIDGET_CTK_STATE_NONE;
widget_current_ctk = NULL;
return;
}
param.to_remove_handle = to_remove_handle;
param.to_remove_modId = to_remove_modId;
if (WIPC_CTX->MMI_is_waiting) /* Typically BRA/MEA UI shutdown in idle screen */
{
widget_MMI_ctk_leave_screen_if_present(¶m);
}
else
{
widget_execute_MMI_p(widget_MMI_ctk_leave_screen_if_present, ¶m, KAL_TRUE);
}
}
/*****************************************************************************
* Callback functions
*****************************************************************************/
/*****************************************************************************
* FUNCTION
* widget_ctk_on_enter
* DESCRIPTION
*
* PARAMETERS
* scrid [IN]
* RETURNS
* void
*****************************************************************************/
static void widget_ctk_on_enter(ctk_screen_handle scrid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
widget_ctk_struct *ctk;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
ctk = (widget_ctk_struct*) ctk_screen_get_msf_window(scrid);
ASSERT(ctk);
ctk->ctk_state = WIDGET_CTK_STATE_ENTERED; /* Maybe paused before */
ctk_screen_enter(scrid);
if (ctk->on_post_paint)
{
ctk->on_post_paint();
}
#ifdef WIDGET_TEST_OUT_OF_MEMORY
SetKeyHandler(widget_simulate_out_of_memory, KEY_POUND, KEY_EVENT_UP);
#endif
}
/*****************************************************************************
* FUNCTION
* widget_ctk_on_pre_paint
* DESCRIPTION
*
* PARAMETERS
* scrid [IN]
* RETURNS
* void
*****************************************************************************/
static void widget_ctk_on_pre_paint(ctk_screen_handle scrid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
widget_ctk_struct *ctk;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
ctk = (widget_ctk_struct*) ctk_screen_get_msf_window(scrid);
ASSERT(ctk);
if (ctk->ctk_flag & WIDGET_CTK_FLAG_DISABLE_SLIM_MENU_STYLE)
{
wgui_override_list_menu_slim_style(WGUI_LIST_MENU_SLIM_STYLE_DRAW_ICON);
}
#ifdef __MMI_WAP_MMS_NUMERIC_LIST_ICON__
else
{
wgui_override_list_menu_slim_style(WGUI_LIST_MENU_SLIM_STYLE_NUMBER);
}
#endif /* __MMI_WAP_MMS_NUMERIC_LIST_ICON__ */
if (ctk->ctk_flag & WIDGET_CTK_FLAG_BACKLIGHT_ALWAYS_ON)
{
TurnOnBacklight(0);
}
widget_setup_security_icon();
}
/*****************************************************************************
* FUNCTION
* widget_ctk_on_exit
* DESCRIPTION
*
* PARAMETERS
* scrid [IN]
* RETURNS
* void
*****************************************************************************/
static void widget_ctk_on_exit(ctk_screen_handle scrid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*
* Two case here
* 1. overriden by another MMI screen
* 2. invoked from wap_entry_widget_screen()
*/
widget_ctk_struct *ctk = (widget_ctk_struct*) ctk_screen_get_msf_window(scrid);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
WIDGET_LOG("widget_ctk_on_exit()");
ASSERT(ctk);
WAP_DBG_ASSERT(ctk == widget_current_ctk);
#ifdef __MMI_WAP_MMS_NUMERIC_LIST_ICON__
wgui_restore_list_menu_slim_style();
#else /* __MMI_WAP_MMS_NUMERIC_LIST_ICON__ */
if (ctk->ctk_flag & WIDGET_CTK_FLAG_DISABLE_SLIM_MENU_STYLE)
{
wgui_restore_list_menu_slim_style();
}
#endif /* __MMI_WAP_MMS_NUMERIC_LIST_ICON__ */
if (ctk->ctk_flag & WIDGET_CTK_FLAG_BACKLIGHT_ALWAYS_ON)
{
TurnOffBacklight();
}
widget_reset_security_icon();
if (WGUI_CTX->is_entering_widget_screen)
{
/*
* Returning to the widget screen, we do not put the CTK screen into history
* This *should* be invoked from widget_ctk_leave_screen_if_present()
*
* We don't reset widget_current_ctk here because we assume widget_ctk_leave_screen_if_present
* should be invoked!
*/
WIDGET_LOG("widget_ctk_on_exit() - back to widget screen");
ctk_screen_exit(scrid, CTK_SCREEN_EXIT_PAUSE_NOT_IN_HISTORY);
ctk->ctk_state = WIDGET_CTK_STATE_NONE;
}
else
{
/*
* Interrupted by another MMI screen
*/
WIDGET_LOG("widget_ctk_on_exit() - interrupted by MMI");
ctk_screen_exit(scrid, CTK_SCREEN_EXIT_PAUSE);
ctk->ctk_state = WIDGET_CTK_STATE_PAUSED;
}
}
/*****************************************************************************
* FUNCTION
* HDIa_widgetCtkGetWindow
* DESCRIPTION
* Get the MsfWindow handle corresponding to the CTK screen handle
* PARAMETERS
* scrid [IN]
* RETURNS
* MsfWindow handle
*****************************************************************************/
MsfWindowHandle HDIa_widgetCtkGetWindow(ctk_screen_handle scrid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return (MsfWindowHandle) ctk_screen_get_msf_window(scrid);
}
/*****************************************************************************
* FUNCTION
* HDIa_widgetCtkGetScreenHandle
* DESCRIPTION
* Get the ctk screen handle corresponding to the MsfWindow
* PARAMETERS
* wnd [IN]
* RETURNS
* MsfWindow handle
*****************************************************************************/
ctk_screen_handle HDIa_widgetCtkGetScreenHandle(MsfWindowHandle wnd)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return _CTK(wnd)->ctk_screen;
}
/*****************************************************************************
* FUNCTION
* HDIa_widgetCtkGetApp
* DESCRIPTION
* CTK application handle is needed to create CTK screen/layout
* PARAMETERS
* void
* RETURNS
* the handle to the CTK application handle of WAP
*****************************************************************************/
ctk_app_handle HDIa_widgetCtkGetApp(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
WAP_DBG_ASSERT(widget_ctk_appid);
return widget_ctk_appid;
}
/*****************************************************************************
* FUNCTION
* HDIa_widgetCtkCreate
* DESCRIPTION
* modId - The current module ID
* scrid - previously created CTK screen handle
* PARAMETERS
* modId [IN]
* scrid [IN]
* RETURNS
* return the handle to the created MsfWindow
*****************************************************************************/
MsfWindowHandle HDIa_widgetCtkCreate(MSF_UINT8 modId, ctk_screen_handle scrid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
widget_ctk_struct *w = widget_create_ctk(modId);
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
w->module_id = modId;
w->size = WGUI_CTX->default_display_size;
w->ctk_screen = scrid;
w->ctk_state = WIDGET_CTK_STATE_NONE;
w->idlescreen_seq_no = WIPC_CTX->idlescreen_seq_no;
ctk_screen_set_msf_window(scrid, (kal_uint32) w);
return (MsfWindowHandle) w;
}
/*****************************************************************************
* FUNCTION
* HDIa_widgetCtkSetOnPostPaint
* DESCRIPTION
* Set callback function when screen is paint.
* It can be used to setup other keypad.
* PARAMETERS
* wnd [IN] MsfWindow containing the CTK screen
* callback [IN] Callback function invoked when CTK screen is painted.
* RETURNS
* void
*****************************************************************************/
void HDIa_widgetCtkSetOnPostPaint(MsfWindowHandle wnd, void (*callback) (void))
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!IS_CTK_TYPE(wnd))
{
WAP_DBG_ASSERT(0);
return;
}
_CTK(wnd)->on_post_paint = callback;
}
/*****************************************************************************
* FUNCTION
* widget_ctk_screen_create
* DESCRIPTION
* return a ctk_screen with OnEnter and OnExit handler for Widget screen
*
* It will override OnEnter, OnExit handler of the created CTK screen
* PARAMETERS
* void
* RETURNS
* handle to created CTK screen
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -