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

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

Issue 251103005: Added arrow key navigation to Overview Mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added reposition animation, shortened movement time, fixed what Terry commented. Created 6 years, 6 months 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
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // |max_width| is the maximum width that will be used (longer lines will be 165 // |max_width| is the maximum width that will be used (longer lines will be
166 // wrapped). If 0, no maximum width is enforced. 166 // wrapped). If 0, no maximum width is enforced.
167 void SizeToFit(int max_width); 167 void SizeToFit(int max_width);
168 168
169 // Gets/sets the flag to determine whether the label should be collapsed when 169 // Gets/sets the flag to determine whether the label should be collapsed when
170 // it's hidden (not visible). If this flag is true, the label will return a 170 // it's hidden (not visible). If this flag is true, the label will return a
171 // preferred size of (0, 0) when it's not visible. 171 // preferred size of (0, 0) when it's not visible.
172 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; } 172 void set_collapse_when_hidden(bool value) { collapse_when_hidden_ = value; }
173 bool collapse_when_hidden() const { return collapse_when_hidden_; } 173 bool collapse_when_hidden() const { return collapse_when_hidden_; }
174 174
175 // Sets the accessibility role the label should report.
176 void set_accessible_role(ui::AXRole role) { accessible_role_ = role; }
177
175 // Overridden from View: 178 // Overridden from View:
176 virtual gfx::Insets GetInsets() const OVERRIDE; 179 virtual gfx::Insets GetInsets() const OVERRIDE;
177 virtual int GetBaseline() const OVERRIDE; 180 virtual int GetBaseline() const OVERRIDE;
178 // Overridden to compute the size required to display this label. 181 // Overridden to compute the size required to display this label.
179 virtual gfx::Size GetPreferredSize() const OVERRIDE; 182 virtual gfx::Size GetPreferredSize() const OVERRIDE;
180 // Returns the width of an ellipsis if the label is non-empty, or 0 otherwise. 183 // Returns the width of an ellipsis if the label is non-empty, or 0 otherwise.
181 virtual gfx::Size GetMinimumSize() const OVERRIDE; 184 virtual gfx::Size GetMinimumSize() const OVERRIDE;
182 // Returns the height necessary to display this label with the provided width. 185 // Returns the height necessary to display this label with the provided width.
183 // This method is used to layout multi-line labels. It is equivalent to 186 // This method is used to layout multi-line labels. It is equivalent to
184 // GetPreferredSize().height() if the receiver is not multi-line. 187 // GetPreferredSize().height() if the receiver is not multi-line.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // Space between text and shadow. 296 // Space between text and shadow.
294 gfx::Point shadow_offset_; 297 gfx::Point shadow_offset_;
295 298
296 // Should a shadow be drawn behind the text? 299 // Should a shadow be drawn behind the text?
297 bool has_shadow_; 300 bool has_shadow_;
298 301
299 // The cached heights to avoid recalculation in GetHeightForWidth(). 302 // The cached heights to avoid recalculation in GetHeightForWidth().
300 mutable std::vector<gfx::Size> cached_heights_; 303 mutable std::vector<gfx::Size> cached_heights_;
301 mutable int cached_heights_cursor_; 304 mutable int cached_heights_cursor_;
302 305
306 // A11y role for the label. Default is AX_ROLE_STATIC_TEXT.
307 ui::AXRole accessible_role_;
308
303 DISALLOW_COPY_AND_ASSIGN(Label); 309 DISALLOW_COPY_AND_ASSIGN(Label);
304 }; 310 };
305 311
306 } // namespace views 312 } // namespace views
307 313
308 #endif // UI_VIEWS_CONTROLS_LABEL_H_ 314 #endif // UI_VIEWS_CONTROLS_LABEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698