aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/libraries/winFang.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2015-12-31 15:53:54 +1000
committerDavid Walter Seikel2015-12-31 15:53:54 +1000
commit556eca046775a1e612006bff8ed5ca36c6216c93 (patch)
tree0f0498918dcbcdd9dcea33be9b88e3a9c7d8e3c2 /src/libraries/winFang.c
parentReplace cube and sphere code with Evas_3D primitives. (diff)
downloadSledjHamr-556eca046775a1e612006bff8ed5ca36c6216c93.zip
SledjHamr-556eca046775a1e612006bff8ed5ca36c6216c93.tar.gz
SledjHamr-556eca046775a1e612006bff8ed5ca36c6216c93.tar.bz2
SledjHamr-556eca046775a1e612006bff8ed5ca36c6216c93.tar.xz
Fix menus, with an evil hack.
ELM managed to break the main menu, it never showed, no matter what I did, but the woMan menus worked fine. Refactored both so they use generic functions for building the menu. Put the main menu in it's own window, which mostly works fine. I gotta rip the elm menu system a new one, or just drop it entirely and build my own.
Diffstat (limited to '')
-rw-r--r--src/libraries/winFang.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c
index eac3c37..b99cfdb 100644
--- a/src/libraries/winFang.c
+++ b/src/libraries/winFang.c
@@ -513,3 +513,60 @@ On the other hand, image is all I really need to fake it.
513elm_cnp.h seems to be the only docs, not actually linked to the rest of Elm docs. 513elm_cnp.h seems to be the only docs, not actually linked to the rest of Elm docs.
514 514
515*/ 515*/
516
517
518Evas_Object *makeMainMenu(winFang *win)
519{
520 // A toolbar thingy.
521 return eo_add(ELM_TOOLBAR_CLASS, win->win,
522 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
523 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
524 elm_obj_toolbar_shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU),
525 efl_gfx_position_set(0, 0),
526 elm_obj_toolbar_align_set(0.0)
527 );
528}
529
530static void _on_menu_focus(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
531{
532 evas_object_raise(obj);
533}
534
535Evas_Object *menuAdd(winFang *win, Evas_Object *tb, char *label)
536{
537 Evas_Object *menu= NULL;
538 Elm_Object_Item *tb_it;
539
540 // Evas_Object * obj, const char *icon, const char *label, Evas_Smart_Cb func, const void *data
541 // The function is called when the item is clicked.
542 tb_it = elm_toolbar_item_append(tb, NULL, label, NULL, NULL);
543 // Mark it as a menu.
544 elm_toolbar_item_menu_set(tb_it, EINA_TRUE);
545 // This alledgedly marks it as a menu (not true), and gets an Evas_Object for us to play with.
546 menu = elm_toolbar_item_menu_get(tb_it);
547 // Alas this does not work. B-(
548 evas_object_smart_callback_add(menu, "focused", _on_menu_focus, NULL);
549
550 // Priority is for when toolbar items are set to hide or menu when there are too many of them. They get hidden or put on the menu based on priority.
551 elm_toolbar_item_priority_set(tb_it, 9999);
552
553 // The docs for this functien are meaningless, but it wont work right if you leave it out.
554 elm_toolbar_menu_parent_set(tb, win->win);
555
556 // Add a seperator after, so that there's some visual distinction between menu items.
557 // Coz using all lower case and with no underline on the first letter, it's hard to tell.
558 tb_it = elm_toolbar_item_append(tb, NULL, NULL, NULL, NULL);
559 elm_toolbar_item_separator_set(tb_it, EINA_TRUE);
560
561 return menu;
562}
563
564void makeMainMenuFinish(winFang *win, Evas_Object *tb)
565{
566 // The toolbar needs to be packed into the box AFTER the menus are added.
567 elm_layout_box_append(win->win, WF_BOX, tb);
568 evas_object_show(tb);
569
570 // Bump the menu above the windows.
571 evas_object_raise(tb);
572}