electron/atom/browser/ui/tray_icon_cocoa.h

56 lines
1.5 KiB
C
Raw Normal View History

// Copyright (c) 2014 GitHub, Inc.
// 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_
#import <Cocoa/Cocoa.h>
#include <string>
#include "atom/browser/ui/tray_icon.h"
#include "base/mac/scoped_nsobject.h"
@class AtomMenuController;
@class StatusItemView;
namespace atom {
2015-08-10 04:48:22 +00:00
class TrayIconCocoa : public TrayIcon,
public AtomMenuModel::Observer {
public:
2014-05-30 15:57:54 +00:00
TrayIconCocoa();
virtual ~TrayIconCocoa();
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;
void SetHighlightMode(TrayIcon::HighlightMode mode) override;
void PopUpContextMenu(const gfx::Point& pos,
AtomMenuModel* menu_model) override;
void SetContextMenu(AtomMenuModel* menu_model) override;
2016-06-21 06:40:30 +00:00
gfx::Rect GetBounds() override;
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
private:
// Atom custom view for NSStatusItem.
base::scoped_nsobject<StatusItemView> status_item_view_;
// 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.
AtomMenuModel* menu_model_; // weak ref.
DISALLOW_COPY_AND_ASSIGN(TrayIconCocoa);
};
} // namespace atom
#endif // ATOM_BROWSER_UI_TRAY_ICON_COCOA_H_