RDA GUI

创建服务:“sysapp_table.h” / "dvb_guiobj_table.h" / "atv_guiobj_table.h"

  “服务”与“回调”

        

1、不同服务的“共享菜单”

  

2、切换到不同的服务,动态加载对应的UI:如“多媒体服务”

  

3、窗口“句柄”与“回调”管理:“app_guimgr.c”  

  先声明句柄

  

  再关联资源:

  

  注意枚举与回调数组的对应关系:

    如:DVB的窗口枚举与 公共+DVB回调的对应

   

4、具体到某一个窗口的回调实例(主菜单窗口):

const GUI_Object_Definition_t stAPPGuiObjMainMenu =
{
    GUI_OBJ_CAN_BE_FOCUSED,
    GUI_OBJ_UPDATE_PERIOD * 10,  
    _APP_GUIOBJ_MainMenu_OnCreate,
    _APP_GUIOBJ_MainMenu_OnRelease,
    _APP_GUIOBJ_MainMenu_OnFocused,
    _APP_GUIOBJ_MainMenu_OnLoseFocus,
    _APP_GUIOBJ_MainMenu_OnTimerUpdate,
    _APP_GUIOBJ_MainMenu_OnEvent,
};

 

5、创建/显示窗口的6个步骤:

  最常用的为步骤3、4。

  步骤3:获取部件句柄。    步骤4:动态设置部件参数

  

   刷新部件的两种方式:

  

 

 6、主菜单绘制

  

/*主要参数*/
static MenuPage_Handle_t g_stMenuPage_Handle;            //主菜单窗口句柄
APP_Mainmenu_SubItemParam_t g_stMainMenuParam;            //标签页内容
APP_Mainmenu_SubItemParam_t g_stMenuParam;                //ListView内容
static INT32 g_arTextItemString[MAINMENU_MAX_ITEM+1][2];//ComboBox内容

// g_stMainMenuParam  对应
static APP_Mainmenu_SubItemEx_t g_stMainmenuItem_Ex[] =
{
    {TV_IDS_String_Channel,             MAIN_CHANNEL_ITEM,            FALSE},
    {TV_IDS_String_Picture,                MAIN_PICTURE_ITEM,            FALSE},
    {TV_IDS_String_Sound,                 MAIN_SOUND_ITEM,            FALSE},
    {TV_IDS_String_Time,                 MAIN_FEATURE_ITEM,            FALSE},
    {TV_IDS_String_Lock,                 MAIN_LOCK_ITEM,                FALSE},
    {TV_IDS_String_Option,                 MAIN_SETUP_ITEM,            FALSE},
    {TV_IDS_String_SCREEN,                 MAIN_SCREEN_ITEM,            FALSE},
};

// g_stMenuParam  对应
static APP_Mainmenu_SubItemEx_t g_stMainmenuItem_PictureEx[] =
{
    {TV_IDS_String_PictureMode,            PICTURE_MODE_ITEM,            FALSE},
    {TV_IDS_String_Contrast,             CONTRAST_ITEM,                FALSE},
    {TV_IDS_String_Brightness,             BRIGHTNESS_ITEM,            FALSE},
    {TV_IDS_String_Colour,                 COLOUR_ITEM,                FALSE},
    {TV_IDS_String_3D_Steup,             PICTURE_3D_SETUP_ITEM,        FALSE},
};

主菜单窗口类型定义:

/*Handle*/
typedef struct{
    HWND h_MainMenu_TitleBitmap[MAINMENU_PAGE_MAX];            //主菜单抬头ICON
    HWND h_MainMenu_Icon_Handle;                            //标签页ICON
    HWND h_MainMenu_Title_Handle;                            //标签页title
    HWND h_MenuLayer_Listview_Handle;                        //ListView
    HWND h_MainMenu_TextItem_Handle[MAINMENU_MAX_ITEM];        //ComboBox
}MenuPage_Handle_t;

对应资源获取窗口句柄:

