1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_BASE_COCOA_COCOA_EVENT_UTILS_H_
6 #define UI_BASE_COCOA_COCOA_EVENT_UTILS_H_
8 #import <Cocoa/Cocoa.h>
10 #include "ui/base/ui_export.h"
11 #include "ui/base/window_open_disposition.h"
15 // Retrieves a bitsum of ui::EventFlags represented by |event|,
16 UI_EXPORT int EventFlagsFromNSEvent(NSEvent* event);
18 // Retrieves a bitsum of ui::EventFlags represented by |event|,
19 // but instead use the modifier flags given by |modifiers|,
20 // which is the same format as |-NSEvent modifierFlags|. This allows
21 // substitution of the modifiers without having to create a new event from
23 UI_EXPORT int EventFlagsFromNSEventWithModifiers(NSEvent* event,
24 NSUInteger modifiers);
26 // Retrieves the WindowOpenDisposition used to open a link from a user gesture
27 // represented by |event|. For example, a Cmd+Click would mean open the
28 // associated link in a background tab.
29 UI_EXPORT WindowOpenDisposition WindowOpenDispositionFromNSEvent(
32 // Retrieves the WindowOpenDisposition used to open a link from a user gesture
33 // represented by |event|, but instead use the modifier flags given by |flags|,
34 // which is the same format as |-NSEvent modifierFlags|. This allows
35 // substitution of the modifiers without having to create a new event from
37 UI_EXPORT WindowOpenDisposition WindowOpenDispositionFromNSEventWithFlags(
38 NSEvent* event, NSUInteger flags);
42 #endif // UI_BASE_COCOA_COCOA_EVENT_UTILS_H_