From 426e7645bc3c783430a53891a288aed83098ff5b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 14 Feb 2014 13:41:20 +0000 Subject: [PATCH] gtk: Add dummy implementation of Menu. --- atom.gyp | 2 ++ browser/api/atom_api_menu.h | 2 +- browser/api/atom_api_menu_gtk.cc | 32 ++++++++++++++++++++++++++++++++ browser/api/atom_api_menu_gtk.h | 30 ++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 browser/api/atom_api_menu_gtk.cc create mode 100644 browser/api/atom_api_menu_gtk.h diff --git a/atom.gyp b/atom.gyp index 4ff70a69bb..6c795a2581 100644 --- a/atom.gyp +++ b/atom.gyp @@ -51,6 +51,8 @@ 'browser/api/atom_api_event.h', 'browser/api/atom_api_menu.cc', 'browser/api/atom_api_menu.h', + 'browser/api/atom_api_menu_gtk.cc', + 'browser/api/atom_api_menu_gtk.h', 'browser/api/atom_api_menu_mac.h', 'browser/api/atom_api_menu_mac.mm', 'browser/api/atom_api_menu_win.cc', diff --git a/browser/api/atom_api_menu.h b/browser/api/atom_api_menu.h index d642892f57..25f94b8354 100644 --- a/browser/api/atom_api_menu.h +++ b/browser/api/atom_api_menu.h @@ -69,7 +69,7 @@ class Menu : public EventEmitter, static void Popup(const v8::FunctionCallbackInfo& args); -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(TOOLKIT_GTK) static void AttachToWindow(const v8::FunctionCallbackInfo& args); #elif defined(OS_MACOSX) static void SetApplicationMenu( diff --git a/browser/api/atom_api_menu_gtk.cc b/browser/api/atom_api_menu_gtk.cc new file mode 100644 index 0000000000..041c9f282b --- /dev/null +++ b/browser/api/atom_api_menu_gtk.cc @@ -0,0 +1,32 @@ +// Copyright (c) 2014 GitHub, Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "browser/api/atom_api_menu_gtk.h" + +namespace atom { + +namespace api { + +MenuGtk::MenuGtk(v8::Handle wrapper) + : Menu(wrapper) { +} + +MenuGtk::~MenuGtk() { +} + +void MenuGtk::Popup(NativeWindow* native_window) { +} + +// static +void Menu::AttachToWindow(const v8::FunctionCallbackInfo& args) { +} + +// static +Menu* Menu::Create(v8::Handle wrapper) { + return new MenuGtk(wrapper); +} + +} // namespace api + +} // namespace atom diff --git a/browser/api/atom_api_menu_gtk.h b/browser/api/atom_api_menu_gtk.h new file mode 100644 index 0000000000..88e05105a7 --- /dev/null +++ b/browser/api/atom_api_menu_gtk.h @@ -0,0 +1,30 @@ +// Copyright (c) 2014 GitHub, Inc. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_API_ATOM_API_MENU_GTK_H_ +#define ATOM_BROWSER_API_ATOM_API_MENU_GTK_H_ + +#include "browser/api/atom_api_menu.h" + +namespace atom { + +namespace api { + +class MenuGtk : public Menu { + public: + explicit MenuGtk(v8::Handle wrapper); + virtual ~MenuGtk(); + + protected: + virtual void Popup(NativeWindow* window) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(MenuGtk); +}; + +} // namespace api + +} // namespace atom + +#endif // ATOM_BROWSER_API_ATOM_API_MENU_GTK_H_