add getter for ignoreDoubleClickEvents field
This commit is contained in:
parent
208374afa4
commit
94ffd4bfc0
6 changed files with 27 additions and 7 deletions
|
@ -182,6 +182,14 @@ void Tray::SetIgnoreDoubleClickEvents(bool ignore) {
|
|||
#endif
|
||||
}
|
||||
|
||||
bool Tray::GetIgnoreDoubleClickEvents() {
|
||||
#if defined(OS_MACOSX)
|
||||
return tray_icon_->GetIgnoreDoubleClickEvents();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Tray::DisplayBalloon(mate::Arguments* args,
|
||||
const mate::Dictionary& options) {
|
||||
mate::Handle<NativeImage> icon;
|
||||
|
@ -232,6 +240,8 @@ void Tray::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("setHighlightMode", &Tray::SetHighlightMode)
|
||||
.SetMethod("setIgnoreDoubleClickEvents",
|
||||
&Tray::SetIgnoreDoubleClickEvents)
|
||||
.SetMethod("getIgnoreDoubleClickEvents",
|
||||
&Tray::GetIgnoreDoubleClickEvents)
|
||||
.SetMethod("displayBalloon", &Tray::DisplayBalloon)
|
||||
.SetMethod("popUpContextMenu", &Tray::PopUpContextMenu)
|
||||
.SetMethod("setContextMenu", &Tray::SetContextMenu)
|
||||
|
|
|
@ -71,6 +71,7 @@ class Tray : public mate::TrackableObject<Tray>, public TrayIconObserver {
|
|||
void SetTitle(const std::string& title);
|
||||
void SetHighlightMode(TrayIcon::HighlightMode mode);
|
||||
void SetIgnoreDoubleClickEvents(bool ignore);
|
||||
bool GetIgnoreDoubleClickEvents();
|
||||
void DisplayBalloon(mate::Arguments* args, const mate::Dictionary& options);
|
||||
void PopUpContextMenu(mate::Arguments* args);
|
||||
void SetContextMenu(v8::Isolate* isolate, mate::Handle<Menu> menu);
|
||||
|
|
|
@ -16,9 +16,6 @@ void TrayIcon::SetTitle(const std::string& title) {}
|
|||
|
||||
void TrayIcon::SetHighlightMode(TrayIcon::HighlightMode mode) {}
|
||||
|
||||
void TrayIcon::SetIgnoreDoubleClickEvents(bool ignore) {
|
||||
}
|
||||
|
||||
void TrayIcon::DisplayBalloon(ImageType icon,
|
||||
const base::string16& title,
|
||||
const base::string16& contents) {}
|
||||
|
|
|
@ -51,9 +51,12 @@ class TrayIcon {
|
|||
};
|
||||
virtual void SetHighlightMode(HighlightMode mode);
|
||||
|
||||
// Sets the flag which determines whether to ignore double click events. This
|
||||
// only works on macOS.
|
||||
virtual void SetIgnoreDoubleClickEvents(bool ignore);
|
||||
// Setter and getter for the flag which determines whether to ignore double
|
||||
// click events. These only work on macOS.
|
||||
#if defined(OS_MACOSX)
|
||||
virtual void SetIgnoreDoubleClickEvents(bool ignore) = 0;
|
||||
virtual bool GetIgnoreDoubleClickEvents() = 0;
|
||||
#endif
|
||||
|
||||
// Displays a notification balloon with the specified contents.
|
||||
// Depending on the platform it might not appear by the icon tray.
|
||||
|
|
|
@ -28,6 +28,7 @@ class TrayIconCocoa : public TrayIcon, public AtomMenuModel::Observer {
|
|||
void SetTitle(const std::string& title) override;
|
||||
void SetHighlightMode(TrayIcon::HighlightMode mode) override;
|
||||
void SetIgnoreDoubleClickEvents(bool ignore) override;
|
||||
bool GetIgnoreDoubleClickEvents() override;
|
||||
void PopUpContextMenu(const gfx::Point& pos,
|
||||
AtomMenuModel* menu_model) override;
|
||||
void SetContextMenu(AtomMenuModel* menu_model) override;
|
||||
|
|
|
@ -206,10 +206,14 @@ const CGFloat kVerticalTitleMargin = 2;
|
|||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
- (void) setIgnoreDoubleClickEvents:(BOOL)ignore {
|
||||
- (void)setIgnoreDoubleClickEvents:(BOOL)ignore {
|
||||
ignoreDoubleClickEvents_ = ignore;
|
||||
}
|
||||
|
||||
- (BOOL)getIgnoreDoubleClickEvents {
|
||||
return ignoreDoubleClickEvents_;
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString*)title {
|
||||
if (title.length > 0) {
|
||||
title_.reset([title copy]);
|
||||
|
@ -450,6 +454,10 @@ void TrayIconCocoa::SetIgnoreDoubleClickEvents(bool ignore) {
|
|||
[status_item_view_ setIgnoreDoubleClickEvents:ignore];
|
||||
}
|
||||
|
||||
bool TrayIconCocoa::GetIgnoreDoubleClickEvents() {
|
||||
return [status_item_view_ getIgnoreDoubleClickEvents];
|
||||
}
|
||||
|
||||
void TrayIconCocoa::PopUpContextMenu(const gfx::Point& pos,
|
||||
AtomMenuModel* menu_model) {
|
||||
[status_item_view_ popUpContextMenu:menu_model];
|
||||
|
|
Loading…
Reference in a new issue