Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: ui/views/examples/slider_example.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/examples/slider_example.h ('k') | ui/views/examples/tabbed_pane_example.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/examples/slider_example.h"
6
7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "ui/views/controls/label.h"
10 #include "ui/views/layout/box_layout.h"
11 #include "ui/views/view.h"
12
13 namespace views {
14 namespace examples {
15
16 SliderExample::SliderExample()
17 : ExampleBase("Slider"),
18 slider_(NULL),
19 label_(NULL) {
20 }
21
22 SliderExample::~SliderExample() {
23 }
24
25 void SliderExample::CreateExampleView(View* container) {
26 label_ = new Label();
27 slider_ = new Slider(this, Slider::HORIZONTAL);
28
29 slider_->SetValue(0.5);
30
31 container->SetLayoutManager(new BoxLayout(BoxLayout::kHorizontal, 3, 3, 3));
32 container->AddChildView(slider_);
33 container->AddChildView(label_);
34 }
35
36 void SliderExample::SliderValueChanged(Slider* sender,
37 float value,
38 float old_value,
39 SliderChangeReason reason) {
40 label_->SetText(base::ASCIIToUTF16(base::StringPrintf("%.3lf", value)));
41 }
42
43 } // namespace examples
44 } // namespace views
45
OLDNEW
« no previous file with comments | « ui/views/examples/slider_example.h ('k') | ui/views/examples/tabbed_pane_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698