wgui_inline_edit.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:887k
源码类别:
MTK
开发平台:
C/C++
- clear_time_period_input_callback();
- #if defined(__MMI_TOUCH_SCREEN__)
- wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY);
- //W06.09 Draw Center Softkey when entering new screen
- //But in in-line editor, redrawing is needed when completing in-line item
- #ifdef __MMI_WGUI_CSK_ENABLE__
- redraw_softkey(MMI_CENTER_SOFTKEY);
- #endif
- #endif /* defined(__MMI_TOUCH_SCREEN__) */
- }
- /*****************************************************************************
- * FUNCTION
- * handle_inline_time_period_edit_cancel
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void handle_inline_time_period_edit_cancel(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_inline_fixed_list_keys();
- clear_left_softkey();
- clear_right_softkey();
- register_left_softkey_handler();
- register_right_softkey_handler();
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- mmi_pen_editor_close_input_box();
- #endif
- wgui_inline_item_handled = 0;
- wgui_text_menuitem_restart_scrolling();
- inline_edit_current_highlight_handler(wgui_inline_item_highlighted_index);
- redraw_current_inline_item = UI_dummy_function;
- complete_inline_item_edit = UI_dummy_function;
- set_current_time_period_input(NULL);
- clear_time_period_input_callback();
- #if defined(__MMI_TOUCH_SCREEN__)
- wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY);
- //W06.09 Draw Center Softkey when entering new screen
- //But in in-line editor, redrawing is needed when completing in-line item
- #ifdef __MMI_WGUI_CSK_ENABLE__
- redraw_softkey(MMI_CENTER_SOFTKEY);
- #endif
- #endif /* defined(__MMI_TOUCH_SCREEN__) */
- }
- /*****************************************************************************
- * FUNCTION
- * redraw_inline_time_period_edit
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void redraw_inline_time_period_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- time_period_input_show_background(&wgui_inline_time_period_input);
- show_time_period_input(&wgui_inline_time_period_input);
- }
- /*****************************************************************************
- * FUNCTION
- * inline_time_period_edit_handle_down_arrow
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void inline_time_period_edit_handle_down_arrow(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- handle_inline_time_period_edit_complete();
- inline_fixed_list_goto_next_item();
- }
- /*****************************************************************************
- * FUNCTION
- * inline_time_period_edit_handle_up_arrow
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void inline_time_period_edit_handle_up_arrow(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- handle_inline_time_period_edit_complete();
- inline_fixed_list_goto_previous_item();
- }
- /*****************************************************************************
- * FUNCTION
- * inline_time_period_input_key_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * vkey_code [IN]
- * key_state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void inline_time_period_input_key_handler(S32 vkey_code, S32 key_state)
- {
- #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (key_state)
- {
- switch (vkey_code)
- {
- case 37:
- time_period_input_previous_character();
- break;
- case 38:
- inline_time_period_edit_handle_up_arrow();
- break;
- case 39:
- time_period_input_next_character();
- break;
- case 40:
- inline_time_period_edit_handle_down_arrow();
- break;
- case 36: /* home */
- break;
- case 35: /* end */
- break;
- case 33: /* page up */
- break;
- case 34: /* page down */
- break;
- case 45:
- time_period_input_toggle_insert_mode();
- break;
- case 46:
- time_period_input_delete_current_character();
- break;
- }
- }
- #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- UI_UNUSED_PARAMETER(vkey_code);
- UI_UNUSED_PARAMETER(key_state);
- #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- }
- /*****************************************************************************
- * FUNCTION
- * handle_inline_time_period_edit_input
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void handle_inline_time_period_edit_input(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- set_wgui_inline_list_menu_changed();
- }
- /* History implementation for inline time_period edit */
- typedef struct _inline_time_period_edit_history
- {
- U16 history_ID;
- S16 current_focus;
- S16 current_position;
- S16 dummy; /* Added for history issue on hardware */
- U32 flags;
- } inline_time_period_edit_history;
- /*****************************************************************************
- * FUNCTION
- * inline_time_period_edit_get_history
- * DESCRIPTION
- *
- * PARAMETERS
- * history_buffer [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 *inline_time_period_edit_get_history(U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (history_buffer != NULL)
- {
- U16 hID = (U16) (INLINE_TIME_PERIOD_HISTORY_ID | 0x8000);
- inline_time_period_edit_history *h = (inline_time_period_edit_history*) history_buffer;
- h->history_ID = hID;
- h->current_focus = (S16) wgui_inline_time_period_input.current_focus;
- if (wgui_inline_time_period_input.focus_input_box != NULL)
- {
- h->current_position =
- (S16) (wgui_inline_time_period_input.focus_input_box->current_text_p -
- wgui_inline_time_period_input.focus_input_box->text);
- }
- h->flags = wgui_inline_time_period_input.flags;
- }
- return (history_buffer);
- }
- /*****************************************************************************
- * FUNCTION
- * inline_time_period_edit_set_history
- * DESCRIPTION
- *
- * PARAMETERS
- * history_ID [IN]
- * history_buffer [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 inline_time_period_edit_set_history(U16 history_ID, U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (history_buffer != NULL)
- {
- inline_time_period_edit_history *h = (inline_time_period_edit_history*) history_buffer;
- if (history_valid(h->history_ID, history_ID))
- {
- wgui_inline_time_period_input.current_focus = h->current_focus;
- time_period_input_reset_focus(&wgui_inline_time_period_input);
- time_period_input_set_focus(&wgui_inline_time_period_input);
- if (wgui_inline_time_period_input.focus_input_box != NULL)
- {
- wgui_inline_time_period_input.focus_input_box->current_text_p =
- wgui_inline_time_period_input.focus_input_box->text + h->current_position;
- }
- wgui_inline_time_period_input.flags = h->flags;
- return (1);
- }
- }
- return (0);
- }
- extern UI_filled_area time_period_input_background_filler;
- /*****************************************************************************
- * FUNCTION
- * handle_inline_time_period_edit
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * width [IN]
- * height [IN]
- * key_code [IN]
- * key_event [IN]
- * text_p [IN]
- * item [?]
- * flags [IN]
- * history_buffer [?]
- * RETURNS
- * void
- *****************************************************************************/
- void handle_inline_time_period_edit(
- S32 x,
- S32 y,
- S32 width,
- S32 height,
- S32 key_code,
- S32 key_event,
- U8 **text_p,
- void *item,
- U32 flags,
- U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_time_period *i = (wgui_inline_item_time_period*) item;
- S32 xx;
- U32 dtflags = 0;
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- mmi_pen_handwriting_area_struct stroke_area;
- mmi_pen_handwriting_area_struct ext_stroke;
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_UNUSED_PARAMETER(key_code);
- UI_UNUSED_PARAMETER(key_event);
- UI_UNUSED_PARAMETER(flags);
- wgui_current_inline_item_type = INLINE_ITEM_TYPE_TIME_PERIOD;
- /* MTK Elvis for R2L characters */
- if (!r2lMMIFlag)
- {
- if (MMI_fixed_icontext_menuitem.text_x == 2)
- {
- xx = -1;
- }
- else
- {
- xx = MMI_fixed_icontext_menuitem.text_x;
- }
- }
- else
- {
- xx = 6;
- }
- /* MTK end */
- if (flags & INLINE_ITEM_LEFT_ALIGN)
- {
- xx = -1;
- }
- switch (flags & INLINE_ITEM_JUSTIFY_MASK)
- {
- case INLINE_ITEM_RIGHT_JUSTIFY:
- dtflags |= TIME_PERIOD_INPUT_RIGHT_JUSTIFY;
- break;
- case INLINE_ITEM_CENTER_JUSTIFY:
- dtflags |= TIME_PERIOD_INPUT_CENTER_JUSTIFY;
- break;
- }
- if (flags & INLINE_ITEM_DISABLE_HIGHLIGHT)
- {
- time_period_input_background_filler = MMI_inputbox_normal_filler; /* *MMI_fixed_list_menu.normal_filler; */
- time_period_input_background_filler.flags &= 0x00000fff;
- }
- else
- {
- time_period_input_background_filler = MMI_inputbox_normal_filler; /* *MMI_fixed_icontext_menuitem.focussed_filler; */
- time_period_input_background_filler.flags &= 0x00000fff;
- }
- complete_inline_item_edit = handle_inline_time_period_edit_complete;
- current_wgui_inline_time_period_item = i;
- current_wgui_inline_time_period_text_p = text_p;
- gui_strcpy((UI_string_type) wgui_inline_time_period_edit_hours_buffer1, (UI_string_type) i->hours_buffer1);
- gui_strcpy((UI_string_type) wgui_inline_time_period_edit_minutes_buffer1, (UI_string_type) i->minutes_buffer1);
- gui_strcpy((UI_string_type) wgui_inline_time_period_edit_hours_buffer2, (UI_string_type) i->hours_buffer2);
- gui_strcpy((UI_string_type) wgui_inline_time_period_edit_minutes_buffer2, (UI_string_type) i->minutes_buffer2);
- wgui_inline_time_period_AM_PM_flag1 = i->AM_PM_flag1;
- wgui_inline_time_period_AM_PM_flag2 = i->AM_PM_flag2;
- /* MTK Elvis for R2L characters */
- if (!r2lMMIFlag)
- {
- create_time_period_input(
- &wgui_inline_time_period_input,
- x + xx,
- y,
- width - 1 - xx,
- height,
- dtflags,
- wgui_inline_time_period_edit_hours_buffer1,
- wgui_inline_time_period_edit_minutes_buffer1,
- wgui_inline_time_period_edit_hours_buffer2,
- wgui_inline_time_period_edit_minutes_buffer2);
- }
- else
- {
- create_time_period_input(
- &wgui_inline_time_period_input,
- x + xx,
- y,
- width - 1 - MMI_fixed_icontext_menuitem.text_x,
- height,
- dtflags,
- wgui_inline_time_period_edit_hours_buffer1,
- wgui_inline_time_period_edit_minutes_buffer1,
- wgui_inline_time_period_edit_hours_buffer2,
- wgui_inline_time_period_edit_minutes_buffer2);
- }
- /* MTK end */
- inline_time_period_edit_set_history(INLINE_TIME_PERIOD_HISTORY_ID, history_buffer);
- time_period_input_set_seperators(&wgui_inline_time_period_input, (UI_character_type) ':', (UI_character_type) '-');
- time_period_input_show_background(&wgui_inline_time_period_input);
- show_time_period_input(&wgui_inline_time_period_input);
- set_current_time_period_input(&wgui_inline_time_period_input);
- time_period_input_register_keys();
- register_keyboard_key_handler(inline_time_period_input_key_handler);
- SetKeyHandler(inline_time_period_edit_handle_down_arrow, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(inline_time_period_edit_handle_up_arrow, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(inline_time_period_edit_handle_down_arrow, KEY_VOL_DOWN, KEY_EVENT_DOWN);
- SetKeyHandler(inline_time_period_edit_handle_up_arrow, KEY_VOL_UP, KEY_EVENT_DOWN);
- register_time_period_input_callback(handle_inline_time_period_edit_input);
- redraw_current_inline_item = redraw_inline_time_period_edit;
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- ext_stroke.x1 = 0;
- ext_stroke.y1 = 0;
- ext_stroke.x2 = UI_device_width - 1;
- ext_stroke.y2 = UI_device_height - 1;
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #else /* 0 */
- stroke_area.x1 = MMI_content_x;
- stroke_area.x2 = MMI_content_x + MMI_content_width - MMI_fixed_list_menu.vbar.width;
- stroke_area.y1 = MMI_title_y;
- stroke_area.y2 = MMI_title_y + MMI_content_height + MMI_title_height;
- #endif /* 0 */
- mmi_pen_editor_setup_input_box(&stroke_area, &ext_stroke, INPUT_TYPE_NUMERIC, MMI_FALSE, PEN_EDITOR_TIME_PERIOD);
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- }
- /*****************************************************************************
- * FUNCTION
- * SetInlineItemTimePeriod
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * hours_buffer1 [?]
- * minutes_buffer1 [?]
- * AM_PM_flag1 [?]
- * hours_buffer2 [?]
- * minutes_buffer2 [?]
- * AM_PM_flag2 [?]
- * f [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineItemTimePeriod(
- InlineItem *item,
- U8 *hours_buffer1,
- U8 *minutes_buffer1,
- U8 *AM_PM_flag1,
- U8 *hours_buffer2,
- U8 *minutes_buffer2,
- U8 *AM_PM_flag2,
- void (*f) (U8 *string_buffer, U8 *hours_buffer1, U8 *minutes_buffer1, U8 *AM_PM_flag1, U8 *hours_buffer2, U8 *minutes_buffer2, U8 *AM_PM_flag2))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_time_period *i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (n_inline_time_period_items >= MAX_INLINE_TIME_PERIOD_ITEMS)
- {
- return;
- }
- item->item = (void*)&wgui_inline_time_period_items[n_inline_time_period_items];
- item->flags = INLINE_ITEM_TYPE_TIME_PERIOD;
- item->text_p = (U8*) wgui_inline_time_period_display_strings[n_inline_time_period_items];
- n_inline_time_period_items++;
- i = (wgui_inline_item_time_period*) item->item;
- i->hours_buffer1 = hours_buffer1;
- i->minutes_buffer1 = minutes_buffer1;
- i->AM_PM_flag1 = AM_PM_flag1;
- i->hours_buffer2 = hours_buffer2;
- i->minutes_buffer2 = minutes_buffer2;
- i->AM_PM_flag2 = AM_PM_flag2;
- i->flags = INLINE_ITEM_LEFT_JUSTIFY;
- i->string_construct_callback = f;
- i->string_construct_callback(
- item->text_p,
- i->hours_buffer1,
- i->minutes_buffer1,
- i->AM_PM_flag1,
- i->hours_buffer2,
- i->minutes_buffer2,
- i->AM_PM_flag2);
- item->handler = handle_inline_time_period_edit;
- }
- /*****************************************************************************
- * FUNCTION
- * ReConfigureInlineItemTimePeriod
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * hours_buffer1 [?]
- * minutes_buffer1 [?]
- * AM_PM_flag1 [?]
- * hours_buffer2 [?]
- * minutes_buffer2 [?]
- * AM_PM_flag2 [?]
- * f [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ReConfigureInlineItemTimePeriod(
- InlineItem *item,
- U8 *hours_buffer1,
- U8 *minutes_buffer1,
- U8 *AM_PM_flag1,
- U8 *hours_buffer2,
- U8 *minutes_buffer2,
- U8 *AM_PM_flag2,
- void (*f) (U8 *string_buffer, U8 *hours_buffer1, U8 *minutes_buffer1, U8 *AM_PM_flag1, U8 *hours_buffer2, U8 *minutes_buffer2, U8 *AM_PM_flag2))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_time_period *i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((item->flags & 0xff) != INLINE_ITEM_TYPE_TIME_PERIOD)
- {
- return;
- }
- i = (wgui_inline_item_time_period*) item->item;
- i->hours_buffer1 = hours_buffer1;
- i->minutes_buffer1 = minutes_buffer1;
- i->AM_PM_flag1 = AM_PM_flag1;
- i->hours_buffer2 = hours_buffer2;
- i->minutes_buffer2 = minutes_buffer2;
- i->AM_PM_flag2 = AM_PM_flag2;
- i->flags = 0;
- i->string_construct_callback = f;
- i->string_construct_callback(
- item->text_p,
- i->hours_buffer1,
- i->minutes_buffer1,
- i->AM_PM_flag1,
- i->hours_buffer2,
- i->minutes_buffer2,
- i->AM_PM_flag2);
- }
- /* Displaying time period edit as a menu item in the fixed list menu */
- U8 wgui_inline_time_period_edit_hours_display_buffer1[3 * ENCODING_LENGTH];
- U8 wgui_inline_time_period_edit_minutes_display_buffer1[3 * ENCODING_LENGTH];
- U8 *wgui_inline_time_period_AM_PM_display_flag1;
- U8 wgui_inline_time_period_edit_hours_display_buffer2[3 * ENCODING_LENGTH];
- U8 wgui_inline_time_period_edit_minutes_display_buffer2[3 * ENCODING_LENGTH];
- U8 *wgui_inline_time_period_AM_PM_display_flag2;
- time_period_input wgui_inline_time_period_input_display;
- /*****************************************************************************
- * FUNCTION
- * wgui_show_inline_time_period_list_menuitem
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * width [IN]
- * height [IN]
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_show_inline_time_period_list_menuitem(S32 x1, S32 y1, S32 width, S32 height, wgui_inline_item *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_time_period *i = (wgui_inline_item_time_period*) item->item;
- S32 xx;
- U32 dtflags = TIME_INPUT_TYPE_HH_MM;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- if (MMI_fixed_icontext_menuitem.text_x == 2)
- {
- xx = -1;
- }
- else
- {
- xx = MMI_fixed_icontext_menuitem.text_x;
- }
- if (item->flags & INLINE_ITEM_LEFT_ALIGN)
- {
- xx = -1;
- }
- switch (item->flags & INLINE_ITEM_JUSTIFY_MASK)
- {
- case INLINE_ITEM_RIGHT_JUSTIFY:
- dtflags |= DATE_INPUT_RIGHT_JUSTIFY;
- break;
- case INLINE_ITEM_CENTER_JUSTIFY:
- dtflags |= DATE_INPUT_CENTER_JUSTIFY;
- break;
- }
- gui_strcpy((UI_string_type) wgui_inline_time_period_edit_hours_display_buffer1, (UI_string_type) i->hours_buffer1);
- gui_strcpy(
- (UI_string_type) wgui_inline_time_period_edit_minutes_display_buffer1,
- (UI_string_type) i->minutes_buffer1);
- gui_strcpy((UI_string_type) wgui_inline_time_period_edit_hours_display_buffer2, (UI_string_type) i->hours_buffer2);
- gui_strcpy(
- (UI_string_type) wgui_inline_time_period_edit_minutes_display_buffer2,
- (UI_string_type) i->minutes_buffer2);
- wgui_inline_time_period_AM_PM_display_flag1 = i->AM_PM_flag1;
- wgui_inline_time_period_AM_PM_display_flag2 = i->AM_PM_flag2;
- wgui_set_date_time_input_unfocussed_theme();
- create_time_period_input(
- &wgui_inline_time_period_input_display,
- x1 + xx,
- y1,
- width - 1 - xx,
- height,
- dtflags,
- wgui_inline_time_period_edit_hours_display_buffer1,
- wgui_inline_time_period_edit_minutes_display_buffer1,
- wgui_inline_time_period_edit_hours_display_buffer2,
- wgui_inline_time_period_edit_minutes_display_buffer2);
- time_period_input_set_seperators(
- &wgui_inline_time_period_input_display,
- (UI_character_type) ':',
- (UI_character_type) '-');
- time_period_input_show_background(&wgui_inline_time_period_input_display);
- time_period_input_reset_focus(&wgui_inline_time_period_input_display);
- show_time_period_input(&wgui_inline_time_period_input_display);
- wgui_set_date_time_input_focussed_theme();
- redraw_left_softkey();
- redraw_right_softkey();
- gdi_layer_unlock_frame_buffer();
- }
- /*----------------------------------------------------------------------------
- Inline IP4 edit implementation
- ----------------------------------------------------------------------------*/
- #ifdef LOW_COST_SUPPORT
- #define MAX_INLINE_IP4_ITEMS 2
- #else
- #define MAX_INLINE_IP4_ITEMS 5 /* wireless lan need 5 items */
- #endif
- #define MAX_INLINE_IP4_DISPLAY_STRING_SIZE 48
- S32 n_inline_IP4_items = 0;
- wgui_inline_item_IP4 wgui_inline_IP4_items[MAX_INLINE_IP4_ITEMS];
- U8 wgui_inline_IP4_display_strings[MAX_INLINE_IP4_ITEMS][MAX_INLINE_IP4_DISPLAY_STRING_SIZE];
- wgui_inline_item_IP4 *current_wgui_inline_IP4_item;
- U8 **current_wgui_inline_IP4_text_p;
- U8 wgui_inline_IP4_edit_buffer1[4 * ENCODING_LENGTH];
- U8 wgui_inline_IP4_edit_buffer2[4 * ENCODING_LENGTH];
- U8 wgui_inline_IP4_edit_buffer3[4 * ENCODING_LENGTH];
- U8 wgui_inline_IP4_edit_buffer4[4 * ENCODING_LENGTH];
- IP4_input wgui_inline_IP4_input;
- /*****************************************************************************
- * FUNCTION
- * handle_inline_IP4_edit_complete
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void handle_inline_IP4_edit_complete(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_inline_fixed_list_keys();
- gui_strcpy((UI_string_type) current_wgui_inline_IP4_item->b1, (UI_string_type) wgui_inline_IP4_edit_buffer1);
- gui_strcpy((UI_string_type) current_wgui_inline_IP4_item->b2, (UI_string_type) wgui_inline_IP4_edit_buffer2);
- gui_strcpy((UI_string_type) current_wgui_inline_IP4_item->b3, (UI_string_type) wgui_inline_IP4_edit_buffer3);
- gui_strcpy((UI_string_type) current_wgui_inline_IP4_item->b4, (UI_string_type) wgui_inline_IP4_edit_buffer4);
- current_wgui_inline_IP4_item->string_construct_callback(
- *current_wgui_inline_IP4_text_p,
- current_wgui_inline_IP4_item->b1,
- current_wgui_inline_IP4_item->b2,
- current_wgui_inline_IP4_item->b3,
- current_wgui_inline_IP4_item->b4);
- MMI_fixed_icontext_menuitems[wgui_inline_item_highlighted_index].item_text =
- (UI_string_type) * current_wgui_inline_IP4_text_p;
- clear_left_softkey();
- clear_right_softkey();
- register_left_softkey_handler();
- register_right_softkey_handler();
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- mmi_pen_editor_close_input_box();
- #endif
- wgui_inline_item_handled = 0;
- wgui_text_menuitem_restart_scrolling();
- inline_edit_current_highlight_handler(wgui_inline_item_highlighted_index);
- redraw_current_inline_item = UI_dummy_function;
- complete_inline_item_edit = UI_dummy_function;
- set_current_IP4_input(NULL);
- clear_IP4_input_callback();
- #if defined(__MMI_TOUCH_SCREEN__)
- wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY);
- //W06.09 Draw Center Softkey when entering new screen
- //But in in-line editor, redrawing is needed when completing in-line item
- #ifdef __MMI_WGUI_CSK_ENABLE__
- redraw_softkey(MMI_CENTER_SOFTKEY);
- #endif
- #endif /* defined(__MMI_TOUCH_SCREEN__) */
- }
- /*****************************************************************************
- * FUNCTION
- * handle_inline_IP4_edit_cancel
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void handle_inline_IP4_edit_cancel(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- register_inline_fixed_list_keys();
- clear_left_softkey();
- clear_right_softkey();
- register_left_softkey_handler();
- register_right_softkey_handler();
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- mmi_pen_editor_close_input_box();
- #endif
- wgui_inline_item_handled = 0;
- wgui_text_menuitem_restart_scrolling();
- inline_edit_current_highlight_handler(wgui_inline_item_highlighted_index);
- redraw_current_inline_item = UI_dummy_function;
- complete_inline_item_edit = UI_dummy_function;
- set_current_IP4_input(NULL);
- clear_IP4_input_callback();
- #if defined(__MMI_TOUCH_SCREEN__)
- wgui_setup_virtual_keyboard(GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY);
- //W06.09 Draw Center Softkey when entering new screen
- //But in in-line editor, redrawing is needed when completing in-line item
- #ifdef __MMI_WGUI_CSK_ENABLE__
- redraw_softkey(MMI_CENTER_SOFTKEY);
- #endif
- #endif /* defined(__MMI_TOUCH_SCREEN__) */
- }
- /*****************************************************************************
- * FUNCTION
- * redraw_inline_IP4_edit
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void redraw_inline_IP4_edit(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IP4_input_show_background(&wgui_inline_IP4_input);
- show_IP4_input(&wgui_inline_IP4_input);
- }
- /*****************************************************************************
- * FUNCTION
- * inline_IP4_edit_handle_down_arrow
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void inline_IP4_edit_handle_down_arrow(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- handle_inline_IP4_edit_complete();
- inline_fixed_list_goto_next_item();
- }
- /*****************************************************************************
- * FUNCTION
- * inline_IP4_edit_handle_up_arrow
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void inline_IP4_edit_handle_up_arrow(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- handle_inline_IP4_edit_complete();
- inline_fixed_list_goto_previous_item();
- }
- /*****************************************************************************
- * FUNCTION
- * inline_IP4_input_key_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * vkey_code [IN]
- * key_state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void inline_IP4_input_key_handler(S32 vkey_code, S32 key_state)
- {
- #if(MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (key_state)
- {
- switch (vkey_code)
- {
- case 37:
- IP4_input_previous_character();
- break;
- case 38:
- inline_IP4_edit_handle_up_arrow();
- break;
- case 39:
- IP4_input_next_character();
- break;
- case 40:
- inline_IP4_edit_handle_down_arrow();
- break;
- case 36: /* home */
- break;
- case 35: /* end */
- break;
- case 33: /* page up */
- break;
- case 34: /* page down */
- break;
- case 45:
- IP4_input_toggle_insert_mode();
- break;
- case 46:
- IP4_input_delete_current_character();
- break;
- }
- }
- #else /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- UI_UNUSED_PARAMETER(vkey_code);
- UI_UNUSED_PARAMETER(key_state);
- #endif /* (MMI_BUILD_TYPE == BUILD_TYPE_X86WIN32) */
- }
- /*****************************************************************************
- * FUNCTION
- * handle_inline_IP4_edit_input
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void handle_inline_IP4_edit_input(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- set_wgui_inline_list_menu_changed();
- }
- /* History implementation for inline IP4 edit */
- typedef struct _inline_IP4_edit_history
- {
- U16 history_ID;
- S16 current_focus;
- S16 current_position;
- S16 dummy; /* Added for history issue on hardware */
- U32 flags;
- } inline_IP4_edit_history;
- /*****************************************************************************
- * FUNCTION
- * inline_IP4_edit_get_history
- * DESCRIPTION
- *
- * PARAMETERS
- * history_buffer [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 *inline_IP4_edit_get_history(U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (history_buffer != NULL)
- {
- U16 hID = (U16) (INLINE_IP4_HISTORY_ID | 0x8000);
- inline_IP4_edit_history *h = (inline_IP4_edit_history*) history_buffer;
- h->history_ID = hID;
- h->current_focus = (S16) wgui_inline_IP4_input.current_focus;
- if (wgui_inline_IP4_input.focus_input_box != NULL)
- {
- h->current_position =
- (S16) (wgui_inline_IP4_input.focus_input_box->current_text_p -
- wgui_inline_IP4_input.focus_input_box->text);
- }
- h->flags = wgui_inline_IP4_input.flags;
- }
- return (history_buffer);
- }
- /*****************************************************************************
- * FUNCTION
- * inline_IP4_edit_set_history
- * DESCRIPTION
- *
- * PARAMETERS
- * history_ID [IN]
- * history_buffer [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 inline_IP4_edit_set_history(U16 history_ID, U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (history_buffer != NULL)
- {
- inline_IP4_edit_history *h = (inline_IP4_edit_history*) history_buffer;
- if (history_valid(h->history_ID, history_ID))
- {
- wgui_inline_IP4_input.current_focus = h->current_focus;
- IP4_input_reset_focus(&wgui_inline_IP4_input);
- IP4_input_set_focus(&wgui_inline_IP4_input);
- if (wgui_inline_IP4_input.focus_input_box != NULL)
- {
- wgui_inline_IP4_input.focus_input_box->current_text_p =
- wgui_inline_IP4_input.focus_input_box->text + h->current_position;
- }
- wgui_inline_IP4_input.flags = h->flags;
- return (1);
- }
- }
- return (0);
- }
- /*****************************************************************************
- * FUNCTION
- * handle_inline_IP4_edit
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * width [IN]
- * height [IN]
- * key_code [IN]
- * key_event [IN]
- * text_p [IN]
- * item [?]
- * flags [IN]
- * history_buffer [?]
- * RETURNS
- * void
- *****************************************************************************/
- void handle_inline_IP4_edit(
- S32 x,
- S32 y,
- S32 width,
- S32 height,
- S32 key_code,
- S32 key_event,
- U8 **text_p,
- void *item,
- U32 flags,
- U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_IP4 *i = (wgui_inline_item_IP4*) item;
- S32 xx;
- U32 dtflags = 0;
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- mmi_pen_handwriting_area_struct stroke_area;
- mmi_pen_handwriting_area_struct ext_stroke;
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- UI_UNUSED_PARAMETER(key_event);
- UI_UNUSED_PARAMETER(key_code);
- UI_UNUSED_PARAMETER(flags);
- wgui_current_inline_item_type = INLINE_ITEM_TYPE_IP4_EDIT;
- /* MTK Elvis for R2L characters */
- if (!r2lMMIFlag)
- {
- if (MMI_fixed_icontext_menuitem.text_x == 2)
- {
- xx = -1;
- }
- else
- {
- xx = MMI_fixed_icontext_menuitem.text_x;
- }
- }
- else
- {
- xx = 1;
- }
- /* MTK end */
- if (flags & INLINE_ITEM_LEFT_ALIGN)
- {
- xx = -1;
- }
- switch (flags & INLINE_ITEM_JUSTIFY_MASK)
- {
- case INLINE_ITEM_RIGHT_JUSTIFY:
- dtflags |= IP4_INPUT_RIGHT_JUSTIFY;
- break;
- case INLINE_ITEM_CENTER_JUSTIFY:
- dtflags |= IP4_INPUT_CENTER_JUSTIFY;
- break;
- }
- complete_inline_item_edit = handle_inline_IP4_edit_complete;
- current_wgui_inline_IP4_item = i;
- current_wgui_inline_IP4_text_p = text_p;
- gui_strcpy((UI_string_type) wgui_inline_IP4_edit_buffer1, (UI_string_type) i->b1);
- gui_strcpy((UI_string_type) wgui_inline_IP4_edit_buffer2, (UI_string_type) i->b2);
- gui_strcpy((UI_string_type) wgui_inline_IP4_edit_buffer3, (UI_string_type) i->b3);
- gui_strcpy((UI_string_type) wgui_inline_IP4_edit_buffer4, (UI_string_type) i->b4);
- /* Ignore r2lMMIFlag */
- create_IP4_input(
- &wgui_inline_IP4_input,
- x + 1,
- y,
- width - 1,
- height,
- dtflags,
- wgui_inline_IP4_edit_buffer1,
- wgui_inline_IP4_edit_buffer2,
- wgui_inline_IP4_edit_buffer3,
- wgui_inline_IP4_edit_buffer4);
- inline_IP4_edit_set_history(INLINE_IP4_HISTORY_ID, history_buffer);
- IP4_input_set_seperator(&wgui_inline_IP4_input, (UI_character_type) '.');
- IP4_input_show_background(&wgui_inline_IP4_input);
- show_IP4_input(&wgui_inline_IP4_input);
- set_current_IP4_input(&wgui_inline_IP4_input);
- IP4_input_register_keys();
- register_keyboard_key_handler(inline_IP4_input_key_handler);
- SetKeyHandler(inline_IP4_edit_handle_down_arrow, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(inline_IP4_edit_handle_up_arrow, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(inline_IP4_edit_handle_down_arrow, KEY_VOL_DOWN, KEY_EVENT_DOWN);
- SetKeyHandler(inline_IP4_edit_handle_up_arrow, KEY_VOL_UP, KEY_EVENT_DOWN);
- register_IP4_input_callback(handle_inline_IP4_edit_input);
- redraw_current_inline_item = redraw_inline_IP4_edit;
- UI_UNUSED_PARAMETER(xx);
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- ext_stroke.x1 = 0;
- ext_stroke.y1 = 0;
- ext_stroke.x2 = UI_device_width - 1;
- ext_stroke.y2 = UI_device_height - 1;
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #else /* 0 */
- stroke_area.x1 = MMI_content_x;
- stroke_area.x2 = MMI_content_x + MMI_content_width - MMI_fixed_list_menu.vbar.width;
- stroke_area.y1 = MMI_title_y;
- stroke_area.y2 = MMI_title_y + MMI_content_height + MMI_title_height;
- #endif /* 0 */
- mmi_pen_editor_setup_input_box(&stroke_area, &ext_stroke, INPUT_TYPE_NUMERIC, MMI_FALSE, PEN_EDITOR_IP4);
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- }
- /*****************************************************************************
- * FUNCTION
- * SetInlineItemIP4
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * b1 [?]
- * b2 [?]
- * b3 [?]
- * b4 [?]
- * f [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineItemIP4(
- InlineItem *item,
- U8 *b1,
- U8 *b2,
- U8 *b3,
- U8 *b4,
- void (*f) (U8 *string_buffer, U8 *b1, U8 *b2, U8 *b3, U8 *b4))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_IP4 *i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (n_inline_IP4_items >= MAX_INLINE_IP4_ITEMS)
- {
- return;
- }
- item->item = (void*)&wgui_inline_IP4_items[n_inline_IP4_items];
- item->flags = INLINE_ITEM_TYPE_IP4_EDIT;
- item->text_p = (U8*) wgui_inline_IP4_display_strings[n_inline_IP4_items];
- n_inline_IP4_items++;
- i = (wgui_inline_item_IP4*) item->item;
- i->b1 = b1;
- i->b2 = b2;
- i->b3 = b3;
- i->b4 = b4;
- i->flags = INLINE_ITEM_LEFT_JUSTIFY;
- i->string_construct_callback = f;
- i->string_construct_callback(item->text_p, i->b1, i->b2, i->b3, i->b4);
- item->handler = handle_inline_IP4_edit;
- }
- /*****************************************************************************
- * FUNCTION
- * ReConfigureInlineItemIP4
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * b1 [?]
- * b2 [?]
- * b3 [?]
- * b4 [?]
- * f [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ReConfigureInlineItemIP4(
- InlineItem *item,
- U8 *b1,
- U8 *b2,
- U8 *b3,
- U8 *b4,
- void (*f) (U8 *string_buffer, U8 *b1, U8 *b2, U8 *b3, U8 *b4))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_IP4 *i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((item->flags & 0xff) != INLINE_ITEM_TYPE_IP4_EDIT)
- {
- return;
- }
- i = (wgui_inline_item_IP4*) item->item;
- i->b1 = b1;
- i->b2 = b2;
- i->b3 = b3;
- i->b4 = b4;
- i->flags = 0;
- i->string_construct_callback = f;
- i->string_construct_callback(item->text_p, i->b1, i->b2, i->b3, i->b4);
- }
- /* Displaying IP address edit as a menu item in the fixed list menu */
- U8 wgui_inline_IP4_edit_display_buffer1[4 * ENCODING_LENGTH];
- U8 wgui_inline_IP4_edit_display_buffer2[4 * ENCODING_LENGTH];
- U8 wgui_inline_IP4_edit_display_buffer3[4 * ENCODING_LENGTH];
- U8 wgui_inline_IP4_edit_display_buffer4[4 * ENCODING_LENGTH];
- IP4_input wgui_inline_IP4_input_display;
- /*****************************************************************************
- * FUNCTION
- * wgui_show_inline_IP4_list_menuitem
- * DESCRIPTION
- *
- * PARAMETERS
- * x1 [IN]
- * y1 [IN]
- * width [IN]
- * height [IN]
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_show_inline_IP4_list_menuitem(S32 x1, S32 y1, S32 width, S32 height, wgui_inline_item *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_IP4 *i = (wgui_inline_item_IP4*) item->item;
- S32 xx;
- U32 dtflags = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- if (MMI_fixed_icontext_menuitem.text_x == 2)
- {
- xx = -1;
- }
- else
- {
- xx = MMI_fixed_icontext_menuitem.text_x;
- }
- if (item->flags & INLINE_ITEM_LEFT_ALIGN)
- {
- xx = -1;
- }
- switch (item->flags & INLINE_ITEM_JUSTIFY_MASK)
- {
- case INLINE_ITEM_RIGHT_JUSTIFY:
- dtflags |= DATE_INPUT_RIGHT_JUSTIFY;
- break;
- case INLINE_ITEM_CENTER_JUSTIFY:
- dtflags |= DATE_INPUT_CENTER_JUSTIFY;
- break;
- }
- gui_strcpy((UI_string_type) wgui_inline_IP4_edit_display_buffer1, (UI_string_type) i->b1);
- gui_strcpy((UI_string_type) wgui_inline_IP4_edit_display_buffer2, (UI_string_type) i->b2);
- gui_strcpy((UI_string_type) wgui_inline_IP4_edit_display_buffer3, (UI_string_type) i->b3);
- gui_strcpy((UI_string_type) wgui_inline_IP4_edit_display_buffer4, (UI_string_type) i->b4);
- wgui_set_date_time_input_unfocussed_theme();
- create_IP4_input(
- &wgui_inline_IP4_input_display,
- x1 - 1,
- y1,
- width + 1,
- height,
- dtflags,
- wgui_inline_IP4_edit_display_buffer1,
- wgui_inline_IP4_edit_display_buffer2,
- wgui_inline_IP4_edit_display_buffer3,
- wgui_inline_IP4_edit_display_buffer4);
- IP4_input_set_seperator(&wgui_inline_IP4_input_display, (UI_character_type) '.');
- /* 20051012 HIMANSHU START INLINE IP4 */
- /* show the different background in case of default text effect is enabled
- for the inline item type IP4 Edit. */
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (IsInlineItemDefaultTextEnable())
- {
- inline_item_default_text_show_background(
- wgui_inline_IP4_input_display.x,
- wgui_inline_IP4_input_display.y,
- wgui_inline_IP4_input_display.x + wgui_inline_IP4_input_display.width - 1,
- wgui_inline_IP4_input_display.y + wgui_inline_IP4_input_display.height - 1);
- }
- else
- #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */
- /* 20051012 HIMANSHU END INLINE IP4 */
- IP4_input_show_background(&wgui_inline_IP4_input_display);
- IP4_input_reset_focus(&wgui_inline_IP4_input_display);
- show_IP4_input(&wgui_inline_IP4_input_display);
- wgui_set_date_time_input_focussed_theme();
- redraw_left_softkey();
- redraw_right_softkey();
- gdi_layer_unlock_frame_buffer();
- UI_UNUSED_PARAMETER(xx);
- }
- /*****************************************************************************
- *
- * Inline Color Selection
- *
- *****************************************************************************/
- #define MAX_INLINE_COLOR_SELECT_ITEMS 3
- #define INLINE_COLOR_SELECT_HEIGHT_SPACING 3
- #define INLINE_COLOR_SELECT_WIDTH_SPACING 15
- #define INLINE_COLOR_SELECT_ICON_SPACING 3
- U16 n_inline_color_select_items = 0;
- U16 current_wgui_inline_color_select_highlighted_index;
- U16 current_wgui_inline_color_select_start_index;
- U16 current_wgui_inline_color_select_region_x1;
- U16 current_wgui_inline_color_select_region_y1;
- U16 current_wgui_inline_color_select_region_x2;
- U16 current_wgui_inline_color_select_region_y2;
- U16 current_wgui_inline_color_select_icon_y;
- U16 current_wgui_inline_color_select_icon1_x1;
- U16 current_wgui_inline_color_select_icon1_x2;
- U16 current_wgui_inline_color_select_icon2_x1;
- U16 current_wgui_inline_color_select_icon2_x2;
- U8 current_wgui_inline_color_select_icon1_pressed;
- U8 current_wgui_inline_color_select_icon2_pressed;
- U8 current_wgui_inline_color_select_pen_on_icon1;
- U8 current_wgui_inline_color_select_pen_on_icon2;
- U16 current_wgui_inline_color_select_box_count;
- U16 current_wgui_inline_color_select_box_size;
- U16 current_wgui_inline_color_select_box_spacing;
- wgui_inline_item_color_select wgui_inline_color_select_items[MAX_INLINE_COLOR_SELECT_ITEMS];
- wgui_inline_item_color_select *current_wgui_inline_color_select_item = NULL;
- /*****************************************************************************
- * FUNCTION
- * clear_inline_color_select_menu_keys
- * DESCRIPTION
- * clear color inline select key handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void clear_inline_color_select_menu_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- clear_keyboard_key_handler();
- clear_inline_item_keys = UI_dummy_function;
- UI_text_menuitem_scroll_time = UI_TEXT_MENUITEM_SCROLL_TIME;
- }
- /*****************************************************************************
- * FUNCTION
- * inline_color_select_menu_change_complete
- * DESCRIPTION
- * move out from inline color select
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void inline_color_select_menu_change_complete(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- clear_inline_color_select_menu_keys();
- wgui_inline_item_handled = 0;
- redraw_current_inline_item = UI_dummy_function;
- complete_inline_item_edit = UI_dummy_function;
- #ifdef __MMI_TOUCH_SCREEN__
- wgui_current_inline_item_pen_function = UI_dummy_inline_item_pen_function;
- #endif
- current_wgui_inline_color_select_highlighted_index = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * inline_color_select_menu_handle_up_arrow
- * DESCRIPTION
- * inline color select up arrow handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void inline_color_select_menu_handle_up_arrow(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- inline_color_select_menu_change_complete();
- inline_fixed_list_goto_previous_item();
- }
- /*****************************************************************************
- * FUNCTION
- * inline_color_select_menu_handle_down_arrow
- * DESCRIPTION
- * inline color select down arrow handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void inline_color_select_menu_handle_down_arrow(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- inline_color_select_menu_change_complete();
- inline_fixed_list_goto_next_item();
- }
- /*****************************************************************************
- * FUNCTION
- * show_highlighted_inline_color_select_menuitem
- * DESCRIPTION
- * draw inline color select menu when it is highlighted
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void show_highlighted_inline_color_select_menuitem(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 box_count; /* how many color will display */
- S32 box_size;
- S32 spacing;
- S32 i;
- S32 box_x1;
- S32 box_x2;
- S32 box_y1;
- S32 box_y2;
- S32 start_x;
- U16 start_index;
- U16 highlighted_index;
- U16 color_count;
- U16 color_index;
- color *color_list;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* pixtel name is too long, hard to read, set to local variable first */
- box_size = current_wgui_inline_color_select_box_size;
- box_count = current_wgui_inline_color_select_box_count;
- spacing = current_wgui_inline_color_select_box_spacing;
- box_y1 = current_wgui_inline_color_select_region_y1;
- box_y2 = current_wgui_inline_color_select_region_y2;
- start_x = current_wgui_inline_color_select_region_x1;
- start_index = current_wgui_inline_color_select_item->start_index;
- highlighted_index = current_wgui_inline_color_select_item->highlighted_index;
- color_list = current_wgui_inline_color_select_item->list_of_color;
- color_count = current_wgui_inline_color_select_item->n_color;
- /* need adjst start index */
- if (start_index == 255)
- {
- /* total color is less then box, always start at 0 */
- if (box_count > color_count)
- {
- start_index = 0;
- }
- else
- {
- if (color_count - highlighted_index >= box_count)
- {
- /* remain color is more than box count */
- start_index = highlighted_index;
- }
- else
- {
- /* remain color not enough */
- start_index = color_count - box_count;
- }
- current_wgui_inline_color_select_item->start_index = start_index;
- }
- }
- /* 20051012 HIMANSHU START INLINE COLOR SELECT */
- /* fill the background of the focussed Color Select menu item with modified
- parameters. */
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (IsInlineItemDefaultTextEnable())
- /* fill region with selected background color */
- {
- gui_fill_rectangle(
- current_wgui_inline_color_select_region_x1 - spacing,
- current_wgui_inline_color_select_region_y1 - spacing,
- current_wgui_inline_color_select_region_x2 + spacing,
- current_wgui_inline_color_select_region_y2 + spacing,
- current_MMI_theme->list_selected_item_filler->c);
- }
- else
- #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */
- /* 20051012 HIMANSHU END INLINE COLOR SELECT */
- /* fill region with selected background color */
- gui_fill_rectangle(
- current_wgui_inline_color_select_icon1_x1 - 2,
- current_wgui_inline_color_select_region_y1 - 2,
- current_wgui_inline_color_select_icon2_x2 + 2,
- current_wgui_inline_color_select_region_y2 + 2,
- current_MMI_theme->list_selected_item_filler->c);
- for (i = 0; i < box_count; i++)
- {
- box_x1 = start_x + (box_size + spacing) * i;
- box_x2 = box_x1 + box_size;
- color_index = (U16) (start_index + i);
- if (color_index > color_count)
- {
- /* no more, get from firsr */
- color_index = color_index - color_count;
- }
- gui_fill_rectangle(box_x1, box_y1, box_x2, box_y2, color_list[color_index]);
- /* if is pure blue, draw cross */
- if (color_list[color_index].r == 0 && color_list[color_index].g == 0 && color_list[color_index].b == 255)
- {
- gui_fill_rectangle(box_x1, box_y1, box_x2, box_y2, gui_color(255, 255, 255));
- gui_line(box_x1, box_y1, box_x2, box_y2, gui_color(0, 0, 0));
- gui_line(box_x2, box_y1, box_x1, box_y2, gui_color(0, 0, 0));
- }
- else
- {
- gui_fill_rectangle(box_x1, box_y1, box_x2, box_y2, color_list[color_index]);
- }
- gui_draw_rectangle(box_x1 + 1, box_y1 + 1, box_x2 - 1, box_y2 - 1, gui_color(255, 255, 255));
- if (color_index == highlighted_index)
- {
- gui_draw_rectangle(box_x1, box_y1, box_x2, box_y2, gui_color(255, 0, 0));
- gui_draw_rectangle(box_x1 - 1, box_y1 - 1, box_x2 + 1, box_y2 + 1, gui_color(255, 0, 0));
- }
- else
- {
- gui_draw_rectangle(box_x1, box_y1, box_x2, box_y2, gui_color(0, 0, 0));
- }
- }
- gui_show_image(
- current_wgui_inline_color_select_icon1_x1,
- current_wgui_inline_color_select_icon_y + current_wgui_inline_color_select_icon1_pressed,
- (PU8) GetImage(IMG_H_SELECT_LEFT));
- gui_show_image(
- current_wgui_inline_color_select_icon2_x1,
- current_wgui_inline_color_select_icon_y + current_wgui_inline_color_select_icon2_pressed,
- (PU8) GetImage(IMG_H_SELECT_RIGHT));
- gdi_layer_blt_previous(
- current_wgui_inline_color_select_icon1_x1 - 2,
- current_wgui_inline_color_select_region_y1 - 2,
- current_wgui_inline_color_select_icon2_x2 + 2,
- current_wgui_inline_color_select_region_y2 + 2);
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_show_highlighted_inline_color_select_menuitemitem
- * DESCRIPTION
- * show color select menu which is not selected
- * PARAMETERS
- * x [IN] Menuitem start position x
- * y [IN] Menuitem start position y
- * width [IN] Menuitem width
- * height [IN] Menuitem height
- * item [IN] Selected item ptr
- * RETURNS
- * void
- *****************************************************************************/
- static void wgui_show_highlighted_inline_color_select_menuitemitem(
- S32 x,
- S32 y,
- S32 width,
- S32 height,
- wgui_inline_item *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 spacing;
- S32 region_spacing;
- S32 box_x1;
- S32 box_x2;
- S32 region_x1;
- S32 region_y1;
- S32 region_x2;
- S32 region_y2;
- S32 box_size;
- S32 box_count;
- S32 i;
- U16 color_index;
- U16 color_count;
- U16 start_index;
- S32 used_width;
- S32 region_width;
- U16 highlighted_index;
- color *color_list;
- /* PMT HIMANSHU START 20051021 */
- S32 icon_width, icon_height;
- /* PMT HIMANSHU END 20051021 */
- wgui_inline_item_color_select *item_ptr;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item_ptr = (wgui_inline_item_color_select*) item->item;
- spacing = INLINE_COLOR_SELECT_HEIGHT_SPACING;
- /* PMT HIMANSHU START 20051021 */
- /* removed the hard-coded value of region_spacing. */
- /* region_spacing = INLINE_COLOR_SELECT_WIDTH_SPACING; */
- gui_measure_image((PU8) GetImage(IMG_H_SELECT_LEFT), &icon_width, &icon_height);
- region_spacing = icon_width + (2 * INLINE_COLOR_SELECT_ICON_SPACING);
- /* PMT HIMANSHU END 20051021 */
- /* 20051012 HIMANSHU START INLINE COLOR SELECT */
- if (r2lMMIFlag)
- {
- region_x1 = x + region_spacing - 4;
- region_x2 = x + width - MMI_fixed_icontext_menuitem.text_x - region_spacing;
- }
- else
- {
- region_x1 = x + MMI_fixed_icontext_menuitem.text_x + region_spacing - 4; /* -4 for arrow width */
- region_x2 = x + width - region_spacing;
- }
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (IsInlineItemDefaultTextEnable())
- {
- region_x1 = x + region_spacing;
- region_x2 = x + width - region_spacing;
- }
- #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */
- /* region_x1 and region_x2 are moved above. */
- // region_x1 = x+MMI_fixed_icontext_menuitem.text_x+region_spacing-4; /* -4 for arrow width */
- region_y1 = y + spacing;
- /* region_x2 = x+width-region_spacing; */
- region_y2 = y + height - spacing;
- /* 20051012 HIMANSHU END INLINE COLOR SELECT */
- highlighted_index = item_ptr->highlighted_index;
- start_index = item_ptr->start_index;
- color_list = item_ptr->list_of_color;
- color_count = item_ptr->n_color;
- box_size = region_y2 - region_y1;
- box_count = (region_x2 - region_x1 + spacing) / (box_size + spacing);
- /* need adjst start index */
- if (start_index == 255)
- {
- /* total color is less then box, always start at 0 */
- if (box_count > color_count)
- {
- start_index = 0;
- }
- else
- {
- if (color_count - highlighted_index >= box_count)
- {
- /* remain color is more than box count */
- start_index = highlighted_index;
- }
- else
- {
- /* remain color not enough */
- start_index = (U16) (color_count - box_count);
- }
- item_ptr->start_index = start_index;
- }
- }
- /* dispatch remain spacing to both side */
- used_width = box_size * box_count + (box_count - 1) * spacing;
- region_width = region_x2 - region_x1 + 1;
- region_x1 += (region_width - used_width) >> 1;
- /* if total color is less then box count, adjust position */
- if (box_count > color_count)
- {
- box_count = color_count;
- /* adjust to center */
- used_width = box_size * box_count + (box_count - 1) * spacing;
- region_width = region_x2 - region_x1 + 1;
- region_x1 += (region_width - used_width) >> 1;
- }
- /* 20051012 HIMANSHU START INLINE COLOR SELECT */
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (IsInlineItemDefaultTextEnable())
- {
- inline_item_default_text_show_background((x - 1), y, (x - 1) + (width - 1), y + height);
- }
- #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */
- /* 20051012 HIMANSHU END INLINE COLOR SELECT */
- for (i = 0; i < box_count; i++)
- {
- box_x1 = region_x1 + (box_size + spacing) * i;
- box_x2 = box_x1 + box_size;
- color_index = (U16) (start_index + i);
- if (color_index > color_count)
- {
- /* no more, get from firsr */
- color_index = color_index - color_count;
- }
- /* if is pure blue, draw cross */
- if (color_list[color_index].r == 0 && color_list[color_index].g == 0 && color_list[color_index].b == 255)
- {
- gui_fill_rectangle(box_x1, region_y1, box_x2, region_y2, gui_color(255, 255, 255));
- gui_line(box_x1, region_y1, box_x2, region_y2, gui_color(0, 0, 0));
- gui_line(box_x2, region_y1, box_x1, region_y2, gui_color(0, 0, 0));
- }
- else
- {
- gui_fill_rectangle(box_x1, region_y1, box_x2, region_y2, color_list[color_index]);
- }
- if (color_index == highlighted_index)
- {
- gui_draw_rectangle(box_x1, region_y1, box_x2, region_y2, gui_color(255, 0, 0));
- gui_draw_rectangle(box_x1 - 1, region_y1 - 1, box_x2 + 1, region_y2 + 1, gui_color(255, 0, 0));
- }
- else
- {
- gui_draw_rectangle(box_x1, region_y1, box_x2, region_y2, gui_color(0, 0, 0));
- }
- gui_draw_rectangle(box_x1 + 1, region_y1 + 1, box_x2 - 1, region_y2 - 1, gui_color(255, 255, 255));
- }
- }
- /*****************************************************************************
- * FUNCTION
- * inline_color_select_menu_previous_item
- * DESCRIPTION
- * selection change to previous color
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void inline_color_select_menu_previous_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_wgui_inline_color_select_item->highlighted_index == 0)
- {
- current_wgui_inline_color_select_item->highlighted_index = current_wgui_inline_color_select_item->n_color - 1;
- current_wgui_inline_color_select_item->start_index =
- current_wgui_inline_color_select_item->n_color - current_wgui_inline_color_select_box_count;
- }
- else
- {
- current_wgui_inline_color_select_item->highlighted_index--;
- if (current_wgui_inline_color_select_item->highlighted_index <
- current_wgui_inline_color_select_item->start_index)
- {
- current_wgui_inline_color_select_item->start_index--;
- }
- }
- show_highlighted_inline_color_select_menuitem();
- if (current_wgui_inline_color_select_item->color_highlighted != NULL)
- {
- current_wgui_inline_color_select_item->color_highlighted(current_wgui_inline_color_select_item->
- highlighted_index);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * inline_color_select_menu_next_item
- * DESCRIPTION
- * selection change to next color
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void inline_color_select_menu_next_item(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (current_wgui_inline_color_select_item->highlighted_index >= current_wgui_inline_color_select_item->n_color - 1)
- {
- current_wgui_inline_color_select_item->highlighted_index = 0;
- current_wgui_inline_color_select_item->start_index = 0;
- }
- else
- {
- current_wgui_inline_color_select_item->highlighted_index++;
- if (current_wgui_inline_color_select_item->highlighted_index >=
- current_wgui_inline_color_select_item->start_index + current_wgui_inline_color_select_box_count)
- {
- current_wgui_inline_color_select_item->start_index++;
- }
- }
- show_highlighted_inline_color_select_menuitem();
- if (current_wgui_inline_color_select_item->color_highlighted != NULL)
- {
- current_wgui_inline_color_select_item->color_highlighted(current_wgui_inline_color_select_item->
- highlighted_index);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * register_inline_color_select_menu_keys
- * DESCRIPTION
- * register key handler when highlighted on inline color selection
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void register_inline_color_select_menu_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetKeyHandler(inline_color_select_menu_previous_item, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(inline_color_select_menu_next_item, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(inline_color_select_menu_handle_up_arrow, KEY_UP_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(inline_color_select_menu_handle_down_arrow, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
- SetKeyHandler(inline_color_select_menu_handle_up_arrow, KEY_VOL_UP, KEY_EVENT_DOWN);
- SetKeyHandler(inline_color_select_menu_handle_down_arrow, KEY_VOL_DOWN, KEY_EVENT_DOWN);
- }
- /*****************************************************************************
- * FUNCTION
- * inline_color_select_pen_handler
- * DESCRIPTION
- * Pen handler of color picker
- * PARAMETERS
- * pen_event [IN]
- * x [IN]
- * y [IN]
- * inline_event [?]
- * item_event(?) [OUT]
- * RETURNS
- * void
- *****************************************************************************/
- #ifdef __MMI_TOUCH_SCREEN__
- static BOOL inline_color_select_pen_handler(
- mmi_pen_event_type_enum pen_event,
- S16 x,
- S16 y,
- gui_inline_item_pen_enum *inline_event)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- BOOL ret;
- S32 i;
- S32 box_xoffset, box_width;
- S32 x1, y1, x2, y2, region_width, region_height;
- BOOL in_left_arrow, in_right_arrow;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *inline_event = GUI_INLINE_PEN_NONE;
- ret = MMI_TRUE;
- x1 = current_wgui_inline_color_select_region_x1;
- y1 = current_wgui_inline_color_select_region_y1;
- x2 = current_wgui_inline_color_select_region_x2;
- y2 = current_wgui_inline_color_select_region_y2;
- region_width = x2 - x1 + 1;
- region_height = y2 - y1 + 1;
- in_left_arrow = MMI_FALSE;
- in_right_arrow = MMI_FALSE;
- //PMT HIMANSHU START 20051021
- // if (x < x1 && y >= current_wgui_inline_color_select_region_y1 && y <= current_wgui_inline_color_select_region_y2)
- if (x >= current_wgui_inline_color_select_icon1_x1
- && x <= current_wgui_inline_color_select_icon1_x2
- && y >= current_wgui_inline_color_select_region_y1 && y <= current_wgui_inline_color_select_region_y2)
- {
- in_left_arrow = MMI_TRUE;
- }
- /* else if (x > x2 && y >= current_wgui_inline_color_select_region_y1 && y <= current_wgui_inline_color_select_region_y2) */
- else if (x >= current_wgui_inline_color_select_icon2_x1
- && x <= current_wgui_inline_color_select_icon2_x2
- && y >= current_wgui_inline_color_select_region_y1 && y <= current_wgui_inline_color_select_region_y2)
- /* PMT HIMANSHU END 20051021 */
- {
- in_right_arrow = MMI_TRUE;
- }
- switch (pen_event)
- {
- case MMI_PEN_EVENT_DOWN:
- current_wgui_inline_color_select_icon1_pressed = 0;
- current_wgui_inline_color_select_icon2_pressed = 0;
- current_wgui_inline_color_select_pen_on_icon1 = 0;
- current_wgui_inline_color_select_pen_on_icon2 = 0;
- if (in_left_arrow)
- {
- current_wgui_inline_color_select_pen_on_icon1 = 1;
- current_wgui_inline_color_select_icon1_pressed = 1;
- show_highlighted_inline_color_select_menuitem();
- }
- else if (in_right_arrow)
- {
- current_wgui_inline_color_select_pen_on_icon2 = 1;
- current_wgui_inline_color_select_icon2_pressed = 1;
- show_highlighted_inline_color_select_menuitem();
- }
- else if (PEN_CHECK_BOUND(x, y, x1, y1, region_width, region_height))
- {
- box_width = current_wgui_inline_color_select_box_size + current_wgui_inline_color_select_box_spacing;
- box_xoffset = x1 + box_width - 1;
- for (i = 0; i < current_wgui_inline_color_select_box_count; i++)
- {
- if (box_xoffset > x)
- {
- current_wgui_inline_color_select_item->highlighted_index =
- i + current_wgui_inline_color_select_item->start_index;
- show_highlighted_inline_color_select_menuitem();
- if (current_wgui_inline_color_select_item->color_highlighted != NULL)
- {
- current_wgui_inline_color_select_item->
- color_highlighted(current_wgui_inline_color_select_item->highlighted_index);
- }
- break;
- }
- box_xoffset += box_width;
- }
- }
- break;
- case MMI_PEN_EVENT_UP:
- if (current_wgui_inline_color_select_pen_on_icon1 && in_left_arrow)
- {
- inline_color_select_menu_previous_item();
- }
- else if (current_wgui_inline_color_select_pen_on_icon2 && in_right_arrow)
- {
- inline_color_select_menu_next_item();
- }
- if (current_wgui_inline_color_select_icon1_pressed || current_wgui_inline_color_select_icon2_pressed)
- {
- current_wgui_inline_color_select_icon1_pressed = 0;
- current_wgui_inline_color_select_icon2_pressed = 0;
- show_highlighted_inline_color_select_menuitem();
- }
- break;
- case MMI_PEN_EVENT_MOVE:
- if (current_wgui_inline_color_select_pen_on_icon1)
- {
- if (in_left_arrow)
- {
- if (!current_wgui_inline_color_select_icon1_pressed)
- {
- current_wgui_inline_color_select_icon1_pressed = 1;
- show_highlighted_inline_color_select_menuitem();
- }
- }
- else
- {
- if (current_wgui_inline_color_select_icon1_pressed)
- {
- current_wgui_inline_color_select_icon1_pressed = 0;
- show_highlighted_inline_color_select_menuitem();
- }
- }
- }
- else if (current_wgui_inline_color_select_pen_on_icon2)
- {
- if (in_right_arrow)
- {
- if (!current_wgui_inline_color_select_icon2_pressed)
- {
- current_wgui_inline_color_select_icon2_pressed = 1;
- show_highlighted_inline_color_select_menuitem();
- }
- }
- else
- {
- if (current_wgui_inline_color_select_icon2_pressed)
- {
- current_wgui_inline_color_select_icon2_pressed = 0;
- show_highlighted_inline_color_select_menuitem();
- }
- }
- }
- break;
- case MMI_PEN_EVENT_LONG_TAP:
- break;
- case MMI_PEN_EVENT_REPEAT:
- break;
- case MMI_PEN_EVENT_ABORT:
- if (current_wgui_inline_color_select_icon1_pressed || current_wgui_inline_color_select_icon2_pressed)
- {
- current_wgui_inline_color_select_icon1_pressed = 0;
- current_wgui_inline_color_select_icon2_pressed = 0;
- show_highlighted_inline_color_select_menuitem();
- }
- break;
- default:
- MMI_ASSERT(0);
- }
- return ret;
- }
- #endif /* __MMI_TOUCH_SCREEN__ */
- /*****************************************************************************
- * FUNCTION
- * handle_inline_color_select
- * DESCRIPTION
- * inline color select hihight hanlder, will init required global variables for drawing.
- * PARAMETERS
- * x [IN] Menuitem start position x
- * y [IN] Menuitem start position y
- * width [IN] Menuitem width
- * height [IN] Menuitem height
- * key_code [IN] Not used
- * key_event [IN] Not used
- * text_p [IN] Not used
- * item [IN] Selected item pointer
- * flags [IN] Not used
- * history_buffer [IN] Not used
- * RETURNS
- * void
- *****************************************************************************/
- static void handle_inline_color_select(
- S32 x,
- S32 y,
- S32 width,
- S32 height,
- S32 key_code,
- S32 key_event,
- U8 **text_p,
- void *item,
- U32 flags,
- U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 spacing;
- S32 region_spacing;
- S32 icon_spacing, icon_width, icon_height;
- S32 used_width;
- S32 region_width;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- spacing = INLINE_COLOR_SELECT_HEIGHT_SPACING;
- //PMT HIMANSHU START 20051021
- // region_spacing = INLINE_COLOR_SELECT_WIDTH_SPACING;
- //PMT HIMANSHU END 20051021
- icon_spacing = INLINE_COLOR_SELECT_ICON_SPACING;
- /* PMT HIMANSHU START 20051021 */
- /* removed the hard-coded value of region_spacing. Now it is calculated according to
- the icon width of arrow image. */
- gui_measure_image((PU8) GetImage(IMG_H_SELECT_LEFT), &icon_width, &icon_height);
- region_spacing = icon_width + (2 * icon_spacing);
- /* PMT HIMANSHU END 20051021 */
- /* wgui_show_inline_select_arrow(x, y, width-3, height, &wgui_inline_items[current_fixed_list_menuitem_display_index]); */
- current_wgui_inline_color_select_item = (wgui_inline_item_color_select*) item;
- current_wgui_inline_color_select_box_spacing = (U16) spacing;
- /* 20051012 HIMANSHU START INLINE COLOR SELECT */
- if (r2lMMIFlag)
- {
- current_wgui_inline_color_select_region_x1 = (U16) (x + region_spacing);
- current_wgui_inline_color_select_region_x2 =
- (U16) (x + width - MMI_fixed_icontext_menuitem.text_x - region_spacing);
- }
- else
- {
- current_wgui_inline_color_select_region_x1 = (U16) (x + MMI_fixed_icontext_menuitem.text_x + region_spacing);
- current_wgui_inline_color_select_region_x2 = (U16) (x + width - region_spacing) - 1; /* 112205 inline color Calvin */
- }
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (IsInlineItemDefaultTextEnable())
- {
- current_wgui_inline_color_select_region_x1 = (U16) (x + region_spacing);
- current_wgui_inline_color_select_region_x2 = (U16) (x + width - region_spacing);
- }
- #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */
- /* region_x1 and region_x2 are moved above. */
- /* current_wgui_inline_color_select_region_x1 = (U16)(x+MMI_fixed_icontext_menuitem.text_x+region_spacing); */
- current_wgui_inline_color_select_region_y1 = (U16) (y + spacing);
- /* current_wgui_inline_color_select_region_x2 = (U16)(x+width-region_spacing); */
- current_wgui_inline_color_select_region_y2 = (U16) (y + height - spacing);
- /* 20051012 HIMANSHU END INLINE COLOR SELECT */
- //PMT HIMANSHU START 20051021
- // moved above
- // gui_measure_image((PU8)GetImage(IMG_H_SELECT_LEFT), &icon_width, &icon_height);
- //PMT HIMANSHU END 20051021
- current_wgui_inline_color_select_icon1_x2 = current_wgui_inline_color_select_region_x1 - icon_spacing - 1; /* 112205 inline color Calvin */
- current_wgui_inline_color_select_icon1_x1 = current_wgui_inline_color_select_icon1_x2 - icon_width + 1;
- current_wgui_inline_color_select_icon2_x1 = current_wgui_inline_color_select_region_x2 + icon_spacing + 1; /* 112205 inline color Calvin */
- current_wgui_inline_color_select_icon2_x2 = current_wgui_inline_color_select_icon2_x1 + icon_width - 1;
- current_wgui_inline_color_select_icon_y = y + (height >> 1) - (icon_height >> 1);
- current_wgui_inline_color_select_icon1_pressed = 0;
- current_wgui_inline_color_select_icon2_pressed = 0;
- current_wgui_inline_color_select_box_size =
- current_wgui_inline_color_select_region_y2 - current_wgui_inline_color_select_region_y1;
- current_wgui_inline_color_select_box_count = (U16) ((current_wgui_inline_color_select_region_x2 - current_wgui_inline_color_select_region_x1 + 1 + spacing) / (current_wgui_inline_color_select_box_size + spacing)); /* 112205 inline color Calvin */
- current_wgui_inline_color_select_item->color_highlighted(current_wgui_inline_color_select_item->highlighted_index);
- /* dispatch remain spacing to both side */
- used_width =
- current_wgui_inline_color_select_box_size * current_wgui_inline_color_select_box_count +
- (current_wgui_inline_color_select_box_count - 1) * spacing;
- region_width = current_wgui_inline_color_select_region_x2 - current_wgui_inline_color_select_region_x1 + 1;
- current_wgui_inline_color_select_region_x1 += (U16) ((region_width - used_width) >> 1);
- /* 112205 inline color Calvin Start */
- //#ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- // if(IsInlineItemDefaultTextEnable())
- current_wgui_inline_color_select_region_x2 -= (U16) ((region_width - used_width) >> 1);
- // #endif
- /* 112205 inline color Calvin Start */
- /* if total color is less then box count, adjust position */
- if (current_wgui_inline_color_select_box_count > current_wgui_inline_color_select_item->n_color)
- {
- current_wgui_inline_color_select_box_count = current_wgui_inline_color_select_item->n_color;
- /* adjust to center */
- used_width =
- current_wgui_inline_color_select_box_size * current_wgui_inline_color_select_box_count +
- (current_wgui_inline_color_select_box_count - 1) * spacing;
- region_width = current_wgui_inline_color_select_region_x2 - current_wgui_inline_color_select_region_x1 + 1;
- current_wgui_inline_color_select_region_x1 += (U16) ((region_width - used_width) >> 1);
- /* 20051012 HIMANSHU START INLINE COLOR SELECT */
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (IsInlineItemDefaultTextEnable())
- {
- current_wgui_inline_color_select_region_x2 -= (U16) ((region_width - used_width) >> 1);
- }
- #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */
- /* 20051012 HIMANSHU END INLINE COLOR SELECT */
- }
- show_highlighted_inline_color_select_menuitem();
- register_inline_color_select_menu_keys();
- clear_inline_item_keys = clear_inline_select_menu_keys;
- complete_inline_item_edit = inline_color_select_menu_change_complete;
- redraw_current_inline_item = show_highlighted_inline_color_select_menuitem;
- #ifdef __MMI_TOUCH_SCREEN__
- wgui_current_inline_item_pen_function = inline_color_select_pen_handler;
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * SetInlineItemColorSelect
- * DESCRIPTION
- * Set color inline selection
- * PARAMETERS
- * item [IN] Inline item pointer
- * n_color [IN] Number of color
- * hilighted_index [IN] Highlighed color index
- * list_of_color [IN] Array of colors
- * color_highlighted [IN] Color highlighted callback function
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineItemColorSelect(
- InlineItem *item,
- S32 n_color,
- U16 hilighted_index,
- color *list_of_color,
- void (*color_highlighted) (U16 index))
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- wgui_inline_item_color_select *i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* check if still have room for another item */
- MMI_ASSERT(n_inline_color_select_items < MAX_INLINE_COLOR_SELECT_ITEMS);
- MMI_ASSERT(hilighted_index < n_color);
- item->item = (void*)&wgui_inline_color_select_items[n_inline_color_select_items];
- item->flags = INLINE_ITEM_TYPE_COLOR_SELECT;
- i = (wgui_inline_item_color_select*) item->item;
- i->flags = 0;
- i->list_of_color = list_of_color;
- i->highlighted_index = hilighted_index;
- i->n_color = (U16) n_color;
- i->color_highlighted = color_highlighted;
- item->handler = handle_inline_color_select;
- /* notify start index need re-adjust */
- i->start_index = 255;
- n_inline_color_select_items++;
- }
- /*----------------------------------------------------------------------------
- Inline edit general functions
- ----------------------------------------------------------------------------*/
- /*****************************************************************************
- * FUNCTION
- * SetInlineItemActivation
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * key_code [IN]
- * key_event [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineItemActivation(InlineItem *item, S32 key_code, S32 key_event)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->key_code = key_code;
- item->key_event = key_event;
- /* 101104 MTK Calvin moved to InitializeCategory57Screen */
- #if (0)
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* (0) */
- /* MTK Calvin end */
- }
- /*****************************************************************************
- * FUNCTION
- * DisableInlineItem
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void DisableInlineItem(InlineItem *item, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags |= INLINE_ITEM_DISABLED;
- wgui_inline_items[index].flags |= INLINE_ITEM_DISABLED;
- }
- /*****************************************************************************
- * FUNCTION
- * EnableInlineItem
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void EnableInlineItem(InlineItem *item, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags &= ~INLINE_ITEM_DISABLED;
- wgui_inline_items[index].flags &= ~INLINE_ITEM_DISABLED;
- }
- /*****************************************************************************
- * FUNCTION
- * SetInlineItemFollowUp
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineItemFollowUp(InlineItem *item, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags |= INLINE_ITEM_FOLLOW_UP;
- wgui_inline_items[index].flags |= INLINE_ITEM_FOLLOW_UP;
- }
- /*****************************************************************************
- * FUNCTION
- * SetInlineItemFollowDown
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineItemFollowDown(InlineItem *item, S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags |= INLINE_ITEM_FOLLOW_DOWN;
- wgui_inline_items[index].flags |= INLINE_ITEM_FOLLOW_DOWN;
- }
- /*****************************************************************************
- * FUNCTION
- * DisableInlineItemHighlight
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void DisableInlineItemHighlight(InlineItem *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags |= INLINE_ITEM_DISABLE_HIGHLIGHT;
- }
- /*****************************************************************************
- * FUNCTION
- * SetInlineItemFullWidth
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineItemFullWidth(InlineItem *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags |= INLINE_ITEM_LEFT_ALIGN;
- }
- /*****************************************************************************
- * FUNCTION
- * LeftJustifyInlineItem
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void LeftJustifyInlineItem(InlineItem *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags &= ~INLINE_ITEM_JUSTIFY_MASK;
- item->flags |= INLINE_ITEM_LEFT_JUSTIFY;
- }
- /*****************************************************************************
- * FUNCTION
- * RightJustifyInlineItem
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void RightJustifyInlineItem(InlineItem *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags &= ~INLINE_ITEM_JUSTIFY_MASK;
- /* 20051012 HIMANSHU START COMMON */
- /* Inline items will not be shown right justify, when the default text effect
- is enabled, so removed the flag in that case. */
- #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
- if (!(IsInlineItemDefaultTextEnable()))
- #endif
- /* 20051012 HIMANSHU END COMMON */
- item->flags |= INLINE_ITEM_RIGHT_JUSTIFY;
- }
- /*****************************************************************************
- * FUNCTION
- * CenterJustifyInlineItem
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void CenterJustifyInlineItem(InlineItem *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags &= ~INLINE_ITEM_JUSTIFY_MASK;
- item->flags |= INLINE_ITEM_CENTER_JUSTIFY;
- }
- /*****************************************************************************
- * FUNCTION
- * DisableInlineItemBoundary
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void DisableInlineItemBoundary(InlineItem *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags &= ~INLINE_ITEM_BOUNDARY_MASK;
- item->flags |= INLINE_ITEM_BOUNDARY_NEVER;
- }
- /*****************************************************************************
- * FUNCTION
- * EnableInlineItemBoundary
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void EnableInlineItemBoundary(InlineItem *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags &= ~INLINE_ITEM_BOUNDARY_MASK;
- item->flags |= INLINE_ITEM_BOUNDARY_ALWAYS;
- }
- /*****************************************************************************
- * FUNCTION
- * SetInlineItemDottedUnderline
- * DESCRIPTION
- *
- * PARAMETERS
- * item [?]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineItemDottedUnderline(InlineItem *item)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- item->flags |= INLINE_ITEM_DOTTED_UNDERLINE;
- }
- /*****************************************************************************
- * FUNCTION
- * clear_inline_item_key_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void clear_inline_item_key_handler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((wgui_inline_item_key_code == -1) || (wgui_inline_item_key_event == -1))
- {
- return;
- }
- ClearKeyHandler((U16) wgui_inline_item_key_code, (U16) wgui_inline_item_key_event);
- wgui_inline_item_key_code = -1;
- wgui_inline_item_key_event = -1;
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_inline_item_key_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void wgui_inline_item_key_handler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_lock_frame_buffer();
- wgui_text_menuitem_reset_scrolling();
- gdi_layer_unlock_frame_buffer();
- wgui_inline_items[wgui_inline_item_highlighted_index].handler(
- wgui_inline_item_x,
- wgui_inline_item_y,
- wgui_inline_item_width,
- wgui_inline_item_height,
- wgui_inline_item_key_code,
- wgui_inline_item_key_event,
- &wgui_inline_items [wgui_inline_item_highlighted_index].text_p,
- wgui_inline_items[wgui_inline_item_highlighted_index]. item,
- wgui_inline_items[wgui_inline_item_highlighted_index]. flags,
- wgui_current_history_buffer);
- wgui_current_history_buffer = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * register_inline_item_key_handler
- * DESCRIPTION
- *
- * PARAMETERS
- * index [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void register_inline_item_key_handler(S32 index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- wgui_inline_item_highlighted_index = index;
- wgui_inline_item_key_code = wgui_inline_items[index].key_code;
- wgui_inline_item_key_event = wgui_inline_items[index].key_event;
- if (wgui_inline_item_key_code == KEY_LSK)
- {
- SetLeftSoftkeyFunction(wgui_inline_item_key_handler, wgui_inline_item_key_event);
- }
- else if (wgui_inline_item_key_code == KEY_RSK)
- {
- SetRightSoftkeyFunction(wgui_inline_item_key_handler, wgui_inline_item_key_event);
- }
- else
- {
- SetKeyHandler(wgui_inline_item_key_handler, (U16) wgui_inline_item_key_code, (U16) wgui_inline_item_key_event);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * handle_inline_item_location
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * width [IN]
- * height [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void handle_inline_item_location(S32 x, S32 y, S32 width, S32 height)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 item_index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (wgui_inline_item_handled)
- {
- return;
- }
- wgui_inline_item_handled = 1;
- wgui_inline_item_x = x;
- wgui_inline_item_y = y;
- wgui_inline_item_width = width;
- wgui_inline_item_height = height;
- item_index = wgui_inline_item_highlighted_index;
- if (wgui_inline_items[item_index].key_code == INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT)
- {
- gdi_layer_lock_frame_buffer();
- wgui_text_menuitem_reset_scrolling = gui_fixed_icontext_menuitem_stop_scroll;
- wgui_text_menuitem_restart_scrolling = gui_fixed_icontext_menuitem_start_scroll;
- if (((wgui_inline_items[item_index].flags & 0xff) != INLINE_ITEM_TYPE_DISPLAY_ONLY))
- {
- wgui_text_menuitem_reset_scrolling();
- }
- wgui_inline_items[item_index].handler(
- wgui_inline_item_x,
- wgui_inline_item_y,
- wgui_inline_item_width,
- wgui_inline_item_height,
- wgui_inline_items[item_index].key_code,
- wgui_inline_items[item_index].key_event,
- &wgui_inline_items[item_index].text_p,
- wgui_inline_items[item_index].item,
- wgui_inline_items[item_index].flags,
- wgui_current_history_buffer);
- wgui_current_history_buffer = NULL;
- gdi_layer_unlock_frame_buffer();
- }
- else if ((wgui_inline_items[item_index].flags & 0xff) == INLINE_ITEM_IMAGE_TEXT_TYPE)
- {
- wgui_text_menuitem_reset_scrolling();
- if (inline_image_text_edit_flag == 1)
- {
- wgui_inline_items[item_index].handler(
- wgui_inline_item_x,
- wgui_inline_item_y,
- wgui_inline_item_width,
- wgui_inline_item_height,
- wgui_inline_items[item_index].key_code,
- wgui_inline_items[item_index].key_event,
- &wgui_inline_items[item_index].text_p,
- wgui_inline_items[item_index].item,
- wgui_inline_items[item_index].flags,
- wgui_current_history_buffer);
- wgui_current_history_buffer = NULL; /* 112105 inline Calvin added */
- }
- else
- {
- if ((wgui_inline_items[item_index].flags & INLINE_ITEM_DISABLE_HIGHLIGHT))
- {
- PRINT_INFORMATION(("n DISABLE HIGHLIGHT TRUE"));
- gui_draw_filled_area(
- wgui_inline_item_x + 17,
- wgui_inline_item_y,
- (wgui_inline_item_x + wgui_inline_item_width),
- (wgui_inline_item_y + wgui_inline_item_height),
- (wgui_inline_select_fixed_text_menuitem_theme.selected_filler));
- }
- else
- {
- PRINT_INFORMATION(("n DISABLE HIGHLIGHT FALSE"));
- gui_draw_filled_area(
- wgui_inline_item_x,
- wgui_inline_item_y,
- (wgui_inline_item_x + wgui_inline_item_width),
- (wgui_inline_item_y + wgui_inline_item_height),
- (wgui_inline_select_fixed_text_menuitem_theme.selected_filler));
- }
- wgui_show_image_text_item_highlight(
- wgui_inline_item_x,
- wgui_inline_item_y,
- wgui_inline_item_width,
- wgui_inline_item_height,
- &wgui_inline_items[item_index]);
- register_left_softkey_handler();
- register_inline_item_key_handler(item_index);
- }
- }
- else if ((wgui_inline_items[item_index].flags & 0xff) == INLINE_ITEM_ATTACH_IMAGE)
- {
- if ((wgui_inline_items[item_index].flags & INLINE_ITEM_DISABLE_HIGHLIGHT))
- {
- PRINT_INFORMATION(("n DISABLE HIGHLIGHT TRUE"));
- gui_draw_filled_area(
- wgui_inline_item_x + 17,
- wgui_inline_item_y,
- (wgui_inline_item_x + wgui_inline_item_width),
- (wgui_inline_item_y + wgui_inline_item_height),
- (wgui_inline_select_fixed_text_menuitem_theme.selected_filler));
- }
- else
- {
- PRINT_INFORMATION(("n DISABLE HIGHLIGHT FALSE"));
- gui_draw_filled_area(
- wgui_inline_item_x,
- wgui_inline_item_y,
- (wgui_inline_item_x + wgui_inline_item_width),
- (wgui_inline_item_y + wgui_inline_item_height),
- (wgui_inline_select_fixed_text_menuitem_theme.selected_filler));
- }
- wgui_show_image_attachment_item_highlight(
- wgui_inline_item_x,
- wgui_inline_item_y,
- wgui_inline_item_width,
- wgui_inline_item_height,
- &wgui_inline_items[item_index]);
- register_left_softkey_handler();
- register_inline_item_key_handler(item_index);
- }
- else
- {
- if (wgui_inline_items[item_index].flags & INLINE_ITEM_OPEN)
- {
- gdi_layer_lock_frame_buffer();
- wgui_text_menuitem_reset_scrolling = gui_fixed_icontext_menuitem_stop_scroll;
- wgui_text_menuitem_restart_scrolling = gui_fixed_icontext_menuitem_start_scroll;
- wgui_text_menuitem_reset_scrolling();
- wgui_inline_items[item_index].handler(
- wgui_inline_item_x,
- wgui_inline_item_y,
- wgui_inline_item_width,
- wgui_inline_item_height,
- wgui_inline_items[item_index].key_code,
- wgui_inline_items[item_index].key_event,
- &wgui_inline_items[item_index].text_p,
- wgui_inline_items[item_index].item,
- wgui_inline_items[item_index].flags,
- wgui_current_history_buffer);
- wgui_inline_items[item_index].flags &= ~INLINE_ITEM_OPEN;
- wgui_current_history_buffer = NULL;
- gdi_layer_unlock_frame_buffer();
- }
- else
- {
- register_left_softkey_handler();
- register_inline_item_key_handler(item_index);
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * wgui_get_inline_history_size
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- S32 wgui_get_inline_history_size(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 inline_history_size = 0, s;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- switch (wgui_current_inline_item_type)
- {
- case INLINE_ITEM_TYPE_TEXT_EDIT:
- inline_history_size = sizeof(inline_text_edit_history);
- break;
- case INLINE_ITEM_TYPE_FULL_SCREEN_EDIT:
- inline_history_size = sizeof(inline_full_screen_edit_history);
- break;
- case INLINE_ITEM_TYPE_DATE:
- inline_history_size = sizeof(inline_date_edit_history);
- break;
- case INLINE_ITEM_TYPE_TIME:
- inline_history_size = sizeof(inline_time_edit_history);
- break;
- case INLINE_ITEM_TYPE_TIME_PERIOD:
- inline_history_size = sizeof(inline_time_period_edit_history);
- break;
- case INLINE_ITEM_TYPE_IP4_EDIT:
- inline_history_size = sizeof(inline_IP4_edit_history);
- break;
- case INLINE_ITEM_TYPE_DOW_SELECT:
- inline_history_size = sizeof(inline_DOW_select_history);
- break;
- }
- s = sizeof(list_menu_category_history);
- s = (s + 3) / 4;
- s *= 4;
- return (s + inline_history_size + sizeof(U32));
- }
- /* Current structure:
- history = <list menu history> + <4 bytes for flags> + <inline edit specific history>
- flags = 1: Content has been changed by user
- flags = 0: Content has not been changed by user */
- /*****************************************************************************
- * FUNCTION
- * wgui_get_inline_history
- * DESCRIPTION
- *
- * PARAMETERS
- * history_ID [IN]
- * history_buffer [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 *wgui_get_inline_history(U16 history_ID, U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 *flags;
- S32 start_offset, s;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- get_list_menu_category_history(history_ID, history_buffer);
- s = sizeof(list_menu_category_history);
- s = (s + 3) / 4;
- s *= 4;
- start_offset = s + sizeof(U32);
- flags = (U32*) (history_buffer + s);
- *flags = wgui_inline_list_menu_changed;
- switch (wgui_current_inline_item_type)
- {
- case INLINE_ITEM_TYPE_TEXT_EDIT:
- inline_text_edit_get_history((U8*) (history_buffer + start_offset), MMI_current_input_type);
- break;
- case INLINE_ITEM_TYPE_FULL_SCREEN_EDIT:
- inline_full_screen_edit_get_history((U8*) (history_buffer + start_offset), MMI_current_input_type);
- break;
- case INLINE_ITEM_TYPE_DATE:
- inline_date_edit_get_history((U8*) (history_buffer + start_offset));
- break;
- case INLINE_ITEM_TYPE_TIME:
- inline_time_edit_get_history((U8*) (history_buffer + start_offset));
- break;
- case INLINE_ITEM_TYPE_TIME_PERIOD:
- inline_time_period_edit_get_history((U8*) (history_buffer + start_offset));
- break;
- case INLINE_ITEM_TYPE_IP4_EDIT:
- inline_IP4_edit_get_history((U8*) (history_buffer + start_offset));
- break;
- case INLINE_ITEM_TYPE_DOW_SELECT:
- inline_DOW_select_get_history((U8*) (history_buffer + start_offset));
- break;
- /* Start Yogesh 20040814 */
- case INLINE_ITEM_TYPE_MULTI_LINE_EDIT:
- inline_multi_line_edit_get_history((U8*) (history_buffer + start_offset), MMI_current_input_type);
- break;
- /* End Yogesh 20040814 */
- }
- return (history_buffer);
- }
- /*****************************************************************************
- * FUNCTION
- * GetInlineDoneFlag
- * DESCRIPTION
- *
- * PARAMETERS
- * history_buffer [?]
- * RETURNS
- *
- *****************************************************************************/
- U8 GetInlineDoneFlag(U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 *flags;
- S32 s = sizeof(list_menu_category_history);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- s = (s + 3) / 4;
- s *= 4;
- if (history_buffer == NULL)
- {
- return (0);
- }
- flags = (U32*) (history_buffer + s);
- if (*flags)
- {
- return (1);
- }
- else
- {
- return (0);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * SetInlineDoneFlag
- * DESCRIPTION
- *
- * PARAMETERS
- * history_buffer [?]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInlineDoneFlag(U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 *flags;
- S32 s = sizeof(list_menu_category_history);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- s = (s + 3) / 4;
- s *= 4;
- if (history_buffer == NULL)
- {
- return;
- }
- flags = (U32*) (history_buffer + s);
- *flags = 1;
- }
- /*****************************************************************************
- * FUNCTION
- * ResetInlineDoneFlag
- * DESCRIPTION
- *
- * PARAMETERS
- * history_buffer [?]
- * RETURNS
- * void
- *****************************************************************************/
- void ResetInlineDoneFlag(U8 *history_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 *flags;
- S32 s = sizeof(list_menu_category_history);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- s = (s + 3) / 4;
- s *= 4;
- if (history_buffer == NULL)
- {
- return;
- }
- flags = (U32*) (history_buffer + s);
- *flags = 0;
- }
- #define INLINE_ITEM_DATA_ID_LENGTH 2
- #define INLINE_ITEM_DATA_SIZE_LENGTH 2
- #define INLINE_ITEM_CAPTION_DATA_ID 0x0001
- #define INLINE_ITEM_DISPLAY_ONLY_DATA_ID 0x0002
- #define INLINE_ITEM_USER_DEFINED_SELECT_DATA_ID 0x0003
- #define INLINE_ITEM_TEXT_EDIT_DATA_ID 0x0004
- #define INLINE_ITEM_FULL_SCREEN_EDIT_DATA_ID 0x0005
- #define INLINE_ITEM_SELECT_DATA_ID 0x0006
- #define INLINE_ITEM_DATE_DATA_ID 0x0007
- #define INLINE_ITEM_TIME_DATA_ID 0x0008
- #define INLINE_ITEM_TIME_PERIOD_DATA_ID 0x0009
- #define INLINE_ITEM_IP4_EDIT_DATA_ID 0x0010
- #define INLINE_ITEM_DOW_SELECT_DATA_ID 0x0011
- /* Gurinder - 30/4/2004 - Att. Control History */
- #define INLINE_ITEM_ATTACH_IMAGE_DATA_ID 0x0012
- /* Gurinder - 5/5/2004 Inline Multiline Box History Control */
- #define INLINE_ITEM_TYPE_MULTI_LINE_DATA_ID 0x0013
- #define INLINE_ITEM_COLOR_SELECT_DATA_ID 0x0014
- /*****************************************************************************
- * FUNCTION
- * wgui_get_inline_data_size
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- S32 wgui_get_inline_data_size(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 i, total_size = 0, size;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < wgui_n_inline_items; i++)
- {
- size = 0;
- switch (wgui_inline_items[i].flags & 0xff)
- {
- case INLINE_ITEM_TYPE_CAPTION:
- case INLINE_ITEM_TYPE_DISPLAY_ONLY:
- case INLINE_ITEM_TYPE_USER_DEFINED_SELECT:
- break;
- case INLINE_ITEM_TYPE_TEXT_EDIT:
- {
- S32 l;
- wgui_inline_item_text_edit *ii = (wgui_inline_item_text_edit*) wgui_inline_items[i].item;
- l = ii->buffer_size * ENCODING_LENGTH;