win: Remove dead menu code.
This commit is contained in:
parent
73df08ebbf
commit
365638f1d5
9 changed files with 1 additions and 1216 deletions
|
@ -250,7 +250,7 @@ void Menu::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("isItemCheckedAt", &Menu::IsItemCheckedAt)
|
||||
.SetMethod("isEnabledAt", &Menu::IsEnabledAt)
|
||||
.SetMethod("isVisibleAt", &Menu::IsVisibleAt)
|
||||
.SetMethod("_attachToWindow", &Menu::AttachToWindow)
|
||||
.SetMethod("attachToWindow", &Menu::AttachToWindow)
|
||||
.SetMethod("_popup", &Menu::Popup);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/api/atom_api_menu_win.h"
|
||||
|
||||
#include "atom/browser/native_window_win.h"
|
||||
#include "atom/browser/ui/win/menu_2.h"
|
||||
#include "ui/gfx/point.h"
|
||||
#include "ui/gfx/screen.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace api {
|
||||
|
||||
MenuWin::MenuWin() : menu_(NULL) {
|
||||
}
|
||||
|
||||
void MenuWin::Popup(Window* window) {
|
||||
gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint();
|
||||
popup_menu_.reset(new atom::Menu2(model_.get()));
|
||||
menu_ = popup_menu_.get();
|
||||
menu_->RunContextMenuAt(cursor);
|
||||
}
|
||||
|
||||
void MenuWin::UpdateStates() {
|
||||
MenuWin* top = this;
|
||||
while (top->parent_)
|
||||
top = static_cast<MenuWin*>(top->parent_);
|
||||
if (top->menu_)
|
||||
top->menu_->UpdateStates();
|
||||
}
|
||||
|
||||
void MenuWin::AttachToWindow(Window* window) {
|
||||
NativeWindowWin* nw = static_cast<NativeWindowWin*>(window->window());
|
||||
nw->SetMenu(model_.get());
|
||||
menu_ = nw->menu();
|
||||
}
|
||||
|
||||
// static
|
||||
mate::Wrappable* Menu::Create() {
|
||||
return new MenuWin();
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace atom
|
|
@ -1,36 +0,0 @@
|
|||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_BROWSER_API_ATOM_API_MENU_WIN_H_
|
||||
#define ATOM_BROWSER_API_ATOM_API_MENU_WIN_H_
|
||||
|
||||
#include "atom/browser/api/atom_api_menu.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
class Menu2;
|
||||
|
||||
namespace api {
|
||||
|
||||
class MenuWin : public Menu {
|
||||
public:
|
||||
MenuWin();
|
||||
|
||||
protected:
|
||||
virtual void Popup(Window* window) OVERRIDE;
|
||||
virtual void UpdateStates() OVERRIDE;
|
||||
virtual void AttachToWindow(Window* window) OVERRIDE;
|
||||
|
||||
private:
|
||||
atom::Menu2* menu_; // Weak ref, could be window menu or popup menu.
|
||||
scoped_ptr<atom::Menu2> popup_menu_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MenuWin);
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_BROWSER_API_ATOM_API_MENU_WIN_H_
|
|
@ -38,14 +38,6 @@ class MenuItem
|
|||
overrideProperty: (name, defaultValue=null) ->
|
||||
this[name] ?= defaultValue
|
||||
|
||||
# Update states when property is changed on Windows.
|
||||
return unless process.platform is 'win32'
|
||||
v8Util.setHiddenValue this, name, this[name]
|
||||
Object.defineProperty this, name,
|
||||
enumerable: true
|
||||
get: => v8Util.getHiddenValue this, name
|
||||
set: (val) => v8Util.setHiddenValue this, name, val
|
||||
|
||||
overrideReadOnlyProperty: (name, defaultValue=null) ->
|
||||
this[name] ?= defaultValue
|
||||
Object.defineProperty this, name,
|
||||
|
|
|
@ -87,10 +87,6 @@ Menu::insert = (pos, item) ->
|
|||
@items.splice pos, 0, item
|
||||
@commandsMap[item.commandId] = item
|
||||
|
||||
Menu::attachToWindow = (window) ->
|
||||
@_callMenuWillShow() if process.platform is 'win32'
|
||||
@_attachToWindow window
|
||||
|
||||
# Force menuWillShow to be called
|
||||
Menu::_callMenuWillShow = ->
|
||||
@delegate?.menuWillShow()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue