| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 gfx::Insets insets = GetInsets(); | 404 gfx::Insets insets = GetInsets(); |
| 405 label_width += insets.width(); | 405 label_width += insets.width(); |
| 406 | 406 |
| 407 if (max_width > 0) | 407 if (max_width > 0) |
| 408 label_width = std::min(label_width, max_width); | 408 label_width = std::min(label_width, max_width); |
| 409 | 409 |
| 410 SetBounds(x(), y(), label_width, 0); | 410 SetBounds(x(), y(), label_width, 0); |
| 411 SizeToPreferredSize(); | 411 SizeToPreferredSize(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 #if defined(OS_WIN) | 414 bool Label::GetAccessibleRole(AccessibilityTypes::Role* role) { |
| 415 bool Label::GetAccessibleRole(VARIANT* role) { | |
| 416 DCHECK(role); | 415 DCHECK(role); |
| 417 | 416 |
| 418 role->vt = VT_I4; | 417 *role = AccessibilityTypes::ROLE_TEXT; |
| 419 role->lVal = ROLE_SYSTEM_TEXT; | |
| 420 return true; | 418 return true; |
| 421 } | 419 } |
| 422 | 420 |
| 423 bool Label::GetAccessibleName(std::wstring* name) { | 421 bool Label::GetAccessibleName(std::wstring* name) { |
| 424 *name = GetText(); | 422 *name = GetText(); |
| 425 return true; | 423 return true; |
| 426 } | 424 } |
| 427 | 425 |
| 428 bool Label::GetAccessibleState(VARIANT* state) { | 426 bool Label::GetAccessibleState(AccessibilityTypes::State* state) { |
| 429 DCHECK(state); | 427 DCHECK(state); |
| 430 | 428 |
| 431 state->lVal |= STATE_SYSTEM_READONLY; | 429 *state = AccessibilityTypes::STATE_READONLY; |
| 432 return true; | 430 return true; |
| 433 } | 431 } |
| 434 #endif // defined(OS_WIN) | |
| 435 | 432 |
| 436 } // namespace views | 433 } // namespace views |
| OLD | NEW |