electron/atom/browser/api/atom_api_menu_mac.h

56 lines
1.4 KiB
C
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
2013-05-06 12:27:09 +00:00
// found in the LICENSE file.
#ifndef ATOM_BROWSER_API_ATOM_API_MENU_MAC_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_MAC_H_
2014-03-16 00:30:26 +00:00
#include "atom/browser/api/atom_api_menu.h"
2013-05-06 12:27:09 +00:00
2017-02-16 18:58:02 +00:00
#include <map>
#include <string>
2014-03-16 00:30:26 +00:00
#import "atom/browser/ui/cocoa/atom_menu_controller.h"
2017-02-16 18:58:02 +00:00
using base::scoped_nsobject;
2013-05-06 12:27:09 +00:00
namespace atom {
namespace api {
class MenuMac : public Menu {
protected:
MenuMac(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
2014-04-21 15:40:10 +00:00
void PopupAt(BrowserWindow* window,
int x, int y, int positioning_item,
2018-01-01 07:26:19 +00:00
const base::Closure& callback) override;
2017-02-15 19:44:25 +00:00
void PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
int32_t window_id,
int x,
int y,
2018-01-01 07:26:19 +00:00
int positioning_item,
base::Closure callback);
2017-02-16 18:58:02 +00:00
void ClosePopupAt(int32_t window_id) override;
2013-05-06 12:27:09 +00:00
private:
friend class Menu;
void OnClosed(int32_t window_id, base::Closure callback);
scoped_nsobject<AtomMenuController> menu_controller_;
// window ID -> open context menu
std::map<int32_t, scoped_nsobject<AtomMenuController>> popup_controllers_;
2017-02-15 19:44:25 +00:00
base::WeakPtrFactory<MenuMac> weak_factory_;
2013-05-06 12:27:09 +00:00
DISALLOW_COPY_AND_ASSIGN(MenuMac);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_MENU_MAC_H_