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

Side by Side Diff: chrome/views/controls/label.cc

Issue 93142: Checkbox/RadioButton labels have to reserve space for the focus rects, even i... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/views/controls/label.h ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/views/controls/label.h" 5 #include "chrome/views/controls/label.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 30 matching lines...) Expand all
41 font_ = font; 41 font_ = font;
42 text_size_valid_ = false; 42 text_size_valid_ = false;
43 SetText(text); 43 SetText(text);
44 url_set_ = false; 44 url_set_ = false;
45 color_ = kEnabledColor; 45 color_ = kEnabledColor;
46 horiz_alignment_ = ALIGN_CENTER; 46 horiz_alignment_ = ALIGN_CENTER;
47 is_multi_line_ = false; 47 is_multi_line_ = false;
48 collapse_when_hidden_ = false; 48 collapse_when_hidden_ = false;
49 rtl_alignment_mode_ = USE_UI_ALIGNMENT; 49 rtl_alignment_mode_ = USE_UI_ALIGNMENT;
50 paint_as_focused_ = false; 50 paint_as_focused_ = false;
51 has_focus_border_ = false;
51 } 52 }
52 53
53 Label::~Label() { 54 Label::~Label() {
54 } 55 }
55 56
56 gfx::Size Label::GetPreferredSize() { 57 gfx::Size Label::GetPreferredSize() {
57 gfx::Size prefsize; 58 gfx::Size prefsize;
58 59
59 // Return a size of (0, 0) if the label is not visible and if the 60 // Return a size of (0, 0) if the label is not visible and if the
60 // collapse_when_hidden_ flag is set. 61 // collapse_when_hidden_ flag is set.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 329
329 void Label::SetEnabled(bool enabled) { 330 void Label::SetEnabled(bool enabled) {
330 if (enabled == enabled_) 331 if (enabled == enabled_)
331 return; 332 return;
332 View::SetEnabled(enabled); 333 View::SetEnabled(enabled);
333 SetColor(enabled ? kEnabledColor : kDisabledColor); 334 SetColor(enabled ? kEnabledColor : kDisabledColor);
334 } 335 }
335 336
336 gfx::Insets Label::GetInsets() const { 337 gfx::Insets Label::GetInsets() const {
337 gfx::Insets insets = View::GetInsets(); 338 gfx::Insets insets = View::GetInsets();
338 if (IsFocusable() || paint_as_focused_) { 339 if (IsFocusable() || has_focus_border_) {
339 insets += gfx::Insets(kFocusBorderPadding, kFocusBorderPadding, 340 insets += gfx::Insets(kFocusBorderPadding, kFocusBorderPadding,
340 kFocusBorderPadding, kFocusBorderPadding); 341 kFocusBorderPadding, kFocusBorderPadding);
341 } 342 }
342 return insets; 343 return insets;
343 } 344 }
344 345
345 // static 346 // static
346 ChromeFont Label::GetDefaultFont() { 347 ChromeFont Label::GetDefaultFont() {
347 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont); 348 return ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont);
348 } 349 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 428
428 bool Label::GetAccessibleState(VARIANT* state) { 429 bool Label::GetAccessibleState(VARIANT* state) {
429 DCHECK(state); 430 DCHECK(state);
430 431
431 state->lVal |= STATE_SYSTEM_READONLY; 432 state->lVal |= STATE_SYSTEM_READONLY;
432 return true; 433 return true;
433 } 434 }
434 #endif // defined(OS_WIN) 435 #endif // defined(OS_WIN)
435 436
436 } // namespace views 437 } // namespace views
OLDNEW
« no previous file with comments | « chrome/views/controls/label.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698