void APP_GUIOBJ_MainMenu_SetHandle(void)
{
    INT32 i32Count = 0;

    GUI_FUNC_CALL(GEL_GetHandle(IDM_MainPage_control,TV_E_IDC_BTN_Button_MainPage_Title,&(g_stMenuPage_Handle.h_MainMenu_Title_Handle)));
    GUI_FUNC_CALL(GEL_GetHandle(IDM_MainPage_control,TV_E_IDC_BTN_Button_MainPage_LeftIcon,&(g_stMenuPage_Handle.h_MainMenu_Icon_Handle)));
    GUI_FUNC_CALL(GEL_GetHandle(IDM_MenuLayer_control,TV_E_IDC_LIST_ListView_MenuLayerText,&(g_stMenuPage_Handle.h_MenuLayer_Listview_Handle)));

    for (i32Count = 0; i32Count < MAINMENU_PAGE_MAX; i32Count++)    //MAINMENU_PAGE_MAX=6        TABLE
    {
        GUI_FUNC_CALL(GEL_GetHandle(IDM_MainPage_control,TV_E_IDC_BTN_Button_MainPage_Picture+i32Count,
            &(g_stMenuPage_Handle.h_MainMenu_TitleBitmap[i32Count])));
    }
    for (i32Count = 0; i32Count < MAINMENU_MAX_ITEM; i32Count++)    //MAINMENU_MAX_ITEM=13        ITEM
    {
        GUI_FUNC_CALL(GEL_GetHandle(IDM_MenuLayer_control,TV_E_IDC_COMBO_ComboBox_MenuLayer_Item0+i32Count,
            &(g_stMenuPage_Handle.h_MainMenu_TextItem_Handle[i32Count])));
    }
}

标签页内容获取“g_stMainMenuParam”:

static void _APP_GUIOBJ_MainMenu_GetItemParam(void)
{
    UINT8 SupportDTV;
    UINT8 SupportATV;
    UINT16 i;
    UINT16 u16Count;
    al_uint32 Support_Input_Source_temp = 0;/*Clear item*/
    memset(&g_stMainMenuParam,0x0,sizeof(APP_Mainmenu_SubItemParam_t));for(i = 0;i < MAIN_MAX_ITEM;i ++)
    {
        u16Count = 0;
        for(i = 0;i < g_u16MainmenuItem_Size;i++)
        {
            if(g_stMainmenuItem_Ex[i].HideFlag)
            {
                continue;
            }
            g_stMainMenuParam.ItemListStr[u16Count] = g_stMainmenuItem_Ex[i].dStrID;
            g_stMainMenuParam.ItemType[u16Count] = g_stMainmenuItem_Ex[i].Type;
            u16Count ++;
        }
        g_stMainMenuParam.ItemListStr[u16Count] = STRING_LAST;
        g_stMainMenuParam.ItemTotalNum = u16Count;
    }
}

 ListView内容获取g_stMenuParam:

static void _APP_GUIOBJ_MainMenu_GetSubItemParam(MainMenuItem_t Item)
{
    UINT16 i = 0;
    UINT16 u16Count = 0;
    memset(&g_stMenuParam,0x0,sizeof(APP_Mainmenu_SubItemParam_t));
    for(i = 0;i<MAINMENU_TOTALITEM_MAX;i++)
    {
        g_stMenuParam.ItemListStr[i] = STRING_ID_INVALID;
        g_stMenuParam.ItemType[i] = 0;
    }
    g_stMenuParam.ItemListStr[MAINMENU_TOTALITEM_MAX] = STRING_LAST;
    g_stMenuParam.ItemType[MAINMENU_TOTALITEM_MAX] = 0;
    g_stMenuParam.ItemTotalNum = 0;
    switch(Item)
    {
        case MAIN_PICTURE_ITEM:
            u16Count = 0;
            for(i = 0;i<g_u16MainmenuItem_PictureEx_Size;i++)
            {
                if(g_stMainmenuItem_PictureEx[i].HideFlag)
                {
                    continue;
                }
                g_stMenuParam.ItemListStr[u16Count] = g_stMainmenuItem_PictureEx[i].dStrID;
                g_stMenuParam.ItemType[u16Count] = g_stMainmenuItem_PictureEx[i].Type;
                u16Count ++;
            }
            g_stMenuParam.ItemListStr[u16Count] = STRING_LAST;
            g_stMenuParam.ItemType[u16Count] = PICTURE_MAX_ITEM;
            g_stMenuParam.ItemTotalNum = u16Count;
            break;
        default:
            break;
    }
}

Layer层ComboBox内容获取:

绘制PICTURE菜单:

