OLD | NEW |
(Empty) | |
| 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 "views/examples/slider_example.h" |
| 6 |
| 7 #include "build/build_config.h" |
| 8 #include "views/fill_layout.h" |
| 9 |
| 10 namespace examples { |
| 11 |
| 12 SliderExample::SliderExample(ExamplesMain* main) : ExampleBase(main) { |
| 13 } |
| 14 |
| 15 SliderExample::~SliderExample() { |
| 16 } |
| 17 |
| 18 std::wstring SliderExample::GetExampleTitle() { |
| 19 return L"Slider"; |
| 20 } |
| 21 |
| 22 void SliderExample::CreateExampleView(views::View* container) { |
| 23 #if !defined(OS_WIN) && !defined(OS_MACOSX) |
| 24 const double min = 0.0; |
| 25 const double max = 100.0; |
| 26 const double step = 1.0; |
| 27 slider_ = new views::Slider(min, max, step, |
| 28 views::Slider::STYLE_DRAW_VALUE, this); |
| 29 |
| 30 container->SetLayoutManager(new views::FillLayout); |
| 31 container->AddChildView(slider_); |
| 32 #endif |
| 33 } |
| 34 |
| 35 void SliderExample::SliderValueChanged(views::Slider* sender) { |
| 36 PrintStatus(L"Value: %.1f", sender->value()); |
| 37 } |
| 38 |
| 39 } // namespace examples |
OLD | NEW |