win: Add BrowserWindow.setMenu API.
This commit is contained in:
parent
2024ae5dba
commit
5a6ff0f80d
7 changed files with 54 additions and 1 deletions
|
@ -4,7 +4,9 @@
|
|||
|
||||
#include "browser/api/atom_api_menu_win.h"
|
||||
|
||||
#include "browser/native_window_win.h"
|
||||
#include "browser/ui/win/menu_2.h"
|
||||
#include "common/v8_conversions.h"
|
||||
#include "ui/gfx/point.h"
|
||||
|
||||
namespace atom {
|
||||
|
@ -23,6 +25,23 @@ void MenuWin::Popup(NativeWindow* native_window) {
|
|||
menu_->RunContextMenuAt(gfx::Point(0, 0));
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> Menu::AttachToWindow(const v8::Arguments& args) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
Menu* self = ObjectWrap::Unwrap<Menu>(args.This());
|
||||
if (self == NULL)
|
||||
return node::ThrowError("Menu is already destroyed");
|
||||
|
||||
NativeWindow* native_window;
|
||||
if (!FromV8Arguments(args, &native_window))
|
||||
return node::ThrowTypeError("Bad argument");
|
||||
|
||||
static_cast<NativeWindowWin*>(native_window)->SetMenu(self->model_.get());
|
||||
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
Menu* Menu::Create(v8::Handle<v8::Object> wrapper) {
|
||||
return new MenuWin(wrapper);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue