tray_icon_->DisplayBalloon(icon, title, content);
}
+void Tray::PopContextMenu() {
+ tray_icon_->PopContextMenu();
+}
+
void Tray::SetContextMenu(mate::Arguments* args, Menu* menu) {
tray_icon_->SetContextMenu(menu->model());
}
.SetMethod("setTitle", &Tray::SetTitle)
.SetMethod("setHighlightMode", &Tray::SetHighlightMode)
.SetMethod("displayBalloon", &Tray::DisplayBalloon)
+ .SetMethod("popContextMenu", &Tray::PopContextMenu)
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
}
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();
void SetContextMenu(mate::Arguments* args, Menu* menu);
private:
const base::string16& contents) {
}
+void TrayIcon::PopContextMenu() {
+}
+
void TrayIcon::NotifyClicked(const gfx::Rect& bounds) {
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnClicked(bounds));
}
const base::string16& title,
const base::string16& contents);
+ virtual void PopContextMenu();
+
// Set the context menu for this icon.
virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) = 0;
void SetToolTip(const std::string& tool_tip) override;
void SetTitle(const std::string& title) override;
void SetHighlightMode(bool highlight) override;
+ void PopContextMenu() override;
void SetContextMenu(ui::SimpleMenuModel* menu_model) override;
private:
[self setNeedsDisplay:YES];
}
+- (void)popContextMenu {
+ if (menuController_ && ![menuController_ isMenuOpen]) {
+ // redraw the dray icon to show highlight if it is enabled.
+ [self setNeedsDisplay:YES];
+ [statusItem_ popUpStatusItemMenu:[menuController_ menu]];
+ // The popUpStatusItemMenu returns only after the showing menu is closed.
+ // When it returns, we need to redraw the tray icon to not show highlight.
+ [self setNeedsDisplay:YES];
+ }
+}
+
- (void)rightMouseUp:(NSEvent*)event {
trayIcon_->NotifyRightClicked([self getBoundsFromEvent:event]);
}
[status_item_view_ setHighlight:highlight];
}
+void TrayIconCocoa::PopContextMenu() {
+ [status_item_view_ popContextMenu];
+}
+
void TrayIconCocoa::SetContextMenu(ui::SimpleMenuModel* menu_model) {
menu_.reset([[AtomMenuController alloc] initWithModel:menu_model]);
[status_item_view_ setMenuController:menu_.get()];