@@ -5,7 +5,7 @@ order: 300
5
5
6
6
## Configuring the Application Menu
7
7
8
- NativePHP allows you to configure the native menu of your application, as well as context menus and Dock menus, using a
8
+ NativePHP allows you to configure the native menu of your application, as well as context menus, MenuBar and Dock menus, using a
9
9
single, unified and expressive Menu API, available through the ` Menu ` facade. Use this for building all of your app's menus.
10
10
11
11
``` php
@@ -65,27 +65,30 @@ Menu::default();
65
65
66
66
### Recreating the menu
67
67
68
- It's sometimes desirable to update the main application menu in response to changes in your application, making it
69
- contextually sensitive perhaps based on which window currently has focus.
68
+ It's sometimes desirable to update the main application menu with a brand new configuration in response to changes in your
69
+ application, making it contextually sensitive, perhaps based on which window currently has focus.
70
70
71
- You can update your application menu at any time by calling ` Menu::create() ` with your desired menu structure.
71
+ You can update your application menu at any time simply by calling ` Menu::create() ` again with your desired menu structure.
72
+ This might be in an event listener, a controller action or even a Livewire action method.
72
73
73
74
## Predefined menus
74
75
75
76
NativePHP comes with a few predefined menus that you can use out of the box. These are a convenience and, for the most
76
77
part, the only thing that can be changed about them is their label.
77
78
78
- > On macOS, the first item in your application menu will _ always_ use the name of your application as its label.
79
-
80
79
You may change this by passing a string as the first parameter to each method, for example:
81
80
82
81
``` php
83
82
Menu::edit('My Edit Menu')
84
83
```
85
84
86
- > The default menus often enable a number of common keyboard shortcuts, such as those typically used for cut, copy, and
87
- > paste. If you decide to build custom versions of these menus, you will need to explicitly define these shortcuts
88
- > ("hotkeys") yourself.
85
+ ** The default menus enable a number of common keyboard shortcuts ("hotkeys"), such as those typically used for cut,
86
+ copy, and paste. If you decide to build custom versions of these menus, you will need to explicitly define these
87
+ shortcuts yourself.**
88
+
89
+ ** On macOS, the first item in your application menu will _ always_ use the name of your application as its label,
90
+ overriding any custom label you set, regardless of which type of submenu you place first.**
91
+
89
92
90
93
### The App menu
91
94
@@ -98,9 +101,11 @@ Menu::create(
98
101
);
99
102
```
100
103
104
+ ** The app menu is only available for macOS. It is typically used as the first menu in your application's menu.**
105
+
101
106
### The File menu
102
107
103
- You may use the ` Menu::file() ` method to create the default edit menu. This menu contains items and functionality that
108
+ You may use the ` Menu::file() ` method to create the default file menu. This menu contains items and functionality that
104
109
you would expect in a file menu (e.g. Close/Quit).
105
110
106
111
``` php
0 commit comments