📄 widget_paint.c
字号:
else
{
if (handle == WGUI_CTX->current_focused_gadget)
{
return KAL_TRUE;
}
else /* For example: two inputboxs in a paintbox at the same time */
{
return KAL_FALSE;
}
}
}
/*****************************************************************************
* FUNCTION
* widget_position_compare
* DESCRIPTION
*
* PARAMETERS
* ax [IN]
* ay [IN]
* bx [IN]
* by [IN]
* RETURNS
*
*****************************************************************************/
static int widget_position_compare(int ax, int ay, int bx, int by)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (ay == by)
{
return ax - bx;
}
else
{
return ay - by;
}
}
/*****************************************************************************
* FUNCTION
* widget_reset_used_range
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void widget_reset_used_range(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
widget_current_widget_position_is_set = KAL_FALSE;
widget_max_x = -10000;
widget_max_y = -10000;
widget_min_x = 10000;
widget_min_y = 10000;
widget_prev_widget_position.x = -10000;
widget_prev_widget_position.y = -10000;
widget_next_widget_position.x = 10000;
widget_next_widget_position.y = 10000;
}
/*
* Only when !WGUI_CTX->in_paintbox
* * Input arguments x1, y1, x2, y2 are absolute coordinate on the device screen.
*/
/*****************************************************************************
* FUNCTION
* widget_record_used_range
* DESCRIPTION
*
* PARAMETERS
* h [IN]
* is_want_focus [IN]
* is_focus [IN]
* x1 [IN]
* y1 [IN]
* x2 [IN]
* y2 [IN]
* RETURNS
* void
*****************************************************************************/
void widget_record_used_range(
widget_header_struct *h,
kal_bool is_want_focus,
kal_bool is_focus,
int x1,
int y1,
int x2,
int y2)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (WGUI_CTX->in_paintbox)
{
return;
}
/* 20040226. Tmp check. To remove in the future */
// TODO: menu window (not 'gadget') do not need to record used region
if (!widget_form_gadget_want_focus(h) && !IS_MENU_TYPE(h) && is_want_focus)
{
WAP_DBG_ASSERT(0);
is_want_focus = KAL_FALSE;
}
if (widget_max_x < x2)
{
widget_max_x = x2;
}
if (widget_min_x > x1)
{
widget_min_x = x1;
}
if (widget_max_y < y2)
{
widget_max_y = y2;
}
if (widget_min_y > y1)
{
widget_min_y = y1;
}
if (is_want_focus) // TODO: I don't understand the code
{
if (is_focus) /* always the first one component */
{
widget_current_widget_position.x = x1;
widget_current_widget_position.y = y1;
widget_current_widget_position_is_set = KAL_TRUE;
}
else if (widget_current_widget_position_is_set) // TODO: It is WRONG if the focused gadget is not the first one and widget_paint is invoked for only one time
{
if (widget_position_compare(widget_current_widget_position.x, widget_current_widget_position.y, x1, y1) > 0)
{
/* upside component */
if (widget_position_compare(
widget_prev_widget_position.x,
widget_prev_widget_position.y,
x1,
y1) < 0
&& WGUI_CTX->display_pos.x <= x1 && WGUI_CTX->display_pos.x + WGUI_CTX->display_size.width >= x1)
{
widget_prev_widget_position.x = x1;
widget_prev_widget_position.y = y1;
widget_prev_widget_size.width = x2 - x1;
widget_prev_widget_size.height = y2 - y1;
widget_prev_keyfocus = h;
}
}
else
{
/* downside component */
if (widget_position_compare(
widget_next_widget_position.x,
widget_next_widget_position.y,
x1,
y1) > 0
&& WGUI_CTX->display_pos.x <= x1 && WGUI_CTX->display_pos.x + WGUI_CTX->display_size.width >= x1)
{
widget_next_widget_position.x = x1;
widget_next_widget_position.y = y1;
widget_next_widget_size.width = x2 - x1;
widget_next_widget_size.height = y2 - y1;
widget_next_keyfocus = h;
}
}
}
}
}
#ifdef __MMI_WALLPAPER_ON_BOTTOM__
/* store the image id of wallpaper */
/*****************************************************************************
* FUNCTION
* widget_paint_wallpaper
* DESCRIPTION
*
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
static void widget_paint_wallpaper()
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 img;
S8 fname[100] = {0};
S8 *pfn = fname;
S32 x, y;
U8 opacity;
S32 img_width, img_height;
GDI_RESULT ret;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* only get the opacity */
dm_get_scr_bg_image(&img, &pfn, &x, &y, &opacity);
gdi_layer_multi_layer_enable();
gdi_layer_get_base_handle(&wgui_base_layer);
gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
gdi_layer_clear(GDI_COLOR_TRANSPARENT);
if (wgui_layer_1 == (gdi_handle) NULL)
{
ret = gdi_layer_create(0, 0, UI_device_width, UI_device_height, &wgui_layer_1);
/* Create layer fail */
if (ret < 0)
{
return;
}
}
gdi_layer_push_and_set_active(wgui_layer_1);
gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
gdi_layer_set_opacity(TRUE, 150);
gdi_layer_clear(GDI_COLOR_WHITE);
/* Start to draw the background */
#ifdef __MMI_LITE_DISPLAY__
gdi_draw_solid_rect(
x,
y,
UI_device_width - 1,
UI_device_height - 1,
gdi_act_color_from_rgb(0xFF, current_MMI_theme->lite_disp_scr_bg_color->r, current_MMI_theme->lite_disp_scr_bg_color->g, current_MMI_theme->lite_disp_scr_bg_color->b));
#else
if (idle_screen_wallpaper_ID != 0) /* from resource */
{
gdi_image_get_dimension_id(idle_screen_wallpaper_ID, &img_width, &img_height);
if (img_width > UI_device_width || img_height > UI_device_height) /* the image is too large to fit the screen */
{
S32 resized_offset_x, resized_offset_y;
S32 resized_width, resized_height;
gdi_image_util_fit_bbox(
UI_device_width,
UI_device_height,
img_width,
img_height,
&resized_offset_x,
&resized_offset_y,
&resized_width,
&resized_height);
ret = gdi_image_draw_resized(
resized_offset_x,
resized_offset_y,
resized_width,
resized_height,
get_image(idle_screen_wallpaper_ID));
}
else
{
S32 offset_x = (UI_device_width - img_width) >> 1;
S32 offset_y = (UI_device_height - img_height) >> 1;;
gdi_image_draw_id(offset_x, offset_y, idle_screen_wallpaper_ID);
}
}
else /* from file */
{
gdi_image_get_dimension_file(idle_screen_wallpaper_name, &img_width, &img_height);
if (img_width > UI_device_width || img_height > UI_device_height) /* the image is too large to fit the screen */
{
S32 resized_offset_x, resized_offset_y;
S32 resized_width, resized_height;
gdi_image_util_fit_bbox(
UI_device_width,
UI_device_height,
img_width,
img_height,
&resized_offset_x,
&resized_offset_y,
&resized_width,
&resized_height);
ret = gdi_image_draw_resized_file(
resized_offset_x,
resized_offset_y,
resized_width,
resized_height,
idle_screen_wallpaper_name);
}
else
{
S32 offset_x = (UI_device_width - img_width) >> 1;
S32 offset_y = (UI_device_height - img_height) >> 1;
gdi_image_draw_file(offset_x, offset_y, idle_screen_wallpaper_name);
}
}
#endif
/* End of drawing the background */
gdi_layer_pop_and_restore_active();
gdi_layer_set_blt_layer(wgui_layer_1, wgui_base_layer, 0, 0);
wgui_set_wallpaper_on_bottom(MMI_TRUE);
#if defined (__MMI_UI_TRANSPARENT_EFFECT__) || defined (__MMI_UI_LIST_HIGHLIGHT_EFFECTS__)
gui_set_transparent_source_layer(wgui_layer_1); /* 110705 WAP menu Calvin added */
#endif
}
#endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ /* #ifdef __MMI_WALLPAPER_ON_BOTTOM__ */
/*****************************************************************************
* FUNCTION
* widget_paint_object
* DESCRIPTION
*
* PARAMETERS
* handle [IN]
* size [IN]
* pos [IN]
* RETURNS
* void
*****************************************************************************/
static void widget_paint_object(widget_header_struct *handle, MsfSize *size, MsfPosition *pos)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
static int paint_level = -1; /* only for MNT display tabs */
kal_uint8 is_draw_child = 1;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!WGUI_CTX->is_widget_screen)
{
return;
}
if (!handle)
{
return; /* null pointer should not be processed. */
}
WIDGET_LOG("widget_paint_object");
paint_level++;
WAP_DBG_ASSERT(widget_check_object_validity(handle));
/* ////////////////////////////////////////////////////////// */
/* Draw itself */
/* Draw title of current active window */
if (IS_WINDOW_TYPE(handle))
{
/* show title */
if (_W(handle)->property_mask & MSF_WINDOW_PROPERTY_TITLE)
{
if (_W(handle)->title)
{
widget_set_title(_W(handle)->title);
}
}
if (IS_DIALOG_TYPE(handle) &&
(WEDITOR_CTX->current_state == FULLSCREEN_EDITOR_RETURN_DONE ||
WEDITOR_CTX->current_state == FULLSCREEN_EDITOR_RETURN_CANCEL))
{
/*
* When the user finish the inputbox of the dialog (goback from the fullscreen editor),
* we will back to the browser (paintbox in widget screen).
* Because MsfDialog doesn't have the title, we use the previous paintbox's title.
*/
if (WGUI_CTX->current_focused_paintbox->title)
{
widget_set_title(WGUI_CTX->current_focused_paintbox->title);
}
}
if (_W(handle)->property_mask & MSF_WINDOW_PROPERTY_EXT_VOLUME_KEY)
{
#ifdef WIDGET_SMIL_VOL_KEY_SUPPORT
widget_setup_volume_key();
#endif
}
if (_W(handle)->property_mask & MSF_WINDOW_PROPERTY_EXT_STATUS_ICON)
{
WAP_DBG_ASSERT(IS_DIALOG_TYPE(handle)); /* Restricted to MsfDialog */
widget_setup_status_icons();
}
}
switch (_H(handle)->data_type)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -