OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_GFX_RANGE_H_ | 5 #ifndef UI_GFX_RANGE_H_ |
6 #define UI_GFX_RANGE_H_ | 6 #define UI_GFX_RANGE_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "ui/ui_api.h" |
11 | 12 |
12 #if defined(OS_MACOSX) | 13 #if defined(OS_MACOSX) |
13 #if __OBJC__ | 14 #if __OBJC__ |
14 #import <Foundation/Foundation.h> | 15 #import <Foundation/Foundation.h> |
15 #else | 16 #else |
16 typedef struct _NSRange NSRange; | 17 typedef struct _NSRange NSRange; |
17 #endif | 18 #endif |
18 #endif // defined(OS_MACOSX) | 19 #endif // defined(OS_MACOSX) |
19 | 20 |
20 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
21 #include <windows.h> | 22 #include <windows.h> |
22 #include <richedit.h> | 23 #include <richedit.h> |
23 #endif | 24 #endif |
24 | 25 |
25 namespace ui { | 26 namespace ui { |
26 | 27 |
27 // A Range contains two integer values that represent a numeric range, like the | 28 // A Range contains two integer values that represent a numeric range, like the |
28 // range of characters in a text selection. A range is made of a start and end | 29 // range of characters in a text selection. A range is made of a start and end |
29 // position; when they are the same, the Range is akin to a caret. Note that | 30 // position; when they are the same, the Range is akin to a caret. Note that |
30 // |start_| can be greater than |end_| to respect the directionality of the | 31 // |start_| can be greater than |end_| to respect the directionality of the |
31 // range. | 32 // range. |
32 class Range { | 33 class UI_API Range { |
33 public: | 34 public: |
34 // Creates an empty range {0,0}. | 35 // Creates an empty range {0,0}. |
35 Range(); | 36 Range(); |
36 | 37 |
37 // Initializes the range with a start and end. | 38 // Initializes the range with a start and end. |
38 Range(size_t start, size_t end); | 39 Range(size_t start, size_t end); |
39 | 40 |
40 // Initializes the range with the same start and end positions. | 41 // Initializes the range with the same start and end positions. |
41 explicit Range(size_t position); | 42 explicit Range(size_t position); |
42 | 43 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 #elif defined(OS_WIN) | 99 #elif defined(OS_WIN) |
99 CHARRANGE ToCHARRANGE() const; | 100 CHARRANGE ToCHARRANGE() const; |
100 #endif | 101 #endif |
101 // GTK+ has no concept of a range. | 102 // GTK+ has no concept of a range. |
102 | 103 |
103 private: | 104 private: |
104 size_t start_; | 105 size_t start_; |
105 size_t end_; | 106 size_t end_; |
106 }; | 107 }; |
107 | 108 |
108 std::ostream& operator<<(std::ostream& out, const ui::Range& range); | 109 UI_API std::ostream& operator<<(std::ostream& out, const ui::Range& range); |
109 | 110 |
110 } // namespace gfx | 111 } // namespace gfx |
111 | 112 |
112 #endif // UI_GFX_RANGE_H_ | 113 #endif // UI_GFX_RANGE_H_ |
OLD | NEW |