API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

IMENUCTL_ADDITEM()

Brew Release
Brew MP 1.0.2
See Also
IMenuCtl IMENUCTL_DeleteItem IMENUCTL_GetItemData IMENUCTL_Redraw IMENUCTL_SetActive
Description
This function adds a new menu item to a menu. The text string identifying the menu 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 item name.

  • If pText is NULL, the function reads the string corresponding to the given resource
  • identifier, wResID, from the resource file and sets it as the item name.

  • If the text string and the resource information are invalid, this function fails.

  • If the text 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
  • item name.

  • If the object identified by IMenuCtl Interface is a soft key menu, this function
  • also determines the extent of the new items in x-axis and the maximum number of
  • items that can be displayed on the soft key bar.

Use the lData to store a double-word data value associated with the menu item to be created. Use IMENUCTL_GetItemData() to get back the parameter value.
Params
pIMenuCtl
[]:
pointer to the IMenuCtl interface object.
pszResFile
[]:
a NULL-terminated string that contains the resource file name.
wResID
[]:
resource identifier that identifies a text string resource.
nItemID
[]:
item identifier that uniquely identifies a menu item.
pText
[]:
a NULL-terminated string that contains the menu item name.
lData
[]:
item data associated with the menu item.
Interface
  • IMENUCTL
Prototype
  •   boolean IMENUCTL_AddItem
      (
        IMenuCtl * pIMenuCtl,
        const char * pszResFile,
        uint16 wResID,
        uint16 nItemID,
        AECHAR * pText,
        uint32 lData
      );
    
Return
  • TRUE: if successful. FALSE: if unsuccessful.
Side Effect
  • When a device user activates the newly added menu item, nItemID and lData values are sent to the applet event handling the function in the short-data and long-data fields, respectively.
Comments
This function does not automatically update the screen. For the new menu item to take effect on the device screen, use IMENUCTL_Redraw(). If the menu is to be activated subsequent to adding menu items, you don’t need to use IMENUCTL_Redraw() because IMENUCTL_SetActive() updates the screen with the new menu items. Use IMENUCTL_DeleteItem() to remove an item from the menu. Its preferable that control rect and properties are set before adding items.