Chinaunix首页 | 论坛 | 博客
  • 博客访问: 866125
  • 博文数量: 190
  • 博客积分: 7021
  • 博客等级: 少将
  • 技术积分: 1752
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-17 19:26
文章分类

全部博文(190)

文章存档

2014年(9)

2011年(32)

2010年(149)

我的朋友

分类:

2010-06-10 15:22:15

ISHELL_CreateInstance()

Description

This function is called to create an object associated with the specified 32-bit ClassID. The object returned must match the interface supported by the ClassID. When successful, ppobj is filled with an object of the specified class and the object is returned with a positive reference count.

Prototypes

    int ISHELL_CreateInstance
    (
     * pIShell,
     cls,
    void * * ppobj
    )

Parameters

pIShell : [in] : Pointer to the Interface object.

cls : [in] : 32-bit ClassID of the requested interface.

ppobj : [out] : Pointer to the memory to fill with the pointer to the object.

Return Value

SUCCESS: class created.

ENOMEMORY: insufficient memory.

ECLASSNOTSUPPORT: class specified is not supported.

IMENUCTL_SetTitle()

Description

This function sets the title of a menu control object. The text string identifying the title can be specified from a resource file or by using the pText parameter. If pText is a valid string, the function uses this string as the title name. If pText is , the function reads the string corresponding to the given resource identifier, wResID, from resource file and sets it as title name. If the text string and the resource information are invalid, the function fails. If the title string in the pText field and the resource file information are both valid, the pText parameter field takes precedence and is used for the menu title.

Prototypes

    boolean IMENUCTL_SetTitle
    (
     * pIMenuCtl,
    const char * pszResFile,
     wResID,
     * pText
    )

Parameters

pIMenuCtl : Pointer to the Interface object.

pszResFile : -terminated string containing resource file name.

wResID : Resource identifier.

pText : -terminated character string to be used for the menu title.

Return Value

: if successful. , if unsuccessful.

Comments

This function does not update the device screen when invoked. For the new title to take effect on the device screen, use (). The title of a soft key control menu is not shown.

IMENUCTL_AddItemEx()

Description

This function adds an item to a menu, list, or icon view. The new item’s properties are indicated by the parameter. If pai->pText is a valid string, the function uses this string as the item name. If pai->pText is , the function reads the string corresponding to the given resource identifier associated with pai->wText and pai->pszResText. If this fails, the function returns . If pai->pImage is a valid , the function calls IIMAGE_AddRef() and uses the image. This allows the caller to release the image object. If the text string in pai->pText and the resource file information are both valid, pai->pText takes precedence and is used for the menu item name. If pai->pImage is and pai->wImage is specified, the function attempts to load the image from the specified resource. If the image fails to load, the function returns .

Prototypes

    boolean IMENUCTL_AddItemEx(IMenuCtl * pIMenuCtl, CtlAddItem * pai)

Parameters

pIMenuCtl : Pointer to the Interface object.

pai : Pointer to the structure.

Return Value

: if successful.

: if unsuccessful.

Comments

This function does not automatically update the screen. For the new menu item to take effect on the device screen, use (). If the menu is to be activated subsequent to adding menu items, you don’t need to use () because () updates the screen with the new menu items.

Its preferable that control rect and properties are set before adding items.

IMENUCTL_SetRect()

Description

This function sets the coordinates of the control rectangle of the menu control object. This control rectangle represents the area on the device screen where the menu is drawn. The values of the control rectangle are stored within the menu control object. This function is used to change the value of the control rectangle to a new one.

Prototypes

    void IMENUCTL_SetRect(IMenuCtl * pIMenuCtl, const AEERect * prc)

Parameters

pIMenuCtl : Pointer to the Interface object.

prc : Control rectangle for the menu control object. This rectangle specifies the coordinates on the device screen where the menu is to be drawn.

Return Value

None

Comments

By default, the control rectangle coordinates stored in the menu control object correspond to the entire device display screen. Use IMENUCTL_SetRect() to set the control rectangle coordinates to a new value. If no other menu draw operations follow this function, use () for the new control rectangle coordinates to take effect.

For a soft key menu, the default control rectangle encompasses the entire device screen, and the soft key menu is drawn at the bottom of the device screen. When using IMENUCTL_SetRect() to set the control rectangle to a new area, such as the top half of the device screen, the soft key menu is placed at the bottom of new control rectangle area, in this case in the middle of the screen.

IMENUCTL_SetActive()

Description

This function makes a menu control object active or inactive. Only an active menu control object handles the event sent to it. An inactive menu control object ignores the events.

NOTE: This function redraws the menu control if the specified active state does not match the current state of the menu. Thus, calling IMENUCTL_SetActive() does not redraw the menu if the state is not changed as a result of the function call.

Prototypes

    void IMENUCTL_SetActive(IMenuCtl * pIMenuCtl, boolean bActive)

Parameters

pIMenuCtl : Pointer to the Interface object.

bActive : Boolean flag that specifies whether to activate () or deactivate () the menu control object.

Return Value

None

Comments

None

IMENUCTL_HandleEvent()

Description

The menu control object uses this function to handle events it receives. An active menu control object handles key press, set title, and add item events. An inactive menu control object handles only set title and add item events. The typical key press events processed by the menu control object are called by pressing the UP, DOWN, LEFT, and RIGHT keys. If command sending is enabled for the menu control object, and when it receives the event generated by pressing the SELECT key, the menu control object sends a command event to the AEE Shell.

