From 33eadad139136bce7f8c9fe4f152f8576aa7e69b Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 10 Aug 2015 13:00:15 +0800 Subject: [PATCH] popContextMenu => popUpContextMenu --- atom/browser/api/atom_api_tray.cc | 6 +++--- atom/browser/api/atom_api_tray.h | 2 +- atom/browser/api/lib/tray.coffee | 4 ++++ atom/browser/ui/tray_icon.cc | 2 +- atom/browser/ui/tray_icon.h | 2 +- atom/browser/ui/tray_icon_cocoa.h | 2 +- atom/browser/ui/tray_icon_cocoa.mm | 6 +++--- atom/browser/ui/win/notify_icon.cc | 4 ++-- atom/browser/ui/win/notify_icon.h | 2 +- docs/api/tray.md | 4 ++-- 10 files changed, 19 insertions(+), 15 deletions(-) diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 0f07737da2bf..1382f015a63b 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -120,10 +120,10 @@ void Tray::DisplayBalloon(mate::Arguments* args, tray_icon_->DisplayBalloon(icon, title, content); } -void Tray::PopContextMenu(mate::Arguments* args) { +void Tray::PopUpContextMenu(mate::Arguments* args) { gfx::Point pos; args->GetNext(&pos); - tray_icon_->PopContextMenu(pos); + tray_icon_->PopUpContextMenu(pos); } void Tray::SetContextMenu(mate::Arguments* args, Menu* menu) { @@ -151,7 +151,7 @@ void Tray::BuildPrototype(v8::Isolate* isolate, .SetMethod("setTitle", &Tray::SetTitle) .SetMethod("setHighlightMode", &Tray::SetHighlightMode) .SetMethod("displayBalloon", &Tray::DisplayBalloon) - .SetMethod("popContextMenu", &Tray::PopContextMenu) + .SetMethod("popUpContextMenu", &Tray::PopUpContextMenu) .SetMethod("_setContextMenu", &Tray::SetContextMenu); } diff --git a/atom/browser/api/atom_api_tray.h b/atom/browser/api/atom_api_tray.h index 02f7418fe41d..dc9302597cf3 100644 --- a/atom/browser/api/atom_api_tray.h +++ b/atom/browser/api/atom_api_tray.h @@ -60,7 +60,7 @@ class Tray : public mate::EventEmitter, void SetTitle(mate::Arguments* args, const std::string& title); void SetHighlightMode(mate::Arguments* args, bool highlight); void DisplayBalloon(mate::Arguments* args, const mate::Dictionary& options); - void PopContextMenu(mate::Arguments* args); + void PopUpContextMenu(mate::Arguments* args); void SetContextMenu(mate::Arguments* args, Menu* menu); private: diff --git a/atom/browser/api/lib/tray.coffee b/atom/browser/api/lib/tray.coffee index 7d158a9a0104..1c225ddd403c 100644 --- a/atom/browser/api/lib/tray.coffee +++ b/atom/browser/api/lib/tray.coffee @@ -3,8 +3,12 @@ bindings = process.atomBinding 'tray' Tray = bindings.Tray Tray::__proto__ = EventEmitter.prototype + Tray::setContextMenu = (menu) -> @_setContextMenu menu @menu = menu # Keep a strong reference of menu. +# Keep compatibility with old APIs. +Tray::popContextMenu = Tray::popUpContextMenu + module.exports = Tray diff --git a/atom/browser/ui/tray_icon.cc b/atom/browser/ui/tray_icon.cc index cc19be6d8d86..12c6be2ea74e 100644 --- a/atom/browser/ui/tray_icon.cc +++ b/atom/browser/ui/tray_icon.cc @@ -26,7 +26,7 @@ void TrayIcon::DisplayBalloon(const gfx::Image& icon, const base::string16& contents) { } -void TrayIcon::PopContextMenu(const gfx::Point& pos) { +void TrayIcon::PopUpContextMenu(const gfx::Point& pos) { } void TrayIcon::NotifyClicked(const gfx::Rect& bounds, int modifiers) { diff --git a/atom/browser/ui/tray_icon.h b/atom/browser/ui/tray_icon.h index 6d917a53467c..55f1c41d19d7 100644 --- a/atom/browser/ui/tray_icon.h +++ b/atom/browser/ui/tray_icon.h @@ -47,7 +47,7 @@ class TrayIcon { const base::string16& title, const base::string16& contents); - virtual void PopContextMenu(const gfx::Point& pos); + virtual void PopUpContextMenu(const gfx::Point& pos); // Set the context menu for this icon. virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) = 0; diff --git a/atom/browser/ui/tray_icon_cocoa.h b/atom/browser/ui/tray_icon_cocoa.h index db53adcbe85d..7781c93a1c03 100644 --- a/atom/browser/ui/tray_icon_cocoa.h +++ b/atom/browser/ui/tray_icon_cocoa.h @@ -29,7 +29,7 @@ class TrayIconCocoa : public TrayIcon, void SetToolTip(const std::string& tool_tip) override; void SetTitle(const std::string& title) override; void SetHighlightMode(bool highlight) override; - void PopContextMenu(const gfx::Point& pos) override; + void PopUpContextMenu(const gfx::Point& pos) override; void SetContextMenu(ui::SimpleMenuModel* menu_model) override; protected: diff --git a/atom/browser/ui/tray_icon_cocoa.mm b/atom/browser/ui/tray_icon_cocoa.mm index 7c2214e06399..d69fa8636b4f 100644 --- a/atom/browser/ui/tray_icon_cocoa.mm +++ b/atom/browser/ui/tray_icon_cocoa.mm @@ -230,7 +230,7 @@ const CGFloat kVerticalTitleMargin = 2; [self setNeedsDisplay:YES]; } -- (void)popContextMenu { +- (void)popUpContextMenu { if (menuController_ && ![menuController_ isMenuOpen]) { // Redraw the dray icon to show highlight if it is enabled. [self setNeedsDisplay:YES]; @@ -316,8 +316,8 @@ void TrayIconCocoa::SetHighlightMode(bool highlight) { [status_item_view_ setHighlight:highlight]; } -void TrayIconCocoa::PopContextMenu(const gfx::Point& pos) { - [status_item_view_ popContextMenu]; +void TrayIconCocoa::PopUpContextMenu(const gfx::Point& pos) { + [status_item_view_ popUpContextMenu]; } void TrayIconCocoa::SetContextMenu(ui::SimpleMenuModel* menu_model) { diff --git a/atom/browser/ui/win/notify_icon.cc b/atom/browser/ui/win/notify_icon.cc index ebc958384363..c4c0fe9141e3 100644 --- a/atom/browser/ui/win/notify_icon.cc +++ b/atom/browser/ui/win/notify_icon.cc @@ -87,7 +87,7 @@ void NotifyIcon::HandleClickEvent(const gfx::Point& cursor_pos, return; } else if (!double_button_click) { // single right click if (menu_model_) - PopContextMenu(cursor_pos); + PopUpContextMenu(cursor_pos); else NotifyRightClicked(gfx::Rect(rect), modifiers); } @@ -163,7 +163,7 @@ void NotifyIcon::DisplayBalloon(const gfx::Image& icon, LOG(WARNING) << "Unable to create status tray balloon."; } -void NotifyIcon::PopContextMenu(const gfx::Point& pos) { +void NotifyIcon::PopUpContextMenu(const gfx::Point& pos) { // Returns if context menu isn't set. if (!menu_model_) return; diff --git a/atom/browser/ui/win/notify_icon.h b/atom/browser/ui/win/notify_icon.h index a28a00ff0d6a..136186b689b9 100644 --- a/atom/browser/ui/win/notify_icon.h +++ b/atom/browser/ui/win/notify_icon.h @@ -52,7 +52,7 @@ class NotifyIcon : public TrayIcon { void DisplayBalloon(const gfx::Image& icon, const base::string16& title, const base::string16& contents) override; - void PopContextMenu(const gfx::Point& pos) override; + void PopUpContextMenu(const gfx::Point& pos) override; void SetContextMenu(ui::SimpleMenuModel* menu_model) override; private: diff --git a/docs/api/tray.md b/docs/api/tray.md index 3d3ebc280f5a..a67772746128 100644 --- a/docs/api/tray.md +++ b/docs/api/tray.md @@ -60,7 +60,7 @@ Creates a new tray icon associated with the `image`. Emitted when the tray icon is clicked. -__Note:__ The `bounds` payload is only implemented on OS X and Windows 7 or newer. +__Note:__ The `bounds` payload is only implemented on OS X and Windows. ### Event: 'right-clicked' @@ -173,7 +173,7 @@ Displays a tray balloon. __Note:__ This is only implemented on Windows. -### Tray.popContextMenu([position]) +### Tray.popUpContextMenu([position]) * `position` Object - The pop position * `x` Integer