[Win] Implement context menu.
This commit is contained in:
parent
286335c8f9
commit
b2872eaf60
2 changed files with 11 additions and 0 deletions
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include "browser/api/atom_api_menu_win.h"
|
#include "browser/api/atom_api_menu_win.h"
|
||||||
|
|
||||||
|
#include "ui/views/controls/menu/menu_2.h"
|
||||||
|
#include "ui/gfx/point.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
namespace api {
|
namespace api {
|
||||||
|
@ -16,6 +19,8 @@ MenuWin::~MenuWin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuWin::Popup(NativeWindow* native_window) {
|
void MenuWin::Popup(NativeWindow* native_window) {
|
||||||
|
menu_.reset(new views::Menu2(model_.get()));
|
||||||
|
menu_->RunContextMenuAt(gfx::Point(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
|
|
||||||
#include "browser/api/atom_api_menu.h"
|
#include "browser/api/atom_api_menu.h"
|
||||||
|
|
||||||
|
namespace views {
|
||||||
|
class Menu2;
|
||||||
|
}
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
namespace api {
|
namespace api {
|
||||||
|
@ -20,6 +24,8 @@ class MenuWin : public Menu {
|
||||||
virtual void Popup(NativeWindow* window) OVERRIDE;
|
virtual void Popup(NativeWindow* window) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
scoped_ptr<views::Menu2> menu_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MenuWin);
|
DISALLOW_COPY_AND_ASSIGN(MenuWin);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue