From 287a3423ba0a7120f968b35c792915b50ff0ce28 Mon Sep 17 00:00:00 2001 From: accusys Date: Sun, 29 Mar 2026 16:24:38 +0800 Subject: [PATCH] Add interactive menu bar (File, Controller, Tools, Help) with clickable items --- ui/main_window.slint | 93 ++++++++++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 24 deletions(-) diff --git a/ui/main_window.slint b/ui/main_window.slint index 9898461..e1336ed 100644 --- a/ui/main_window.slint +++ b/ui/main_window.slint @@ -1,6 +1,5 @@ // RAIDGuard X - Complete GUI Recreation // Mimics Java Swing frmMain.java appearance -// Based on Java frmMain.java structure (765x700, toolbar 750x65) export component AppWindow inherits Window { title: "RAIDGuard X - DTR RAID Admin"; @@ -15,6 +14,12 @@ export component AppWindow inherits Window { callback menu_exit(); callback menu_add_controller(); + // Menu bar properties for callbacks + in-out property menu_file_open: false; + in-out property menu_ctrl_open: false; + in-out property menu_tools_open: false; + in-out property menu_help_open: false; + in-out property connected: false; in-out property is_loading: false; in-out property status_text: "Disconnected"; @@ -100,35 +105,75 @@ export component AppWindow inherits Window { VerticalLayout { spacing: 0; - // Menu Bar - matches Java Swing JMenuBar (height 21) + // Menu Bar - matches Java Swing JMenuBar Rectangle { - height: 21px; + height: 22px; background: #d4d0c8; HorizontalLayout { - padding: 2px; - spacing: 4px; - Text { - text: "File"; - font_size: 12px; - color: #000000; + spacing: 0; + + // File menu + Rectangle { + width: 55px; + height: 22px; + background: menu_file_open ? #c0c0c0 : #d4d0c8; + Text { + text: "File"; + font_size: 12px; + horizontal-alignment: center; + vertical-alignment: center; + } + TouchArea { + clicked => { menu_file_open = !menu_file_open; } + } } - Text { width: 16px; } - Text { - text: "Controller"; - font_size: 12px; - color: #000000; + + // Controller menu + Rectangle { + width: 85px; + height: 22px; + background: menu_ctrl_open ? #c0c0c0 : #d4d0c8; + Text { + text: "Controller"; + font_size: 12px; + horizontal-alignment: center; + vertical-alignment: center; + } + TouchArea { + clicked => { menu_ctrl_open = !menu_ctrl_open; } + } } - Text { width: 16px; } - Text { - text: "Tools"; - font_size: 12px; - color: #000000; + + // Tools menu + Rectangle { + width: 55px; + height: 22px; + background: menu_tools_open ? #c0c0c0 : #d4d0c8; + Text { + text: "Tools"; + font_size: 12px; + horizontal-alignment: center; + vertical-alignment: center; + } + TouchArea { + clicked => { menu_tools_open = !menu_tools_open; } + } } - Text { width: 16px; } - Text { - text: "Help"; - font_size: 12px; - color: #000000; + + // Help menu + Rectangle { + width: 55px; + height: 22px; + background: menu_help_open ? #c0c0c0 : #d4d0c8; + Text { + text: "Help"; + font_size: 12px; + horizontal-alignment: center; + vertical-alignment: center; + } + TouchArea { + clicked => { menu_help_open = !menu_help_open; } + } } } }