Prototypes

    boolean IMENUCTL_HandleEvent
    (
     * pIMenuCtl,
     evt,
     wp,
     dwp
    )

Parameters

pIMenuCtl : Pointer to the Interface object.

evt : Event code.

wp : 16-bit event data.

dwp : 32-bit event data.

Return Value

: if the event was processed by the Interface object.

: if the event was not processed.

Comments

The menu control event handler is used in applets to handle menu related inputs from a device user. For example, when a device user presses the down arrow key to move from one menu item selection to another, this event is handled by the menu control event handler. In this case, the applet event handler function receives the corresponding event. The applet event handler at this time can call the menu control object event handler to process this event. If the applet event handler does not call the menu control event handler, this event remains unprocessed. The SELECT key is located in different physical locations on a device, depending on the manufacturer or model. When a device user presses this key, the applet receives the event word parameter wParam of type AVK_SELECT.

static boolean HelloBrew_HandleEvent(CHelloBrewApp * pApp, AEEEvent eCode,
uint16 wParam, uint32 dwParam)
{
    switch (eCode)
    {
     case EVT_APP_START:
    //建立一个Menu Control 实例

    if(ISHELL_CreateInstance(pApp->a.m_pIShell,
        AEECLSID_MENUCTL, (void **)(&pApp->m_pMenu)) != SUCCESS)
    {
        return FALSE;
    }
    HelloBrew_DisplayMainMenu( pApp );
    return(TRUE);
    case EVT_APP_STOP:
    // Add your code here .....

    return TRUE;
    case EVT_KEY:
    // 响应用户的按键

    if (IMENUCTL_HandleEvent(pApp->m_pMenu, EVT_KEY, wParam, 0))
    {
        return TRUE;
    }
    case EVT_COMMAND:
    //跳转到下一个页面

    switch(wParam)
    {
        case IDC_ADD_NEW: // User selected 'Add New' from the Main Menu

    // Add your code here .....

    return TRUE;
    case IDC_VIEW: // User selected the 'View' option from the

                   //Main Menu

    // Add your code here .....

    return TRUE;
    case IDC_OPTIONS: // confirmation screen so display

                      //the 'Options'

    menu on the screen.
// Add your code here .....

return TRUE;
default:
break;
}
default:
break;
}
return FALSE;
}
static void HelloBrew_DisplayMainMenu( CHelloBrewApp * pApp)
{
CtlAddItem ai;
// Set Title

IMENUCTL_SetTitle(pApp->m_pMenu,HELLOBREW_RES_FILE,
IDS_MAIN_MENU,NULL);
// Add Items in the Menu

ai.pText = NULL;
ai.pImage = NULL;
ai.pszResImage = ai.pszResText = HELLOBREW_RES_FILE;
ai.wFont = AEE_FONT_LARGE;
ai.dwData = 0;
// Add

ai.wFont = AEE_FONT_LARGE;
ai.dwData = 0;
// Add New

ai.wText = IDC_ADD_NEW;
ai.wImage = IDB_ADD_NEW;
ai.wItemID = IDC_ADD_NEW;
IMENUCTL_AddItemEx(pApp->m_pMenu, &ai);
// View

ai.wText = IDC_VIEW;
ai.wImage = IDB_VIEW;
ai.wItemID = IDC_VIEW;
IMENUCTL_AddItemEx(pApp->m_pMenu, &ai);
// Options

ai.wText = IDC_OPTIONS;
ai.wImage = IDB_OPTIONS;
ai.wItemID = IDC_OPTIONS;
IMENUCTL_AddItemEx(pApp->m_pMenu, &ai);
IMENUCTL_SetRect( pApp->m_pMenu, &pApp->m_rScreenRect );
IMENUCTL_SetActive( pApp->m_pMenu, TRUE );
}


阅读(1121) | 评论(2) | 转发(0) |
0

上一篇:编写BREW程序

下一篇:MIF applet rule

给主人留下些什么吧!~~

chinaunix网友2010-06-29 17:10:35

上海到杭州货运公司http://www.hangzhouzhuanxian.cn 上海至扬州货运http://www.nanjing56.net.cn/zhuanxianfour.htm 上海到义乌货运公司http://www.hangzhouzhuanxian.cn/news/yw_01.htm 上海至江阴货运http://www.nanjing56.net.cn/news/jy_01.htm 上海至扬州货运http://www.nanjingzhuanxian.cn/news/yz_01.htm 上海到常州货运公司http://www.nanjing56.net.cn/zhuanxianeight.htm 上海至江阴货运http://www.nanjingzhuanxian.cn/news/jy_01.htm 上海到义乌货运公司http://www.57156.net.cn 上海到常州货运公司http://www.nanjingzhuanxian.cn/news/cz_01.htm web260x华宜物流公司

chinaunix网友2010-06-29 17:10:09

设备木箱包装http://www.jiaoyib2c.com.cn/ 木箱包装http://www.jiaoyib2c.com.cn/ 木箱包装订做http://www.jiaoyib2c.com.cn/ 包装托运 http://www.jiaoyib2c.com.cn/ 上海包装箱http://www.jiaoyib2c.cn/ 出口包装箱http://www.jiaoyib2c.cn/ 木箱包装http://www.jiaoyib2c.cn/ 免熏蒸木箱包装http://www.jiaoyib2c.cn/ 木盘http://www.jiaoyib2b.com.cn/ 铁木盘http://www.jiaoyib2b.com.cn/ 电缆线木盘http://www.jiaoyib2b.com.cn/web260x华宜物流公司