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/examples/button_example.h" | 5 #include "ui/views/examples/button_example.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); | 48 rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); |
49 image_button_->SetImage(ImageButton::BS_HOT, | 49 image_button_->SetImage(ImageButton::BS_HOT, |
50 rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); | 50 rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); |
51 image_button_->SetImage(ImageButton::BS_PUSHED, | 51 image_button_->SetImage(ImageButton::BS_PUSHED, |
52 rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia()); | 52 rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia()); |
53 image_button_->SetOverlayImage(rb.GetImageNamed( | 53 image_button_->SetOverlayImage(rb.GetImageNamed( |
54 IDR_MENU_CHECK).ToImageSkia()); | 54 IDR_MENU_CHECK).ToImageSkia()); |
55 container->AddChildView(image_button_); | 55 container->AddChildView(image_button_); |
56 } | 56 } |
57 | 57 |
58 void ButtonExample::ButtonPressed(Button* sender, const Event& event) { | 58 void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) { |
59 PrintStatus("Pressed! count: %d", ++count_); | 59 PrintStatus("Pressed! count: %d", ++count_); |
60 | 60 |
61 if (event.IsControlDown()) { | 61 if (event.IsControlDown()) { |
62 if (event.IsShiftDown()) { | 62 if (event.IsShiftDown()) { |
63 if (event.IsAltDown()) { | 63 if (event.IsAltDown()) { |
64 text_button_->SetMultiLine(!text_button_->multi_line()); | 64 text_button_->SetMultiLine(!text_button_->multi_line()); |
65 if (text_button_->multi_line()) { | 65 if (text_button_->multi_line()) { |
66 text_button_->SetText(ASCIIToUTF16("Multi-line text\n") + | 66 text_button_->SetText(ASCIIToUTF16("Multi-line text\n") + |
67 ASCIIToUTF16("is here to stay all the way!\n") + | 67 ASCIIToUTF16("is here to stay all the way!\n") + |
68 ASCIIToUTF16("123")); | 68 ASCIIToUTF16("123")); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 text_button_->set_border(new TextButtonBorder()); | 118 text_button_->set_border(new TextButtonBorder()); |
119 } | 119 } |
120 } else if (event.IsAltDown()) { | 120 } else if (event.IsAltDown()) { |
121 text_button_->SetIsDefault(!text_button_->is_default()); | 121 text_button_->SetIsDefault(!text_button_->is_default()); |
122 } | 122 } |
123 example_view()->GetLayoutManager()->Layout(example_view()); | 123 example_view()->GetLayoutManager()->Layout(example_view()); |
124 } | 124 } |
125 | 125 |
126 } // namespace examples | 126 } // namespace examples |
127 } // namespace views | 127 } // namespace views |
OLD | NEW |