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