]> khamidou — GitHub mirrors - electron.git/commitdiff
Add JS menubar APIs
authorCheng Zhao <zcbenz@gmail.com>
Wed, 12 Nov 2014 12:31:55 +0000 (20:31 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 12 Nov 2014 12:31:55 +0000 (20:31 +0800)
atom/browser/api/atom_api_window.cc
atom/browser/api/atom_api_window.h

index 1f4a4bbe6ce4d38a6ff4afbd10f97515873c7ede..49ba2c8df7b2ad814fbb271d76a65258e008a27e 100644 (file)
@@ -378,6 +378,22 @@ void Window::SetProgressBar(double progress) {
   window_->SetProgressBar(progress);
 }
 
+void Window::SetAutoHideMenuBar(bool auto_hide) {
+  window_->SetAutoHideMenuBar(auto_hide);
+}
+
+bool Window::IsMenuBarAutoHide() {
+  return window_->IsMenuBarAutoHide();
+}
+
+void Window::SetMenuBarVisibility(bool visible) {
+  window_->SetMenuBarVisibility(visible);
+}
+
+bool Window::IsMenuBarVisible() {
+  return window_->IsMenuBarVisible();
+}
+
 mate::Handle<WebContents> Window::GetWebContents(v8::Isolate* isolate) const {
   return WebContents::CreateFrom(isolate, window_->GetWebContents());
 }
@@ -443,6 +459,10 @@ void Window::BuildPrototype(v8::Isolate* isolate,
       .SetMethod("capturePage", &Window::CapturePage)
       .SetMethod("print", &Window::Print)
       .SetMethod("setProgressBar", &Window::SetProgressBar)
+      .SetMethod("setAutoHideMenuBar", &Window::SetAutoHideMenuBar)
+      .SetMethod("isMenuBarAutoHide", &Window::IsMenuBarAutoHide)
+      .SetMethod("setMenuBarVisibility", &Window::SetMenuBarVisibility)
+      .SetMethod("isMenuBarVisible", &Window::IsMenuBarVisible)
       .SetMethod("_getWebContents", &Window::GetWebContents)
       .SetMethod("_getDevToolsWebContents", &Window::GetDevToolsWebContents);
 }
index 905559a8c35f74f6c52e1fe5f5fc4c4823ba4b84..370634f13105af4930f11741aa2b535754ba3acb 100644 (file)
@@ -111,6 +111,10 @@ class Window : public mate::EventEmitter,
   void CapturePage(mate::Arguments* args);
   void Print(mate::Arguments* args);
   void SetProgressBar(double progress);
+  void SetAutoHideMenuBar(bool auto_hide);
+  bool IsMenuBarAutoHide();
+  void SetMenuBarVisibility(bool visible);
+  bool IsMenuBarVisible();
 
   // APIs for WebContents.
   mate::Handle<WebContents> GetWebContents(v8::Isolate* isolate) const;