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"
16 class ThrobberView
: public View
{
18 ThrobberView() : throbber_(new Throbber()) {
19 AddChildView(throbber_
);
23 gfx::Size
GetPreferredSize() const override
{
24 return gfx::Size(width(), height());
27 void Layout() override
{
29 throbber_
->SetBounds((width() - diameter
) / 2,
30 (height() - diameter
) / 2,
32 SizeToPreferredSize();
38 DISALLOW_COPY_AND_ASSIGN(ThrobberView
);
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