1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ui/views/examples/checkbox_example.h" 6 7 #include "base/strings/stringprintf.h" 8 #include "base/strings/utf_string_conversions.h" 9 #include "ui/views/controls/button/checkbox.h" 10 #include "ui/views/controls/button/radio_button.h" 11 #include "ui/views/layout/fill_layout.h" 12 13 namespace views { 14 namespace examples { 15 CheckboxExample()16CheckboxExample::CheckboxExample() : ExampleBase("Checkbox"), count_(0) { 17 } 18 ~CheckboxExample()19CheckboxExample::~CheckboxExample() { 20 } 21 CreateExampleView(View * container)22void CheckboxExample::CreateExampleView(View* container) { 23 button_ = new Checkbox(base::ASCIIToUTF16("Checkbox")); 24 button_->set_listener(this); 25 container->SetLayoutManager(new FillLayout); 26 container->AddChildView(button_); 27 } 28 ButtonPressed(Button * sender,const ui::Event & event)29void CheckboxExample::ButtonPressed(Button* sender, const ui::Event& event) { 30 PrintStatus("Pressed! count: %d", ++count_); 31 } 32 33 } // namespace examples 34 } // namespace views 35