2014-10-31 18:17:05 +00:00
|
|
|
// Copyright (c) 2014 GitHub, Inc.
|
2014-05-30 02:31:27 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ATOM_BROWSER_UI_TRAY_ICON_COCOA_H_
|
|
|
|
#define ATOM_BROWSER_UI_TRAY_ICON_COCOA_H_
|
|
|
|
|
2014-05-30 06:37:53 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
2014-05-30 02:31:27 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "atom/browser/ui/tray_icon.h"
|
2014-05-30 06:37:53 +00:00
|
|
|
#include "base/mac/scoped_nsobject.h"
|
|
|
|
|
|
|
|
@class AtomMenuController;
|
2015-07-15 10:26:39 +00:00
|
|
|
@class StatusItemView;
|
2014-05-30 02:31:27 +00:00
|
|
|
|
|
|
|
namespace atom {
|
|
|
|
|
2018-04-18 01:44:10 +00:00
|
|
|
class TrayIconCocoa : public TrayIcon, public AtomMenuModel::Observer {
|
2014-05-30 02:31:27 +00:00
|
|
|
public:
|
2014-05-30 15:57:54 +00:00
|
|
|
TrayIconCocoa();
|
2018-04-17 23:03:51 +00:00
|
|
|
~TrayIconCocoa() override;
|
2014-05-30 15:57:54 +00:00
|
|
|
|
2015-01-10 01:24:36 +00:00
|
|
|
void SetImage(const gfx::Image& image) override;
|
|
|
|
void SetPressedImage(const gfx::Image& image) override;
|
|
|
|
void SetToolTip(const std::string& tool_tip) override;
|
|
|
|
void SetTitle(const std::string& title) override;
|
2016-07-26 20:51:43 +00:00
|
|
|
void SetHighlightMode(TrayIcon::HighlightMode mode) override;
|
2018-04-02 01:07:26 +00:00
|
|
|
void SetIgnoreDoubleClickEvents(bool ignore) override;
|
2018-05-03 07:43:46 +00:00
|
|
|
bool GetIgnoreDoubleClickEvents() override;
|
2015-12-02 10:43:11 +00:00
|
|
|
void PopUpContextMenu(const gfx::Point& pos,
|
2016-07-02 02:47:40 +00:00
|
|
|
AtomMenuModel* menu_model) override;
|
|
|
|
void SetContextMenu(AtomMenuModel* menu_model) override;
|
2016-06-21 06:40:30 +00:00
|
|
|
gfx::Rect GetBounds() override;
|
2014-05-30 02:31:27 +00:00
|
|
|
|
2015-08-10 04:48:22 +00:00
|
|
|
protected:
|
|
|
|
// AtomMenuModel::Observer:
|
2018-01-27 14:35:58 +00:00
|
|
|
void OnMenuWillClose() override;
|
2015-08-10 04:48:22 +00:00
|
|
|
|
2014-05-30 02:31:27 +00:00
|
|
|
private:
|
2015-07-15 10:26:39 +00:00
|
|
|
// Atom custom view for NSStatusItem.
|
|
|
|
base::scoped_nsobject<StatusItemView> status_item_view_;
|
2014-06-02 03:28:23 +00:00
|
|
|
|
2014-05-30 06:37:53 +00:00
|
|
|
// Status menu shown when right-clicking the system icon.
|
|
|
|
base::scoped_nsobject<AtomMenuController> menu_;
|
|
|
|
|
2015-08-10 04:48:22 +00:00
|
|
|
// Used for unregistering observer.
|
2018-05-21 22:18:38 +00:00
|
|
|
AtomMenuModel* menu_model_ = nullptr; // weak ref.
|
2015-08-10 04:48:22 +00:00
|
|
|
|
2014-05-30 02:31:27 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(TrayIconCocoa);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_BROWSER_UI_TRAY_ICON_COCOA_H_
|