clide/qml/ClideMenuBar.qml

186 lines
3.4 KiB
QML
Raw Normal View History

2025-03-29 08:01:13 -04:00
import QtQuick
import QtQuick.Controls
2025-03-30 11:20:21 -04:00
import clide.module 1.0
2025-03-29 08:01:13 -04:00
MenuBar {
2025-03-30 11:47:16 -04: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 {
2025-03-30 11:20:21 -04:00
color: RustColors.menubar
border.color: RustColors.menubar_border
2025-03-29 08:01:13 -04:00
}
2025-03-30 11:47:16 -04: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")
2025-03-29 08:01:13 -04:00
onTriggered: Qt.quit()
}
ClideMenu {
title: qsTr("&File")
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionNewProject
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionOpen
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionSave
}
MenuSeparator {
background: Rectangle {
border.color: color
2025-03-30 11:20:21 -04:00
color: RustColors.menubar_border
2025-03-29 08:01:13 -04:00
implicitHeight: 3
implicitWidth: 200
}
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionExit
}
}
2025-03-30 11:47:16 -04: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")
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionUndo
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionRedo
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionCut
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionCopy
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionPaste
}
}
2025-03-30 11:47:16 -04: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")
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionToolWindows
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionAppearance
}
}
2025-03-30 11:47:16 -04:00
//
// Help Menu
2025-03-30 12:52:44 -04:00
ClideAboutWindow {
id: clideAbout
}
2025-03-29 08:01:13 -04:00
Action {
id: actionDocumentation
text: qsTr("&Documentation")
}
Action {
id: actionAbout
2025-03-30 12:52:44 -04: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")
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionDocumentation
}
2025-03-30 11:47:16 -04:00
ClideMenuItem {
2025-03-29 08:01:13 -04:00
action: actionAbout
}
}
}