clide/qml/ClideMenuBar.qml

191 lines
3.6 KiB
QML
Raw Normal View History

2026-01-31 08:02:16 -05:00
// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
2025-03-29 08:01:13 -04:00
import QtQuick
import QtQuick.Controls
2026-01-25 20:57:36 +00:00
import clide.module 1.0
2025-03-29 08:01:13 -04:00
MenuBar {
2026-01-25 20:57:36 +00:00
// Base settings for each Menu.
component ClideMenu : Menu {
background: Rectangle {
color: RustColors.menubar
implicitWidth: 100
radius: 2
}
}
// Base settings for each MenuItem.
component ClideMenuItem : MenuItem {
id: root
background: Rectangle {
color: root.hovered ? RustColors.hovered : RustColors.unhovered
radius: 2.5
}
contentItem: IconLabel {
color: "black"
font.family: "Helvetica"
text: root.text
}
}
// Background for this MenuBar.
2025-03-29 08:01:13 -04:00
background: Rectangle {
2026-01-25 20:57:36 +00:00
color: RustColors.menubar
border.color: RustColors.menubar_border
2025-03-29 08:01:13 -04:00
}
2026-01-25 20:57:36 +00:00
//
// File Menu
2025-03-29 08:01:13 -04:00
Action {
id: actionNewProject
text: qsTr("&New Project...")
}
Action {
id: actionOpen
text: qsTr("&Open...")
}
Action {
id: actionSave
text: qsTr("&Save")
}
Action {
id: actionExit
text: qsTr("&Exit")
2026-01-25 20:57:36 +00:00
2025-03-29 08:01:13 -04:00
onTriggered: Qt.quit()
}
ClideMenu {
title: qsTr("&File")
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionNewProject
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionOpen
2026-01-25 20:57:36 +00:00
onTriggered: FileSystem.setDirectory(FileSystem.filePath)
2025-03-29 08:01:13 -04:00
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionSave
}
MenuSeparator {
background: Rectangle {
border.color: color
2026-01-25 20:57:36 +00:00
color: RustColors.menubar_border
2025-03-29 08:01:13 -04:00
implicitHeight: 3
implicitWidth: 200
}
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionExit
}
}
2026-01-25 20:57:36 +00:00
//
// Edit Menu
2025-03-29 08:01:13 -04:00
Action {
id: actionUndo
text: qsTr("&Undo")
}
Action {
id: actionRedo
text: qsTr("&Redo")
}
Action {
id: actionCut
text: qsTr("&Cut")
}
Action {
id: actionCopy
text: qsTr("&Copy")
}
Action {
id: actionPaste
text: qsTr("&Paste")
}
ClideMenu {
title: qsTr("&Edit")
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionUndo
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionRedo
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionCut
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionCopy
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionPaste
}
}
2026-01-25 20:57:36 +00:00
//
// View Menu
2025-03-29 08:01:13 -04:00
Action {
id: actionToolWindows
text: qsTr("&Tool Windows")
}
Action {
id: actionAppearance
text: qsTr("&Appearance")
}
ClideMenu {
title: qsTr("&View")
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionToolWindows
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionAppearance
}
}
2026-01-25 20:57:36 +00:00
//
// Help Menu
ClideAboutWindow {
id: clideAbout
}
2025-03-29 08:01:13 -04:00
Action {
id: actionDocumentation
text: qsTr("&Documentation")
}
Action {
id: actionAbout
2026-01-25 20:57:36 +00:00
// Toggle the about window with the menu item is clicked.
onTriggered: clideAbout.visible = !clideAbout.visible
2025-03-29 08:01:13 -04:00
text: qsTr("&About")
}
ClideMenu {
title: qsTr("&Help")
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionDocumentation
}
2026-01-25 20:57:36 +00:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionAbout
}
}
}