OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_GFX_POINT_H__ | 5 #ifndef BASE_GFX_POINT_H__ |
6 #define BASE_GFX_POINT_H__ | 6 #define BASE_GFX_POINT_H__ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <iosfwd> | 10 #include <iosfwd> |
11 | 11 |
12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 typedef unsigned long DWORD; |
13 typedef struct tagPOINT POINT; | 14 typedef struct tagPOINT POINT; |
14 #elif defined(OS_MACOSX) | 15 #elif defined(OS_MACOSX) |
15 #include <ApplicationServices/ApplicationServices.h> | 16 #include <ApplicationServices/ApplicationServices.h> |
16 #endif | 17 #endif |
17 | 18 |
18 namespace gfx { | 19 namespace gfx { |
19 | 20 |
20 // | 21 // |
21 // A point has an x and y coordinate. | 22 // A point has an x and y coordinate. |
22 // | 23 // |
23 class Point { | 24 class Point { |
24 public: | 25 public: |
25 Point(); | 26 Point(); |
26 Point(int x, int y); | 27 Point(int x, int y); |
27 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
| 29 // |point| is a DWORD value that contains a coordinate. The x-coordinate is |
| 30 // the low-order short and the y-coordinate is the high-order short. This |
| 31 // value is commonly acquired from GetMessagePos/GetCursorPos. |
| 32 explicit Point(DWORD point); |
28 explicit Point(const POINT& point); | 33 explicit Point(const POINT& point); |
29 Point& operator=(const POINT& point); | 34 Point& operator=(const POINT& point); |
30 #elif defined(OS_MACOSX) | 35 #elif defined(OS_MACOSX) |
31 explicit Point(const CGPoint& point); | 36 explicit Point(const CGPoint& point); |
32 #endif | 37 #endif |
33 | 38 |
34 ~Point() {} | 39 ~Point() {} |
35 | 40 |
36 int x() const { return x_; } | 41 int x() const { return x_; } |
37 int y() const { return y_; } | 42 int y() const { return y_; } |
(...skipping 27 matching lines...) Expand all Loading... |
65 | 70 |
66 private: | 71 private: |
67 int x_; | 72 int x_; |
68 int y_; | 73 int y_; |
69 }; | 74 }; |
70 | 75 |
71 } // namespace gfx | 76 } // namespace gfx |
72 | 77 |
73 std::ostream& operator<<(std::ostream& out, const gfx::Point& p); | 78 std::ostream& operator<<(std::ostream& out, const gfx::Point& p); |
74 | 79 |
75 #endif // BASE_GFX_POINT_H__ | 80 #endif // BASE_GFX_POINT_H__ |
OLD | NEW |