MTK 添加softkey到确定界面

MTK的softkey都是放在屏幕的最下方,这有好处,如果是确定框的时候,把softkey放在确定框上,则更显友好:

 

只要修改三个文件即可:
1.Custcoordinates.c (plutommi/customer/custresource):
修改控件。
2.Wgui_categories_popup.c (plutommi/mmi/gui/gui_src):
修改坐标。
3.Wgui_draw_manager.c (plutommi/mmi/gui/gui_src):
画softkey。

 

具体过程下面给出

(1)去掉旧的softkey,在Custcoordinates.c中,把控件DM_BUTTON_BAR1换成

DM_CATEGORY_CONTROLLED_AREA2,并把属性更改为DM_SUBMENU_CONTENT_COORDINATE_FLAG。

确定框使用的控件ID是MMI_CATEGORY165_ID,我们查找全局控件数组g_categories_controls_map[],有:
  {MMI_CATEGORY165_ID, (U8 *) category165, (S16 *) coordinate_set165, NULL},
可以看到,MMI_CATEGORY165_ID的控件放在category165数组里,coordinate_set165则是控件的属性,找
到category165和coordinate_set165的定义:

 

const U8 category165[] =
{
    8,//8个控件
    ...... //省略
    #if 1 //把控件DM_BUTTON_BAR1换成DM_CATEGORY_CONTROLLED_AREA2
    DM_CATEGORY_CONTROLLED_AREA2
    #else
    DM_BUTTON_BAR1
    #endif
};
const S16 coordinate_set165[] =
{
    ...... //省略
    #if 1 //更改属性
    DM_SUBMENU_CONTENT_COORDINATE_FLAG
    #else
    DM_DEFAULT_BUTTON_BAR_FLAG, MMI_SOFTKEY_WIDTH
    #endif
};
这样softkey就不会画出来了。

 

(2)画新的softkey,在Wgui_categories_popup.c中,找到函数ShowCategory163Screen,注册控件

DM_CATEGORY_CONTROLLED_AREA2的回调函数,和触笔函数:

void ShowCategory163Screen(.......//省略)
{
    .......//省略
    #if 1 //注册控件DM_CATEGORY_CONTROLLED_AREA2回调函数
    dm_register_category_controlled2_callback(
       confirm_draw_softkey);//自己的画按键函数
    wgui_register_category_screen_control_area2_pen_handlers(
       confirm_softkey_pen_down_hdlr,//pen down函数
       MMI_PEN_EVENT_DOWN);
    wgui_register_category_screen_control_area2_pen_handlers(
       confirm_softkey_pen_up_hdlr,//pen up函数
       MMI_PEN_EVENT_UP);
    wgui_register_category_screen_control_area2_pen_handlers(
       confirm_softkey_pen_move_hdlr,//pen move函数
       MMI_PEN_EVENT_MOVE);
    wgui_register_category_screen_control_area2_pen_handlers(
       confirm_softkey_pen_abort_hdlr,//pen abort函数
       MMI_PEN_EVENT_ABORT);
    #endif

    .......//省略
    dm_redraw_category_screen();

}

 

(3)由于画softkey需要占屏幕空间,可能要更改确定框的坐标,在Wgui_draw_manager.c中,把确定框的

Y坐标减去50,高度加50(这里定义softkey的高度为50),修改两个地方:

S32 dm_setup_and_draw_popup_background(S16 **UICtrlAccessPtr_p)
{
    .......//省略
    #if 1
    if(g_dm_data.s32CatId == MMI_CATEGORY165_ID)
    {
 dm_popup_background_info.s16Y -= 50;
 dm_popup_background_info.s16Height += 50;
    }
    #endif
    memcpy(&dm_popupbg_coordinate, &dm_popup_background_info, sizeof(dm_coordinates));
    dm_popupbg_set_clip(&dm_popup_background_info);
    ......//省略
}

S32 dm_setup_and_draw_aligned_area(S16 **UICtrlAccessPtr_p, U8 *control_set_ptr)
{
    ......//省略
    #if 1
    if(g_dm_data.s32CatId == MMI_CATEGORY165_ID)
    {
 dm_aligned_area_data.s16Y -= 50;
 dm_aligned_area_data.s16height += 50;
    }
    #endif
    return 1;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值