Hi Iņigo,
Some more tips for getting a quick-start with the menus. You can take a look at ipc.c and menu.c in
xournal.
Most of the ipc.c file can be used as is, only the on_prepare_unmount(), on_changed_orientation() and the on_status_item_activated() need some attention and the xournal specific include files.
The menu.c has separate functions to:
- Create the menu (menu_init())
- Settings the text of the menu items (menu_set_text())
- Showing the menu (menu_show(), called from ipc.c-on_window_activated())
- Handling menu selections (menu_on_item_activated(), called from ipc.c - on_menu_item().
The menu.c file also shows how to get icons from the local program directories.
ipc_menu_add_menu( MENU_MAIN, GROUP_BROWSE, GROUP_ACTIONS, GROUP_FILE); is used to add 3 sub-groups to the MENU_MAIN-menu. If you do not need tree groups you can use a NULL-pointer for the unused menus. The unused ones should be at the end (If I remember well). (Note that an older version of ipc.c is used, I believe that more menu-groups can be added in newer versions.)
ipc_menu_show_menu( MENU_MAIN ); shows the MENU_MAIN-menu.
I did not yet experiment with sub-menu-items, so I can not support on that part.
Hope this gives you a quick-start with the dr-menus,
Marcel.