专注于服务器编程、网络编程

~~保持一颗平常心~~持之以恒~~
posts - 18, comments - 7, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

ShowCategory200Screen

Posted on 2009-12-19 10:59 ~William~ 阅读(576) 评论(0)  编辑 收藏 引用 所属分类: MTK_MMI

MTK: ShowCategory200Screen() 收藏
 
说明:

1.所有的ShowScreen都有2个ID:Screen ID(EntryNewScreen()函数中设置的ID),以及模板ID(Category ID)。

2.所有的窗口模板的基本设置都保存在一个全局变量:g_categories_controls_map中。它的结构是:

typedef struct

{

    U16 category_id;                           模板ID号

    U8 *control_set_p;                        这个模板的组件指针

    S16 *default_coordinate_set_p;   这个模板中各组件属性的指针

    S16 *rotated_coordinate_set_p;  其他特殊属性指针

} dm_category_id_control_set_map_struct;

 

例如Category200:{MMI_CATEGORY200_ID, (U8 *) category200, (S16 *) coordinate_set200, NULL},

组件:

const U8 category200[] =

{

    5,

    DM_BASE_LAYER_START,

    DM_SCR_BG,

    DM_BASE_CONTROL_SET1,

    DM_CATEGORY_CONTROLLED_AREA,

    DM_SINGLELINE_INPUTBOX1

};

属性:

const S16 coordinate_set200[] =

{

    DM_FULL_SCREEN_COORDINATE_FLAG,

    DM_CONTENT_COORDINATE_FLAG,

    26,

       MAIN_LCD_DEVICE_HEIGHT - MMI_BUTTON_BAR_HEIGHT - MMI_SINGLELINE_INPUTBOX_HEIGHT - 2,

       MAIN_LCD_DEVICE_WIDTH - 29,

       MMI_SINGLELINE_INPUTBOX_HEIGHT,

       DM_NO_FLAGS

};

 

3.一个Screen ID的属性变量:g_screenid_coordinate_sets_map[]。其中只包含了几个Screen的属性指针,可能是用来设置一些特殊窗口的属性。结构是:

typedef struct

{

    S32 screen_id;

    S16 *coordinate_set_p;

} dm_screen_id_coordinate_set_map_struct;

 

4.2个函数:

(1)U8 *dm_search_control_set(S32 category_id, S16 **default_coordinate_set_p)

       获取某个模板的组件和组件属性指针。

(2)S16 *dm_search_coordinate_set(S32 ScrId)

       获取Screen ID的属性指针。

进入ShowCategory200Screen():MTK的电话簿快速查询

ShowCategory200Screen()

       dm_data_struct dm_data;             定义变量,赋值后,带入全局变量:g_dm_data。最后在dm_redraw_category_screen()中使用。

      

       gdi_layer_lock_frame_buffer();     锁屏

      

       create_fixed_icontext_menuitems();     设置fixed list menuitem的公共属性MMI_fixed_icontext_menuitem,以及每个menuitems: MMI_fixed_icontext_menuitems[i]和指针

                                                               MMI_fixed_menuitem_pointers[i]

       associate_fixed_icontext_list();            把上面设置的menuitems与框架MMI_fixed_list_menu结合起来,设置icontext的menuitem的接口函数。

       init_dynamic_item_buffer(number_of_items, get_item_func, get_hint_func, UI_dummy_function);       装载动态menuitem:dynamic_item_buffer:获取item,hint的函数,以及开始,结束,

                                                               总的items数目;并调用函数设置MMI_fixed_icontext_menuitems[]中的每个menuitem。

       设置shotcut位置MMI_menu_shortcut_box。

       register_dynamic_list_keys()           注册方向键的响应。

       resize_fixed_list(240,191)             设置icontext menuitem框架的位置尺寸,以及fixed list和滚动条的位置尺寸

       设置输入框的位置尺寸

       dynamic_list_goto_item_no_redraw(highlighted_item = 0);

              gui_dynamic_list_menu_goto_item(&MMI_fixed_list_menu, item_index);

                     gui_dynamic_list_menu_locate_highlighted_item(m);

       wgui_setup_singleline_inputbox()    设置输入框,包括信息框

              SetKeyHandler(wgui_handle_qsearch_singleline_inputbox_change_input_mode, KEY_POUND, KEY_EVENT_DOWN);       #键改变输入法

       gui_set_single_line_input_box_theme(&MMI_singleline_inputbox, &cat200_singleline_inputbox_theme);                                   输入框主题

       resize_dynamic_icontext_menuitems_to_list_width();

       set_fixed_icontext_positions                设置icontext的icon和text 的坐标

       singleline_inputbox_input_callback();    右软件标签

       设置左软件标签

       gdi_layer_unlock_frame_buffer();        解屏

       ExitCategoryFunction = ExitCategory200Screen;

    dm_setup_category_functions(dm_redraw_category_screen, GetCategory200History, GetCategory200HistorySize);   /* 102605 quick search history Calvin add */

    dm_data.s32flags = DM_CLEAR_SCREEN_BACKGROUND;           设置dm_data

    dm_data.s32flags |= DM_SHOW_VKPAD;

    dm_data.s32ScrId = (S32) GetActiveScreenId();

    dm_data.s32CatId = MMI_CATEGORY200_ID;

    dm_setup_data(&dm_data);                                                           设置g_dm_data

       dm_register_category_controlled_callback(RedrawCategoryControlledArea200Screen);          注册控制区域的CBACK函数

       dm_register_vkpad_callback(cat200_virtual_keypad_callback);                                            画虚拟键盘的CBACK

       dm_redraw_category_screen();

      

