wgui_inline_edit.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:887k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * wgui_inline_edit.C
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   Functions for Inline items.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  * -------
  53.  * -------
  54.  *
  55.  *============================================================================
  56.  *             HISTORY
  57.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  58.  *------------------------------------------------------------------------------
  59.  * removed!
  60.  *
  61.  * removed!
  62.  * removed!
  63.  * removed!
  64.  *
  65.  * removed!
  66.  * removed!
  67.  * removed!
  68.  *
  69.  * removed!
  70.  * removed!
  71.  * removed!
  72.  *
  73.  * removed!
  74.  * removed!
  75.  * removed!
  76.  *
  77.  * removed!
  78.  * removed!
  79.  * removed!
  80.  *
  81.  * removed!
  82.  * removed!
  83.  * removed!
  84.  *
  85.  * removed!
  86.  * removed!
  87.  * removed!
  88.  *
  89.  * removed!
  90.  * removed!
  91.  * removed!
  92.  *
  93.  * removed!
  94.  * removed!
  95.  * removed!
  96.  *
  97.  * removed!
  98.  * removed!
  99.  * removed!
  100.  *
  101.  * removed!
  102.  * removed!
  103.  * removed!
  104.  *
  105.  * removed!
  106.  * removed!
  107.  * removed!
  108.  *
  109.  * removed!
  110.  * removed!
  111.  * removed!
  112.  *
  113.  * removed!
  114.  * removed!
  115.  * removed!
  116.  *
  117.  * removed!
  118.  * removed!
  119.  * removed!
  120.  *
  121.  * removed!
  122.  * removed!
  123.  * removed!
  124.  *
  125.  * removed!
  126.  * removed!
  127.  * removed!
  128.  *
  129.  * removed!
  130.  * removed!
  131.  * removed!
  132.  *
  133.  * removed!
  134.  * removed!
  135.  * removed!
  136.  *
  137.  * removed!
  138.  * removed!
  139.  * removed!
  140.  *
  141.  * removed!
  142.  * removed!
  143.  * removed!
  144.  *
  145.  * removed!
  146.  * removed!
  147.  * removed!
  148.  *
  149.  * removed!
  150.  * removed!
  151.  * removed!
  152.  *
  153.  * removed!
  154.  * removed!
  155.  * removed!
  156.  *
  157.  * removed!
  158.  * removed!
  159.  * removed!
  160.  *
  161.  * removed!
  162.  * removed!
  163.  * removed!
  164.  *
  165.  * removed!
  166.  * removed!
  167.  * removed!
  168.  *
  169.  * removed!
  170.  * removed!
  171.  * removed!
  172.  *
  173.  * removed!
  174.  * removed!
  175.  * removed!
  176.  *
  177.  * removed!
  178.  * removed!
  179.  * removed!
  180.  *
  181.  * removed!
  182.  * removed!
  183.  * removed!
  184.  *
  185.  * removed!
  186.  * removed!
  187.  * removed!
  188.  *
  189.  * removed!
  190.  * removed!
  191.  * removed!
  192.  *
  193.  * removed!
  194.  * removed!
  195.  * removed!
  196.  *
  197.  * removed!
  198.  * removed!
  199.  * removed!
  200.  *
  201.  * removed!
  202.  * removed!
  203.  * removed!
  204.  *
  205.  * removed!
  206.  * removed!
  207.  * removed!
  208.  *
  209.  * removed!
  210.  * removed!
  211.  * removed!
  212.  *
  213.  * removed!
  214.  * removed!
  215.  * removed!
  216.  *
  217.  * removed!
  218.  * removed!
  219.  * removed!
  220.  *
  221.  * removed!
  222.  * removed!
  223.  * removed!
  224.  *
  225.  * removed!
  226.  * removed!
  227.  * removed!
  228.  *
  229.  * removed!
  230.  * removed!
  231.  * removed!
  232.  *
  233.  * removed!
  234.  * removed!
  235.  * removed!
  236.  *
  237.  * removed!
  238.  * removed!
  239.  * removed!
  240.  *
  241.  * removed!
  242.  * removed!
  243.  * removed!
  244.  *
  245.  * removed!
  246.  * removed!
  247.  * removed!
  248.  *
  249.  * removed!
  250.  * removed!
  251.  * removed!
  252.  *
  253.  * removed!
  254.  * removed!
  255.  * removed!
  256.  *
  257.  * removed!
  258.  * removed!
  259.  * removed!
  260.  *
  261.  * removed!
  262.  * removed!
  263.  * removed!
  264.  *
  265.  * removed!
  266.  * removed!
  267.  * removed!
  268.  *
  269.  * removed!
  270.  * removed!
  271.  * removed!
  272.  *
  273.  * removed!
  274.  * removed!
  275.  * removed!
  276.  *
  277.  * removed!
  278.  * removed!
  279.  * removed!
  280.  *
  281.  * removed!
  282.  * removed!
  283.  * removed!
  284.  *
  285.  * removed!
  286.  * removed!
  287.  * removed!
  288.  *
  289.  * removed!
  290.  * removed!
  291.  * removed!
  292.  *
  293.  * removed!
  294.  * removed!
  295.  * removed!
  296.  *
  297.  * removed!
  298.  * removed!
  299.  * removed!
  300.  *
  301.  * removed!
  302.  * removed!
  303.  * removed!
  304.  *
  305.  * removed!
  306.  * removed!
  307.  * removed!
  308.  *
  309.  * removed!
  310.  * removed!
  311.  * removed!
  312.  *
  313.  * removed!
  314.  * removed!
  315.  * removed!
  316.  *
  317.  * removed!
  318.  * removed!
  319.  * removed!
  320.  *
  321.  * removed!
  322.  * removed!
  323.  * removed!
  324.  *
  325.  * removed!
  326.  * removed!
  327.  * removed!
  328.  *
  329.  * removed!
  330.  * removed!
  331.  * removed!
  332.  *
  333.  * removed!
  334.  * removed!
  335.  * removed!
  336.  *
  337.  * removed!
  338.  * removed!
  339.  * removed!
  340.  *
  341.  * removed!
  342.  * removed!
  343.  * removed!
  344.  *
  345.  * removed!
  346.  * removed!
  347.  * removed!
  348.  *
  349.  * removed!
  350.  * removed!
  351.  * removed!
  352.  *
  353.  * removed!
  354.  * removed!
  355.  * removed!
  356.  *
  357.  * removed!
  358.  * removed!
  359.  * removed!
  360.  *
  361.  * removed!
  362.  * removed!
  363.  * removed!
  364.  *
  365.  * removed!
  366.  * removed!
  367.  * removed!
  368.  *
  369.  * removed!
  370.  * removed!
  371.  * removed!
  372.  *
  373.  * removed!
  374.  * removed!
  375.  * removed!
  376.  *
  377.  * removed!
  378.  * removed!
  379.  * removed!
  380.  *
  381.  * removed!
  382.  * removed!
  383.  * removed!
  384.  *
  385.  * removed!
  386.  * removed!
  387.  * removed!
  388.  *
  389.  * removed!
  390.  * removed!
  391.  * removed!
  392.  *
  393.  * removed!
  394.  * removed!
  395.  * removed!
  396.  *
  397.  * removed!
  398.  * removed!
  399.  * removed!
  400.  *
  401.  * removed!
  402.  * removed!
  403.  * removed!
  404.  *
  405.  * removed!
  406.  * removed!
  407.  * removed!
  408.  *
  409.  * removed!
  410.  * removed!
  411.  * removed!
  412.  *
  413.  * removed!
  414.  * removed!
  415.  * removed!
  416.  *
  417.  * removed!
  418.  * removed!
  419.  * removed!
  420.  *
  421.  * removed!
  422.  * removed!
  423.  * removed!
  424.  *
  425.  * removed!
  426.  * removed!
  427.  * removed!
  428.  *
  429.  * removed!
  430.  * removed!
  431.  * removed!
  432.  *
  433.  * removed!
  434.  * removed!
  435.  * removed!
  436.  *
  437.  * removed!
  438.  * removed!
  439.  * removed!
  440.  *
  441.  * removed!
  442.  * removed!
  443.  * removed!
  444.  *
  445.  * removed!
  446.  * removed!
  447.  * removed!
  448.  *
  449.  * removed!
  450.  * removed!
  451.  * removed!
  452.  *
  453.  *------------------------------------------------------------------------------
  454.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  455.  *============================================================================
  456.  ****************************************************************************/
  457. /**
  458.  * Copyright Notice
  459.  * (c) 2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  460.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  461.  *  (It is illegal to remove this copyright notice from this software or any
  462.  *  portion of it)
  463.  */
  464. /**********************************************************************************
  465.    Filename:      wgui_inline_edit.c
  466.    Author:        manju
  467.    Date Created:  June-17-2003
  468.    Contains:      Implementation for inline editing
  469. **********************************************************************************/
  470. #include "GlobalDefs.h"
  471. #include "CustDataRes.h"
  472. #include "CustDataProts.h"
  473. #include "gui_themes.h"
  474. #include "gui_config.h"
  475. #include "wgui_categories.h"
  476. #include "wgui_status_icons.h"
  477. #include "wgui_datetime.h"
  478. #include "MMI_features.h"
  479. #include "TimerEvents.h"
  480. #include "DebugInitDef.h"
  481. /* MTK Leo add 20040413, add category257 for currency convertor */
  482. #include "HistoryGprot.h"
  483. #include "wgui_inline_edit.h"
  484. #include "wgui_categories_inputs.h"
  485. #include "wgui_categories_defs.h"
  486. #include "CommonScreens.h"
  487. #include "gui_setting.h"
  488. /* W05.36 Temp Solution for Pop Screen in Full Screen Editor */
  489. #include "wap.h"
  490. #include "pocgprot.h"
  491. #include "messagesresourcedata.h"
  492. #include "satdefs.h"
  493. #include "wgui_draw_manager.h"
  494. #include "wgui_virtual_keyboard.h"
  495. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  496. #include "EditorPen.h"
  497. static BOOL mmi_pen_editor_is_closecategory57;
  498. #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */ 
  499. /* MTK Elvis */
  500. extern U16 StopMyTimer(U16 nTimerId);
  501. extern U16 StartMyTimerInt(U16 nTimerId, U32 nTimeDuration, oslTimerFuncPtr TimerExpiry, U8 alignment);
  502. /* MTK end */
  503. /* MTK Elvis for R2L characters */
  504. extern BOOL r2lMMIFlag;
  505. /* MTK end */
  506. /* 041205 Calvin added */
  507. extern GDI_HANDLE MOMT_animation_handle;
  508. /* 041205 Calvin end */
  509. /* MTK Terry for 0x81 encoding support for Phone Book */
  510. extern S16 MMI_current_input_ext_type;
  511. extern U8 MMI_allow_only_english_input_modes;
  512. /* MTK Add By Elvis for T9Init declare */
  513. /*
  514.  * #ifdef __MMI_T9__
  515.  * extern void (*t9_inputbox_LSK_function)(void);
  516.  * extern void InuptMethodEnterCategory5(void);
  517.  * //MTK Elvis 20040521 ---patch for inline multiline input box
  518.  * //Leo 0530extern void InuptMethodEnterInlineMultilineScreen(void);
  519.  * //MTK end
  520.  * #elif defined __MMI_ZI__
  521.  * extern void (*zi_inputbox_LSK_function)(void);
  522.  * extern void ZiInuptMethodEnterCategory5(void);
  523.  * #elif defined __MMI_KA__
  524.  * extern void (*ka_inputbox_LSK_function)(void);
  525.  * extern void KonkaInuptMethodEnterCategory5(void);
  526.  * #elif defined __MMI_ITAP__
  527.  * extern void (*itap_inputbox_LSK_function)(void);
  528.  * extern void ItapInuptMethodEnterCategory5(void);
  529.  * #endif
  530.  */
  531. /* MTK end */
  532. #ifdef __MMI_T9__
  533. #include "t9definition.h"
  534. #include "t9api.h"
  535. extern void T9SetInputboxLSKFunction(FuncPtr f);
  536. extern void InuptMethodEnterCategory5(void);
  537. extern void InuptMethodExitCategory5(void);
  538. extern void T9InputMethodExit(void);
  539. #elif defined __MMI_ZI__
  540. extern void ZiSetInputboxLSKFunction(FuncPtr f);
  541. extern void ZiInuptMethodEnterSinglelineInputBox(void);
  542. extern void ZiInuptMethodExitSinglelineInputBox(void);
  543. extern void ZiInuptMethodEnterCategory5(void);
  544. extern void ZiInuptMethodExitCategory5(void);
  545. extern void ZiInputMethodExit(void);
  546. //KP Jerry add on 2007-3-8 start
  547. #elif defined __MMI_CSTAR__
  548. #include "cstarime.h"
  549. //KP Jerry add on 2007-3-8 end
  550. #elif defined __MMI_KA__
  551. extern void KonKaSetInputboxLSKFunction(FuncPtr f);
  552. extern void KonkaInuptMethodEnterSinglelineInputBox(void);
  553. extern void KonkaInuptMethodExitSinglelineInputBox(void);
  554. extern void KonkaInuptMethodEnterCategory5(void);
  555. extern void KonkaInuptMethodExitCategory5(void);
  556. extern void KonkaInputMethodExit(void);
  557. #elif defined __MMI_ITAP__
  558. /* under construction !*/
  559. /* under construction !*/
  560. /* under construction !*/
  561. /* under construction !*/
  562. /* under construction !*/
  563. #endif 
  564. /* MTK Elvis for multitap zero key */
  565. #ifdef __MMI_MULTITAP_KEY_0__
  566. #define ENABLE_DIALER_ZERO_KEY_MULTITAP            1    /* 0 */
  567. #else 
  568. #define ENABLE_DIALER_ZERO_KEY_MULTITAP            0
  569. #endif 
  570. /* MTK end */
  571. /* Amount of time (milliseconds) to wait before displaying the
  572.    current input method pop up for inline text edit items               */
  573. #define INLINE_INPUT_METHOD_DISPLAY_WAIT        (1000)
  574. /* Amount of time (milliseconds) to display the current input method    */
  575. #define INLINE_INPUT_METHOD_HIDE_WAIT           (2000)
  576. /*----------------------------------------------------------------------------
  577.    Inline edit data
  578. ----------------------------------------------------------------------------*/
  579. /* 072904 Calvin moved for centralized control */
  580. // #define ENABLE_INLINE_SINGLELINE_INPUTBOX_FRAME_SKIPPING  1
  581. /* Calvin end */
  582. /* History IDs for inline items  */
  583. #define INLINE_TEXT_EDIT_HISTORY_ID                1
  584. #define INLINE_SELECT_HISTORY_ID                   3
  585. #define INLINE_USER_DEFINED_SELECT_HISTORY_ID      4
  586. #define INLINE_DATE_HISTORY_ID                     5
  587. #define INLINE_TIME_HISTORY_ID                     6
  588. #define INLINE_DOW_SELECT_HISTORY_ID               7
  589. #define INLINE_TIME_PERIOD_HISTORY_ID              8
  590. #define INLINE_IP4_HISTORY_ID                      9
  591. #define INLINE_FULL_SCREEN_EDIT_HISTORY_ID         10
  592. #define INLINE_MULTI_LINE_EDIT_HISTORY_ID          11
  593. #define INLINE_COLOR_SELECT_SCREEN_ID              12
  594. wgui_inline_item wgui_inline_items[MAX_INLINE_ITEMS];
  595. wgui_inline_item *current_wgui_inline_item = NULL;
  596. /* Start Yogesh 20040816 */
  597. extern pBOOL flag_use_current_input_type;
  598. //End Yogesh 20040816   
  599. //PMT VIKAS START 20050707    
  600. #ifdef __MMI_UI_DALMATIAN_FIXEDLIST__
  601. extern void gui_disable_inline_bottom_line_draw(void);
  602. extern void gui_enable_inline_bottom_line_draw(void);
  603. extern void gui_enable_fixed_list_line_draw();
  604. extern void gui_disable_fixed_list_line_draw(void);
  605. extern BOOL line_draw;
  606. #endif /* __MMI_UI_DALMATIAN_FIXEDLIST__ */ 
  607. /* PMT VIKAS END 20050707 */
  608. S32 wgui_n_inline_items = 0;
  609. S32 wgui_inline_item_highlighted_index = -1;
  610. S32 wgui_inline_item_key_code = -1;
  611. S32 wgui_inline_item_key_event = -1;
  612. S32 wgui_inline_item_x = 0;
  613. S32 wgui_inline_item_y = 0;
  614. S32 wgui_inline_item_width = 0;
  615. S32 wgui_inline_item_height = 0;
  616. U8 wgui_inline_item_handled = 0;
  617. S32 wgui_current_inline_item_type = 0;
  618. U8 *wgui_current_history_buffer = NULL;
  619. U8 wgui_disable_inline_input_method_hints = 1;
  620. #if defined(__MMI_INSCREEN_MULTILINE_TEXTBOX__)
  621. S8 MMI_multi_line_inputbox_present = 0;
  622. #endif 
  623. /* Added to handle (Back/Done) on RSK  */
  624. U8 wgui_inline_list_menu_changed = 0;
  625. U8 wgui_inline_list_menu_disable_done = 0;
  626. void (*wgui_inline_edit_BACK_function) (void) = NULL;
  627. void (*wgui_inline_edit_DONE_function) (void) = NULL;
  628. void (*wgui_inline_edit_LSK_function) (void) = NULL;
  629. extern UI_single_line_input_box_theme date_time_input_theme;
  630. extern UI_filled_area date_time_input_background_filler;
  631. extern UI_filled_area time_period_input_background_filler;
  632. extern void set_current_input_box_type(mmi_editor_inoutbox_enum input_box_type);
  633. #define MAX_INLINE_TEXT_EDIT_ITEMS                    15
  634. #define MAX_INLINE_TEXT_EDIT_BUFFER_SIZE              124       /* For Email */
  635. /* Pixtel - Gurinder - 3/24/2004 To Support Signature Control. */
  636. #define MAX_INLINE_FULL_SCREEN_TEXT_EDIT_BUFFER_SIZE     512
  637. S32 n_inline_text_edit_items = 0;
  638. S8 inline_multiline_complete = 0;
  639. wgui_inline_item_text_edit wgui_inline_text_edit_items[MAX_INLINE_TEXT_EDIT_ITEMS];
  640. U8 inline_text_edit_mask_buffers[MAX_INLINE_TEXT_EDIT_ITEMS][MAX_INLINE_TEXT_EDIT_BUFFER_SIZE];
  641. UI_string_type inline_full_screen_edit_saved_title = (UI_string_type) NULL;
  642. UI_string_type inline_full_screen_edit_saved_LSK_label = (UI_string_type) NULL;
  643. UI_string_type inline_full_screen_edit_saved_RSK_label = (UI_string_type) NULL;
  644. PU8 inline_full_screen_edit_saved_LSK_icon = (PU8) NULL;
  645. PU8 inline_full_screen_edit_saved_RSK_icon = (PU8) NULL;
  646. PU8 inline_full_screen_edit_saved_title_icon = (PU8) NULL;
  647. U8 inline_full_screen_edit_changed = 0;
  648. wgui_inline_item_text_edit *current_wgui_inline_text_edit_item;
  649. U8 **current_wgui_inline_text_edit_text_p;
  650. U8 wgui_inline_full_screen_text_edit_buffer[MAX_INLINE_FULL_SCREEN_TEXT_EDIT_BUFFER_SIZE];
  651. void handle_inline_full_screen_edit_cancel(void);
  652. void inline_edit_prepare_mask_buffer(U8 *, U8 *);
  653. void wgui_inline_edit_handle_multiline_inputbox_input(void);
  654. void handle_inline_full_screen_edit_complete(void);
  655. void handle_inline_full_screen_edit_close(void);
  656. void wgui_inline_edit_default_list_highlight_handler(S32 item_index);
  657. /** New Image Text Control ***/
  658. #if defined __MMI_PLUTO_GPRS__
  659. #define MAX_INLINE_IMAGE_TEXT_ITEMS                   10
  660. /* Issue: Email: 144 - Gurinder 30/4/2004 */
  661. #define  IMAGE_TEXT_CONTROL_TEXT_X        26
  662. #define  IMAGE_TEXT_CONTROL_TEXT_WIDTH    83
  663. U8 inline_scroll_flag = FALSE;
  664. S32 image_text_control_scroll_x = 0;
  665. scrolling_text wgui_inline_scroll_text;
  666. PU8 inline_last_image = NULL;
  667. S32 inline_y_pos_image = 0;
  668. U8 inline_image_text_edit_flag = 0;
  669. void draw_image_text_control(
  670.         wgui_inline_image_text *control,
  671.         S32 x1,
  672.         S32 y1,
  673.         S32 iwidth,
  674.         S32 iheight,
  675.         PU8 image1,
  676.         PU8 image2,
  677.         PU8 image3,
  678.         U8 *text,
  679.         U8 highlight_flag);
  680. void wgui_show_image_text_item(S32 x1, S32 y1, S32 iwidth, S32 iheight, wgui_inline_item *item);
  681. wgui_inline_image_text wgui_inline_image_text_items[MAX_INLINE_IMAGE_TEXT_ITEMS];
  682. wgui_inline_image_text *current_image_text_control = NULL;
  683. S32 n_inline_image_text = 0;
  684. void handle_inline_full_screen_edit(
  685.         S32 x,
  686.         S32 y,
  687.         S32 width,
  688.         S32 height,
  689.         S32 key_code,
  690.         S32 key_event,
  691.         U8 **text_p,
  692.         void *item,
  693.         U32 flags,
  694.         U8 *history_buffer);
  695. void handle_inline_full_screen_imagetext_edit(
  696.         S32 x,
  697.         S32 y,
  698.         S32 width,
  699.         S32 height,
  700.         S32 key_code,
  701.         S32 key_event,
  702.         U8 **text_p,
  703.         void *item,
  704.         U32 flags,
  705.         U8 *history_buffer);
  706. #endif /* defined __MMI_PLUTO_GPRS__ */ 
  707. #ifdef __MMI_TOUCH_SCREEN__
  708. typedef enum
  709. {
  710.     /* Ignore pen events */
  711.     WGUI_INLINE_PEN_HANDLER_NONE,
  712.     /* Prepare to change highlight on Pen Up. Do nothing else. */
  713.     WGUI_INLINE_PEN_HANDLER_SWITCH_ITEM,
  714.     /* Redirect pen events to scrollbar */
  715.     WGUI_INLINE_PEN_HANDLER_SCROLLBAR,
  716.     /* Redirect pen events to the current menu item */
  717.     WGUI_INLINE_PEN_HANDLER_CURRENT_ITEM,
  718.     /* Wait long press animation to invoke LSK */
  719.     WGUI_INLINE_PEN_HANDLER_WAIT_LONGPRESS,
  720.     /* Redirect pen events to fullscreen editor */
  721.     WGUI_INLINE_PEN_HANDLER_FULLSCREEN_EDITOR
  722. } wgui_inline_pen_handler_type_enum;
  723. static wgui_inline_pen_handler_type_enum wgui_inline_pen_handler_type;
  724. static S32 wgui_inline_pen_down_item_index;
  725. static BOOL(*wgui_current_inline_item_pen_function) (mmi_pen_event_type_enum pen_event, S16 x, S16 y,
  726.                                                      gui_inline_item_pen_enum *item_event) =
  727.     UI_dummy_inline_item_pen_function;
  728. #endif /* __MMI_TOUCH_SCREEN__ */ 
  729. /* 101105 inline Calvin Start */
  730. #if defined (__MMI_WALLPAPER_ON_BOTTOM__)
  731. static MMI_ID_TYPE inline_edit_scr_bg_ID;
  732. static S8 *inline_edit_scr_bg_filename;
  733. static S32 inline_edit_scr_bg_x, inline_edit_scr_bg_y;
  734. static U8 inline_edit_scr_bg_opacity;
  735. #endif /* defined (__MMI_WALLPAPER_ON_BOTTOM__) */ 
  736. /* 101105 Calvin End */
  737. extern icontext_button MMI_softkeys[];
  738. /* MTK Leo start 20051001, for sending inline items' change notify to application */
  739. static void (*inline_item_changed_handler) (U16 index);
  740. /* MTK Leo end */
  741. /************************/
  742. void redraw_inline_full_screen_edit(void);
  743. void inline_edit_phone_number_input_complete_multitap_star_key(void);
  744. /* MTK Elvis */
  745. void inline_edit_phone_number_input_complete_multitap_zero_key(void);
  746. /* MTK Elvis */
  747. void cat57_virtual_keypad_callback(void);
  748. /* Used to highlight the same item again after editing (ex: After return from full screen edit  */
  749. void (*inline_edit_current_highlight_handler) (S32 item_index) = MMI_dummy_highlight_handler;
  750. UI_filled_area temp_inline_list_menu_background_filler = 
  751. {
  752.     UI_FILLED_AREA_TYPE_COLOR,
  753.     UI_NULL_IMAGE,
  754.     NULL,
  755.     /* MTK Leo modify 0912 */
  756. #ifdef __MMI_DEFAULT_THEME_3__
  757.     {206, 206, 206, 100},
  758. #else 
  759.     {240, 240, 240, 100},
  760. #endif 
  761.     /* MTK Leo end */
  762.     {0, 0, 0, 0},
  763.     {0, 0, 0, 100},
  764.     {0, 0, 0, 0},
  765.     0
  766. };
  767. UI_filled_area temp_inline_list_menu_normal_item_filler = {UI_FILLED_AREA_TYPE_COLOR,
  768.     UI_NULL_IMAGE,
  769.     NULL,
  770.     /* MTK Leo modify 0912 */
  771. #ifdef __MMI_DEFAULT_THEME_3__
  772.     {206, 206, 206, 100},
  773. #else 
  774.     {240, 240, 240, 100},
  775. #endif 
  776.     /* MTK Leo end */
  777.     {0, 0, 0, 0},
  778.     {0, 0, 0, 0},
  779.     {0, 0, 0, 0},
  780.     0
  781. };
  782. UI_filled_area temp_inline_list_menu_selected_item_filler = {UI_FILLED_AREA_TYPE_COLOR,
  783.     UI_NULL_IMAGE,
  784.     NULL,
  785.     /* MTK Leo modify 0912 */
  786. #ifdef __MMI_DEFAULT_THEME_3__
  787.     {255, 255, 255, 100},
  788. #else 
  789.     {167, 232, 93, 100},
  790. #endif 
  791.     /* MTK Leo end */
  792.     {0, 0, 0, 0},
  793.     {0, 0, 0, 0},
  794.     {0, 0, 0, 0},
  795.     0
  796. };
  797. UI_filled_area temp_inline_list_menu_disabled_item_filler = {UI_FILLED_AREA_TYPE_COLOR,
  798.     UI_NULL_IMAGE,
  799.     NULL,
  800.     {192, 192, 192, 100},
  801.     {0, 0, 0, 0},
  802.     {0, 0, 0, 0},
  803.     {0, 0, 0, 0},
  804.     0
  805. };
  806. UI_fixed_list_menu_theme wgui_inline_fixed_list_menu_theme = { &temp_inline_list_menu_background_filler,
  807.     &temp_inline_list_menu_background_filler,
  808.     5,
  809.     UI_LIST_MENU_LOOP
  810. };
  811. UI_fixed_icontext_menuitem_theme wgui_inline_fixed_icontext_menuitem_theme =
  812.     { &temp_inline_list_menu_normal_item_filler,
  813.     &temp_inline_list_menu_disabled_item_filler,
  814.     &temp_inline_list_menu_selected_item_filler,
  815.     &temp_inline_list_menu_selected_item_filler,
  816.     {0, 0, 0, 100},
  817.     {0, 0, 0, 100},
  818.     {0, 0, 0, 100},
  819.     {0, 0, 0, 100},
  820.     &MMI_default_font,
  821.     UI_MENUITEM_CENTER_TEXT_Y | UI_MENUITEM_CENTER_ICON_Y
  822. };
  823. UI_filled_area temp_inline_select_menu_filler = {UI_FILLED_AREA_TYPE_COLOR,
  824.     NULL,
  825.     NULL,
  826.     {71, 127, 255, 100},
  827.     {0, 0, 0, 0},
  828.     {0, 0, 0, 100},
  829.     {0, 0, 0, 0},
  830.     0
  831. };
  832. UI_horizontal_select_theme temp_inline_select_menu_theme = { &temp_inline_select_menu_filler,
  833.     UI_HORIZONTAL_SELECT_LOOP,
  834. };
  835. UI_fixed_text_menuitem_theme wgui_inline_select_fixed_text_menuitem_theme = { &temp_inline_list_menu_normal_item_filler,
  836.     &temp_inline_list_menu_disabled_item_filler,
  837.     &temp_inline_list_menu_selected_item_filler,
  838.     &temp_inline_list_menu_selected_item_filler,
  839.     {0, 0, 0, 100},
  840.     {0, 0, 0, 100},
  841.     {0, 0, 0, 100},
  842.     {0, 0, 0, 100},
  843.     &MMI_default_font,
  844.     UI_MENUITEM_CENTER_TEXT_Y
  845. };
  846. /* PMT  MANISH  START  20050722 */
  847. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  848. U8 wgui_enable_inline_item_default_text = 0;
  849. UI_filled_area temp_inline_edit_normal_filler =
  850.     {UI_FILLED_AREA_TYPE_COLOR | UI_FILLED_AREA_SINGLE_BORDER | UI_FILLED_AREA_ROUNDED_BORDER,
  851.     UI_NULL_IMAGE,
  852.     NULL,
  853.     /* 20051012 HIMANSHU START COMMON */
  854.     {255, 229, 172, 100},
  855.     /* 20051012 HIMANSHU END COMMON */
  856.     {0, 0, 0, 0},
  857.     {0, 0, 0, 100},
  858.     {0, 0, 0, 0},
  859.     0
  860. };
  861. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  862. /* PMT  MANISH  END  20050722 */
  863. /*----------------------------------------------------------------------------
  864.    Key handlers for the inline fixed list
  865. ----------------------------------------------------------------------------*/
  866. #define CATEGORY57_NO_KEY_FLAG         0
  867. #define CATEGORY57_UP_ARROW_KEY_FLAG   1
  868. #define CATEGORY57_DOWN_ARROW_KEY_FLAG 2
  869. U8 wgui_inline_edit_arrow_key_flag = CATEGORY57_NO_KEY_FLAG;
  870. void (*clear_inline_item_keys) (void) = UI_dummy_function;
  871. void (*redraw_current_inline_item) (void) = UI_dummy_function;
  872. void (*complete_inline_item_edit) (void) = UI_dummy_function;
  873. void register_inline_fixed_list_keys(void);
  874. void ShowCommonCategoryInlineEdit(UI_string_type title, U16 title_icon, U16 left_softkey, U16 left_softkey_icon,
  875.                                   U16 right_softkey, U16 right_softkey_icon, S32 number_of_items, U16 *list_of_icons,
  876.                                   InlineItem *list_of_items, S32 highlighted_item, U8 *history_buffer,
  877.                                   void (*highlight_handler) (S32 item_index),
  878.                                   void (*unhighlight_handler) (S32 item_index), U16 history_id);
  879. /* 20051012 HIMANSHU START COMMON */
  880. #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  881. void inline_item_default_text_show_background(S32 x1, S32 y1, S32 x2, S32 y2);
  882. void inline_text_edit_show_background(single_line_input_box *b);
  883. #endif /* __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__ */ 
  884. /* 20051012 HIMANSHU END INLINE EDIT */
  885. /* For transparent color filler */
  886. //PMT VIKAS START 20050630
  887. // This part of code should be removed
  888. #if 0
  889. /* under construction !*/
  890. /* under construction !*/
  891. #ifdef __MMI_UI_TRANSPARENT_EFFECT__
  892. /* under construction !*/
  893. /* under construction !*/
  894. /* under construction !*/
  895. /* under construction !*/
  896. /* under construction !*/
  897. /* under construction !*/
  898. /* under construction !*/
  899. /* under construction !*/
  900. /* under construction !*/
  901. /* under construction !*/
  902. /* under construction !*/
  903. /* under construction !*/
  904. /* under construction !*/
  905. /* under construction !*/
  906. /* under construction !*/
  907. /* under construction !*/
  908. /* under construction !*/
  909. /* under construction !*/
  910. /* under construction !*/
  911. /* under construction !*/
  912. /* under construction !*/
  913. /* under construction !*/
  914. /* under construction !*/
  915. /* under construction !*/
  916. /* under construction !*/
  917. #endif
  918. /* under construction !*/
  919. /* under construction !*/
  920. #endif /* 0 */ 
  921. /* PMT VIKAS END 20050630 */
  922. /* Function Added To Get The Status Of Inline Screen - Gurinder 15/4/2004 */
  923. /*****************************************************************************
  924.  * FUNCTION
  925.  *  get_wgui_inline_list_menu_status
  926.  * DESCRIPTION
  927.  *  
  928.  * PARAMETERS
  929.  *  void
  930.  * RETURNS
  931.  *  
  932.  *****************************************************************************/
  933. S32 get_wgui_inline_list_menu_status(void)
  934. {
  935.     /*----------------------------------------------------------------*/
  936.     /* Local Variables                                                */
  937.     /*----------------------------------------------------------------*/
  938.     /*----------------------------------------------------------------*/
  939.     /* Code Body                                                      */
  940.     /*----------------------------------------------------------------*/
  941.     return wgui_inline_list_menu_changed;
  942. }
  943. /*****************************************************************************
  944.  * FUNCTION
  945.  *  set_wgui_inline_list_menu_status
  946.  * DESCRIPTION
  947.  *  
  948.  * PARAMETERS
  949.  *  status      [IN]        
  950.  * RETURNS
  951.  *  void
  952.  *****************************************************************************/
  953. void set_wgui_inline_list_menu_status(S32 status)
  954. {
  955.     /*----------------------------------------------------------------*/
  956.     /* Local Variables                                                */
  957.     /*----------------------------------------------------------------*/
  958.     /*----------------------------------------------------------------*/
  959.     /* Code Body                                                      */
  960.     /*----------------------------------------------------------------*/
  961.     wgui_inline_list_menu_changed = (U8) status;
  962. }
  963. /*** Image Text Control *****/
  964. #if defined __MMI_PLUTO_GPRS__
  965. /*****************************************************************************
  966.  * FUNCTION
  967.  *  ShowAsControl
  968.  * DESCRIPTION
  969.  *  
  970.  * PARAMETERS
  971.  *  item        [?]     
  972.  * RETURNS
  973.  *  void
  974.  *****************************************************************************/
  975. void ShowAsControl(InlineItem *item)
  976. {
  977.     /*----------------------------------------------------------------*/
  978.     /* Local Variables                                                */
  979.     /*----------------------------------------------------------------*/
  980.     /*----------------------------------------------------------------*/
  981.     /* Code Body                                                      */
  982.     /*----------------------------------------------------------------*/
  983.     item->show_img_flag = TRUE;
  984. }
  985. /*****************************************************************************
  986.  * FUNCTION
  987.  *  SetInlineFullScreenEditCustomFunctionImageText
  988.  * DESCRIPTION
  989.  *  
  990.  * PARAMETERS
  991.  *  item        [?]         
  992.  *  f           [IN]        
  993.  * RETURNS
  994.  *  void
  995.  *****************************************************************************/
  996. void SetInlineFullScreenEditCustomFunctionImageText(InlineItem *item, void (*f) (void))
  997. {
  998.     /*----------------------------------------------------------------*/
  999.     /* Local Variables                                                */
  1000.     /*----------------------------------------------------------------*/
  1001.     wgui_inline_image_text *image_item = (wgui_inline_image_text*) item->item;
  1002.     wgui_inline_item_text_edit *i = (wgui_inline_item_text_edit*) image_item->inline_full_text;
  1003.     /*----------------------------------------------------------------*/
  1004.     /* Code Body                                                      */
  1005.     /*----------------------------------------------------------------*/
  1006.     i->custom_setup_function = f;
  1007. }
  1008. /*****************************************************************************
  1009.  * FUNCTION
  1010.  *  UI_dummy_edit_complete_handler
  1011.  * DESCRIPTION
  1012.  *  
  1013.  * PARAMETERS
  1014.  *  buffer          [?]         
  1015.  *  buffer_size     [IN]        
  1016.  * RETURNS
  1017.  *  void
  1018.  *****************************************************************************/
  1019. void UI_dummy_edit_complete_handler(U8 *buffer, S32 buffer_size)
  1020. {
  1021.     /*----------------------------------------------------------------*/
  1022.     /* Local Variables                                                */
  1023.     /*----------------------------------------------------------------*/
  1024.     /*----------------------------------------------------------------*/
  1025.     /* Code Body                                                      */
  1026.     /*----------------------------------------------------------------*/
  1027.     UI_UNUSED_PARAMETER(buffer);
  1028.     UI_UNUSED_PARAMETER(buffer_size);
  1029. }
  1030. #ifdef __MMI_TOUCH_SCREEN__
  1031. /*****************************************************************************
  1032.  * FUNCTION
  1033.  *  inline_image_text_redraw_image_by_pen
  1034.  * DESCRIPTION
  1035.  *  
  1036.  * PARAMETERS
  1037.  *  i       [?]     
  1038.  * RETURNS
  1039.  *  void
  1040.  *****************************************************************************/
  1041. void inline_image_text_redraw_image_by_pen(wgui_inline_image_text *i)
  1042. {
  1043.     /*----------------------------------------------------------------*/
  1044.     /* Local Variables                                                */
  1045.     /*----------------------------------------------------------------*/
  1046.     S32 index = i->pen_down_image_index;
  1047.     PU8 image = NULL;   /* 111605 warning Calvin */
  1048.     S32 image_y_offset = 0;
  1049.     S32 x1, y1, x2, y2;
  1050.     /*----------------------------------------------------------------*/
  1051.     /* Code Body                                                      */
  1052.     /*----------------------------------------------------------------*/
  1053.     if (index < 0)
  1054.     {
  1055.         return;
  1056.     }
  1057.     gdi_layer_push_clip();
  1058.     gdi_layer_reset_clip();
  1059.     gdi_layer_lock_frame_buffer();
  1060.     x1 = i->image_left_top[index].x;
  1061.     y1 = i->image_left_top[index].y;
  1062.     x2 = i->image_right_bottom[index].x;
  1063.     y2 = i->image_right_bottom[index].y;
  1064.     gui_draw_filled_area(x1, y1, x2, y2 + 1, wgui_inline_select_fixed_text_menuitem_theme.selected_filler);
  1065.     if (index == i->pen_curr_pressed_image_index)
  1066.     {
  1067.         image_y_offset++;
  1068.     }
  1069.     if (index == 0)
  1070.     {
  1071.         image = i->image2;
  1072.     }
  1073.     else if (index == 1)
  1074.     {
  1075.         image = i->image3;
  1076.     }
  1077.     else
  1078.     {
  1079.         MMI_ASSERT(0);
  1080.     }
  1081.     gui_show_transparent_image(x1, y1 + image_y_offset, image, 0);
  1082.     gui_pop_clip();
  1083.     gdi_layer_unlock_frame_buffer();
  1084.     gdi_layer_blt_previous(x1, y1, x2, y2 + 1);
  1085. }
  1086. /*****************************************************************************
  1087.  * FUNCTION
  1088.  *  inline_image_text_pen_handler
  1089.  * DESCRIPTION
  1090.  *  
  1091.  * PARAMETERS
  1092.  *  pen_event       [IN]        
  1093.  *  x               [IN]        
  1094.  *  y               [IN]        
  1095.  *  item_event      [?]         
  1096.  * RETURNS
  1097.  *  
  1098.  *****************************************************************************/
  1099. BOOL inline_image_text_pen_handler(
  1100.         mmi_pen_event_type_enum pen_event,
  1101.         S16 x,
  1102.         S16 y,
  1103.         gui_inline_item_pen_enum *item_event)
  1104. {
  1105.     /*----------------------------------------------------------------*/
  1106.     /* Local Variables                                                */
  1107.     /*----------------------------------------------------------------*/
  1108.     BOOL ret = MMI_TRUE;
  1109.     wgui_inline_image_text *i = current_image_text_control;
  1110.     /*----------------------------------------------------------------*/
  1111.     /* Code Body                                                      */
  1112.     /*----------------------------------------------------------------*/
  1113.     *item_event = GUI_INLINE_ITEM_PEN_NONE;
  1114.     if (!i)
  1115.     {
  1116.         MMI_DBG_ASSERT(0);
  1117.         return MMI_FALSE;
  1118.     }
  1119.     switch (pen_event)
  1120.     {
  1121.         case MMI_PEN_EVENT_DOWN:
  1122.             i->pen_down_image_index = -1;
  1123.             if (i->image2 && i->image_callback[0] && x >= i->image_left_top[0].x && y >= i->image_left_top[0].y &&
  1124.                 x <= i->image_right_bottom[0].x && y <= i->image_right_bottom[0].y)
  1125.             {
  1126.                 i->pen_down_image_index = 0;
  1127.                 i->pen_curr_pressed_image_index = 0;
  1128.                 inline_image_text_redraw_image_by_pen(i);
  1129.             }
  1130.             else if (i->image3 && i->image_callback[1] && x >= i->image_left_top[1].x && y >= i->image_left_top[1].y &&
  1131.                      x <= i->image_right_bottom[1].x && y <= i->image_right_bottom[1].y)
  1132.             {
  1133.                 i->pen_down_image_index = 1;
  1134.                 i->pen_curr_pressed_image_index = 1;
  1135.                 inline_image_text_redraw_image_by_pen(i);
  1136.             }
  1137.             else
  1138.             {
  1139.                 ret = MMI_FALSE;
  1140.             }
  1141.             break;
  1142.         case MMI_PEN_EVENT_MOVE:
  1143.             if (i->pen_down_image_index >= 0)
  1144.             {
  1145.                 S32 index = i->pen_down_image_index;
  1146.                 if (i->pen_curr_pressed_image_index == i->pen_down_image_index)
  1147.                 {
  1148.                     if (!(x >= i->image_left_top[index].x && y >= i->image_left_top[index].y &&
  1149.                           x <= i->image_right_bottom[index].x && y <= i->image_right_bottom[index].y))
  1150.                     {
  1151.                         i->pen_curr_pressed_image_index = -1;
  1152.                         inline_image_text_redraw_image_by_pen(i);
  1153.                     }
  1154.                 }
  1155.                 else
  1156.                 {
  1157.                     if (x >= i->image_left_top[index].x && y >= i->image_left_top[index].y &&
  1158.                         x <= i->image_right_bottom[index].x && y <= i->image_right_bottom[index].y)
  1159.                     {
  1160.                         i->pen_curr_pressed_image_index = index;
  1161.                         inline_image_text_redraw_image_by_pen(i);
  1162.                     }
  1163.                 }
  1164.             }
  1165.             break;
  1166.         case MMI_PEN_EVENT_UP:
  1167.             if (i->pen_down_image_index >= 0 && i->pen_curr_pressed_image_index >= 0)
  1168.             {
  1169.                 i->pen_curr_pressed_image_index = -1;
  1170.                 inline_image_text_redraw_image_by_pen(i);
  1171.                 if (i->image_callback[i->pen_down_image_index])
  1172.                 {
  1173.                     (i->image_callback[i->pen_down_image_index]) ();
  1174.                 }
  1175.             }
  1176.             break;
  1177.         case MMI_PEN_EVENT_ABORT:
  1178.             if (i->pen_down_image_index >= 0 && i->pen_curr_pressed_image_index >= 0)
  1179.             {
  1180.                 i->pen_curr_pressed_image_index = -1;
  1181.                 inline_image_text_redraw_image_by_pen(i);
  1182.             }
  1183.             break;
  1184.     }
  1185.     return ret;
  1186. }
  1187. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1188. /*****************************************************************************
  1189.  * FUNCTION
  1190.  *  SetInlineItemImageText
  1191.  * DESCRIPTION
  1192.  *  
  1193.  * PARAMETERS
  1194.  *  item            [?]         
  1195.  *  text            [?]         
  1196.  *  image1          [IN]        
  1197.  *  image2          [IN]        
  1198.  *  image3          [IN]        
  1199.  *  buf_size        [IN]        
  1200.  *  title           [IN]        
  1201.  *  title_icon      [IN]        
  1202.  *  input_type      [IN]        
  1203.  * RETURNS
  1204.  *  void
  1205.  *****************************************************************************/
  1206. void SetInlineItemImageText(
  1207.         InlineItem *item,
  1208.         U8 *text,
  1209.         PU8 image1,
  1210.         PU8 image2,
  1211.         PU8 image3,
  1212.         S32 buf_size,
  1213.         U16 title,
  1214.         U16 title_icon,
  1215.         S16 input_type)
  1216. {
  1217.     /*----------------------------------------------------------------*/
  1218.     /* Local Variables                                                */
  1219.     /*----------------------------------------------------------------*/
  1220.     wgui_inline_image_text *image_item;
  1221.     wgui_inline_item_text_edit *i;
  1222.     UI_buffer_type mask_buffer;
  1223.     S16 t = input_type & INPUT_TYPE_MASK;
  1224.     /*----------------------------------------------------------------*/
  1225.     /* Code Body                                                      */
  1226.     /*----------------------------------------------------------------*/
  1227.     if (n_inline_image_text >= MAX_INLINE_IMAGE_TEXT_ITEMS)
  1228.     {
  1229.         return;
  1230.     }
  1231.     if (n_inline_text_edit_items >= MAX_INLINE_TEXT_EDIT_ITEMS)
  1232.     {
  1233.         return;
  1234.     }
  1235.     item->item = (void*)&wgui_inline_image_text_items[n_inline_image_text];
  1236.     item->flags = INLINE_ITEM_IMAGE_TEXT_TYPE;
  1237.     item->show_img_flag = FALSE;
  1238.     n_inline_image_text++;
  1239.     image_item = (wgui_inline_image_text*) item->item;
  1240.     image_item->flags = 0;
  1241.     image_item->buffer_size = buf_size;
  1242.     image_item->image1 = image1;
  1243.     image_item->image2 = image2;
  1244.     image_item->image3 = image3;
  1245.     image_item->text = text;
  1246.     item->handler = handle_inline_full_screen_imagetext_edit;   /* wgui_show_image_text_item;//handle_inline_full_screen_imagetext_edit ; */
  1247. #ifdef __MMI_TOUCH_SCREEN__
  1248.     memset(image_item->image_callback, 0, sizeof(image_item->image_callback));
  1249.     memset(image_item->image_left_top, 0, sizeof(image_item->image_left_top));
  1250.     memset(image_item->image_right_bottom, 0, sizeof(image_item->image_right_bottom));
  1251.     image_item->pen_down_image_index = -1;
  1252.     image_item->pen_curr_pressed_image_index = -1;
  1253. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1254.     image_item->inline_full_text = (void*)&wgui_inline_text_edit_items[n_inline_text_edit_items];
  1255.     mask_buffer = inline_text_edit_mask_buffers[n_inline_text_edit_items];
  1256.     n_inline_text_edit_items++;
  1257.     i = (wgui_inline_item_text_edit*) image_item->inline_full_text;
  1258.     i->title = title;
  1259.     i->title_icon = title_icon;
  1260.     i->buffer = text;
  1261.     i->buffer_size = buf_size;
  1262.     i->flags = 0;
  1263.     i->input_type = input_type;
  1264.     item->text_p = i->buffer;
  1265.     i->edit_complete_callback = UI_dummy_edit_complete_handler;
  1266.     i->custom_setup_function = NULL;
  1267.     i->validation_callback = UI_dummy_validation_function;
  1268.     if ((t == INPUT_TYPE_NUMERIC_PASSWORD) || (t == INPUT_TYPE_ALPHANUMERIC_PASSWORD) ||
  1269.         (t == INPUT_TYPE_SAT_NUMERIC_PASSWORD))
  1270.     {
  1271.         inline_edit_prepare_mask_buffer(text, mask_buffer);
  1272.         i->mask_buffer = mask_buffer;
  1273.         item->text_p = mask_buffer;
  1274.     }
  1275.     /* UCS2_count==-1 means this field hasn't been edited */
  1276.     i->UCS2_count = -1;
  1277. }
  1278. #ifdef __MMI_TOUCH_SCREEN__
  1279. /*****************************************************************************
  1280.  * FUNCTION
  1281.  *  SetInlineImageTextPenHandler
  1282.  * DESCRIPTION
  1283.  *  
  1284.  * PARAMETERS
  1285.  *  item                [?]         
  1286.  *  image2_callback     [IN]        
  1287.  *  image3_callback     [IN]        
  1288.  * RETURNS
  1289.  *  void
  1290.  *****************************************************************************/
  1291. void SetInlineImageTextPenHandler(InlineItem *item, FuncPtr image2_callback, FuncPtr image3_callback)
  1292. {
  1293.     /*----------------------------------------------------------------*/
  1294.     /* Local Variables                                                */
  1295.     /*----------------------------------------------------------------*/
  1296.     wgui_inline_image_text *image_item = (wgui_inline_image_text*) item->item;
  1297.     /*----------------------------------------------------------------*/
  1298.     /* Code Body                                                      */
  1299.     /*----------------------------------------------------------------*/
  1300.     image_item->image_callback[0] = image2_callback;
  1301.     image_item->image_callback[1] = image3_callback;
  1302. }
  1303. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1304. /*****************************************************************************
  1305.  * FUNCTION
  1306.  *  wgui_inlinescrolling_timer
  1307.  * DESCRIPTION
  1308.  *  
  1309.  * PARAMETERS
  1310.  *  void
  1311.  * RETURNS
  1312.  *  void
  1313.  *****************************************************************************/
  1314. void wgui_inlinescrolling_timer(void)
  1315. {
  1316.     /*----------------------------------------------------------------*/
  1317.     /* Local Variables                                                */
  1318.     /*----------------------------------------------------------------*/
  1319.     /*----------------------------------------------------------------*/
  1320.     /* Code Body                                                      */
  1321.     /*----------------------------------------------------------------*/
  1322.     gui_handle_scrolling_text(&wgui_inline_scroll_text);
  1323.     if (inline_last_image)
  1324.     {
  1325.         gui_show_transparent_image(103, inline_y_pos_image, inline_last_image, 0);
  1326.     }
  1327. }
  1328. /*****************************************************************************
  1329.  * FUNCTION
  1330.  *  wgui_scrolling_text_draw_background
  1331.  * DESCRIPTION
  1332.  *  
  1333.  * PARAMETERS
  1334.  *  x1      [IN]        
  1335.  *  y1      [IN]        
  1336.  *  x2      [IN]        
  1337.  *  y2      [IN]        
  1338.  * RETURNS
  1339.  *  void
  1340.  *****************************************************************************/
  1341. void wgui_scrolling_text_draw_background(S32 x1, S32 y1, S32 x2, S32 y2)
  1342. {
  1343.     /*----------------------------------------------------------------*/
  1344.     /* Local Variables                                                */
  1345.     /*----------------------------------------------------------------*/
  1346.     /*----------------------------------------------------------------*/
  1347.     /* Code Body                                                      */
  1348.     /*----------------------------------------------------------------*/
  1349.     gui_draw_filled_area(x1, y1, x2, y2, (wgui_inline_select_fixed_text_menuitem_theme.selected_filler));
  1350. }
  1351. /*****************************************************************************
  1352.  * FUNCTION
  1353.  *  wgui_show_image_text_control
  1354.  * DESCRIPTION
  1355.  *  
  1356.  * PARAMETERS
  1357.  *  i       [?]     
  1358.  * RETURNS
  1359.  *  void
  1360.  *****************************************************************************/
  1361. void wgui_show_image_text_control(wgui_inline_image_text *i)
  1362. {
  1363.     /*----------------------------------------------------------------*/
  1364.     /* Local Variables                                                */
  1365.     /*----------------------------------------------------------------*/
  1366.     //S32 y1 = i->y ;
  1367.     //S32 height = 0;
  1368.     wgui_inline_item_text_edit *i_edit = (wgui_inline_item_text_edit*) i->inline_full_text;
  1369.     /*----------------------------------------------------------------*/
  1370.     /* Code Body                                                      */
  1371.     /*----------------------------------------------------------------*/
  1372.     draw_image_text_control(i, i->x, i->y, i->width, i->height, i->image1, i->image2, i->image3, i_edit->buffer, 1);
  1373. }
  1374. /*****************************************************************************
  1375.  * FUNCTION
  1376.  *  redraw_image_text_control
  1377.  * DESCRIPTION
  1378.  *  
  1379.  * PARAMETERS
  1380.  *  void
  1381.  * RETURNS
  1382.  *  void
  1383.  *****************************************************************************/
  1384. void redraw_image_text_control(void)
  1385. {
  1386.     /*----------------------------------------------------------------*/
  1387.     /* Local Variables                                                */
  1388.     /*----------------------------------------------------------------*/
  1389.     /*----------------------------------------------------------------*/
  1390.     /* Code Body                                                      */
  1391.     /*----------------------------------------------------------------*/
  1392.     gdi_layer_lock_frame_buffer();
  1393.     wgui_show_image_text_control(current_image_text_control);
  1394.     gdi_layer_unlock_frame_buffer();
  1395.     gdi_layer_blt_previous(
  1396.         current_image_text_control->x,
  1397.         current_image_text_control->y,
  1398.         current_image_text_control->x + current_image_text_control->width - 1,
  1399.         current_image_text_control->y + current_image_text_control->height - 1);
  1400. }
  1401. /*****************************************************************************
  1402.  * FUNCTION
  1403.  *  draw_image_text_control
  1404.  * DESCRIPTION
  1405.  *  
  1406.  * PARAMETERS
  1407.  *  control             [?]         
  1408.  *  x1                  [IN]        
  1409.  *  y1                  [IN]        
  1410.  *  iwidth              [IN]        
  1411.  *  iheight             [IN]        
  1412.  *  image1              [IN]        
  1413.  *  image2              [IN]        
  1414.  *  image3              [IN]        
  1415.  *  text                [?]         
  1416.  *  highlight_flag      [IN]        
  1417.  * RETURNS
  1418.  *  void
  1419.  *****************************************************************************/
  1420. void draw_image_text_control(
  1421.         wgui_inline_image_text *control,
  1422.         S32 x1,
  1423.         S32 y1,
  1424.         S32 iwidth,
  1425.         S32 iheight,
  1426.         PU8 image1,
  1427.         PU8 image2,
  1428.         PU8 image3,
  1429.         U8 *text,
  1430.         U8 highlight_flag)
  1431. {
  1432.     /*----------------------------------------------------------------*/
  1433.     /* Local Variables                                                */
  1434.     /*----------------------------------------------------------------*/
  1435.     S32 width = 0, height = 0, char_height = 0, img_y1 = 0, text_y;
  1436.     color text_colr = gui_color(0, 0, 0);
  1437.     S32 temp_x = x1 + 1;
  1438.     S32 text_x = 0, text_width = 0, text_height = 0;
  1439.     /*----------------------------------------------------------------*/
  1440.     /* Code Body                                                      */
  1441.     /*----------------------------------------------------------------*/
  1442.     gdi_layer_push_clip();
  1443.     gdi_layer_reset_clip();
  1444.     gui_reset_text_clip();
  1445.     /* MTK Elvis for R2L characters */
  1446.     if (!r2lMMIFlag)
  1447.     {
  1448.         if (image1)
  1449.         {
  1450.             gui_measure_image((PU8) image1, &width, &height);
  1451.             img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  1452.             gui_show_transparent_image(temp_x, (y1 + img_y1), image1, 0);
  1453.             temp_x = x1 + width + 4;
  1454.         }
  1455.         else
  1456.             /* 20051012 HIMANSHU START INLINE SELECT */
  1457.     #ifdef __MMI_UI_INLINE_EDIT_DEFAULT_TEXT_EFFECT__
  1458.         if (!IsInlineItemDefaultTextEnable())
  1459.     #endif 
  1460.             /* 20051012 HIMANSHU END INLINE SELECT */
  1461.             temp_x = x1 + MMI_fixed_icontext_menuitem.text_x;
  1462.         if (image2)
  1463.         {
  1464.             gui_measure_image(image2, &width, &height);
  1465.             img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  1466.             gui_show_transparent_image(temp_x, (y1 + img_y1), image2, 0);
  1467.             text_x = temp_x + width + 2;
  1468.             text_width = iwidth - text_x;
  1469.         #ifdef __MMI_TOUCH_SCREEN__
  1470.             if (control)
  1471.             {
  1472.                 control->image_left_top[0].x = temp_x;
  1473.                 control->image_left_top[0].y = y1 + img_y1;
  1474.                 control->image_right_bottom[0].x = temp_x + width - 1;
  1475.                 control->image_right_bottom[0].y = y1 + img_y1 + height - 1;
  1476.             }
  1477.         #endif /* __MMI_TOUCH_SCREEN__ */ 
  1478.         }
  1479.         else
  1480.         {
  1481.             text_x = temp_x;
  1482.             text_width = iwidth - text_x - x1 - 4;
  1483.         }
  1484.         if (image3)
  1485.         {
  1486.             gui_measure_image(image3, &width, &height);
  1487.             temp_x = x1 + 1 + iwidth - width - 2;
  1488.             img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  1489.             gui_show_transparent_image(temp_x, (y1 + img_y1), image3, 0);
  1490.             text_width = temp_x - text_x - 2;
  1491.         #ifdef __MMI_TOUCH_SCREEN__
  1492.             if (control)
  1493.             {
  1494.                 control->image_left_top[1].x = temp_x;
  1495.                 control->image_left_top[1].y = y1 + img_y1;
  1496.                 control->image_right_bottom[1].x = temp_x + width - 1;
  1497.                 control->image_right_bottom[1].y = y1 + img_y1 + height - 1;
  1498.             }
  1499.         #endif /* __MMI_TOUCH_SCREEN__ */ 
  1500.         }
  1501.     }
  1502.     else
  1503.     {
  1504.         temp_x = UI_device_width - 1;
  1505.         if (image1)
  1506.         {
  1507.             gui_measure_image((PU8) image1, &width, &height);
  1508.             img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  1509.             temp_x -= width;
  1510.             gui_show_transparent_image(temp_x, (y1 + img_y1), image1, 0);
  1511.         }
  1512.         else
  1513.         {
  1514.             temp_x = UI_device_width - MMI_fixed_icontext_menuitem.text_x;
  1515.         }
  1516.         if (image3)
  1517.         {
  1518.             gui_measure_image(image3, &width, &height);
  1519.             img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  1520.             temp_x -= (width + 2);
  1521.             gui_show_transparent_image(temp_x, (y1 + img_y1), image3, 0);
  1522.             text_x = temp_x - 2;
  1523.             text_width = iwidth - (UI_device_width - text_x);
  1524.         #ifdef __MMI_TOUCH_SCREEN__
  1525.             if (control)
  1526.             {
  1527.                 control->image_left_top[1].x = temp_x;
  1528.                 control->image_left_top[1].y = y1 + img_y1;
  1529.                 control->image_right_bottom[1].x = temp_x + width - 1;
  1530.                 control->image_right_bottom[1].y = y1 + img_y1 + height - 1;
  1531.             }
  1532.         #endif /* __MMI_TOUCH_SCREEN__ */ 
  1533.         }
  1534.         else
  1535.         {
  1536.             text_x = temp_x;
  1537.             text_width = iwidth - (UI_device_width - text_x) - 2;
  1538.         }
  1539.         if (image2)
  1540.         {
  1541.             gui_measure_image(image2, &width, &height);
  1542.             img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  1543.             temp_x = (UI_device_width - 1) - iwidth + 2;
  1544.             gui_show_transparent_image(temp_x, (y1 + img_y1), image2, 0);
  1545.             text_width = text_x - temp_x - 2 - width;
  1546.         #ifdef __MMI_TOUCH_SCREEN__
  1547.             if (control)
  1548.             {
  1549.                 control->image_left_top[0].x = temp_x;
  1550.                 control->image_left_top[0].y = y1 + img_y1;
  1551.                 control->image_right_bottom[0].x = temp_x + width - 1;
  1552.                 control->image_right_bottom[0].y = y1 + img_y1 + height - 1;
  1553.             }
  1554.         #endif /* __MMI_TOUCH_SCREEN__ */ 
  1555.         }
  1556.     }
  1557.     char_height = gui_get_character_height();
  1558.     gui_measure_string((UI_string_type) text, &width, &height);
  1559.     text_height = height;
  1560.     text_y = y1 + (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  1561.     if (highlight_flag)
  1562.     {
  1563.         text_colr = MMI_fixed_icontext_menuitem.focussed_text_color;
  1564.         if (width > text_width)
  1565.         {
  1566.             if (r2lMMIFlag)
  1567.             {
  1568.                 gui_create_scrolling_text(&wgui_inline_scroll_text, text_x - text_width, text_y, text_width, text_height, (UI_string_type) text, wgui_inlinescrolling_timer, wgui_scrolling_text_draw_background, text_colr, text_colr);        /* 031205 Calvin modified */
  1569.             }
  1570.             else
  1571.             {
  1572.                 gui_create_scrolling_text(&wgui_inline_scroll_text, text_x, text_y, text_width, text_height, (UI_string_type) text, wgui_inlinescrolling_timer, wgui_scrolling_text_draw_background, text_colr, text_colr);     /* 031205 Calvin modified */
  1573.             }
  1574.             gui_show_scrolling_text(&wgui_inline_scroll_text);
  1575.         }
  1576.         else
  1577.         {
  1578.             if (r2lMMIFlag)
  1579.             {
  1580.                 gdi_layer_set_clip(text_x - text_width, text_y - 1, text_x, text_y + text_height + 1);
  1581.             }
  1582.             else
  1583.             {
  1584.                 gdi_layer_set_clip(text_x, text_y - 1, text_x + text_width, text_y + text_height + 1);
  1585.             }
  1586.             gui_move_text_cursor(text_x, text_y);
  1587.             gui_set_text_color(text_colr);
  1588.             gui_print_text((UI_string_type) text);
  1589.         }
  1590.     }
  1591.     else
  1592.     {
  1593.         text_colr = MMI_fixed_icontext_menuitem.normal_text_color;
  1594.         if (r2lMMIFlag)
  1595.         {
  1596.             gdi_layer_set_clip(text_x - text_width, text_y - 1, text_x, text_y + text_height + 1);
  1597.         }
  1598.         else
  1599.         {
  1600.             gdi_layer_set_clip(text_x, text_y - 1, text_x + text_width, text_y + text_height + 1);
  1601.         }
  1602.         gui_move_text_cursor(text_x, text_y);
  1603.         gui_set_text_color(text_colr);
  1604.         gui_print_text((UI_string_type) text);
  1605.     }
  1606.     gui_pop_clip();
  1607.     UI_UNUSED_PARAMETER(char_height);
  1608. }
  1609. /*****************************************************************************
  1610.  * FUNCTION
  1611.  *  wgui_show_image_text_item
  1612.  * DESCRIPTION
  1613.  *  
  1614.  * PARAMETERS
  1615.  *  x1          [IN]        
  1616.  *  y1          [IN]        
  1617.  *  iwidth      [IN]        
  1618.  *  iheight     [IN]        
  1619.  *  item        [?]         
  1620.  * RETURNS
  1621.  *  void
  1622.  *****************************************************************************/
  1623. void wgui_show_image_text_item(S32 x1, S32 y1, S32 iwidth, S32 iheight, wgui_inline_item *item)
  1624. {
  1625.     /*----------------------------------------------------------------*/
  1626.     /* Local Variables                                                */
  1627.     /*----------------------------------------------------------------*/
  1628.     wgui_inline_image_text *i = (wgui_inline_image_text*) item->item;
  1629.     wgui_inline_item_text_edit *i_edit = (wgui_inline_item_text_edit*) i->inline_full_text;
  1630.     /*----------------------------------------------------------------*/
  1631.     /* Code Body                                                      */
  1632.     /*----------------------------------------------------------------*/
  1633.     draw_image_text_control(i, x1, y1, iwidth, iheight, i->image1, i->image2, i->image3, i_edit->buffer, 0);
  1634. }
  1635. /*****************************************************************************
  1636.  * FUNCTION
  1637.  *  clear_inline_image_text_item
  1638.  * DESCRIPTION
  1639.  *  
  1640.  * PARAMETERS
  1641.  *  void
  1642.  * RETURNS
  1643.  *  void
  1644.  *****************************************************************************/
  1645. void clear_inline_image_text_item(void)
  1646. {
  1647.     /*----------------------------------------------------------------*/
  1648.     /* Local Variables                                                */
  1649.     /*----------------------------------------------------------------*/
  1650.     /*----------------------------------------------------------------*/
  1651.     /* Code Body                                                      */
  1652.     /*----------------------------------------------------------------*/
  1653.     gui_scrolling_text_stop(&wgui_inline_scroll_text);
  1654.     inline_scroll_flag = FALSE;
  1655.     memset(&wgui_inline_scroll_text, 0, sizeof(wgui_inline_scroll_text));
  1656.     clear_inline_item_keys = UI_dummy_function;
  1657.     redraw_current_inline_item = UI_dummy_function;
  1658. #ifdef __MMI_TOUCH_SCREEN__
  1659.     wgui_current_inline_item_pen_function = UI_dummy_inline_item_pen_function;
  1660. #endif 
  1661. }
  1662. /*****************************************************************************
  1663.  * FUNCTION
  1664.  *  wgui_show_image_text_item_highlight
  1665.  * DESCRIPTION
  1666.  *  
  1667.  * PARAMETERS
  1668.  *  x1          [IN]        
  1669.  *  y1          [IN]        
  1670.  *  iwidth      [IN]        
  1671.  *  iheight     [IN]        
  1672.  *  item        [?]         
  1673.  * RETURNS
  1674.  *  void
  1675.  *****************************************************************************/
  1676. void wgui_show_image_text_item_highlight(S32 x1, S32 y1, S32 iwidth, S32 iheight, wgui_inline_item *item)
  1677. {
  1678.     /*----------------------------------------------------------------*/
  1679.     /* Local Variables                                                */
  1680.     /*----------------------------------------------------------------*/
  1681.     wgui_inline_image_text *i = (wgui_inline_image_text*) item->item;
  1682.     wgui_inline_item_text_edit *i_edit = (wgui_inline_item_text_edit*) i->inline_full_text;
  1683.     /*----------------------------------------------------------------*/
  1684.     /* Code Body                                                      */
  1685.     /*----------------------------------------------------------------*/
  1686.     i->x = x1;
  1687.     i->y = y1;
  1688.     i->width = iwidth;
  1689.     i->height = iheight;
  1690.     clear_inline_item_keys = clear_inline_image_text_item;
  1691.     redraw_current_inline_item = redraw_image_text_control;
  1692. #ifdef __MMI_TOUCH_SCREEN__
  1693.     wgui_current_inline_item_pen_function = inline_image_text_pen_handler;
  1694. #endif 
  1695.     current_image_text_control = i;
  1696.     draw_image_text_control(i, x1, y1, iwidth, iheight, i->image1, i->image2, i->image3, i_edit->buffer, 1);
  1697. }
  1698. /*****************************************************************************
  1699.  * FUNCTION
  1700.  *  handle_inline_full_screen_imagetext_edit
  1701.  * DESCRIPTION
  1702.  *  
  1703.  * PARAMETERS
  1704.  *  x                   [IN]        
  1705.  *  y                   [IN]        
  1706.  *  width               [IN]        
  1707.  *  height              [IN]        
  1708.  *  key_code            [IN]        
  1709.  *  key_event           [IN]        
  1710.  *  text_p              [IN]        
  1711.  *  item                [?]         
  1712.  *  flags               [IN]        
  1713.  *  history_buffer      [?]         
  1714.  * RETURNS
  1715.  *  void
  1716.  *****************************************************************************/
  1717. void handle_inline_full_screen_imagetext_edit(
  1718.         S32 x,
  1719.         S32 y,
  1720.         S32 width,
  1721.         S32 height,
  1722.         S32 key_code,
  1723.         S32 key_event,
  1724.         U8 **text_p,
  1725.         void *item,
  1726.         U32 flags,
  1727.         U8 *history_buffer)
  1728. {
  1729.     /*----------------------------------------------------------------*/
  1730.     /* Local Variables                                                */
  1731.     /*----------------------------------------------------------------*/
  1732.     S32 input_type;
  1733.     wgui_inline_image_text *image_type = (wgui_inline_image_text*) item;
  1734.     /* wgui_inline_item_text_edit *i=&wgui_inline_text_edit_items[0];//(wgui_inline_item_text_edit*)image_type->inline_full_text; */
  1735.     wgui_inline_item_text_edit *i = (wgui_inline_item_text_edit*) image_type->inline_full_text;
  1736.     S32 inputbox_x = 0;
  1737.     S32 inputbox_y = (MMI_title_y + MMI_title_height);
  1738.     S32 inputbox_width = MMI_content_width;
  1739.     S32 inputbox_height = MMI_content_height - MMI_multitap_height;
  1740.     /*----------------------------------------------------------------*/
  1741.     /* Code Body                                                      */
  1742.     /*----------------------------------------------------------------*/
  1743.     UI_UNUSED_PARAMETER(x);
  1744.     UI_UNUSED_PARAMETER(y);
  1745.     UI_UNUSED_PARAMETER(width);
  1746.     UI_UNUSED_PARAMETER(height);
  1747.     UI_UNUSED_PARAMETER(key_code);
  1748.     UI_UNUSED_PARAMETER(key_event);
  1749.     UI_UNUSED_PARAMETER(flags);
  1750.     if (i->custom_setup_function != NULL)
  1751.     {
  1752.         i->custom_setup_function();
  1753.         return;
  1754.     }
  1755. #ifdef __MMI_T9__
  1756.     InuptMethodEnterCategory5();
  1757. #elif defined __MMI_ZI__
  1758.     ZiInuptMethodEnterCategory5();
  1759. //KP Jerry add on 2007-3-8 start
  1760. #elif defined __MMI_CSTAR__
  1761.     CstarInputMethodEnterCategory5();
  1762. //KP Jerry add on 2007-3-8 end
  1763. #elif defined __MMI_KA__
  1764.     KonkaInuptMethodEnterCategory5();
  1765. #elif defined __MMI_ITAP__
  1766. /* under construction !*/
  1767. #endif 
  1768.     gdi_layer_lock_frame_buffer();
  1769.     wgui_text_menuitem_reset_scrolling();
  1770.     clear_inline_image_text_item();
  1771.     if (i->flags & INLINE_ITEM_CHANGED)
  1772.     {
  1773.         inline_full_screen_edit_changed = 1;
  1774.     }
  1775.     else
  1776.     {
  1777.         inline_full_screen_edit_changed = 0;
  1778.     }
  1779.     wgui_current_inline_item_type = INLINE_ITEM_TYPE_FULL_SCREEN_EDIT;
  1780.     current_wgui_inline_text_edit_item = i;
  1781.     current_wgui_inline_text_edit_text_p = text_p;
  1782.     input_type = i->input_type;
  1783.     if (inline_image_text_edit_flag == 0)
  1784.     {
  1785.         if (!(i->flags & INLINE_ITEM_OPEN))
  1786.         {
  1787.             gui_strcpy((UI_string_type) wgui_inline_full_screen_text_edit_buffer, (UI_string_type) i->buffer);
  1788.             history_buffer = NULL;
  1789.         }
  1790.     }
  1791.     inline_image_text_edit_flag = 1;
  1792.     i->flags &= ~INLINE_ITEM_OPEN;
  1793.     inline_full_screen_edit_saved_title = MMI_title_string;
  1794.     inline_full_screen_edit_saved_title_icon = MMI_title_icon;
  1795.     inline_full_screen_edit_saved_LSK_label = MMI_softkeys[MMI_LEFT_SOFTKEY].text;
  1796.     inline_full_screen_edit_saved_RSK_label = MMI_softkeys[MMI_RIGHT_SOFTKEY].text;
  1797.     inline_full_screen_edit_saved_LSK_icon = MMI_softkeys[MMI_LEFT_SOFTKEY].normal_up_icon;
  1798.     inline_full_screen_edit_saved_RSK_icon = MMI_softkeys[MMI_RIGHT_SOFTKEY].normal_up_icon;
  1799.     change_left_softkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1800.     change_right_softkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  1801.     MMI_menu_shortcut_number = -1;
  1802.     MMI_disable_title_shortcut_display = 1;
  1803.     clear_key_handlers();
  1804.     change_left_softkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  1805.     change_right_softkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  1806.     clear_left_softkey();
  1807.     clear_right_softkey();
  1808.     register_left_softkey_handler();
  1809.     register_right_softkey_handler();
  1810.     register_default_hide_softkeys();
  1811.     MMI_title_string = get_string(i->title);
  1812.     MMI_title_icon = get_image(i->title_icon);
  1813.     register_hide_multitap(category5_hide_multitap);
  1814.     wgui_inputbox_validation_callback = i->validation_callback;
  1815.     wgui_setup_inputbox(
  1816.         inputbox_x,
  1817.         inputbox_y,
  1818.         inputbox_width,
  1819.         inputbox_height,
  1820.         wgui_inline_full_screen_text_edit_buffer,
  1821.         i->buffer_size,
  1822.         INLINE_FULL_SCREEN_EDIT_HISTORY_ID,
  1823.         get_string(STR_GLOBAL_BACK),
  1824.         get_image(IMG_GLOBAL_BACK),
  1825.         (S16) input_type,
  1826.         history_buffer,
  1827.         1);
  1828.     inputbox_height = MMI_content_height - MMI_multitap_height - wgui_inputbox_information_bar_height;
  1829.     if (MMI_multiline_inputbox.height > inputbox_height)
  1830.     {
  1831.         gui_resize_multi_line_input_box(&MMI_multiline_inputbox, MMI_multiline_inputbox.width, inputbox_height);
  1832.     }
  1833.     /* 101105 inline Calvin Start */
  1834. #ifdef __MMI_WALLPAPER_ON_BOTTOM__
  1835.     MMI_multiline_inputbox.flags |= UI_MULTI_LINE_INPUT_BOX_TRANSPARENT_BACKGROUND;
  1836.     dm_get_scr_bg_image(
  1837.         &inline_edit_scr_bg_ID,
  1838.         &inline_edit_scr_bg_filename,
  1839.         &inline_edit_scr_bg_x,
  1840.         &inline_edit_scr_bg_y,
  1841.         &inline_edit_scr_bg_opacity);
  1842.     dm_set_scr_bg_image(inline_edit_scr_bg_ID, inline_edit_scr_bg_filename, inline_edit_scr_bg_x, inline_edit_scr_bg_y, current_MMI_theme->bg_opacity_low); /* 100605 editor opacity Calvin */
  1843. #endif /* __MMI_WALLPAPER_ON_BOTTOM__ */ 
  1844.     /* 101105 Calvin End */
  1845.     register_multiline_inputbox_input_callback(wgui_inline_edit_handle_multiline_inputbox_input);
  1846.     wgui_inputbox_RSK_function = handle_inline_full_screen_edit_cancel;
  1847.     redraw_current_inline_item = redraw_inline_full_screen_edit;
  1848.     set_left_softkey_function(handle_inline_full_screen_edit_complete, KEY_EVENT_UP);
  1849. #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
  1850.     mmi_pen_editor_set_inputbox_LSK_Function(handle_inline_full_screen_edit_complete);
  1851. #endif 
  1852.     gdi_layer_unlock_frame_buffer();
  1853.     redraw_inline_full_screen_edit();
  1854.     complete_inline_item_edit = handle_inline_full_screen_edit_close;
  1855. }
  1856. /* / ATTACHMENT CONTROL//////////////////// */
  1857. #define ATTACHMENT_IMAGE_ITEM_HIGHLIGHTED                   1
  1858. #define ATTACHMENT_IMAGE_ITEM_UNHIGHLIGHTED                 0
  1859. #define ATTACHMENT_IMAGE_ITEM_ICON_MARGIN    4  /* Margin Between Icon of Inline item and start of Image Attachment Control */
  1860. #define ATTACHMENT_IMAGE_ICON_MARGIN         2  /* Margin Between Attachment Images in Image Attachment Control */
  1861. #define MAX_INLINE_IMAGE_ATTACHMENT_ITEMS 2
  1862. /* 0 ~ (MAX_INLINE_IMAGE_ATTACHMENT_ITEMS-1) inline items containing image attachments controls */
  1863. static wgui_inline_image_attachment wgui_inline_image_attachment_items[MAX_INLINE_IMAGE_ATTACHMENT_ITEMS];
  1864. static S32 n_inline_attach_items = 0;
  1865. /* 0 ~ (MAX_IMAGES_IN_INLINE_ATTACHMENT-1)  images inside current image attachment control */
  1866. static S32 n_images_in_inline_attach_item = 0;
  1867. static wgui_inline_image_attachment *current_attach_control = NULL;
  1868. static MMI_BOOL attach_disable_flag = MMI_FALSE;
  1869. extern void show_attachment_images(
  1870.                 S32 x1,
  1871.                 S32 y1,
  1872.                 S32 iwidth,
  1873.                 S32 iheight,
  1874.                 wgui_inline_image_attachment *image_control,
  1875.                 U8);
  1876. extern void handle_attachment_image(
  1877.                 S32 x,
  1878.                 S32 y,
  1879.                 S32 width,
  1880.                 S32 height,
  1881.                 S32 key_code,
  1882.                 S32 key_event,
  1883.                 U8 **text_p,
  1884.                 void *item,
  1885.                 U32 flags,
  1886.                 U8 *history_buffer);
  1887. #ifdef __MMI_TOUCH_SCREEN__
  1888. extern BOOL inline_image_attachment_pen_handler(
  1889.                 mmi_pen_event_type_enum pen_event,
  1890.                 S16 x,
  1891.                 S16 y,
  1892.                 gui_inline_item_pen_enum *item_event);
  1893. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1894. /*****************************************************************************
  1895.  * FUNCTION
  1896.  *  clear_inline_image_attachment_item
  1897.  * DESCRIPTION
  1898.  *  
  1899.  * PARAMETERS
  1900.  *  void
  1901.  * RETURNS
  1902.  *  void
  1903.  *****************************************************************************/
  1904. void clear_inline_image_attachment_item(void)
  1905. {
  1906.     /*----------------------------------------------------------------*/
  1907.     /* Local Variables                                                */
  1908.     /*----------------------------------------------------------------*/
  1909.     /*----------------------------------------------------------------*/
  1910.     /* Code Body                                                      */
  1911.     /*----------------------------------------------------------------*/
  1912.     /* FIXME. reset current_attach_control? */
  1913.     clear_inline_item_keys = UI_dummy_function;
  1914.     redraw_current_inline_item = UI_dummy_function;
  1915.     ClearKeyHandler(KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1916.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1917. #ifdef __MMI_TOUCH_SCREEN__
  1918.     wgui_current_inline_item_pen_function = UI_dummy_inline_item_pen_function;
  1919. #endif 
  1920. }
  1921. /*****************************************************************************
  1922.  * FUNCTION
  1923.  *  redraw_image_attachment_control
  1924.  * DESCRIPTION
  1925.  *  
  1926.  * PARAMETERS
  1927.  *  void
  1928.  * RETURNS
  1929.  *  void
  1930.  *****************************************************************************/
  1931. void redraw_image_attachment_control(void)
  1932. {
  1933.     /*----------------------------------------------------------------*/
  1934.     /* Local Variables                                                */
  1935.     /*----------------------------------------------------------------*/
  1936.     wgui_inline_image_attachment *attach_item = current_attach_control;
  1937. #ifdef __MMI_TOUCH_SCREEN__
  1938.     S32 x1;
  1939.     /*----------------------------------------------------------------*/
  1940.     /* Code Body                                                      */
  1941.     /*----------------------------------------------------------------*/
  1942.     gdi_layer_lock_frame_buffer();
  1943.     if (attach_disable_flag)
  1944.     {
  1945.         x1 = attach_item->control_x1 + 17;
  1946.     }
  1947.     else
  1948.     {
  1949.         x1 = attach_item->control_x1;
  1950.     }
  1951.     gui_draw_filled_area(
  1952.         x1,
  1953.         attach_item->control_y1,
  1954.         attach_item->control_x1 + attach_item->control_width - 1,
  1955.         attach_item->control_y1 + attach_item->control_height - 1,
  1956.         wgui_inline_select_fixed_text_menuitem_theme.selected_filler);
  1957.     gdi_layer_unlock_frame_buffer();
  1958.     gdi_layer_blt_previous(
  1959.         x1,
  1960.         attach_item->control_y1,
  1961.         attach_item->control_x1 + attach_item->control_width - 1,
  1962.         attach_item->control_y1 + attach_item->control_height - 1);
  1963. #endif /* __MMI_TOUCH_SCREEN__ */ 
  1964.     show_attachment_images(
  1965.         attach_item->control_x1,
  1966.         attach_item->control_y1,
  1967.         attach_item->control_width,
  1968.         attach_item->control_height,
  1969.         attach_item,
  1970.         ATTACHMENT_IMAGE_ITEM_HIGHLIGHTED);
  1971. }
  1972. /*****************************************************************************
  1973.  * FUNCTION
  1974.  *  RegisterAttachmentLskFunction
  1975.  * DESCRIPTION
  1976.  *  
  1977.  * PARAMETERS
  1978.  *  item        [?]         
  1979.  *  f           [IN]        
  1980.  * RETURNS
  1981.  *  void
  1982.  *****************************************************************************/
  1983. void RegisterAttachmentLskFunction(InlineItem *item, void (*f) (PU8 image, UI_string_type str))
  1984. {
  1985.     /*----------------------------------------------------------------*/
  1986.     /* Local Variables                                                */
  1987.     /*----------------------------------------------------------------*/
  1988.     wgui_inline_image_attachment *attach_item;
  1989.     /*----------------------------------------------------------------*/
  1990.     /* Code Body                                                      */
  1991.     /*----------------------------------------------------------------*/
  1992.     if (f)
  1993.     {
  1994.         attach_item = (wgui_inline_image_attachment*) item->item;
  1995.         attach_item->lsk_function = f;
  1996.     }
  1997. }
  1998. /*****************************************************************************
  1999.  * FUNCTION
  2000.  *  RegisterAttachmentRskFunction
  2001.  * DESCRIPTION
  2002.  *  
  2003.  * PARAMETERS
  2004.  *  item        [?]         
  2005.  *  f           [IN]        
  2006.  * RETURNS
  2007.  *  void
  2008.  *****************************************************************************/
  2009. void RegisterAttachmentRskFunction(InlineItem *item, void (*f) (PU8 image, UI_string_type str))
  2010. {
  2011.     /*----------------------------------------------------------------*/
  2012.     /* Local Variables                                                */
  2013.     /*----------------------------------------------------------------*/
  2014.     wgui_inline_image_attachment *attach_item;
  2015.     /*----------------------------------------------------------------*/
  2016.     /* Code Body                                                      */
  2017.     /*----------------------------------------------------------------*/
  2018.     if (f)
  2019.     {
  2020.         attach_item = (wgui_inline_image_attachment*) item->item;
  2021.         attach_item->rsk_function = f;
  2022.     }
  2023. }
  2024. /*****************************************************************************
  2025.  * FUNCTION
  2026.  *  SetCurrentHighlightedAttachment
  2027.  * DESCRIPTION
  2028.  *  
  2029.  * PARAMETERS
  2030.  *  item        [IN]
  2031.  *  index       [IN]        
  2032.  * RETURNS
  2033.  *  void
  2034.  *****************************************************************************/
  2035. void SetHighlightedAttachment(wgui_inline_item *inline_item, S32 index)
  2036. {
  2037.     /*----------------------------------------------------------------*/
  2038.     /* Local Variables                                                */
  2039.     /*----------------------------------------------------------------*/
  2040. wgui_inline_image_attachment *image = (wgui_inline_image_attachment*)inline_item->item;
  2041.     /*----------------------------------------------------------------*/
  2042.     /* Code Body                                                      */
  2043.     /*----------------------------------------------------------------*/
  2044.     
  2045. image->highlited_image = (S16) index;
  2046. }
  2047. /*****************************************************************************
  2048.  * FUNCTION
  2049.  *  GetCurrentHighlightedAttachment
  2050.  * DESCRIPTION
  2051.  *  
  2052.  * PARAMETERS
  2053.  *  void
  2054.  * RETURNS
  2055.  *  
  2056.  *****************************************************************************/
  2057. S32 GetCurrentHighlightedAttachment(void)
  2058. {
  2059.     /*----------------------------------------------------------------*/
  2060.     /* Local Variables                                                */
  2061.     /*----------------------------------------------------------------*/
  2062.     /*----------------------------------------------------------------*/
  2063.     /* Code Body                                                      */
  2064.     /*----------------------------------------------------------------*/
  2065.     PRINT_INFORMATION(("current highlighted attachment is %d", current_attach_control->highlited_image));
  2066.     return current_attach_control->highlited_image;
  2067. }
  2068. /* Right arrow key handler */
  2069. /*****************************************************************************
  2070.  * FUNCTION
  2071.  *  attach_control_right_arrow
  2072.  * DESCRIPTION
  2073.  *  
  2074.  * PARAMETERS
  2075.  *  void
  2076.  * RETURNS
  2077.  *  void
  2078.  *****************************************************************************/
  2079. void attach_control_right_arrow(void)
  2080. {
  2081.     /*----------------------------------------------------------------*/
  2082.     /* Local Variables                                                */
  2083.     /*----------------------------------------------------------------*/
  2084.     S32 temp_x1 = 0;
  2085.     wgui_inline_image_attachment *image = current_attach_control;
  2086.     /*----------------------------------------------------------------*/
  2087.     /* Code Body                                                      */
  2088.     /*----------------------------------------------------------------*/
  2089.     gdi_layer_lock_frame_buffer();
  2090.     image->highlited_image++;
  2091.     if (image->highlited_image >= n_images_in_inline_attach_item)
  2092.     {
  2093.         image->highlited_image = 0;
  2094.     }
  2095.     if ( image->image_change_cb )
  2096.     {
  2097.         image->image_change_cb(image->highlited_image);
  2098.     }
  2099.     if (attach_disable_flag)
  2100.     {
  2101.         temp_x1 = image->control_x1 + 17;
  2102.     }
  2103.     else
  2104.     {
  2105.         temp_x1 = image->control_x1;
  2106.     }
  2107.     gui_draw_filled_area(
  2108.         temp_x1,
  2109.         image->control_y1,
  2110.         image->control_x1 + image->control_width - 1,
  2111.         image->control_y1 + image->control_height - 1,
  2112.         wgui_inline_select_fixed_text_menuitem_theme.selected_filler);
  2113.     gdi_layer_unlock_frame_buffer();
  2114.     show_attachment_images(
  2115.         image->control_x1,
  2116.         image->control_y1,
  2117.         image->control_width,
  2118.         image->control_height,
  2119.         image,
  2120.         ATTACHMENT_IMAGE_ITEM_HIGHLIGHTED);
  2121. }
  2122. /* Left arrow key handler */
  2123. /*****************************************************************************
  2124.  * FUNCTION
  2125.  *  attach_control_left_arrow
  2126.  * DESCRIPTION
  2127.  *  
  2128.  * PARAMETERS
  2129.  *  void
  2130.  * RETURNS
  2131.  *  void
  2132.  *****************************************************************************/
  2133. void attach_control_left_arrow(void)
  2134. {
  2135.     /*----------------------------------------------------------------*/
  2136.     /* Local Variables                                                */
  2137.     /*----------------------------------------------------------------*/
  2138.     S32 temp_x1 = 0;
  2139.     wgui_inline_image_attachment *image = current_attach_control;
  2140.     /*----------------------------------------------------------------*/
  2141.     /* Code Body                                                      */
  2142.     /*----------------------------------------------------------------*/
  2143.     gdi_layer_lock_frame_buffer();
  2144.     if (image->highlited_image == 0)
  2145.     {
  2146.         image->highlited_image = (S16) (n_images_in_inline_attach_item - 1);
  2147.     }
  2148.     else
  2149.     {
  2150.         image->highlited_image--;
  2151.     }
  2152.     if ( image->image_change_cb )
  2153.     {
  2154.         image->image_change_cb(image->highlited_image);
  2155.     }
  2156.     if (attach_disable_flag)
  2157.     {
  2158.         temp_x1 = image->control_x1 + 17;
  2159.     }
  2160.     else
  2161.     {
  2162.         temp_x1 = image->control_x1;
  2163.     }
  2164.     gui_draw_filled_area(
  2165.         temp_x1,
  2166.         image->control_y1,
  2167.         image->control_x1 + image->control_width - 1,
  2168.         image->control_y1 + image->control_height - 1,
  2169.         wgui_inline_select_fixed_text_menuitem_theme.selected_filler);
  2170.     gdi_layer_unlock_frame_buffer();
  2171.     show_attachment_images(
  2172.         image->control_x1,
  2173.         image->control_y1,
  2174.         image->control_width,
  2175.         image->control_height,
  2176.         image,
  2177.         ATTACHMENT_IMAGE_ITEM_HIGHLIGHTED);
  2178. }
  2179. /*****************************************************************************
  2180.  * FUNCTION
  2181.  *  ClearAllAttachmentImages
  2182.  * DESCRIPTION
  2183.  *  
  2184.  * PARAMETERS
  2185.  *  item                    [?]         
  2186.  *  attachments_present     [IN]        
  2187.  * RETURNS
  2188.  *  void
  2189.  *****************************************************************************/
  2190. void ClearAllAttachmentImages(InlineItem *item, S32 attachments_present)
  2191. {
  2192.     /*----------------------------------------------------------------*/
  2193.     /* Local Variables                                                */
  2194.     /*----------------------------------------------------------------*/
  2195.     S32 i;
  2196.     wgui_inline_image_attachment *attach_item;
  2197.     /*----------------------------------------------------------------*/
  2198.     /* Code Body                                                      */
  2199.     /*----------------------------------------------------------------*/
  2200.     attach_item = (wgui_inline_image_attachment*) item->item;
  2201.     for (i = 0; i < attachments_present; i++)
  2202.     {
  2203.         attach_item->attach_image[i].image1 = 0;
  2204.         gui_strcpy((UI_string_type) (attach_item->attach_image[i].image_file_name), (UI_string_type) L"");
  2205.         attach_item->attach_image[i].type_of_image = 0;
  2206.     }
  2207. }
  2208. /*****************************************************************************
  2209.  * FUNCTION
  2210.  *  ClearAttachmentImage
  2211.  * DESCRIPTION
  2212.  *  
  2213.  * PARAMETERS
  2214.  *  item        [?]         
  2215.  *  index       [IN]        
  2216.  * RETURNS
  2217.  *  void
  2218.  *****************************************************************************/
  2219. void ClearAttachmentImage(InlineItem *item, S32 index)
  2220. {
  2221.     /*----------------------------------------------------------------*/
  2222.     /* Local Variables                                                */
  2223.     /*----------------------------------------------------------------*/
  2224.     S32 i;
  2225.     wgui_inline_image_attachment *attach_item;
  2226.     /*----------------------------------------------------------------*/
  2227.     /* Code Body                                                      */
  2228.     /*----------------------------------------------------------------*/
  2229.     attach_item = current_attach_control;
  2230.     attach_item = (wgui_inline_image_attachment*) item->item;
  2231.     for (i = index; i < MAX_IMAGES_IN_INLINE_ATTACHMENT; i++)
  2232.     {
  2233.         if (i == MAX_IMAGES_IN_INLINE_ATTACHMENT - 1)
  2234.         {
  2235.             attach_item->attach_image[i].image1 = 0;
  2236.             gui_strcpy((UI_string_type) (attach_item->attach_image[i].image_file_name), (UI_string_type) L"");
  2237.             attach_item->attach_image[i].type_of_image = 0;
  2238.         }
  2239.         else
  2240.         {
  2241.             attach_item->attach_image[i].image1 = attach_item->attach_image[i + 1].image1;
  2242.             gui_strcpy(
  2243.                 (UI_string_type) (attach_item->attach_image[i].image_file_name),
  2244.                 (UI_string_type) (attach_item->attach_image[i + 1].image_file_name));
  2245.             attach_item->attach_image[i].type_of_image = attach_item->attach_image[i + 1].type_of_image;
  2246.         }
  2247.     }
  2248. }
  2249. /* Add an image inside an image attachment inline item. 
  2250.    This function should be called after SetInlineItemImageAttachment(). */
  2251. /* FIXME. we should change function prototype to pass the number of images as a parameter
  2252.    instead of using MAX_IMAGES_IN_INLINE_ATTACHMENT */
  2253. /*****************************************************************************
  2254.  * FUNCTION
  2255.  *  AddEmailImageAttachmentUI
  2256.  * DESCRIPTION
  2257.  *  
  2258.  * PARAMETERS
  2259.  *  item                [?]     
  2260.  *  image_details       [?]     
  2261.  * RETURNS
  2262.  *  void
  2263.  *****************************************************************************/
  2264. void AddEmailImageAttachmentUI(InlineItem *item, wgui_inline_images_detail *image_details)
  2265. {
  2266.     /*----------------------------------------------------------------*/
  2267.     /* Local Variables                                                */
  2268.     /*----------------------------------------------------------------*/
  2269.     wgui_inline_image_attachment *attach_item;
  2270.     S32 i;
  2271.     /*----------------------------------------------------------------*/
  2272.     /* Code Body                                                      */
  2273.     /*----------------------------------------------------------------*/
  2274.     MMI_ASSERT((item->flags & 0xFF) == INLINE_ITEM_ATTACH_IMAGE);
  2275.     attach_item = (wgui_inline_image_attachment*) item->item;
  2276.     for (i = 0; i < MAX_IMAGES_IN_INLINE_ATTACHMENT; i++)
  2277.     {
  2278.         if (image_details[i].image1)
  2279.         {
  2280.             attach_item->attach_image[i].image1 = image_details[i].image1;
  2281.             attach_item->attach_image[i].type_of_image = image_details[i].type_of_image;
  2282.             pfnUnicodeStrcpy(
  2283.                 (PS8) attach_item->attach_image[i].image_file_name,
  2284.                 (PS8) image_details[i].image_file_name);
  2285.         }
  2286.     }
  2287. }
  2288. /* Create an inline item containing image attachment */
  2289. /*****************************************************************************
  2290.  * FUNCTION
  2291.  *  SetInlineItemImageAttachment
  2292.  * DESCRIPTION
  2293.  *  
  2294.  * PARAMETERS
  2295.  *  item                [?]         
  2296.  *  image1              [IN]        
  2297.  *  image2              [IN]        
  2298.  *  image3              [IN]        
  2299.  *  title               [IN]        
  2300.  *  title_icon          [IN]        
  2301.  *  highlight_image     [IN]        
  2302.  * RETURNS
  2303.  *  void
  2304.  *****************************************************************************/
  2305. void SetInlineItemImageAttachment(
  2306.         InlineItem *item,
  2307.         PU8 image1,
  2308.         PU8 image2,
  2309.         PU8 image3,
  2310.         U16 title,
  2311.         U16 title_icon,
  2312.         U8 highlight_image)
  2313. {
  2314.     /*----------------------------------------------------------------*/
  2315.     /* Local Variables                                                */
  2316.     /*----------------------------------------------------------------*/
  2317.     wgui_inline_image_attachment *attach_item;
  2318.     /*----------------------------------------------------------------*/
  2319.     /* Code Body                                                      */
  2320.     /*----------------------------------------------------------------*/
  2321.     if (n_inline_attach_items >= MAX_INLINE_IMAGE_ATTACHMENT_ITEMS)
  2322.     {
  2323.         MMI_DBG_ASSERT(0);
  2324.         return;
  2325.     }
  2326.     item->item = (void*)&wgui_inline_image_attachment_items[n_inline_attach_items];
  2327.     item->flags = INLINE_ITEM_ATTACH_IMAGE;
  2328.     item->show_img_flag = FALSE;
  2329.     n_inline_attach_items++;
  2330.     attach_item = (wgui_inline_image_attachment*) item->item;
  2331.     attach_item->title = title;
  2332.     attach_item->title_icon = title_icon;
  2333.     attach_item->highlited_image = highlight_image;
  2334.     attach_item->flags = 0;
  2335.     attach_item->image1 = image1;
  2336.     attach_item->image2 = image2;
  2337.     attach_item->image3 = image3;
  2338.     item->handler = handle_attachment_image;
  2339. #ifdef __MMI_TOUCH_SCREEN__
  2340.     attach_item->highlight_changed = 0;
  2341.     memset(attach_item->image_left_top, 0, sizeof(attach_item->image_left_top));
  2342.     memset(attach_item->image_right_bottom, 0, sizeof(attach_item->image_right_bottom));
  2343. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2344. }
  2345. /*****************************************************************************
  2346.  * FUNCTION
  2347.  *  ShowImageAttach
  2348.  * DESCRIPTION
  2349.  *  
  2350.  * PARAMETERS
  2351.  *  image       [IN]        
  2352.  *  str         [IN]        
  2353.  * RETURNS
  2354.  *  void
  2355.  *****************************************************************************/
  2356. void ShowImageAttach(PU8 image, UI_string_type str)
  2357. {
  2358.     /*----------------------------------------------------------------*/
  2359.     /* Local Variables                                                */
  2360.     /*----------------------------------------------------------------*/
  2361.     S32 width = 0, height = 0, img_x = 0, img_y = 0;
  2362.     /*----------------------------------------------------------------*/
  2363.     /* Code Body                                                      */
  2364.     /*----------------------------------------------------------------*/
  2365.     gdi_layer_lock_frame_buffer();
  2366.     clear_screen();
  2367.     change_left_softkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  2368.     change_right_softkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  2369.     MMI_menu_shortcut_number = -1;
  2370.     MMI_disable_title_shortcut_display = 1;
  2371.     clear_key_handlers();
  2372.     clear_left_softkey();
  2373.     clear_right_softkey();
  2374.     register_left_softkey_handler();
  2375.     register_right_softkey_handler();
  2376.     register_default_hide_softkeys();
  2377.     change_left_softkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  2378.     change_right_softkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  2379.     MMI_title_string = (UI_string_type) str;
  2380.     MMI_title_icon = 0;
  2381.     gui_measure_image(image, &width, &height);
  2382.     img_x = (UI_device_width >> 1) - (width >> 1);
  2383.     img_y = (MMI_title_y + MMI_title_height) + 1;
  2384.     img_y = img_y + ((MMI_CONTENT_HEIGHT >> 1) - (height >> 1));
  2385.     draw_title();
  2386.     gui_show_image(img_x, img_y, image);
  2387.     gdi_layer_unlock_frame_buffer();
  2388.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);
  2389. }
  2390. /*****************************************************************************
  2391.  * FUNCTION
  2392.  *  handle_attachment_image
  2393.  * DESCRIPTION
  2394.  *  
  2395.  * PARAMETERS
  2396.  *  x                   [IN]        
  2397.  *  y                   [IN]        
  2398.  *  iwidth              [IN]        
  2399.  *  iheight             [IN]        
  2400.  *  key_code            [IN]        
  2401.  *  key_event           [IN]        
  2402.  *  text_p              [IN]        
  2403.  *  item                [?]         
  2404.  *  flags               [IN]        
  2405.  *  history_buffer      [?]         
  2406.  * RETURNS
  2407.  *  void
  2408.  *****************************************************************************/
  2409. void handle_attachment_image(
  2410.         S32 x,
  2411.         S32 y,
  2412.         S32 iwidth,
  2413.         S32 iheight,
  2414.         S32 key_code,
  2415.         S32 key_event,
  2416.         U8 **text_p,
  2417.         void *item,
  2418.         U32 flags,
  2419.         U8 *history_buffer)
  2420. {
  2421.     /*----------------------------------------------------------------*/
  2422.     /* Local Variables                                                */
  2423.     /*----------------------------------------------------------------*/
  2424.     S32 width = 0, height = 0;
  2425.     wgui_inline_image_attachment *image_attach = (wgui_inline_image_attachment*) item;
  2426.     /*----------------------------------------------------------------*/
  2427.     /* Code Body                                                      */
  2428.     /*----------------------------------------------------------------*/
  2429.     UI_UNUSED_PARAMETER(x);
  2430.     UI_UNUSED_PARAMETER(y);
  2431.     UI_UNUSED_PARAMETER(width);
  2432.     UI_UNUSED_PARAMETER(height);
  2433.     UI_UNUSED_PARAMETER(key_code);
  2434.     UI_UNUSED_PARAMETER(key_event);
  2435.     UI_UNUSED_PARAMETER(flags);
  2436.     image_attach->lsk_function(
  2437.                     image_attach->attach_image[image_attach->highlited_image].image1,
  2438.                     (UI_string_type) image_attach->attach_image[image_attach->highlited_image]. image_file_name);
  2439. }
  2440. /*****************************************************************************
  2441.  * FUNCTION
  2442.  *  register_inline_image_attach_keys
  2443.  * DESCRIPTION
  2444.  *  
  2445.  * PARAMETERS
  2446.  *  void
  2447.  * RETURNS
  2448.  *  void
  2449.  *****************************************************************************/
  2450. void register_inline_image_attach_keys(void)
  2451. {
  2452.     /*----------------------------------------------------------------*/
  2453.     /* Local Variables                                                */
  2454.     /*----------------------------------------------------------------*/
  2455.     /*----------------------------------------------------------------*/
  2456.     /* Code Body                                                      */
  2457.     /*----------------------------------------------------------------*/
  2458.     SetKeyHandler(attach_control_right_arrow, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2459.     SetKeyHandler(attach_control_left_arrow, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2460. }
  2461. /*****************************************************************************
  2462.  * FUNCTION
  2463.  *  show_attachment_images
  2464.  * DESCRIPTION
  2465.  *  
  2466.  * PARAMETERS
  2467.  *  x1                  [IN]        
  2468.  *  y1                  [IN]        
  2469.  *  iwidth              [IN]        
  2470.  *  iheight             [IN]        
  2471.  *  image_control       [?]         
  2472.  *  highlight           [IN]        
  2473.  * RETURNS
  2474.  *  void
  2475.  *****************************************************************************/
  2476. void show_attachment_images(
  2477.         S32 x1,
  2478.         S32 y1,
  2479.         S32 iwidth,
  2480.         S32 iheight,
  2481.         wgui_inline_image_attachment *image_control,
  2482.         U8 highlight)
  2483. {
  2484.     /*----------------------------------------------------------------*/
  2485.     /* Local Variables                                                */
  2486.     /*----------------------------------------------------------------*/
  2487.     S32 width = 0, height = 0, temp_x = x1 + 1, index = 0, img_y1 = 0;
  2488.     color blue_col = gui_color(0, 0, 255);
  2489.     /*----------------------------------------------------------------*/
  2490.     /* Code Body                                                      */
  2491.     /*----------------------------------------------------------------*/
  2492.     if (highlight)
  2493.     {
  2494.         gdi_layer_lock_frame_buffer();
  2495.     }
  2496.     gdi_layer_reset_clip();
  2497.     gui_reset_text_clip();
  2498.     if (!r2lMMIFlag)
  2499.     {
  2500.         if (image_control->image1)
  2501.         {
  2502.             gui_measure_image((PU8) image_control->image1, &width, &height);
  2503.             img_y1 = (iheight >> 1) - (height >> 1);
  2504.             gui_show_transparent_image(temp_x, (y1 + img_y1), image_control->image1, 0);
  2505.             temp_x = x1 + width + ATTACHMENT_IMAGE_ITEM_ICON_MARGIN;
  2506.         }
  2507.         if (image_control->image2)
  2508.         {
  2509.             gui_measure_image(image_control->image2, &width, &height);
  2510.             img_y1 = (iheight >> 1) - (height >> 1);
  2511.             gui_show_transparent_image(temp_x, (y1 + img_y1), image_control->image2, 0);
  2512.             temp_x += width + ATTACHMENT_IMAGE_ICON_MARGIN;
  2513.         }
  2514.       /** Show attachment images */
  2515.         n_images_in_inline_attach_item = 0;
  2516.         for (index = 0; index < MAX_IMAGES_IN_INLINE_ATTACHMENT; index++)
  2517.         {
  2518.             if (image_control->attach_image[index].image1)
  2519.             {
  2520.                 n_images_in_inline_attach_item++;
  2521.                 gui_measure_image((PU8) image_control->attach_image[index].image1, &width, &height);
  2522.                 img_y1 = (iheight >> 1) - (height >> 1);
  2523.                 if ((image_control->highlited_image == index) && (highlight == ATTACHMENT_IMAGE_ITEM_HIGHLIGHTED))
  2524.                 {
  2525.                     gui_fill_rectangle(temp_x - 1, y1 + img_y1 - 1, (temp_x + width), (y1 + img_y1 + height), blue_col);
  2526.                 }
  2527.                 gui_show_transparent_image(temp_x, (y1 + img_y1), image_control->attach_image[index].image1, 0);
  2528.             #ifdef __MMI_TOUCH_SCREEN__
  2529.                 image_control->image_left_top[index].x = temp_x;
  2530.                 image_control->image_left_top[index].y = y1 + img_y1;
  2531.                 image_control->image_right_bottom[index].x = temp_x + width - 1;
  2532.                 image_control->image_right_bottom[index].y = y1 + img_y1 + height - 1;
  2533.             #endif /* __MMI_TOUCH_SCREEN__ */ 
  2534.                 temp_x = temp_x + width + ATTACHMENT_IMAGE_ICON_MARGIN;
  2535.             }
  2536.         }
  2537.       /********/
  2538.         if (image_control->image3)
  2539.         {
  2540.             gui_measure_image(image_control->image3, &width, &height);
  2541.             img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  2542.             /* temp_x = (UI_device_width - width - 8); */
  2543.             temp_x = (x1 + 1) + iwidth - (width + ATTACHMENT_IMAGE_ICON_MARGIN);
  2544.             gui_show_transparent_image(temp_x, (y1 + img_y1), image_control->image3, 0);
  2545.         }
  2546.     }
  2547.     else
  2548.     {
  2549.         temp_x = UI_device_width - 1;
  2550.         if (image_control->image1)
  2551.         {
  2552.             gui_measure_image((PU8) image_control->image1, &width, &height);
  2553.             img_y1 = (iheight >> 1) - (height >> 1);
  2554.             temp_x -= width;
  2555.             gui_show_transparent_image(temp_x, (y1 + img_y1), image_control->image1, 0);
  2556.         }
  2557.         if (image_control->image3)
  2558.         {
  2559.             gui_measure_image(image_control->image3, &width, &height);
  2560.             img_y1 = (iheight >> 1) - (height >> 1);
  2561.             temp_x -= (width + ATTACHMENT_IMAGE_ICON_MARGIN);
  2562.             gui_show_transparent_image(temp_x, (y1 + img_y1), image_control->image3, 0);
  2563.         }
  2564.       /** Show attachment images */
  2565.         n_images_in_inline_attach_item = 0;
  2566.         for (index = MAX_IMAGES_IN_INLINE_ATTACHMENT - 1; index >= 0; index--)
  2567.         {
  2568.             if (image_control->attach_image[index].image1)
  2569.             {
  2570.                 n_images_in_inline_attach_item++;
  2571.                 gui_measure_image((PU8) image_control->attach_image[index].image1, &width, &height);
  2572.                 img_y1 = (iheight >> 1) - (height >> 1);
  2573.                 temp_x -= (width + ATTACHMENT_IMAGE_ICON_MARGIN);
  2574.                 if ((image_control->highlited_image == index) && (highlight == ATTACHMENT_IMAGE_ITEM_HIGHLIGHTED))
  2575.                 {
  2576.                     gui_fill_rectangle(
  2577.                         (temp_x - 1),
  2578.                         y1 + img_y1 - 1,
  2579.                         (temp_x + width),
  2580.                         (y1 + img_y1 + height),
  2581.                         blue_col);
  2582.                 }
  2583.                 gui_show_transparent_image(temp_x, (y1 + img_y1), image_control->attach_image[index].image1, 0);
  2584.             #ifdef __MMI_TOUCH_SCREEN__
  2585.                 image_control->image_left_top[index].x = temp_x;
  2586.                 image_control->image_left_top[index].y = y1 + img_y1;
  2587.                 image_control->image_right_bottom[index].x = temp_x + width - 1;
  2588.                 image_control->image_right_bottom[index].y = y1 + img_y1 + height - 1;
  2589.             #endif /* __MMI_TOUCH_SCREEN__ */ 
  2590.             }
  2591.         }
  2592.         if (image_control->image2)
  2593.         {
  2594.             gui_measure_image(image_control->image2, &width, &height);
  2595.             img_y1 = (MMI_INLINE_EDIT_MENUITEM_HEIGHT >> 1) - (height >> 1);
  2596.             temp_x = (UI_device_width - 1) - iwidth + ATTACHMENT_IMAGE_ICON_MARGIN;
  2597.             gui_show_transparent_image(temp_x, (y1 + img_y1), image_control->image2, 0);
  2598.         }
  2599.     }
  2600.     if (highlight)
  2601.     {
  2602.         gdi_layer_unlock_frame_buffer();
  2603.         gdi_layer_blt_previous(1, y1, (x1 + iwidth - 1), (y1 + iheight - 1));
  2604.     }
  2605. }
  2606. /*****************************************************************************
  2607.  * FUNCTION
  2608.  *  wgui_show_image_attachment_item
  2609.  * DESCRIPTION
  2610.  *  
  2611.  * PARAMETERS
  2612.  *  x1          [IN]        
  2613.  *  y1          [IN]        
  2614.  *  iwidth      [IN]        
  2615.  *  iheight     [IN]        
  2616.  *  item        [?]         
  2617.  * RETURNS
  2618.  *  void
  2619.  *****************************************************************************/
  2620. void wgui_show_image_attachment_item(S32 x1, S32 y1, S32 iwidth, S32 iheight, wgui_inline_item *item)
  2621. {
  2622.     /*----------------------------------------------------------------*/
  2623.     /* Local Variables                                                */
  2624.     /*----------------------------------------------------------------*/
  2625.     wgui_inline_image_attachment *image = (wgui_inline_image_attachment*) item->item;
  2626.     /*----------------------------------------------------------------*/
  2627.     /* Code Body                                                      */
  2628.     /*----------------------------------------------------------------*/
  2629.     if ((item->flags & INLINE_ITEM_DISABLE_HIGHLIGHT))
  2630.     {
  2631.         attach_disable_flag = MMI_TRUE;
  2632.     }
  2633.     else
  2634.     {
  2635.         attach_disable_flag = MMI_FALSE;
  2636.     }
  2637.     image->highlited_image = 0;
  2638.     if ( image->image_change_cb )
  2639.     {
  2640.         image->image_change_cb(0);
  2641.     }
  2642.     show_attachment_images(x1, y1, iwidth, iheight, image, ATTACHMENT_IMAGE_ITEM_UNHIGHLIGHTED);
  2643. }
  2644. /*****************************************************************************
  2645.  * FUNCTION
  2646.  *  wgui_show_image_attachment_item_highlight
  2647.  * DESCRIPTION
  2648.  *  
  2649.  * PARAMETERS
  2650.  *  x1          [IN]        
  2651.  *  y1          [IN]        
  2652.  *  iwidth      [IN]        
  2653.  *  iheight     [IN]        
  2654.  *  item        [?]         
  2655.  * RETURNS
  2656.  *  void
  2657.  *****************************************************************************/
  2658. void wgui_show_image_attachment_item_highlight(S32 x1, S32 y1, S32 iwidth, S32 iheight, wgui_inline_item *item)
  2659. {
  2660.     /*----------------------------------------------------------------*/
  2661.     /* Local Variables                                                */
  2662.     /*----------------------------------------------------------------*/
  2663.     wgui_inline_image_attachment *image = (wgui_inline_image_attachment*) item->item;
  2664.     /*----------------------------------------------------------------*/
  2665.     /* Code Body                                                      */
  2666.     /*----------------------------------------------------------------*/
  2667.     image->control_x1 = (U8) x1;
  2668.     image->control_y1 = (U8) y1;
  2669.     image->control_width = (U8) iwidth;
  2670.     image->control_height = (U8) iheight;
  2671.     current_attach_control = image;
  2672.     register_inline_image_attach_keys();
  2673.     clear_inline_item_keys = clear_inline_image_attachment_item;
  2674.     redraw_current_inline_item = redraw_image_attachment_control;
  2675.     register_inline_image_attach_keys();
  2676. #ifdef __MMI_TOUCH_SCREEN__
  2677.     wgui_current_inline_item_pen_function = inline_image_attachment_pen_handler;
  2678. #endif 
  2679.     show_attachment_images(x1, y1, iwidth, iheight, image, ATTACHMENT_IMAGE_ITEM_HIGHLIGHTED);
  2680. }
  2681. /*****************************************************************************
  2682. * FUNCTION
  2683. *  RegisterAttachmentHighlightedFunction()
  2684. * DESCRIPTION
  2685. *   Register highlighted item callback function
  2686. * PARAMETERS
  2687. *  item IN inline item
  2688. *  f IN callback function
  2689. * RETURNS
  2690. *   void
  2691. * GLOBALS AFFECTED
  2692. *   nil
  2693. *****************************************************************************/
  2694. void RegisterAttachmentHighlightedFunction (InlineItem * item, void (*f)(S32 index))
  2695. {
  2696.     /*----------------------------------------------------------------*/
  2697.     /* Local Variables                                                */
  2698.     /*----------------------------------------------------------------*/
  2699.     wgui_inline_image_attachment *attach_item;
  2700.     /*----------------------------------------------------------------*/
  2701.     /* Code Body                                                      */
  2702.     /*----------------------------------------------------------------*/
  2703.     if (f)
  2704.     {
  2705.         attach_item = (wgui_inline_image_attachment *) item->item;
  2706.         attach_item->image_change_cb= f;
  2707.     }
  2708. }
  2709. #ifdef __MMI_TOUCH_SCREEN__
  2710. /*
  2711.  * If success, *item_index >= 0 and return MMI_TRUE
  2712.  * * Otherwise, *item_index < 0 and return MMI_FALSE
  2713.  */
  2714. /*****************************************************************************
  2715.  * FUNCTION
  2716.  *  gui_image_attachment_translate_pen_position
  2717.  * DESCRIPTION
  2718.  *  
  2719.  * PARAMETERS
  2720.  *  x               [IN]        
  2721.  *  y               [IN]        
  2722.  *  item_index      [?]         
  2723.  * RETURNS
  2724.  *  
  2725.  *****************************************************************************/
  2726. static BOOL gui_image_attachment_translate_pen_position(S16 x, S16 y, S32 *item_index)
  2727. {
  2728.     /*----------------------------------------------------------------*/
  2729.     /* Local Variables                                                */
  2730.     /*----------------------------------------------------------------*/
  2731.     S32 index;
  2732.     S32 x1, y1, x2, y2;
  2733.     wgui_inline_image_attachment *image_control;
  2734.     /*----------------------------------------------------------------*/
  2735.     /* Code Body                                                      */
  2736.     /*----------------------------------------------------------------*/
  2737.     MMI_DBG_ASSERT(current_attach_control);
  2738.     image_control = current_attach_control;
  2739.     *item_index = -1;
  2740.     for (index = 0; index < n_images_in_inline_attach_item; index++)
  2741.     {
  2742.         if (image_control->attach_image[index].image1)
  2743.         {
  2744.             x1 = image_control->image_left_top[index].x;
  2745.             y1 = image_control->image_left_top[index].y;
  2746.             x2 = image_control->image_right_bottom[index].x;
  2747.             y2 = image_control->image_right_bottom[index].y;
  2748.             if (x >= x1 && x <= x2 && y >= y1 && y <= y2)
  2749.             {
  2750.                 *item_index = index;
  2751.                 break;
  2752.             }
  2753.         }
  2754.     }
  2755.     if (*item_index < 0)
  2756.     {
  2757.         return MMI_FALSE;
  2758.     }
  2759.     else
  2760.     {
  2761.         return MMI_TRUE;
  2762.     }
  2763. }
  2764. /*****************************************************************************
  2765.  * FUNCTION
  2766.  *  inline_image_attachment_pen_handler
  2767.  * DESCRIPTION
  2768.  *  
  2769.  * PARAMETERS
  2770.  *  pen_event       [IN]        
  2771.  *  x               [IN]        
  2772.  *  y               [IN]        
  2773.  *  item_event      [?]         
  2774.  * RETURNS
  2775.  *  
  2776.  *****************************************************************************/
  2777. BOOL inline_image_attachment_pen_handler(
  2778.         mmi_pen_event_type_enum pen_event,
  2779.         S16 x,
  2780.         S16 y,
  2781.         gui_inline_item_pen_enum *item_event)
  2782. {
  2783.     /*----------------------------------------------------------------*/
  2784.     /* Local Variables                                                */
  2785.     /*----------------------------------------------------------------*/
  2786.     BOOL ret;
  2787.     S32 x1, y1, x2, y2;
  2788.     wgui_inline_image_attachment *image_control;
  2789.     /*----------------------------------------------------------------*/
  2790.     /* Code Body                                                      */
  2791.     /*----------------------------------------------------------------*/
  2792.     MMI_DBG_ASSERT(current_attach_control);
  2793.     image_control = current_attach_control;
  2794.     x1 = image_control->control_x1;
  2795.     y1 = image_control->control_y1;
  2796.     x2 = x1 + image_control->control_width;
  2797.     y2 = y1 + image_control->control_height;
  2798.     ret = MMI_TRUE;
  2799.     *item_event = GUI_INLINE_ITEM_PEN_NONE;
  2800.     switch (pen_event)
  2801.     {
  2802.         case MMI_PEN_EVENT_DOWN:
  2803.         {
  2804.             if (PEN_CHECK_BOUND(x, y, x1, y1, x2, y2))
  2805.             {
  2806.                 S32 index;
  2807.                 if (gui_image_attachment_translate_pen_position(x, y, &index))
  2808.                 {
  2809.                     image_control->highlited_image = index;
  2810.                     if ( image_control->image_change_cb )
  2811.                     {
  2812.                         image_control->image_change_cb(image_control->highlited_image);
  2813.                     }
  2814.                     *item_event = GUI_INLINE_ITEM_PEN_NEED_REDRAW_ITEM;
  2815.                 }
  2816.                 image_control->highlight_changed = 0;
  2817.             }
  2818.             else
  2819.             {
  2820.                 ret = MMI_FALSE;
  2821.             }
  2822.         }
  2823.             break;
  2824.         case MMI_PEN_EVENT_MOVE:
  2825.         {
  2826.             S32 index;
  2827.             gui_image_attachment_translate_pen_position(x, y, &index);
  2828.             if (index != image_control->highlited_image)
  2829.             {
  2830.                 image_control->highlight_changed = 1;
  2831.             }
  2832.         }
  2833.             break;
  2834.         case MMI_PEN_EVENT_UP:
  2835.         {
  2836.             S32 index;
  2837.             gui_image_attachment_translate_pen_position(x, y, &index);
  2838.             if (index == image_control->highlited_image && !image_control->highlight_changed)
  2839.             {
  2840.                 *item_event = GUI_INLINE_ITEM_PEN_SELECTED;
  2841.             }
  2842.         }
  2843.             break;
  2844.         case MMI_PEN_EVENT_LONG_TAP:
  2845.             /* Do Nothing */
  2846.             break;
  2847.         case MMI_PEN_EVENT_REPEAT:
  2848.             /* Do Nothing */
  2849.             break;
  2850.         case MMI_PEN_EVENT_ABORT:
  2851.             /* Do Nothing */
  2852.             break;
  2853.         default:
  2854.             MMI_DBG_ASSERT(0);
  2855.     }
  2856.     return ret;
  2857. }
  2858. #endif /* __MMI_TOUCH_SCREEN__ */ 
  2859. #endif /* defined __MMI_PLUTO_GPRS__ */ 
  2860. /************************** Image Text Control End ********/
  2861. /*****************************************************************************
  2862.  * FUNCTION
  2863.  *  inline_fixed_list_goto_previous_item
  2864.  * DESCRIPTION
  2865.  *  
  2866.  * PARAMETERS
  2867.  *  void
  2868.  * RETURNS
  2869.  *  void
  2870.  *****************************************************************************/
  2871. void inline_fixed_list_goto_previous_item(void)
  2872. {
  2873.     /*----------------------------------------------------------------*/
  2874.     /* Local Variables                                                */
  2875.     /*----------------------------------------------------------------*/
  2876.     /*----------------------------------------------------------------*/
  2877.     /* Code Body                                                      */
  2878.     /*----------------------------------------------------------------*/
  2879.     /* FIXME. register as complete_inline_item_edit()? */
  2880.     if (!(MMI_multiline_inputbox.flags & UI_MULTI_LINE_INPUT_BOX_VIEW_MODE) &&
  2881.         (MMI_multiline_inputbox.flags & UI_MULTI_LINE_INPUT_BOX_INSIDE_INLINE_MENU))
  2882.     {
  2883.         handle_inline_multi_line_edit_complete();
  2884.     }
  2885.     wgui_inline_edit_arrow_key_flag = CATEGORY57_UP_ARROW_KEY_FLAG;
  2886.     clear_inline_item_keys();
  2887.     register_inline_fixed_list_keys();
  2888. #if 0   /* defined(__MMI_TOUCH_SCREEN__) */
  2889. /* under construction !*/
  2890. /* under construction !*/
  2891. /* under construction !*/
  2892. /* under construction !*/
  2893. /* under construction !*/
  2894. /* under construction !*/
  2895. /* under construction !*/
  2896. /* under construction !*/
  2897. /* under construction !*/
  2898. /* under construction !*/
  2899. /* under construction !*/
  2900. /* under construction !*/
  2901. /* under construction !*/
  2902. /* under construction !*/
  2903. /* under construction !*/
  2904. /* under construction !*/
  2905. /* under construction !*/
  2906. /* under construction !*/
  2907. /* under construction !*/
  2908. /* under construction !*/
  2909. #else /* 0 */ 
  2910.     /* Lock frame buffer to avoid partial screen update 
  2911.        (e.g. softkey changed before list is redrawn) */
  2912.     gdi_layer_lock_frame_buffer();
  2913.     fixed_list_goto_previous_item();
  2914.     gdi_layer_unlock_frame_buffer();
  2915.     gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);    
  2916. #if defined(__MMI_TOUCH_SCREEN__)
  2917.     /* W06.05 Do not draw fixed list in category57 because of virtual keyboard */
  2918.     if (GUI_VIRTUAL_KEYBOARD_EMPTY_TRAY != MMI_virtual_keyboard.lang_type)
  2919.     {
  2920.         mmi_pen_editor_clear_and_show_virtual_keyboard_area();
  2921.     }
  2922. #endif /* defined(__MMI_TOUCH_SCREEN__) */ 
  2923. #endif /* 0 */ 
  2924. }
  2925. /*****************************************************************************
  2926.  * FUNCTION
  2927.  *  inline_fixed_list_goto_next_item
  2928.  * DESCRIPTION
  2929.  *  
  2930.  * PARAMETERS
  2931.  *  void
  2932.  * RETURNS
  2933.  *  void
  2934.  *****************************************************************************/
  2935. void inline_fixed_list_goto_next_item(void)
  2936. {
  2937.     /*----------------------------------------------------------------*/
  2938.     /* Local Variables                                                */
  2939.     /*----------------------------------------------------------------*/
  2940.     /*----------------------------------------------------------------*/
  2941.     /* Code Body                                                      */
  2942.     /*----------------------------------------------------------------*/
  2943.     wgui_inline_edit_arrow_key_flag = CATEGORY57_DOWN_ARROW_KEY_FLAG;
  2944.     clear_inline_item_keys();
  2945.     register_inline_fixed_list_keys();
  2946. #if 0   /* defined(__MMI_TOUCH_SCREEN__) */
  2947. /* under construction !*/