1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file. 4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#ifndef UI_EVENTS_COCOA_COCOA_EVENT_UTILS_H_ 6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define UI_EVENTS_COCOA_COCOA_EVENT_UTILS_H_ 7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#import <Cocoa/Cocoa.h> 9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/events/events_export.h" 11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace ui { 13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Converts the Cocoa |modifiers| bitsum into a ui::EventFlags bitsum. 15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)EVENTS_EXPORT int EventFlagsFromModifiers(NSUInteger modifiers); 16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 17a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Retrieves a bitsum of ui::EventFlags represented by |event|, 18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// but instead use the modifier flags given by |modifiers|, 19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// which is the same format as |-NSEvent modifierFlags|. This allows 20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// substitution of the modifiers without having to create a new event from 21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// scratch. 22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)EVENTS_EXPORT int EventFlagsFromNSEventWithModifiers(NSEvent* event, 23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) NSUInteger modifiers); 24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)} // namespace ui 25a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) 26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif // UI_EVENTS_COCOA_COCOA_EVENT_UTILS_H_ 27