📄 jui_widget.c
字号:
c = *current_MMI_theme->lite_disp_scr_bg_color;
if((GDI_HANDLE)get_status_icon_bar_layer(0)!=GDI_ERROR_HANDLE)
{
gdi_layer_push_and_set_active(get_status_icon_bar_layer(0));
}
/* set clip region */
gui_push_clip();
get_status_icon_bar_clip(0, &x1, &y1, &x2, &y2); /* get teh clip values of bar_id */
gui_set_clip(x1, y1, x2, y2);
gui_fill_rectangle(x1, y1, x2, y2, c); /* fill the icon position with grey color */
gui_pop_clip();
if((GDI_HANDLE)get_status_icon_bar_layer(0)!=GDI_ERROR_HANDLE)
{
gdi_layer_pop_and_restore_active();
}
}
/*****************************************************************************
* FUNCTION
* jui_widget_set_title
* DESCRIPTION
* Set title
* PARAMETERS
* title [IN] Title string buffer
* title_length [IN] Title string buffer length
* RETURNS
* void
*****************************************************************************/
void jui_widget_set_title(kal_uint16 *title, kal_int32 title_length)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (title == NULL)
{
jui_widget_override_mode_setting(JUI_OBJ_TITLE_BAR, KAL_FALSE);
title_length = 0;
}
else
{
jui_widget_override_mode_setting(JUI_OBJ_TITLE_BAR, KAL_TRUE);
}
kal_trace(TRACE_GROUP_5,
FUNC_J2ME_JUI_TITLE,
__LINE__,
jui_widget_obj_show_status(JUI_OBJ_TITLE_BAR),
jui_title_is_shown,
(jui_widget_act_mode_idx == JUI_SCREEN_MODE_FULL),
jui_hardware_layer_handle,
title);
if (title_length > JUI_MAX_TITLE_LENGTH)
{
title_length = JUI_MAX_TITLE_LENGTH;
}
if (title_length)
{
memcpy(jui_title_buffer, title, title_length * 2);
}
jui_title_buffer[title_length] = 0;
}
#if defined (MMI_SHOW_STATUS_ICON_IN_TITLE)
/*****************************************************************************
* FUNCTION
* jui_title_oem_show_normal_ex
* DESCRIPTION
* Show title
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void jui_title_oem_show_normal_ex(void)
{
if(!jvm_is_own_screen() || (jui_widget_act_mode_idx == JUI_SCREEN_MODE_FULL) ||
!jui_widget_obj_show_status(JUI_OBJ_TITLE_BAR))
{
return;
}
gdi_layer_lock_frame_buffer();
if ((jui_status_icon_layer_handle != GDI_LAYER_EMPTY_HANDLE) &&
(jui_hardware_layer_handle != GDI_LAYER_EMPTY_HANDLE))
{
gdi_layer_push_and_set_active(jui_status_icon_layer_handle);
}
gui_title_oem_show_normal_ex();
if ((jui_status_icon_layer_handle != GDI_LAYER_EMPTY_HANDLE) &&
(jui_hardware_layer_handle != GDI_LAYER_EMPTY_HANDLE))
{
gdi_layer_pop_and_restore_active();
}
wgui_status_icon_integrated_register_redraw(jui_title_oem_show_normal_ex);
gdi_layer_unlock_frame_buffer();
}
#endif
/*****************************************************************************
* FUNCTION
* jui_widget_show_title
* DESCRIPTION
* Show title
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void jui_widget_show_title(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
gdi_handle org_layer_handle = GDI_LAYER_EMPTY_HANDLE;
gdi_layer_struct* base_layer = (gdi_layer_struct*)jui_layer_handle;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_trace(TRACE_GROUP_5,
FUNC_J2ME_JUI_TITLE,
__LINE__,
jui_widget_obj_show_status(JUI_OBJ_TITLE_BAR),
jui_title_is_shown,
(jui_widget_act_mode_idx == JUI_SCREEN_MODE_FULL),
jui_hardware_layer_handle,
jui_status_icon_layer_handle);
jui_lcd_mutex_lock();
/* in case of vm is running in the background */
if ((jui_layer_handle == GDI_LAYER_EMPTY_HANDLE) ||
(jui_status_icon_layer_handle == GDI_LAYER_EMPTY_HANDLE))
{
if ((!jui_widget_obj_show_status(JUI_OBJ_TITLE_BAR)) || (jui_widget_act_mode_idx == JUI_SCREEN_MODE_FULL))
{
if (jui_title_is_shown)
{
jui_title_is_shown = KAL_FALSE;
#if defined (SUPPORT_MMAPI)
/* video or video recorder is active and coordinate is changed */
jma_video_player_update_is_title_displayed();
#endif
}
}
else
{
if (!jui_title_is_shown)
{
jui_title_is_shown = KAL_TRUE;
#if defined (SUPPORT_MMAPI)
/* video or video recorder is active and coordinate is changed */
jma_video_player_update_is_title_displayed();
#endif
}
}
jui_lcd_mutex_unlock();
return;
}
if ((!jui_widget_obj_show_status(JUI_OBJ_TITLE_BAR)) || (jui_widget_act_mode_idx == JUI_SCREEN_MODE_FULL))
{
if (jui_title_is_shown)
{
jui_title_is_shown = KAL_FALSE;
if(!jvm_is_own_screen()){
#if defined (SUPPORT_MMAPI)
/* video or video recorder is active and coordinate is changed */
jma_video_player_update_is_title_displayed();
#endif
jui_lcd_mutex_unlock();
return;
}
#if defined (MMI_SHOW_STATUS_ICON_IN_TITLE)
wgui_status_icon_integrated_enable(KAL_FALSE);
wgui_status_icon_integrated_register_redraw(NULL);
#endif
gdi_layer_push_and_set_active(jui_status_icon_layer_handle);
gdi_draw_solid_rect(0, jui_title_offset, jui_ui_device_width - 1, jui_title_offset + MMI_title_height - 1, GDI_COLOR_TRANSPARENT);
gdi_layer_pop_and_restore_active();
#if defined (SUPPORT_MMAPI)
/* video or video recorder is active and coordinate is changed */
jma_video_player_update_is_title_displayed();
#endif
}
jui_lcd_mutex_unlock();
return;
}
jui_lcd_mutex_unlock();
JAL_LOCK_MUTEX
MMI_title_string = (UI_string_type) jui_title_buffer;
MMI_menu_shortcut_number = -1;
MMI_title_icon = NULL;
#if defined (MMI_SHOW_STATUS_ICON_IN_TITLE)
if (g_wgui_status_bar_integrated_disabled)
{
wgui_status_icon_integrated_enable(KAL_TRUE);
wgui_status_icon_integrated_register_redraw(jui_title_oem_show_normal_ex);
}
#endif
gdi_layer_lock_frame_buffer();
gdi_image_abm_get_source_layer(&org_layer_handle);
gdi_image_abm_set_source_layer(jui_layer_handle);
draw_title();
gdi_image_abm_set_source_layer(org_layer_handle);
gdi_layer_unlock_frame_buffer();
if ( jui_double_buffer_activated )
{
memcpy(((gdi_layer_struct*)jui_blt_handle)->buf_ptr , base_layer->buf_ptr, jui_ui_device_width * MMI_title_height * 2);
}
gdi_layer_push_and_set_active(jui_status_icon_layer_handle);
if ((jui_hardware_layer_handle == GDI_LAYER_EMPTY_HANDLE))
{
gdi_draw_solid_rect(0, jui_title_offset, jui_ui_device_width - 1, jui_title_offset + MMI_title_height - 1, GDI_COLOR_TRANSPARENT);
}
else
{
#if defined (MMI_SHOW_STATUS_ICON_IN_TITLE)
wgui_status_icon_integrated_enable(KAL_TRUE);
wgui_status_icon_integrated_register_redraw(jui_title_oem_show_normal_ex);
#endif
gdi_resize_bitblt(
jui_layer_handle,
0,
0,
jui_ui_device_width - 1,
MMI_title_height - 1,
0,
jui_title_offset,
jui_ui_device_width - 1,
jui_title_offset + MMI_title_height - 1);
}
gdi_layer_pop_and_restore_active();
gdi_layer_blt_previous(0, jui_title_offset, jui_ui_device_width - 1, jui_title_offset + MMI_title_height - 1);
JAL_UNLOCK_MUTEX
if (!jui_title_is_shown)
{
jui_title_is_shown = KAL_TRUE;
#if defined (SUPPORT_MMAPI)
/* video or video recorder is active and coordinate is changed */
jma_video_player_update_is_title_displayed();
#endif
}
}
/*****************************************************************************
* FUNCTION
* jui_widget_is_title_displayed
* DESCRIPTION
* tell if title exists or not
* PARAMETERS
*
* RETURNS
* void
*****************************************************************************/
kal_bool jui_widget_is_title_displayed (void)
{
return jui_title_is_shown;
}
/* kal_int32 LCDUIgetPixel(kal_int32 rgb, kal_int32 gray, kal_int32 isGray) */
/*****************************************************************************
* FUNCTION
* jui_widget_get_pixel
* DESCRIPTION
* get pixel data
* PARAMETERS
* rgb [IN]
* gray [IN]
* isGray [IN]
* RETURNS
*
*****************************************************************************/
kal_int32 jui_widget_get_pixel(kal_int32 rgb, kal_int32 gray, kal_int32 isGray)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
return rgb;
}
/* void j2me_init_layer(void) // this function is used for VM initializeWindowSystem */
/*****************************************************************************
* FUNCTION
* jui_widget_init_layer
* DESCRIPTION
* init layer data
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
kal_int32 jui_widget_init_layer(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 *img_ptr = (U8*) get_image(IMG_SI_JAVA_CONNECT);
S32 width, height;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#if defined (MMI_SHOW_STATUS_ICON_IN_TITLE)
jui_title_offset = 0;
#else
jui_title_offset = MMI_status_bar_height;
#endif
kal_trace(TRACE_GROUP_5,
FUNC_J2ME_JUI_INIT,
__LINE__,
jvm_is_own_screen(),
jui_title_offset,
jui_layer_handle,
jui_lcd_buffer,
jui_icon_lcd_buffer,
jui_icon_layer_handle,
jui_soft_button_layer_handle,
jui_status_icon_layer_handle);
jui_lcd_mutex_lock();//protect jvm_is_own_screen
if (jvm_is_own_screen())
{
wgui_cat176_set_jui_menu_filler();//011507 menu
jui_lcd_buffer_size = (jui_ui_device_width * jui_ui_device_height) << 1;
jui_lcd_buffer = (kal_uint16*) jvm_malloc(jui_lcd_buffer_size);
if ( jui_lcd_buffer == NULL )
{
ASSERT(0);
}
#ifdef __JUI_USE_DOUBLE_BUFFER_LAYER__
jui_lcd_buffer_double = (kal_uint16*) mmi_frm_scrmem_alloc(jui_lcd_buffer_size);
if ( jui_lcd_buffer_double == NULL )
{
ASSERT(0);
}
#endif/* __JUI_USE_DOUBLE_BUFFER_LAYER__ */
if ((img_ptr != NULL) && jam_get_net_icon_setting())
{
gdi_image_get_dimension(img_ptr, &width, &height);
jui_icon_layer_buffer_size = (width * height) << 1;
jui_icon_lcd_buffer = (kal_uint16*) jvm_malloc(jui_icon_layer_buffer_size);
if ( jui_icon_lcd_buffer == NULL )
{
ASSERT(0);
}
gdi_layer_create_using_outside_memory(
(jui_ui_device_width - width) >> 1,
0,
width,
height,
&jui_icon_layer_handle,
(U8*) jui_icon_lcd_buffer,
((width * height) << 1));
gdi_layer_push_and_set_active(jui_icon_layer_handle);
gdi_layer_set_opacity(TRUE, 150);
gdi_layer_set_source_key(TRUE, GDI_COLOR_TRANSPARENT);
gdi_layer_clear(GDI_COLOR_TRANSPARENT);
gdi_image_draw(0, 0, img_ptr);
gdi_layer_pop_and_restore_active();
}
else
{
jui_icon_layer_handle = GDI_LAYER_EMPTY_HANDLE;
}
jui_lcd_mutex_unlock();
kal_trace(TRACE_GROUP_5,
FUNC_J2ME_JUI_INIT,
__LINE__,
jui_lcd_buffer_size,
jui_lcd_buffer_double,
jui_layer_handle,
jui_lcd_buffer,
jui_icon_lcd_buffer,
jui_icon_layer_handle,
img_ptr,
jui_icon_layer_buffer_size);
return 0;
}
else
{
jui_lcd_mutex_unlock();
return -1;
}
}
/*****************************************************************************
* FUNCTION
* jui_widget_deinit_layer
* DESCRIPTION
* deinit layer data
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void jui_widget_deinit_layer(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
kal_trace(TRACE_GROUP_5,
FUNC_J2ME_JUI_DEINIT,
jui_layer_handle,
jui_lcd_buffer,
jui_lcd_buffer_double,
jui_icon_lcd_buffer,
jui_icon_layer_handle,
jui_soft_button_layer_handle,
jui_status_icon_layer_handle);
/* Fix to check jui_lcd_buffer before release */
jui_is_hide_status_icon = KAL_FALSE;
if (jui_lcd_buffer)
{
jvm_free(jui_lcd_buffer);
jui_lcd_buffer = NULL;
}
#ifdef __JUI_USE_DOUBLE_BUFFER_LAYER__
if ( jui_lcd_buffer_double != NULL )
{
mmi_frm_scrmem_free ((void*) jui_lcd_buffer_double );
jui_lcd_buffer_double = NULL;
}
#endif/* __JUI_USE_DOUBLE_BUFFER_LAYER__ */
if ( jui_icon_layer_handle != GDI_LAYER_EMPTY_HANDLE )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -