Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / ui / views / examples / throbber_example.cc
blob3333e5b0c946bb552ab992f92d30bd1c606eb7f5
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.
5 #include "ui/views/examples/throbber_example.h"
7 #include "ui/views/controls/throbber.h"
8 #include "ui/views/layout/fill_layout.h"
9 #include "ui/views/view.h"
11 namespace views {
12 namespace examples {
14 namespace {
16 class ThrobberView : public View {
17 public:
18 ThrobberView() : throbber_(new Throbber()) {
19 AddChildView(throbber_);
20 throbber_->Start();
23 gfx::Size GetPreferredSize() const override {
24 return gfx::Size(width(), height());
27 void Layout() override {
28 int diameter = 64;
29 throbber_->SetBounds((width() - diameter) / 2,
30 (height() - diameter) / 2,
31 diameter, diameter);
32 SizeToPreferredSize();
35 private:
36 Throbber* throbber_;
38 DISALLOW_COPY_AND_ASSIGN(ThrobberView);
41 } // namespace
43 ThrobberExample::ThrobberExample() : ExampleBase("Throbber") {
46 ThrobberExample::~ThrobberExample() {
49 void ThrobberExample::CreateExampleView(View* container) {
50 container->SetLayoutManager(new FillLayout());
51 container->AddChildView(new ThrobberView());
54 } // namespace examples
55 } // namespace views