mac: Add Tray.setTitle API, fixes #560.
This commit is contained in:
parent
db8de9e60d
commit
4330d67e0d
6 changed files with 18 additions and 0 deletions
|
@ -48,6 +48,10 @@ void Tray::SetToolTip(const std::string& tool_tip) {
|
||||||
tray_icon_->SetToolTip(tool_tip);
|
tray_icon_->SetToolTip(tool_tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Tray::SetTitle(const std::string& title) {
|
||||||
|
tray_icon_->SetTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
void Tray::SetContextMenu(Menu* menu) {
|
void Tray::SetContextMenu(Menu* menu) {
|
||||||
tray_icon_->SetContextMenu(menu->model());
|
tray_icon_->SetContextMenu(menu->model());
|
||||||
}
|
}
|
||||||
|
@ -59,6 +63,7 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("setImage", &Tray::SetImage)
|
.SetMethod("setImage", &Tray::SetImage)
|
||||||
.SetMethod("setPressedImage", &Tray::SetPressedImage)
|
.SetMethod("setPressedImage", &Tray::SetPressedImage)
|
||||||
.SetMethod("setToolTip", &Tray::SetToolTip)
|
.SetMethod("setToolTip", &Tray::SetToolTip)
|
||||||
|
.SetMethod("setTitle", &Tray::SetTitle)
|
||||||
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
|
.SetMethod("_setContextMenu", &Tray::SetContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ class Tray : public mate::EventEmitter,
|
||||||
void SetImage(const gfx::ImageSkia& image);
|
void SetImage(const gfx::ImageSkia& image);
|
||||||
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 SetContextMenu(Menu* menu);
|
void SetContextMenu(Menu* menu);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -12,6 +12,9 @@ TrayIcon::TrayIcon() {
|
||||||
TrayIcon::~TrayIcon() {
|
TrayIcon::~TrayIcon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrayIcon::SetTitle(const std::string& title) {
|
||||||
|
}
|
||||||
|
|
||||||
void TrayIcon::NotifyClicked() {
|
void TrayIcon::NotifyClicked() {
|
||||||
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnClicked());
|
FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnClicked());
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,10 @@ class TrayIcon {
|
||||||
// status icon (e.g. Ubuntu Unity).
|
// status icon (e.g. Ubuntu Unity).
|
||||||
virtual void SetToolTip(const std::string& tool_tip) = 0;
|
virtual void SetToolTip(const std::string& tool_tip) = 0;
|
||||||
|
|
||||||
|
// Sets the title displayed aside of the status icon in the status bar. This
|
||||||
|
// only works on OS X.
|
||||||
|
virtual void SetTitle(const std::string& title);
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ class TrayIconCocoa : public TrayIcon {
|
||||||
virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
|
virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
|
||||||
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 SetContextMenu(ui::SimpleMenuModel* menu_model) OVERRIDE;
|
virtual void SetContextMenu(ui::SimpleMenuModel* menu_model) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -68,6 +68,10 @@ void TrayIconCocoa::SetToolTip(const std::string& tool_tip) {
|
||||||
[item_ setToolTip:base::SysUTF8ToNSString(tool_tip)];
|
[item_ setToolTip:base::SysUTF8ToNSString(tool_tip)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrayIconCocoa::SetTitle(const std::string& title) {
|
||||||
|
[item_ setTitle:base::SysUTF8ToNSString(title)];
|
||||||
|
}
|
||||||
|
|
||||||
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