aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-07-08 12:50:13 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-07-08 12:50:13 +0200
commit45b96e1b4b75954ff4092103f42282ce23956a94 (patch)
tree007c227bf224f60ae1b9aa87d82973c0d7bb8751 /lib
parent22d4c1670b7e885cb5a4cfca2179ca82cec72588 (diff)
downloadsynthpod-45b96e1b4b75954ff4092103f42282ce23956a94.tar.xz
prototype menu.
Diffstat (limited to 'lib')
-rw-r--r--lib/synthpod_ui.c83
1 files changed, 80 insertions, 3 deletions
diff --git a/lib/synthpod_ui.c b/lib/synthpod_ui.c
index c227f3ce..a9f12a32 100644
--- a/lib/synthpod_ui.c
+++ b/lib/synthpod_ui.c
@@ -263,6 +263,8 @@ struct _sp_ui_t {
Evas_Object *win;
Evas_Object *table;
Evas_Object *popup;
+ Evas_Object *mainmenu;
+ Evas_Object *statusline;
int colors_max;
@@ -4108,6 +4110,51 @@ _plugentry_changed(void *data, Evas_Object *obj, void *event_info)
free(match);
}
+static void
+_menu_open(void *data, Evas_Object *obj, void *event_info)
+{
+ sp_ui_t *ui = data;
+
+ const char *bundle_path = NULL; //TODO
+ if(bundle_path)
+ sp_ui_bundle_load(ui, bundle_path);
+}
+
+static void
+_menu_save(void *data, Evas_Object *obj, void *event_info)
+{
+ sp_ui_t *ui = data;
+
+ const char *bundle_path = NULL; //TODO
+ if(bundle_path)
+ sp_ui_bundle_save(ui, bundle_path);
+}
+
+static void
+_menu_about(void *data, Evas_Object *obj, void *event_info)
+{
+ sp_ui_t *ui = data;
+
+ elm_popup_timeout_set(ui->popup, 0.f);
+ if(evas_object_visible_get(ui->popup))
+ evas_object_hide(ui->popup);
+ else
+ evas_object_show(ui->popup);
+}
+
+static void
+_menu_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ sp_ui_t *ui = data;
+ Evas_Event_Mouse_Down *ev = event_info;
+
+ if(ev->button == 3)
+ {
+ elm_menu_move(ui->mainmenu, ev->output.x, ev->output.y);
+ evas_object_show(ui->mainmenu);
+ }
+}
+
sp_ui_t *
sp_ui_new(Evas_Object *win, const LilvWorld *world, sp_ui_driver_t *driver,
void *data, int show_splash)
@@ -4285,6 +4332,25 @@ sp_ui_new(Evas_Object *win, const LilvWorld *world, sp_ui_driver_t *driver,
_theme_resize(ui, NULL, ui->win, NULL);
evas_object_event_callback_add(ui->win, EVAS_CALLBACK_RESIZE, _theme_resize, ui);
+
+ ui->mainmenu = elm_menu_add(ui->table);
+ //ui->mainmenu = elm_win_main_menu_get(ui->win);
+ if(ui->mainmenu)
+ {
+ //TODO use
+ Elm_Object_Item *itm;
+ itm = elm_menu_item_add(ui->mainmenu, NULL, "document-open", "Load",
+ _menu_open, ui);
+ itm = elm_menu_item_add(ui->mainmenu, NULL, "document-save", "Save",
+ _menu_save, ui);
+
+ elm_menu_item_separator_add(ui->mainmenu, NULL);
+ itm = elm_menu_item_add(ui->mainmenu, NULL, "help-about", "About",
+ _menu_about, ui);
+
+ evas_object_event_callback_add(ui->table, EVAS_CALLBACK_MOUSE_DOWN,
+ _menu_show, ui);
+ } // mainmenu
ui->mainpane = elm_panes_add(ui->table);
if(ui->mainpane)
@@ -4294,9 +4360,7 @@ sp_ui_new(Evas_Object *win, const LilvWorld *world, sp_ui_driver_t *driver,
evas_object_size_hint_weight_set(ui->mainpane, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ui->mainpane, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(ui->mainpane);
- elm_table_pack(ui->table, ui->mainpane, 0, 0, 1, 1); //TODO
-
- //TODO add status bar + info button
+ elm_table_pack(ui->table, ui->mainpane, 0, 1, 1, 1);
ui->popup = elm_popup_add(ui->table);
if(ui->popup)
@@ -4478,6 +4542,19 @@ sp_ui_new(Evas_Object *win, const LilvWorld *world, sp_ui_driver_t *driver,
elm_object_part_content_set(ui->mainpane, "right", ui->modgrid);
} // modgrid
} // mainpane
+
+ ui->statusline = elm_label_add(ui->table);
+ if(ui->statusline)
+ {
+ //TODO use
+ elm_object_text_set(ui->statusline, "[status]");
+ evas_object_size_hint_weight_set(ui->statusline, EVAS_HINT_EXPAND, 0.f);
+ evas_object_size_hint_align_set(ui->statusline, 0.f, 1.f);
+ evas_object_show(ui->statusline);
+ elm_table_pack(ui->table, ui->statusline, 0, 2, 1, 1);
+ } // statusline
+
+ //TODO add info button
} // theme
// initialzie registry