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 CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/autocomplete/autocomplete_match.h" | 9 #include "chrome/browser/autocomplete/autocomplete_match.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 const gfx::Font& bold_font); | 40 const gfx::Font& bold_font); |
41 virtual ~AutocompleteResultView(); | 41 virtual ~AutocompleteResultView(); |
42 | 42 |
43 static SkColor GetColor(ResultViewState state, ColorKind kind); | 43 static SkColor GetColor(ResultViewState state, ColorKind kind); |
44 | 44 |
45 // Updates the match used to paint the contents of this result view. We copy | 45 // Updates the match used to paint the contents of this result view. We copy |
46 // the match so that we can continue to paint the last result even after the | 46 // the match so that we can continue to paint the last result even after the |
47 // model has changed. | 47 // model has changed. |
48 void SetMatch(const AutocompleteMatch& match); | 48 void SetMatch(const AutocompleteMatch& match); |
49 | 49 |
50 gfx::Size GetCollapsedSize(); | |
51 | |
52 // views::View: | |
53 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
Peter Kasting
2011/07/27 20:18:25
Nit: If you move the declaration, you should move
| |
54 | |
50 protected: | 55 protected: |
51 virtual void PaintMatch(gfx::Canvas* canvas, | 56 virtual void PaintMatch(gfx::Canvas* canvas, |
52 const AutocompleteMatch& match, | 57 const AutocompleteMatch& match, |
53 int x); | 58 int x); |
54 | 59 |
55 // Returns the height of the text portion of the result view. In the base | 60 // Returns the height of the text portion of the result view. In the base |
56 // class, this is the height of one line of text. | 61 // class, this is the height of one line of text. |
57 virtual int GetTextHeight() const; | 62 virtual int GetTextHeight() const; |
58 | 63 |
59 // Draws the specified |text| into the canvas, using highlighting provided by | 64 // Draws the specified |text| into the canvas, using highlighting provided by |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 // "LTR_STRING" and the RTL run "RTL_STRING", the unelided text would be drawn | 98 // "LTR_STRING" and the RTL run "RTL_STRING", the unelided text would be drawn |
94 // like: | 99 // like: |
95 // LTR_STRING GNIRTS_LTR | 100 // LTR_STRING GNIRTS_LTR |
96 // If we need to elide the RTL run, then it will be drawn like: | 101 // If we need to elide the RTL run, then it will be drawn like: |
97 // LTR_STRING ...RTS_LTR | 102 // LTR_STRING ...RTS_LTR |
98 // Instead of: | 103 // Instead of: |
99 // LTR_STRING RTS_LTR... | 104 // LTR_STRING RTS_LTR... |
100 void Elide(Runs* runs, int remaining_width) const; | 105 void Elide(Runs* runs, int remaining_width) const; |
101 | 106 |
102 // views::View: | 107 // views::View: |
103 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
104 virtual void Layout() OVERRIDE; | 108 virtual void Layout() OVERRIDE; |
105 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 109 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
106 | 110 |
107 static int default_icon_size_; | 111 static int default_icon_size_; |
108 | 112 |
109 // This row's model and model index. | 113 // This row's model and model index. |
110 AutocompleteResultViewModel* model_; | 114 AutocompleteResultViewModel* model_; |
111 size_t model_index_; | 115 size_t model_index_; |
112 | 116 |
113 const gfx::Font normal_font_; | 117 const gfx::Font normal_font_; |
114 const gfx::Font bold_font_; | 118 const gfx::Font bold_font_; |
115 | 119 |
116 // Width of the ellipsis in the normal font. | 120 // Width of the ellipsis in the normal font. |
117 int ellipsis_width_; | 121 int ellipsis_width_; |
118 | 122 |
119 // A context used for mirroring regions. | 123 // A context used for mirroring regions. |
120 class MirroringContext; | 124 class MirroringContext; |
121 scoped_ptr<MirroringContext> mirroring_context_; | 125 scoped_ptr<MirroringContext> mirroring_context_; |
122 | 126 |
123 AutocompleteMatch match_; | 127 AutocompleteMatch match_; |
124 | 128 |
125 gfx::Rect text_bounds_; | 129 gfx::Rect text_bounds_; |
126 gfx::Rect icon_bounds_; | 130 gfx::Rect icon_bounds_; |
127 | 131 |
128 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView); | 132 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView); |
129 }; | 133 }; |
130 | 134 |
131 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ |
OLD | NEW |