| 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 // Returns the size necessary to show just the icon and an ellipsis. |
| 51 gfx::Size GetCollapsedSize(); |
| 52 |
| 53 // views::View: |
| 54 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 55 |
| 50 protected: | 56 protected: |
| 51 virtual void PaintMatch(gfx::Canvas* canvas, | 57 virtual void PaintMatch(gfx::Canvas* canvas, |
| 52 const AutocompleteMatch& match, | 58 const AutocompleteMatch& match, |
| 53 int x); | 59 int x); |
| 54 | 60 |
| 55 // Returns the height of the text portion of the result view. In the base | 61 // 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. | 62 // class, this is the height of one line of text. |
| 57 virtual int GetTextHeight() const; | 63 virtual int GetTextHeight() const; |
| 58 | 64 |
| 59 // Draws the specified |text| into the canvas, using highlighting provided by | 65 // 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 | 99 // "LTR_STRING" and the RTL run "RTL_STRING", the unelided text would be drawn |
| 94 // like: | 100 // like: |
| 95 // LTR_STRING GNIRTS_LTR | 101 // LTR_STRING GNIRTS_LTR |
| 96 // If we need to elide the RTL run, then it will be drawn like: | 102 // If we need to elide the RTL run, then it will be drawn like: |
| 97 // LTR_STRING ...RTS_LTR | 103 // LTR_STRING ...RTS_LTR |
| 98 // Instead of: | 104 // Instead of: |
| 99 // LTR_STRING RTS_LTR... | 105 // LTR_STRING RTS_LTR... |
| 100 void Elide(Runs* runs, int remaining_width) const; | 106 void Elide(Runs* runs, int remaining_width) const; |
| 101 | 107 |
| 102 // views::View: | 108 // views::View: |
| 103 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 104 virtual void Layout() OVERRIDE; | 109 virtual void Layout() OVERRIDE; |
| 105 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 110 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 106 | 111 |
| 107 static int default_icon_size_; | 112 static int default_icon_size_; |
| 108 | 113 |
| 109 // This row's model and model index. | 114 // This row's model and model index. |
| 110 AutocompleteResultViewModel* model_; | 115 AutocompleteResultViewModel* model_; |
| 111 size_t model_index_; | 116 size_t model_index_; |
| 112 | 117 |
| 113 const gfx::Font normal_font_; | 118 const gfx::Font normal_font_; |
| 114 const gfx::Font bold_font_; | 119 const gfx::Font bold_font_; |
| 115 | 120 |
| 116 // Width of the ellipsis in the normal font. | 121 // Width of the ellipsis in the normal font. |
| 117 int ellipsis_width_; | 122 int ellipsis_width_; |
| 118 | 123 |
| 119 // A context used for mirroring regions. | 124 // A context used for mirroring regions. |
| 120 class MirroringContext; | 125 class MirroringContext; |
| 121 scoped_ptr<MirroringContext> mirroring_context_; | 126 scoped_ptr<MirroringContext> mirroring_context_; |
| 122 | 127 |
| 123 AutocompleteMatch match_; | 128 AutocompleteMatch match_; |
| 124 | 129 |
| 125 gfx::Rect text_bounds_; | 130 gfx::Rect text_bounds_; |
| 126 gfx::Rect icon_bounds_; | 131 gfx::Rect icon_bounds_; |
| 127 | 132 |
| 128 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView); | 133 DISALLOW_COPY_AND_ASSIGN(AutocompleteResultView); |
| 129 }; | 134 }; |
| 130 | 135 |
| 131 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ | 136 #endif // CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_RESULT_VIEW_H_ |
| OLD | NEW |