void _APP_GUIOBJ_MainMenu_SetPicture(UINT8 u8PageNum)
{
    INT32 i32Count = 0;
    UINT32 enString_Id = 0;
    UINT32 u32PictureMode;
    UINT8 index = 0;
    bool u8DisableFlag = FALSE;
    APP_Video_ImageSharpnessAction_t ePictureSharpnessState;
    APP_Video_ImageTintAction_t ePictureTintState;
    APP_Video_ImageNRAction_t ePictureNRState;    
    Picture_Data_t stUIPictureData;

    /*清除菜单*/
    _APP_GUIOBJ_MainMenu_ClearSubItem();

    /*动态更改或隐藏ITEM*/
    _APP_GUIOBJ_MainMenu_InitSubItemParam(MAIN_PICTURE_ITEM);

    /*获取ListView字串g_stMenuParam*/
    _APP_GUIOBJ_MainMenu_GetSubItemParam(MAIN_PICTURE_ITEM);

    /*重绘ListView*/
    GUI_FUNC_CALL(GEL_SetParam(g_stMenuPage_Handle.h_MenuLayer_Listview_Handle,PARAM_STATIC_STRING, g_stMenuParam.ItemListStr));

    for (i32Count = 0; i32Count < g_stMenuParam.ItemTotalNum; i32Count++)
    {
        index = i32Count%MAINMENU_MAX_ITEM;
        switch(g_stMenuParam.ItemType[i32Count])
        {
            case PICTURE_MODE_ITEM:
                APP_GUIOBJ_Picture_GetPictureMode(&u32PictureMode);
                g_arTextItemString[index][0] = u32PictureMode;
                g_arTextItemString[index][1] = STRING_LAST;
                /*重绘ComboBox*/
                GUI_FUNC_CALL(GEL_SetParam(g_stMenuPage_Handle.h_MainMenu_TextItem_Handle[index],PARAM_STATIC_STRING, &g_arTextItemString[index]));
                break;
            case BRIGHTNESS_ITEM:
                /*Set brightness*/
                sprintf(stUIPictureData.pBrightness[0],"%d",stUIPictureData.Brightness);
                GUI_FUNC_CALL(GEL_SetParam(g_stMenuPage_Handle.h_MainMenu_TextItem_Handle[index],
                    PARAM_DYNAMIC_STRING, stUIPictureData.pBrightness));
                break;
            default:
                break;
        }
    }

    APP_GUIOBJ_Picture_SetPictureData(&stUIPictureData);

    /*设置DISABLE状态*/
    for (i32Count = 0; i32Count < g_stMenuParam.ItemTotalNum; i32Count++)
    {
        /*init disable state*/
        index = i32Count%MAINMENU_MAX_ITEM;
        APP_GUIOBJ_MainMenu_SwitchItemEnorDisable(u8PageNum,i32Count,TRUE);
        u8DisableFlag = FALSE;
        /*Get disabled item*/
        switch(g_stMenuParam.ItemType[i32Count])
        {
            case SHARPNESS_ITEM:
                APP_Video_CheckSharpnessState(&ePictureSharpnessState);
                g_ePictureSharpnessState = ePictureSharpnessState;
                if (ePictureSharpnessState == APP_VIDEO_IMAGE_SHARPNESS_DISABLED)
                {
                    u8DisableFlag = TRUE;
                }
                break;
                break;
            default:
                break;
        }
        if(u8DisableFlag)    /*Set diabled item as disable*/
        {
            APP_GUIOBJ_MainMenu_SwitchItemEnorDisable(u8PageNum,i32Count,FALSE);
        }
    }

}

7、增加/删除窗口

  修改“application\radisson\mstar ” 对应UI 目录 atv/dvb 下的makefile文件,如:“SRCS_LIST += app_guiobj_dtv_xxx.c”

  application\radisson\mstar\resources\menu  目录下的  TV_IDM_xxx.c   TV_IDM_xxx.h,有时需要修改“menu.in”

  增加/删除“application\radisson\mstar\UI_Project\TV_UIProject\Menus” 目录下的 “uim” 文件,注意使用“uiDesign”工具处理

  增加对应窗口API   app_guiobj_dtv_xxx.c,以及修改Makefile

  app_menumgr.c   //销毁资源

  sysapp_table.h 增加窗口回调

  新建窗口,完成功能示例如下:

  

 

8、常用API相关

  //刷新一个部件
    GUI_FUNC_CALL(GEL_RGNBUF_RenderControl(h_List_BinName));

  //刷新一组部件
    APP_GuiMgr_RegionBufferControl(hRegionBuf, u32RegionBufCnt);

  app_menumgr.c

  g_stUserInfoData.AutoInstalled

 

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页