dm_redraw_category_screen()

       S16 *UICtrlAccessPtr_p = NULL, *DeafultCoordinateSet_p = NULL;      Category200模板的组件属性指针

       U8 *control_set_ptr = NULL;                                                               Category200模板的组件指针

       control_set_ptr = dm_search_control_set((U16) g_dm_data.s32CatId, &DeafultCoordinateSet_p);        获取模板200的组件和组件默认属性指针

       u8NoOfUICtrls = control_set_ptr[0];           组件第一个参数是组件个数

      

       UICtrlAccessPtr_p = dm_search_coordinate_set(g_dm_data.s32ScrId);    获取组件属性。即:UICtrlAccessPtr_p是组件属性指针,如果UICtrlAccessPtr_p为空,就设置为默认属性。

       gdi_layer_lock_frame_buffer();

       UICtrlAccessPtr_p = dm_get_cat_scr_coordinates(UICtrlAccessPtr_p, &dm_cat_scr_info);          Get category screen size,在画组件之前,根据属性要获取这个窗口的大小。

                                                                             此时,属性指针下移一个位置,指向下一个属性。

      

       gdi_layer_set_active(GDI_LAYER_MAIN_BASE_LAYER_HANDLE);      设置基本层

       gui_set_clip(dm_cat_scr_info.x1, dm_cat_scr_info.y1, dm_cat_scr_info.x2, dm_cat_scr_info.y2);       设置窗口剪切区

       gdi_draw_solid_rect(0, 0, UI_device_width - 1, UI_device_height - 1, GDI_COLOR_TRANSPARENT);      画背景

      

       for (u8CtrlCt = 1; u8CtrlCt <= u8NoOfUICtrls; u8CtrlCt++)      开始画组件

       {

              switch (control_set_ptr[u8CtrlCt])       判断组件

              {

                     case DM_BASE_LAYER_START:

            {

                if (redraw_type != REDRAW_2_REDRAW)

                {

                    dm_setup_base_layer();

                }

                break;

            }

                     case DM_BASE_CONTROL_SET1:

            {

                dm_setup_and_draw_base_control_set(&UICtrlAccessPtr_p);          画基本组件:status, title, button

                                   control_set_ptr = dm_get_base_control_set();                          获取基本组件指针

                                UICtrlAccessPtr_p = dm_get_base_coordinate_set();                获取基本组件属性

                                   u8NoOfUICtrls = control_set_ptr[0];

                                for (u8CtrlCt = 1; u8CtrlCt <= u8NoOfUICtrls; u8CtrlCt++)

                                   {    

                                          画3个基本组件。注意要传进入属性指针作为参数。因为在画的时候,要根据组件属性,去获取坐标等参数。

                                          dm_setup_and_draw_status_icons(&UICtrlAccessPtr_p);

                                          dm_setup_and_draw_title(&UICtrlAccessPtr_p);

                                          dm_setup_and_draw_button_bar(&UICtrlAccessPtr_p);

                                   }

                break;

            }

                     case DM_CATEGORY_CONTROLLED_AREA:

            {

                dm_setup_and_draw_category_controlled_area(&UICtrlAccessPtr_p);

                                   *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_category_controlled_area_info);       根据属性输入坐标

                                   (*dm_category_controlled_area_callback) (&dm_category_controlled_area_info);    即注册的CBACK:RedrawCategoryControlledArea200Screen()

                                          gdi_layer_lock_frame_buffer();     锁屏

                                          wgui_redraw_singleline_input_information_bar();       画输入法提示框

                                          show_dynamic_list();                                              画fixed list menu

                                          gui_draw_rectangle()                                               画输入框

                                          gui_show_image()                                              输入框前面的image

                                          gdi_layer_unlock_frame_buffer();

                                       gdi_layer_blt_previous(0, 0, UI_device_width - 1, UI_device_height - 1);

                break;

            }

                     case DM_SINGLELINE_INPUTBOX1:

            {

                dm_setup_and_draw_singleline_inputbox(&UICtrlAccessPtr_p);

                                   *UICtrlAccessPtr_p = dm_get_coordinates(*UICtrlAccessPtr_p, &dm_singleline_inputbox_info);         根据属性,获取坐标

                                   show_singleline_inputbox();

                break;

            }

              }

       }     到for退出后,所有的控件就画好了

      

       gdi_layer_unlock_frame_buffer();

       gdi_layer_blt()

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/xqq2009/archive/2009/09/13/4546713.aspx


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理