No more need to override Menu::Popup
This commit is contained in:
parent
0e3a3d0748
commit
ca77c95c6d
6 changed files with 5 additions and 11 deletions
|
@ -69,6 +69,10 @@ void Menu::MenuWillShow(ui::SimpleMenuModel* source) {
|
||||||
menu_will_show_.Run();
|
menu_will_show_.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Menu::Popup(Window* window) {
|
||||||
|
PopupAt(window);
|
||||||
|
}
|
||||||
|
|
||||||
void Menu::InsertItemAt(
|
void Menu::InsertItemAt(
|
||||||
int index, int command_id, const base::string16& label) {
|
int index, int command_id, const base::string16& label) {
|
||||||
model_->InsertItemAt(index, command_id, label);
|
model_->InsertItemAt(index, command_id, label);
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Menu : public mate::TrackableObject<Menu>,
|
||||||
void ExecuteCommand(int command_id, int event_flags) override;
|
void ExecuteCommand(int command_id, int event_flags) override;
|
||||||
void MenuWillShow(ui::SimpleMenuModel* source) override;
|
void MenuWillShow(ui::SimpleMenuModel* source) override;
|
||||||
|
|
||||||
virtual void Popup(Window* window) = 0;
|
void Popup(Window* window);
|
||||||
virtual void PopupAt(Window* window,
|
virtual void PopupAt(Window* window,
|
||||||
int x = -1, int y = -1,
|
int x = -1, int y = -1,
|
||||||
int positioning_item = 0) = 0;
|
int positioning_item = 0) = 0;
|
||||||
|
|
|
@ -19,7 +19,6 @@ class MenuMac : public Menu {
|
||||||
protected:
|
protected:
|
||||||
MenuMac();
|
MenuMac();
|
||||||
|
|
||||||
void Popup(Window* window) override;
|
|
||||||
void PopupAt(Window* window, int x, int y, int positioning_item = 0) override;
|
void PopupAt(Window* window, int x, int y, int positioning_item = 0) override;
|
||||||
|
|
||||||
base::scoped_nsobject<AtomMenuController> menu_controller_;
|
base::scoped_nsobject<AtomMenuController> menu_controller_;
|
||||||
|
|
|
@ -18,10 +18,6 @@ namespace api {
|
||||||
MenuMac::MenuMac() {
|
MenuMac::MenuMac() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuMac::Popup(Window* window) {
|
|
||||||
PopupAt(window, -1, -1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuMac::PopupAt(Window* window, int x, int y, int positioning_item) {
|
void MenuMac::PopupAt(Window* window, int x, int y, int positioning_item) {
|
||||||
NativeWindow* native_window = window->window();
|
NativeWindow* native_window = window->window();
|
||||||
if (!native_window)
|
if (!native_window)
|
||||||
|
|
|
@ -16,10 +16,6 @@ namespace api {
|
||||||
MenuViews::MenuViews() {
|
MenuViews::MenuViews() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuViews::Popup(Window* window) {
|
|
||||||
PopupAt(window, -1, -1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
|
void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
|
||||||
NativeWindow* native_window = static_cast<NativeWindow*>(window->window());
|
NativeWindow* native_window = static_cast<NativeWindow*>(window->window());
|
||||||
if (!native_window)
|
if (!native_window)
|
||||||
|
|
|
@ -17,7 +17,6 @@ class MenuViews : public Menu {
|
||||||
MenuViews();
|
MenuViews();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Popup(Window* window) override;
|
|
||||||
void PopupAt(Window* window, int x, int y, int positioning_item = 0) override;
|
void PopupAt(Window* window, int x, int y, int positioning_item = 0) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue