📄 wgui_categories_popup.c
字号:
/*****************************************************************************
* FUNCTION
* ExitCategory62Screen
* DESCRIPTION
* Exits the category62 screen
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void ExitCategory62Screen(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* 052405 Calvin added */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
reset_small_screen();
#endif
/* Calvin end */
gui_hide_animations();
ExitCategoryFunction = MMI_dummy_function;
RedrawCategoryFunction = MMI_dummy_function;
GetCategoryHistory = dummy_get_history;
GetCategoryHistorySize = dummy_get_history_size;
}
/*****************************************************************************
* FUNCTION
* ShowCategory63Screen
* DESCRIPTION
* Displays the category63 screen
* PARAMETERS
* message [IN] Message string
* message_icon [IN]
* history_buffer [IN] History buffer
* MMI_ID_TYPE(?) [IN] Icon Message icon
* RETURNS
* void
*****************************************************************************/
void ShowCategory63Screen(U8 *message, U16 message_icon, U8 *history_buffer)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
dm_data_struct dm_data;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* 053005 Calvin added */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
set_small_screen();
#endif
/* Calvin end */
ShowCommonCategoryPopupScreen((UI_string_type) message, history_buffer);
ExitCategoryFunction = ExitCategory62Screen;
RedrawCategoryFunction = dm_redraw_category_screen;
GetCategoryHistory = dummy_get_history;
GetCategoryHistorySize = dummy_get_history_size;
dm_data.s32ScrId = (S32) GetActiveScreenId();
dm_data.s32CatId = MMI_CATEGORY62_ID;
dm_data.s32flags = 0;
dm_setup_data(&dm_data);
dm_add_image(get_image(message_icon), NULL, NULL);
dm_redraw_category_screen();
}
/*****************************************************************************
* FUNCTION
* ShowCategory64Screen
* DESCRIPTION
* Displays the category64 screen
* PARAMETERS
* message [IN] Message string
* message_icon [IN]
* history_buffer [IN] History buffer
* MMI_ID_TYPE(?) [IN] Icon Message icon
* RETURNS
* void
*****************************************************************************/
void ShowCategory64Screen(U16 message, U16 message_icon, U8 *history_buffer)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
dm_data_struct dm_data;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* 053005 Calvin added */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
set_small_screen();
#endif
/* Calvin end */
ShowCommonCategoryPopupScreen(get_string(message), history_buffer);
ExitCategoryFunction = ExitCategory62Screen;
RedrawCategoryFunction = dm_redraw_category_screen;
GetCategoryHistory = dummy_get_history;
GetCategoryHistorySize = dummy_get_history_size;
dm_data.s32ScrId = (S32) GetActiveScreenId();
dm_data.s32CatId = MMI_CATEGORY64_ID;
dm_data.s32flags = 0;
dm_setup_data(&dm_data);
dm_add_image(get_image(message_icon), NULL, NULL);
dm_redraw_category_screen();
}
/* Leo start 20050722, pen down on image close popup */
#if (defined __MMI_TOUCH_SCREEN__)
/*****************************************************************************
* FUNCTION
* Cat65ImagePenDownHdlr
* DESCRIPTION
*
* PARAMETERS
* point [IN]
* RETURNS
*
*****************************************************************************/
MMI_BOOL Cat65ImagePenDownHdlr(mmi_pen_point_struct point)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (PopupFunc == NULL)
{
PopupTimerFlagEnable();
PopupCloseByPressAnyKey();
return MMI_TRUE;
}
else
{
return MMI_FALSE;
}
}
#endif /* (defined __MMI_TOUCH_SCREEN__) */
/* Len end 20050722 */
/*****************************************************************************
* FUNCTION
* ShowCategory65Screen
* DESCRIPTION
* Displays the category65 screen
* PARAMETERS
* message [IN] Message string
* message_icon [IN]
* history_buffer [IN] History buffer
* MMI_ID_TYPE(?) [IN] Icon Message icon
* RETURNS
* void
*****************************************************************************/
void ShowCategory65Screen(U8 *message, U16 message_icon, U8 *history_buffer)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
dm_data_struct dm_data;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* 052405 Calvin added */
#ifdef __MMI_UI_SMALL_SCREEN_SUPPORT__
set_small_screen();
#endif
/* Calvin end */
ShowCommonCategoryPopupScreen((UI_string_type) message, history_buffer);
#ifdef __MMI_TOUCH_SCREEN__
wgui_register_category_screen_control_area_pen_handlers(Cat65ImagePenDownHdlr, MMI_PEN_EVENT_DOWN);
#endif
ExitCategoryFunction = ExitCategory62Screen;
RedrawCategoryFunction = dm_redraw_category_screen;
GetCategoryHistory = dummy_get_history;
GetCategoryHistorySize = dummy_get_history_size;
dm_data.s32ScrId = (S32) GetActiveScreenId();
dm_data.s32CatId = MMI_CATEGORY64_ID;
dm_data.s32flags = 0;
dm_setup_data(&dm_data);
dm_add_image(get_image(message_icon), NULL, NULL);
dm_redraw_category_screen();
}
#if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
typedef struct
{
S16 image_x; /* left-top corner of image */
S16 image_y;
U16 image_id;
U16 state;
} gui_calibration_screen_struct;
static gui_calibration_screen_struct g_gui_calibration_screen_cntx;
/*****************************************************************************
* FUNCTION
* UpdateCalibrationScreen
* DESCRIPTION
* Updates Multiline buffer contents before redrawing calibration setting screens.
* PARAMETERS
* image_id [IN]
* cali_x [IN] The position of central point of image (i.e. the calibration point)
* cali_y [IN]
* string [IN]
* state [IN] Casted from PHNSET_CALIBRATION_STATE_ENUM
* redraw [IN] Redraw the category screen
* image(?) [IN]
* RETURNS
* void
* REMARKS
* We should avoid overlapping of image and text
*****************************************************************************/
void UpdateCalibrationScreen(U16 image_id, S16 cali_x, S16 cali_y, U16 string, U16 state, BOOL redraw)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
S32 l, fh, image_width = 0, image_height = 0;
S32 yloc = 0; /* start y coordinate *//* 111605 warning Calvin */
S32 maxht; /* maximum height of Multiline Box */
S32 max_space; /* max_space is the available height excluding the image */
PU8 image;
S32 image_x1, image_y1, image_x2, image_y2;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
g_gui_calibration_screen_cntx.image_id = image_id;
g_gui_calibration_screen_cntx.state = state;
if (image_id)
{
image = get_image((MMI_ID_TYPE) image_id);
gui_measure_image(image, &image_width, &image_height);
image_x1 = g_gui_calibration_screen_cntx.image_x = (S16) (cali_x - (image_width >> 1));
image_y1 = g_gui_calibration_screen_cntx.image_y = (S16) (cali_y - (image_height >> 1));
image_x2 = image_x1 + image_width - 1;
image_y2 = image_x1 + image_height - 1;
MMI_DBG_ASSERT(image_x1 >= 0 && image_x2 < UI_device_width && image_y1 >= 0 && image_y2 < UI_device_height);
}
else
{
image = NULL;
image_x1 = image_y1 = image_x2 = image_y2 = 0;
}
/* Compute inputbox height */
MMI_message_string = (UI_string_type) GetString(string);
l = gui_strlen(MMI_message_string);
create_multiline_inputbox_set_buffer(MMI_message_string, l, l, 0);
MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_DISABLE_CURSOR_DRAW
| UI_MULTI_LINE_INPUT_BOX_CENTER_JUSTIFY
| UI_MULTI_LINE_INPUT_BOX_DISABLE_BACKGROUND
| UI_MULTI_LINE_INPUT_BOX_DISABLE_SCROLLBAR | UI_MULTI_LINE_INPUT_BOX_VIEW_MODE;
resize_multiline_inputbox(UI_device_width - 2, UI_device_height);
show_multiline_inputbox_no_draw();
fh = get_multiline_inputbox_line_height();
/* Move the inputbox to appropriate position */
#ifdef __MMI_MAINLCD_128X128__
maxht = (MMI_multiline_inputbox.n_lines * fh) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y + 10;
#else
maxht = (MMI_multiline_inputbox.n_lines * fh) + MULTILINE_INPUTBOX_HEIGHT_PAD + MMI_multiline_inputbox.text_y;
#endif
if (maxht > UI_device_height)
{
maxht = UI_device_height;
}
switch (state)
{
case CALIBRATION_WELCOME_STATE:
yloc = (UI_device_height >> 1) - (maxht >> 1);
break;
case CALIBRATION_TOP_LEFT_POINT_STATE:
max_space = UI_device_height - image_y2 - 1;
if (maxht > max_space)
{
yloc = image_y2 + 1;
maxht = max_space;
}
else
{
yloc = image_y2 + 1 + (max_space - maxht) / 3;
}
break;
case CALIBRATION_CENTER_POINT_STATE:
max_space = image_y1 - 1;
if (maxht > max_space)
{
yloc = 0;
maxht = max_space;
}
else
{
yloc = (max_space >> 1) - (maxht >> 1);
}
break;
case CALIBRATION_BOTTOM_RIGHT_POINT_STATE:
max_space = image_y1 - 1;
if (maxht > max_space)
{
yloc = 0;
maxht = max_space;
}
else
{
yloc = (max_space - maxht) * 2 / 3;
}
break;
default:
MMI_ASSERT(0);
break;
}
resize_multiline_inputbox(UI_device_width - 2, maxht);
move_multiline_inputbox(1, yloc);
if (redraw)
{
RedrawCalibrationScreen();
}
}
/*****************************************************************************
* FUNCTION
* ExitCalibrationScreen
* DESCRIPTION
* Exits Calibration Screen
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void ExitCalibrationScreen(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
gui_hide_animations();
ExitCategoryFunction = MMI_dummy_function;
RedrawCategoryFunction = MMI_dummy_function;
GetCategoryHistory = dummy_get_history;
GetCategoryHistorySize = dummy_get_history_size;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -