Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: ui/views/controls/label.h

Issue 681883002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/image_view.h ('k') | ui/views/controls/link.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_VIEWS_CONTROLS_LABEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_LABEL_H_
6 #define UI_VIEWS_CONTROLS_LABEL_H_ 6 #define UI_VIEWS_CONTROLS_LABEL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 public: 24 public:
25 // Internal class name. 25 // Internal class name.
26 static const char kViewClassName[]; 26 static const char kViewClassName[];
27 27
28 // The padding for the focus border when rendering focused text. 28 // The padding for the focus border when rendering focused text.
29 static const int kFocusBorderPadding; 29 static const int kFocusBorderPadding;
30 30
31 Label(); 31 Label();
32 explicit Label(const base::string16& text); 32 explicit Label(const base::string16& text);
33 Label(const base::string16& text, const gfx::FontList& font_list); 33 Label(const base::string16& text, const gfx::FontList& font_list);
34 virtual ~Label(); 34 ~Label() override;
35 35
36 // Gets or sets the fonts used by this label. 36 // Gets or sets the fonts used by this label.
37 const gfx::FontList& font_list() const { return font_list_; } 37 const gfx::FontList& font_list() const { return font_list_; }
38 virtual void SetFontList(const gfx::FontList& font_list); 38 virtual void SetFontList(const gfx::FontList& font_list);
39 39
40 // Get or set the label text. 40 // Get or set the label text.
41 const base::string16& text() const { return text_; } 41 const base::string16& text() const { return text_; }
42 virtual void SetText(const base::string16& text); 42 virtual void SetText(const base::string16& text);
43 43
44 // Enables or disables auto-color-readability (enabled by default). If this 44 // Enables or disables auto-color-readability (enabled by default). If this
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // wrapped). If 0, no maximum width is enforced. 113 // wrapped). If 0, no maximum width is enforced.
114 void SizeToFit(int max_width); 114 void SizeToFit(int max_width);
115 115
116 // Sets whether the preferred size is empty when the label is not visible. 116 // Sets whether the preferred size is empty when the label is not visible.
117 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } 117 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; }
118 118
119 // Get the text as displayed to the user, respecting the obscured flag. 119 // Get the text as displayed to the user, respecting the obscured flag.
120 const base::string16& GetLayoutTextForTesting() const; 120 const base::string16& GetLayoutTextForTesting() const;
121 121
122 // View: 122 // View:
123 virtual gfx::Insets GetInsets() const override; 123 gfx::Insets GetInsets() const override;
124 virtual int GetBaseline() const override; 124 int GetBaseline() const override;
125 virtual gfx::Size GetPreferredSize() const override; 125 gfx::Size GetPreferredSize() const override;
126 virtual gfx::Size GetMinimumSize() const override; 126 gfx::Size GetMinimumSize() const override;
127 virtual int GetHeightForWidth(int w) const override; 127 int GetHeightForWidth(int w) const override;
128 virtual const char* GetClassName() const override; 128 const char* GetClassName() const override;
129 virtual View* GetTooltipHandlerForPoint(const gfx::Point& point) override; 129 View* GetTooltipHandlerForPoint(const gfx::Point& point) override;
130 virtual bool CanProcessEventsWithinSubtree() const override; 130 bool CanProcessEventsWithinSubtree() const override;
131 virtual void GetAccessibleState(ui::AXViewState* state) override; 131 void GetAccessibleState(ui::AXViewState* state) override;
132 virtual bool GetTooltipText(const gfx::Point& p, 132 bool GetTooltipText(const gfx::Point& p,
133 base::string16* tooltip) const override; 133 base::string16* tooltip) const override;
134 134
135 protected: 135 protected:
136 // Called by Paint to paint the text. 136 // Called by Paint to paint the text.
137 void PaintText(gfx::Canvas* canvas, 137 void PaintText(gfx::Canvas* canvas,
138 const base::string16& text, 138 const base::string16& text,
139 const gfx::Rect& text_bounds, 139 const gfx::Rect& text_bounds,
140 int flags); 140 int flags);
141 141
142 virtual gfx::Size GetTextSize() const; 142 virtual gfx::Size GetTextSize() const;
143 143
144 SkColor disabled_color() const { return actual_disabled_color_; } 144 SkColor disabled_color() const { return actual_disabled_color_; }
145 145
146 // View: 146 // View:
147 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 147 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
148 virtual void OnPaint(gfx::Canvas* canvas) override; 148 void OnPaint(gfx::Canvas* canvas) override;
149 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 149 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
150 150
151 private: 151 private:
152 // These tests call CalculateDrawStringParams in order to verify the 152 // These tests call CalculateDrawStringParams in order to verify the
153 // calculations done for drawing text. 153 // calculations done for drawing text.
154 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineString); 154 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineString);
155 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineString); 155 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineString);
156 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineStringInRTL); 156 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawSingleLineStringInRTL);
157 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineStringInRTL); 157 FRIEND_TEST_ALL_PREFIXES(LabelTest, DrawMultiLineStringInRTL);
158 FRIEND_TEST_ALL_PREFIXES(LabelTest, DirectionalityFromText); 158 FRIEND_TEST_ALL_PREFIXES(LabelTest, DirectionalityFromText);
159 FRIEND_TEST_ALL_PREFIXES(LabelTest, DisableSubpixelRendering); 159 FRIEND_TEST_ALL_PREFIXES(LabelTest, DisableSubpixelRendering);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // The cached heights to avoid recalculation in GetHeightForWidth(). 220 // The cached heights to avoid recalculation in GetHeightForWidth().
221 mutable std::vector<gfx::Size> cached_heights_; 221 mutable std::vector<gfx::Size> cached_heights_;
222 mutable int cached_heights_cursor_; 222 mutable int cached_heights_cursor_;
223 223
224 DISALLOW_COPY_AND_ASSIGN(Label); 224 DISALLOW_COPY_AND_ASSIGN(Label);
225 }; 225 };
226 226
227 } // namespace views 227 } // namespace views
228 228
229 #endif // UI_VIEWS_CONTROLS_LABEL_H_ 229 #endif // UI_VIEWS_CONTROLS_LABEL_H_
OLDNEW
« no previous file with comments | « ui/views/controls/image_view.h ('k') | ui/views/controls/link.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698