mac: Add Tray.setHighlightMode API, fixes #425.
This commit is contained in:
parent
4330d67e0d
commit
ec1db0c7bb
6 changed files with 18 additions and 0 deletions
|
@ -52,6 +52,10 @@ void Tray::SetTitle(const std::string& title) {
|
||||||
tray_icon_->SetTitle(title);
|
tray_icon_->SetTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Tray::SetHighlightMode(bool highlight) {
|
||||||
|
tray_icon_->SetHighlightMode(highlight);
|
||||||
|
}
|
||||||
|
|
||||||
void Tray::SetContextMenu(Menu* menu) {
|
void Tray::SetContextMenu(Menu* menu) {
|
||||||
tray_icon_->SetContextMenu(menu->model());
|
tray_icon_->SetContextMenu(menu->model());
|
||||||
}
|
}
|
||||||
|
@ -64,6 +68,7 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("setPressedImage", &Tray::SetPressedImage)
|
.SetMethod("setPressedImage", &Tray::SetPressedImage)
|
||||||
.SetMethod("setToolTip", &Tray::SetToolTip)
|
.SetMethod("setToolTip", &Tray::SetToolTip)
|
||||||
.SetMethod("setTitle", &Tray::SetTitle)
|
.SetMethod("setTitle", &Tray::SetTitle)
|
||||||
|
.SetMethod("setHighlightMode", &Tray::SetHighlightMode)
|
||||||
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
|
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ class Tray : public mate::EventEmitter,
|
||||||
void SetPressedImage(const gfx::ImageSkia& image);
|
void SetPressedImage(const gfx::ImageSkia& image);
|
||||||
void SetToolTip(const std::string& tool_tip);
|
void SetToolTip(const std::string& tool_tip);
|
||||||
void SetTitle(const std::string& title);
|
void SetTitle(const std::string& title);
|
||||||
|
void SetHighlightMode(bool highlight);
|
||||||
void SetContextMenu(Menu* menu);
|
void SetContextMenu(Menu* menu);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -15,6 +15,9 @@ TrayIcon::~TrayIcon() {
|
||||||
void TrayIcon::SetTitle(const std::string& title) {
|
void TrayIcon::SetTitle(const std::string& title) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrayIcon::SetHighlightMode(bool highlight) {
|
||||||
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyClicked() {
|
void TrayIcon::NotifyClicked() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnClicked());
|
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnClicked());
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,10 @@ class TrayIcon {
|
||||||
// only works on OS X.
|
// only works on OS X.
|
||||||
virtual void SetTitle(const std::string& title);
|
virtual void SetTitle(const std::string& title);
|
||||||
|
|
||||||
|
// Sets whether the status icon is highlighted when it is clicked. This only
|
||||||
|
// works on OS X.
|
||||||
|
virtual void SetHighlightMode(bool highlight);
|
||||||
|
|
||||||
// Set the context menu for this icon.
|
// Set the context menu for this icon.
|
||||||
virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) = 0;
|
virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) = 0;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ class TrayIconCocoa : public TrayIcon {
|
||||||
virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
|
virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
|
||||||
virtual void SetToolTip(const std::string& tool_tip) OVERRIDE;
|
virtual void SetToolTip(const std::string& tool_tip) OVERRIDE;
|
||||||
virtual void SetTitle(const std::string& title) OVERRIDE;
|
virtual void SetTitle(const std::string& title) OVERRIDE;
|
||||||
|
virtual void SetHighlightMode(bool highlight) OVERRIDE;
|
||||||
virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) OVERRIDE;
|
virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -72,6 +72,10 @@ void TrayIconCocoa::SetTitle(const std::string& title) {
|
||||||
[item_ setTitle:base::SysUTF8ToNSString(title)];
|
[item_ setTitle:base::SysUTF8ToNSString(title)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrayIconCocoa::SetHighlightMode(bool highlight) {
|
||||||
|
[item_ setHighlightMode:highlight];
|
||||||
|
}
|
||||||
|
|
||||||
void TrayIconCocoa::SetContextMenu(ui::SimpleMenuModel* menu_model) {
|
void TrayIconCocoa::SetContextMenu(ui::SimpleMenuModel* menu_model) {
|
||||||
menu_.reset([[AtomMenuController alloc] initWithModel:menu_model]);
|
menu_.reset([[AtomMenuController alloc] initWithModel:menu_model]);
|
||||||
[item_ setMenu:[menu_ menu]];
|
[item_ setMenu:[menu_ menu]];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue