Add "click" event for TrayIcon.
This commit is contained in:
parent
9699dbb71f
commit
cbd9366898
6 changed files with 43 additions and 1 deletions
|
@ -31,6 +31,10 @@ mate::Wrappable* Tray::New(const gfx::ImageSkia& image) {
|
|||
return new Tray(image);
|
||||
}
|
||||
|
||||
void Tray::OnClicked() {
|
||||
Emit("clicked");
|
||||
}
|
||||
|
||||
void Tray::SetImage(const gfx::ImageSkia& image) {
|
||||
tray_icon_->SetImage(image);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "atom/browser/api/event_emitter.h"
|
||||
#include "atom/browser/ui/tray_icon_observer.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
|
||||
namespace gfx {
|
||||
|
@ -22,7 +23,8 @@ namespace api {
|
|||
|
||||
class Menu;
|
||||
|
||||
class Tray : public mate::EventEmitter {
|
||||
class Tray : public mate::EventEmitter,
|
||||
public TrayIconObserver {
|
||||
public:
|
||||
static mate::Wrappable* New(const gfx::ImageSkia& image);
|
||||
|
||||
|
@ -33,6 +35,9 @@ class Tray : public mate::EventEmitter {
|
|||
explicit Tray(const gfx::ImageSkia& image);
|
||||
virtual ~Tray();
|
||||
|
||||
// TrayIcon implementations:
|
||||
virtual void OnClicked() OVERRIDE;
|
||||
|
||||
void SetImage(const gfx::ImageSkia& image);
|
||||
void SetPressedImage(const gfx::ImageSkia& image);
|
||||
void SetToolTip(const std::string& tool_tip);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue