Skip to content

Commit

Permalink
feat: add window removeMenu() method
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jan 28, 2019
1 parent d105dcc commit 258b63f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions atom/browser/api/atom_api_top_level_window.cc
Expand Up @@ -659,6 +659,13 @@ void TopLevelWindow::SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> value) {
}
}

void TopLevelWindow::RemoveMenu() {
mate::Handle<Menu> menu;

menu_.Reset();
window_->SetMenu(nullptr);
}

void TopLevelWindow::SetParentWindow(v8::Local<v8::Value> value,
mate::Arguments* args) {
if (IsModal()) {
Expand Down Expand Up @@ -1103,6 +1110,7 @@ void TopLevelWindow::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setContentProtection", &TopLevelWindow::SetContentProtection)
.SetMethod("setFocusable", &TopLevelWindow::SetFocusable)
.SetMethod("setMenu", &TopLevelWindow::SetMenu)
.SetMethod("removeMenu", &TopLevelWindow::RemoveMenu)
.SetMethod("setParentWindow", &TopLevelWindow::SetParentWindow)
.SetMethod("setBrowserView", &TopLevelWindow::SetBrowserView)
.SetMethod("addBrowserView", &TopLevelWindow::AddBrowserView)
Expand Down
1 change: 1 addition & 0 deletions atom/browser/api/atom_api_top_level_window.h
Expand Up @@ -165,6 +165,7 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
void SetContentProtection(bool enable);
void SetFocusable(bool focusable);
void SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> menu);
void RemoveMenu();
void SetParentWindow(v8::Local<v8::Value> value, mate::Arguments* args);
virtual void SetBrowserView(v8::Local<v8::Value> value);
virtual void AddBrowserView(v8::Local<v8::Value> value);
Expand Down
7 changes: 5 additions & 2 deletions docs/api/browser-window.md
Expand Up @@ -1308,8 +1308,11 @@ Same as `webContents.reload`.

* `menu` Menu | null

Sets the `menu` as the window's menu bar, setting it to `null` will remove the
menu bar.
Sets the `menu` as the window's menu bar, setting it to `null` will remove the menu bar.

#### `win.removeMenu()` _Linux_ _Windows_

Remove the window's menu bar.

#### `win.setProgressBar(progress[, options])`

Expand Down

0 comments on commit 258b63f

Please sign in to comment.