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/message_box_example.h" | 5 #include "ui/views/examples/message_box_example.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "ui/views/controls/message_box_view.h" | 8 #include "ui/views/controls/message_box_view.h" |
9 #include "ui/views/layout/grid_layout.h" | 9 #include "ui/views/layout/grid_layout.h" |
10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 0.5f, GridLayout::USE_PREF, 0, 0); | 42 0.5f, GridLayout::USE_PREF, 0, 0); |
43 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, | 43 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, |
44 0.5f, GridLayout::USE_PREF, 0, 0); | 44 0.5f, GridLayout::USE_PREF, 0, 0); |
45 | 45 |
46 layout->StartRow(0 /* no expand */, button_column); | 46 layout->StartRow(0 /* no expand */, button_column); |
47 | 47 |
48 layout->AddView(status_); | 48 layout->AddView(status_); |
49 layout->AddView(toggle_); | 49 layout->AddView(toggle_); |
50 } | 50 } |
51 | 51 |
52 void MessageBoxExample::ButtonPressed(Button* sender, const Event& event) { | 52 void MessageBoxExample::ButtonPressed(Button* sender, const ui::Event& event) { |
53 if (sender == status_) { | 53 if (sender == status_) { |
54 message_box_view_->SetCheckBoxLabel( | 54 message_box_view_->SetCheckBoxLabel( |
55 ASCIIToUTF16(BoolToOnOff(message_box_view_->IsCheckBoxSelected()))); | 55 ASCIIToUTF16(BoolToOnOff(message_box_view_->IsCheckBoxSelected()))); |
56 PrintStatus(message_box_view_->IsCheckBoxSelected() ? | 56 PrintStatus(message_box_view_->IsCheckBoxSelected() ? |
57 "Check Box Selected" : "Check Box Not Selected"); | 57 "Check Box Selected" : "Check Box Not Selected"); |
58 } else if (sender == toggle_) { | 58 } else if (sender == toggle_) { |
59 message_box_view_->SetCheckBoxSelected( | 59 message_box_view_->SetCheckBoxSelected( |
60 !message_box_view_->IsCheckBoxSelected()); | 60 !message_box_view_->IsCheckBoxSelected()); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 } // namespace examples | 64 } // namespace examples |
65 } // namespace views | 65 } // namespace views |
OLD | NEW |