| OLD | NEW |
| 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 #include "ui/views/controls/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
| 10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 base::i18n::AdjustStringForLocaleDirection(&text); | 586 base::i18n::AdjustStringForLocaleDirection(&text); |
| 587 | 587 |
| 588 menu->AppendMenuItem(i + kFirstMenuItemId, text, MenuItemView::NORMAL); | 588 menu->AppendMenuItem(i + kFirstMenuItemId, text, MenuItemView::NORMAL); |
| 589 max_width = std::max(max_width, gfx::GetStringWidth(text, font_list)); | 589 max_width = std::max(max_width, gfx::GetStringWidth(text, font_list)); |
| 590 } | 590 } |
| 591 | 591 |
| 592 content_size_.SetSize(max_width, font_list.GetHeight()); | 592 content_size_.SetSize(max_width, font_list.GetHeight()); |
| 593 } | 593 } |
| 594 | 594 |
| 595 void Combobox::UpdateBorder() { | 595 void Combobox::UpdateBorder() { |
| 596 FocusableBorder* border = new FocusableBorder(); | 596 scoped_ptr<FocusableBorder> border(new FocusableBorder()); |
| 597 if (style_ == STYLE_NOTIFY_ON_CLICK) | 597 if (style_ == STYLE_NOTIFY_ON_CLICK) |
| 598 border->SetInsets(8, 13, 8, 13); | 598 border->SetInsets(8, 13, 8, 13); |
| 599 if (invalid_) | 599 if (invalid_) |
| 600 border->SetColor(kWarningColor); | 600 border->SetColor(kWarningColor); |
| 601 set_border(border); | 601 SetBorder(border.PassAs<Border>()); |
| 602 } | 602 } |
| 603 | 603 |
| 604 void Combobox::AdjustBoundsForRTLUI(gfx::Rect* rect) const { | 604 void Combobox::AdjustBoundsForRTLUI(gfx::Rect* rect) const { |
| 605 rect->set_x(GetMirroredXForRect(*rect)); | 605 rect->set_x(GetMirroredXForRect(*rect)); |
| 606 } | 606 } |
| 607 | 607 |
| 608 void Combobox::PaintText(gfx::Canvas* canvas) { | 608 void Combobox::PaintText(gfx::Canvas* canvas) { |
| 609 gfx::Insets insets = GetInsets(); | 609 gfx::Insets insets = GetInsets(); |
| 610 | 610 |
| 611 gfx::ScopedCanvas scoped_canvas(canvas); | 611 gfx::ScopedCanvas scoped_canvas(canvas); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 790 |
| 791 void Combobox::HandleClickEvent() { | 791 void Combobox::HandleClickEvent() { |
| 792 if (style_ != STYLE_NOTIFY_ON_CLICK) | 792 if (style_ != STYLE_NOTIFY_ON_CLICK) |
| 793 return; | 793 return; |
| 794 | 794 |
| 795 if (listener_) | 795 if (listener_) |
| 796 listener_->OnComboboxTextButtonClicked(this); | 796 listener_->OnComboboxTextButtonClicked(this); |
| 797 } | 797 } |
| 798 | 798 |
| 799 } // namespace views | 799 } // namespace views |
| OLD | NEW |