summaryrefslogtreecommitdiffstats
path: root/views/examples/bubble_example.h
blob: 0201b003c51fe854712b2acd458f9fe74401d68e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) 2011 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.

#ifndef VIEWS_EXAMPLES_BUBBLE_EXAMPLE_H_
#define VIEWS_EXAMPLES_BUBBLE_EXAMPLE_H_
#pragma once

#include <string>

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/base/animation/animation_delegate.h"
#include "views/controls/button/text_button.h"
#include "views/examples/example_base.h"
#include "views/layout/box_layout.h"
#include "views/layout/grid_layout.h"
#include "views/widget/widget.h"

namespace views {
class BubbleDelegateView;
class Button;
class ColumnSet;
}  // namespace views

namespace examples {
struct BubbleConfig;

// A Bubble example.
class BubbleExample : public ExampleBase,
                      public ui::AnimationDelegate,
                      public views::ButtonListener {
 public:
  explicit BubbleExample(ExamplesMain* main);
  virtual ~BubbleExample();

  // Overridden from ExampleBase.
  virtual void CreateExampleView(views::View* container) OVERRIDE;

 private:
  virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;

  virtual void ButtonPressed(views::Button* sender,
                             const views::Event& event) OVERRIDE;

  // Add a bubble view in the example
  views::Widget* AddBubbleButton(const BubbleConfig& config);

  views::Button* round_;
  views::Button* pointy_;
  views::Button* fade_;
  views::BoxLayout* layout_;

  views::Widget* round_bubble_;
  views::Widget* pointy_bubble_;
  views::Widget* fade_bubble_;

  DISALLOW_COPY_AND_ASSIGN(BubbleExample);
};

}  // namespace examples

#endif  // VIEWS_EXAMPLES_BUBBLE_EXAMPLE_H_