📄 widget_paint.c
字号:
{
*y2 -= WGUI_CTX->current_horizontal_scrollbar->size.height;
}
}
}
/*****************************************************************************
* FUNCTION
* widget_set_title
* DESCRIPTION
*
* PARAMETERS
* h [IN]
* RETURNS
* void
*****************************************************************************/
void widget_set_title(MsfStringHandle h)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
int len;
void *src;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
// WAP_DBG_ASSERT(WGUI_CTX->is_widget_screen); /* We should not set title outside of widget screen */
src = widget_string_content(h);
len = widget_string_length(h);
if (len > WIDGET_MAX_TITLE_LEN)
{
len = WIDGET_MAX_TITLE_LEN;
}
if (src)
{
memcpy((void*)WGUI_CTX->title_buffer, src, len * 2);
}
else
{
len = 0;
}
WGUI_CTX->title_buffer[len] = 0;
MMI_title_string = (UI_string_type) WGUI_CTX->title_buffer;
}
/*****************************************************************************
* FUNCTION
* widget_clear
* DESCRIPTION
*
* PARAMETERS
* size [IN]
* pos [IN]
* RETURNS
* void
*****************************************************************************/
void widget_clear(MsfSize *size, MsfPosition *pos)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
color c;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!WGUI_CTX->is_widget_screen)
{
return;
}
c.r = 255;
c.g = 255;
c.b = 255;
c.alpha = 100;
gui_push_clip();
gui_set_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
gui_fill_rectangle(pos->x, pos->y, pos->x + size->width, pos->y + size->height, c);
gui_pop_clip();
/* no blit double buffer */
}
/* widget_set_current_object is invoked on passive focus */
/*****************************************************************************
* FUNCTION
* widget_set_current_object
* DESCRIPTION
*
* PARAMETERS
* obj [IN]
* RETURNS
* void
*****************************************************************************/
void widget_set_current_object(widget_header_struct *obj)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!obj)
{
return;
}
if (IS_GADGET_TYPE(obj))
{
WGUI_CTX->current_focused_gadget = obj;
return; /* Keep WGUI_CTX->in_paintbox & WGUI_CTX->in_editor unchanged */
}
if (IS_SCREEN_TYPE(obj))
{
switch (obj->module_id)
{
case MSF_MODID_MEA:
case MSF_MODID_MMS:
case MSF_MODID_SMA:
case MSF_MODID_SLS:
WGUI_CTX->MMS_screen_is_active = 1;
break;
default:
WGUI_CTX->MMS_screen_is_active = 0;
break;
}
return; /* Keep WGUI_CTX->in_paintbox & WGUI_CTX->in_editor unchanged */
}
if (!IS_WINDOW_TYPE(obj)) /* Not gadget nor screen */
{
WAP_DBG_ASSERT(0);
}
/* Obj is a window or screen now (not gadget) */
WGUI_CTX->in_paintbox = 0;
WGUI_CTX->in_editor = 0;
if (IS_CTK_TYPE(obj))
{
widget_prepare_to_enter_ctk_window(_CTK(obj));
}
else if (IS_PAINTBOX_TYPE(obj))
{
WGUI_CTX->in_paintbox = 1;
WGUI_CTX->current_focused_paintbox = _P(obj);
enable_bit_flag(obj->flag, WIDGET_FLAG_HAS_FOCUS);
}
else if (IS_EDITOR_TYPE(obj))
{
WGUI_CTX->in_editor = 1;
}
/* Example. The SEC dialog shows and disappears, we need to restore the busy flag */
if (IS_WINDOW_TYPE(obj) && !IS_SCREEN_TYPE(obj))
{
if (WGUI_CTX->status_bar_flags & WIDGET_STATUS_BAR_BUSY)
{
if (!(_W(obj)->property_mask & MSF_WINDOW_PROPERTY_BUSY))
{
widget_disable_status_bar(WIDGET_STATUS_BAR_BUSY);
}
}
else
{
if (_W(obj)->property_mask & MSF_WINDOW_PROPERTY_BUSY)
{
widget_enable_status_bar(WIDGET_STATUS_BAR_BUSY);
}
}
}
}
/* widget_set_current_focus is invoked on active focus */
/*****************************************************************************
* FUNCTION
* widget_set_current_focus
* DESCRIPTION
*
* PARAMETERS
* obj [IN]
* has_focus [IN]
* RETURNS
* void
*****************************************************************************/
void widget_set_current_focus(widget_header_struct *obj, kal_bool has_focus)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!obj)
{
WAP_DBG_ASSERT(0);
return;
}
/* we don't use widget_resume_screen here in order to increment WGUI_CTX->current_screen_level */
if (!WGUI_CTX->is_widget_screen)
{
if (IS_WINDOW_TYPE(obj) && wap_status == WAP_RUNNING && !WGUI_CTX->is_shutdown_UI)
{
WGUI_CTX->tried_to_enter_widget_screen = 1;
}
/* It is difficult to handle with incoming call screen */
#ifdef __UNIFIED_MSG_SUPPORT__
if (!MSF_moduleIsRunning(MSF_MODID_BRS))
{
WAP_DBG_ASSERT(IsScreenPresent(WAP_SCREEN_WIDGET));
}
else
#endif /* __UNIFIED_MSG_SUPPORT__ */
{
WAP_DBG_ASSERT(IsScreenPresent(WAP_SCREEN_WIDGET) || !isInCall() ||
(isInCall() && GetWapCallPresent()));
}
/*
* If we allow to goto widget screen when another widget screen is paused.
* It will cause a lot of problems. For example:
* 1. widget->CTK->widget->CTK
* 2. widget (BRA)->MO call->widget (error dialog) .
*
* Reference Chicago #631:
* BRAif_destroyUI and MEA UI termination might invoke HDIa_widgetSetInFocus(),
* but we do not want to goto widget screen when the WAP UI is terminating.
* (The focused window might be destroyed immediately)
*
*/
// TODO: maybe it is not necesssary to check WGUI_CTX->current_screen_level at all !
if (IS_WINDOW_TYPE(obj) && /* We don't check IS_SCREEN_TYPE() because MsfScreen are resident */
/* It should never overlap MO/MT screen. If CSD call is active after WAP out-of-memory, we should allow enter widget screen */
(WGUI_CTX->current_screen_level == 0 /* Widget screen not paused in history. Should we set this if WAP reset. XXX */
|| !IsScreenPresent(WAP_SCREEN_WIDGET)) &&
wap_status == WAP_RUNNING && !WGUI_CTX->is_shutdown_UI && !mmi_shutdown_is_in_power_off_period())
{
if (!IsScreenPresent(WAP_SCREEN_WIDGET))
{
/* Certain MMI applications might delete previous history of widget in wrong way */
WGUI_CTX->current_screen_level = 0; /* Redundant. Set by wap_entry_widget_screen */
}
if (WIPC_CTX->wait_message_notification_in_idle_screen)
/* If MMI is blocked, we should not enter widget screen here */
{
WIPC_CTX->pending_to_enter_widget_screen = 1;
}
else
{
if (WGUI_CTX->who_want_to_enter_widget_screen != 0 &&
WGUI_CTX->who_want_to_enter_widget_screen != WIDGET_VIRTUAL_SCREEN_ID &&
WGUI_CTX->who_want_to_enter_widget_screen != GetExitScrnID())
{
/*
* Someone want to enter the widget screen, but the interrupt occurs.
* We add the widget screen in the history.
*/
history currHistory;
currHistory.scrnID = WAP_SCREEN_WIDGET;
currHistory.entryFuncPtr = wap_entry_widget_screen;
SET_CHR_AT(currHistory.inputBuffer, 0, 0);
GetCategoryHistory (currHistory.guiBuffer);
AddHistory (currHistory);
WGUI_CTX->who_want_to_enter_widget_screen = WIDGET_VIRTUAL_SCREEN_ID;
}
else
{
#ifndef __UNIFIED_MSG_SUPPORT__
if ( !isInCall() || (isInCall() && GetWapCallPresent()) )
#endif /* __UNIFIED_MSG_SUPPORT__ */
{
/*
* It should never overlap MO/MT screen.
* If CSD call is active after WAP out-of-memory, we should allow enter widget screen
*/
widget_execute_MMI(widget_MMI_entry_new_screen_with_check, KAL_TRUE);
}
}
} /* if (WIPC_CTX->wait_message_notification_in_idle_screen) */
}
}
/*
* For screens that will put widget into History and go to new category screen,
* we set special flag on here (HDIa_widgetSetFocus),
* and we only go to new category screen if these flags are set
*
* FIXME move to widget_set_current_object
*/
/*
* If it goes back to widget screen from full-screen editor, WEDITOR_CTX->current_state is
* FULLSCREEN_EDITOR_RETURN_DONE or FULLSCREEN_EDITOR_RETURN_CANCEL
*
* wap_entry_widget_screen() invokes widget_paintbox_redraw(), which
* might set focus to the input gadget again. we should not override the value of WEDITOR_CTX->current_state
*/
if ((IS_GADGET_INPUT_TYPE(obj) || IS_EDITOR_TYPE(obj)) &&
(WEDITOR_CTX->current_state == FULLSCREEN_EDITOR_RETURN_NONE))
{
WEDITOR_CTX->current_state = FULLSCREEN_EDITOR_WANT_EXECUTE;
}
if (IS_GADGET_SELECT_GROUP_TYPE(obj) && !IS_WINDOW_TYPE(obj) /* gadget */
&& (_M(obj)->choice_type == MsfExclusiveChoice || _M(obj)->choice_type == MsfMultipleChoice)
&& WENTER_MENU_CTX->state == WIDGET_ENTER_MENU_NONE)
{
widget_init_fullscreen_menu();
WENTER_MENU_CTX->target_menu = _M(obj);
WENTER_MENU_CTX->state = WIDGET_ENTER_MENU_PREPARE_TO_ENTER;
}
/*
* For direct paint mode,
*/
if (WGUI_CTX->in_paintbox)
{
if (WIDGET_WANT_FOCUS_LIST & (1 << obj->data_type))
{
/*
* If paintbox is defocused, then it's active child will get focus
* * because our rule is the active child (first added child) will be focused if the parent is focused
* * but we don't want the first child gadget in paintbox automatically get focused.
*/
if (IS_PAINTBOX_TYPE(obj))
{
set_bit_flag(WGUI_CTX->current_focused_paintbox->flag, WIDGET_FLAG_HAS_FOCUS, has_focus);
}
else
{
set_bit_flag(WGUI_CTX->current_focused_paintbox->flag, WIDGET_FLAG_HAS_FOCUS, !has_focus);
}
widget_paint();
}
}
}
/*****************************************************************************
* FUNCTION
* widget_clear_keyfocus
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void widget_clear_keyfocus(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* widget_curr_keyfocus= */
widget_prev_keyfocus = widget_next_keyfocus = NULL;
}
/*****************************************************************************
* FUNCTION
* widget_register_keyfocus
* DESCRIPTION
*
* PARAMETERS
* handle [IN]
* RETURNS
*
*****************************************************************************/
kal_bool widget_register_keyfocus(widget_header_struct *handle)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (WGUI_CTX->in_paintbox)
{
if (WGUI_CTX->current_focused_paintbox->flag & WIDGET_FLAG_HAS_FOCUS)
{
return KAL_FALSE;
}
/* Set paintbox as the previous and next object to focus */
widget_prev_keyfocus = widget_next_keyfocus = _H(WGUI_CTX->current_focused_paintbox);
if (handle == WGUI_CTX->current_focused_gadget)
{
/* widget_curr_keyfocus = handle; */
return KAL_TRUE;
}
else /* For example: two inputboxs in a paintbox at the same time */
{
return KAL_FALSE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -