aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/base.c7
-rw-r--r--src/ui/root.c25
2 files changed, 31 insertions, 1 deletions
diff --git a/src/ui/base.c b/src/ui/base.c
index d914acf..50e6944 100644
--- a/src/ui/base.c
+++ b/src/ui/base.c
@@ -206,6 +206,13 @@ void ui_init(void)
ui__init_window_dock(maindock);
ui__root_set_content(ui_root, ui__cast(base, maindock));
+ const char *menu_names[] = { "File", "View", "Tools", "Filters", "Help", NULL };
+ for (int i = 0; menu_names[i]; ++i) {
+ struct uimenu_item_menu *menu = malloc(sizeof(struct uimenu_item_menu));
+ uimenu_item_menu_init(menu, menu_names[i]);
+ uimenu_menu_add(ui_root->menu_root, ui_root->menu_root->tail, (struct uimenu_item_header *)menu, true);
+ }
+
for (unsigned i = 0; i < UI__WINDOW_DOCK_MAX; ++i)
{
if (i == UI__WINDOW_DOCK_LEFT) continue;
diff --git a/src/ui/root.c b/src/ui/root.c
index c3f7468..3877359 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -1,5 +1,6 @@
#include "ui.internal.h"
#include "macros.h"
+#include "ui/uimenu.internal.h"
#include <curses.h>
#define UI__ROOT_MIN_Y (24)
@@ -72,7 +73,29 @@ void ui__root_draw_menu(struct ui_window_root *root)
WINDOW *mywin = root->super.cwindow;
attron(A_REVERSE);
mvwhline(mywin, 0, 0, ' ', getmaxx(mywin));
- mvwaddstr(mywin, 0, 0, " UMPS v0.1.0-dev File Edit Filters Window Help");
+ mvwaddstr(mywin, 0, 0, " UMPS v0.1.0-dev");
+
+ char *text;
+ for (struct uimenu_item_header *item = root->menu_root->head; item; item = item->next) {
+ waddstr(mywin, " ");
+ switch (item->type) {
+ case UMPS__MENU_TYPE_SPACER:
+ waddstr(mywin, "--");
+ continue;
+ case UMPS__MENU_TYPE_BUTTON:
+ text = ((struct uimenu_item_button *)item)->text;
+ break;
+ case UMPS__MENU_TYPE_MENU:
+ text = ((struct uimenu_item_menu *)item)->text;
+ break;
+ default:
+ umps_trap;
+ }
+
+ if (text) waddstr(mywin, text);
+ else waddstr(mywin, "???");
+ }
+
attroff(A_REVERSE);
}