1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_COCOA_PANELS_PANEL_UTILS_COCOA_H_
6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_UTILS_COCOA_H_
8 #import <Cocoa/Cocoa.h>
9 #include "ui/gfx/geometry/point.h"
10 #include "ui/gfx/geometry/rect.h"
12 namespace cocoa_utils
{
14 // TODO(dcheng): Move elsewhere so BrowserWindowCocoa can use them too.
15 // Converts a rect from the platform-independent screen coordinates (with the
16 // (0,0) in the top-left corner of the primary screen) to the Cocoa screen
17 // coordinates (with (0,0) in the low-left corner).
18 NSRect
ConvertRectToCocoaCoordinates(const gfx::Rect
& bounds
);
20 // Converts a rect from the Cocoa screen oordinates (with (0,0) in the low-left
21 // corner) to the platform-independent screen coordinates (with the (0,0) in
22 // the top-left corner of the primary screen).
23 gfx::Rect
ConvertRectFromCocoaCoordinates(NSRect bounds
);
25 // Converts a point from the platform-independent screen coordinates (with the
26 // (0,0) in the top-left corner of the primary screen) to the Cocoa screen
27 // coordinates (with (0,0) in the low-left corner).
28 NSPoint
ConvertPointToCocoaCoordinates(const gfx::Point
& point
);
30 // Converts a point from the Cocoa screen coordinates (with (0,0) in the
31 // low-left corner of the primary screen) to the platform-independent screen
32 // coordinates (with the (0,0) in the top-left corner).
33 gfx::Point
ConvertPointFromCocoaCoordinates(NSPoint point
);
35 } // namespace cocoa_utils
37 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_UTILS_COCOA_H_