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

Unified Diff: ui/views/examples/progress_bar_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/examples/progress_bar_example.h ('k') | ui/views/examples/radio_button_example.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/examples/progress_bar_example.cc
diff --git a/ui/views/examples/progress_bar_example.cc b/ui/views/examples/progress_bar_example.cc
deleted file mode 100644
index 8a860f212affcb3154900955e8baa803f8b1c530..0000000000000000000000000000000000000000
--- a/ui/views/examples/progress_bar_example.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/views/examples/progress_bar_example.h"
-
-#include <algorithm>
-
-#include "base/strings/utf_string_conversions.h"
-#include "ui/views/controls/button/label_button.h"
-#include "ui/views/controls/progress_bar.h"
-#include "ui/views/layout/grid_layout.h"
-#include "ui/views/view.h"
-
-namespace {
-
-const double kStepSize = 0.1;
-
-double SetToMax(double percent) {
- return std::min(std::max(percent, 0.0), 1.0);
-}
-
-} // namespace
-
-namespace views {
-namespace examples {
-
-ProgressBarExample::ProgressBarExample()
- : ExampleBase("Progress Bar"),
- minus_button_(NULL),
- plus_button_(NULL),
- progress_bar_(NULL),
- current_percent_(0.0) {
-}
-
-ProgressBarExample::~ProgressBarExample() {
-}
-
-void ProgressBarExample::CreateExampleView(View* container) {
- GridLayout* layout = new GridLayout(container);
- container->SetLayoutManager(layout);
-
- ColumnSet* column_set = layout->AddColumnSet(0);
- column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL,
- 0, GridLayout::USE_PREF, 0, 0);
- column_set->AddPaddingColumn(0, 8);
- column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
- 1, GridLayout::USE_PREF, 0, 0);
- column_set->AddPaddingColumn(0, 8);
- column_set->AddColumn(GridLayout::TRAILING, GridLayout::FILL,
- 0, GridLayout::USE_PREF, 0, 0);
-
- layout->StartRow(0, 0);
- minus_button_ = new LabelButton(this, base::ASCIIToUTF16("-"));
- layout->AddView(minus_button_);
- progress_bar_ = new ProgressBar();
- layout->AddView(progress_bar_);
- plus_button_ = new LabelButton(this, base::ASCIIToUTF16("+"));
- layout->AddView(plus_button_);
-}
-
-void ProgressBarExample::ButtonPressed(Button* sender, const ui::Event& event) {
- if (sender == minus_button_)
- current_percent_ = SetToMax(current_percent_ - kStepSize);
- else if (sender == plus_button_)
- current_percent_ = SetToMax(current_percent_ + kStepSize);
-
- progress_bar_->SetValue(current_percent_);
-}
-
-} // namespace examples
-} // namespace views
« no previous file with comments | « ui/views/examples/progress_bar_example.h ('k') | ui/views/examples/radio_button_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698