Tuesday, August 4, 2009


Creating a menu for the native DR-menu is very easy. The code in hello-world is using the helper functions in ipc.c, which I would also advice to use. The process of making menu-groups and items is split in two part in hello-world, this to allow easy internationalisation of the menu. In the first pass, menu_init(), the menu is created and every item gets its name and icon. In the second pass menu_set_text(), the 'correct' labels will be set. The 2nd function can now easily be called when the user changes the language to use. (More on internationalisation later.)
In version R1.5 the firmware had a problem with adding icons, only the icons available in the system could be used. In R1.6 it is allowed to use a full path.
You have to make sure that the correct bitmaps for your menu and the toolbar are available. You need up to 6 bitmaps:
- the orginal bitmap, lets call it icon.png
- a 'bold' version if you want to support state for the menu item (i.e. does it represent something that can be on and off). The icon should be called icon_selected.png.
- a grayed-out value of the icon, if you want to be able to disable the menu. This icon should be called icon_disabled.png.
And three icons for the toolbar called:
- toolbar_icon.png
- toobar_icon_selected.png and
- toolbar_icon_disabled.png.

When creating the menu, you only give the path and name for the first bitmap, the other names will be created by the firmware when needed.

No comments:

Post a Comment