| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |