Change windows messages api to hook instead of emitter

This commit is contained in:
Omri Litov 2015-10-27 14:00:08 +02:00
parent edbebf84b9
commit e355532d27
4 changed files with 73 additions and 9 deletions

View file

@ -5,6 +5,7 @@
#ifndef ATOM_BROWSER_API_ATOM_API_WINDOW_H_
#define ATOM_BROWSER_API_ATOM_API_WINDOW_H_
#include <map>
#include <string>
#include <vector>
@ -76,8 +77,8 @@ class Window : public mate::TrackableObject<Window>,
void OnExecuteWindowsCommand(const std::string& command_name) override;
#if defined(OS_WIN)
void OnWindowMessage(unsigned int message, LPARAM l_param,
WPARAM w_param) override;
void OnWindowMessage(UINT message, WPARAM w_param,
LPARAM l_param) override;
#endif
// mate::Wrappable:
@ -148,6 +149,18 @@ class Window : public mate::TrackableObject<Window>,
bool IsMenuBarVisible();
void SetAspectRatio(double aspect_ratio, mate::Arguments* args);
#if defined(OS_WIN)
typedef base::Callback<void(WPARAM, LPARAM)> MessageCallback;
typedef std::map<UINT, MessageCallback> MessageCallbackMap;
MessageCallbackMap messages_callback_map_;
bool HookWindowMessage(UINT message,
const MessageCallback& callback);
bool IsWindowMessageHooked(UINT message);
void UnhookWindowMessage(UINT message);
void UnhookAllWindowMessages();
#endif
#if defined(OS_MACOSX)
void ShowDefinitionForSelection();
#endif