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 "base/strings/utf_string_conversions.h"
6 #include "ui/views/bubble/bubble_border.h"
7 #include "ui/views/bubble/bubble_delegate.h"
8 #include "ui/views/controls/label.h"
9 #include "ui/views/layout/fill_layout.h"
10 #include "ui/views/widget/widget.h"
17 views::View
* anchor_view
;
18 views::BubbleBorder::Arrow arrow
;
21 class ExampleBubbleDelegateView
: public views::BubbleDelegateView
{
23 ExampleBubbleDelegateView(const BubbleConfig
& config
)
24 : BubbleDelegateView(config
.anchor_view
, config
.arrow
),
25 label_(config
.label
) {}
27 virtual void Init() OVERRIDE
{
28 SetLayoutManager(new views::FillLayout());
29 views::Label
* label
= new views::Label(label_
);
34 base::string16 label_
;
37 void CreatePointyBubble(views::View
* anchor_view
) {
39 config
.label
= base::ASCIIToUTF16("PointyBubble");
40 config
.anchor_view
= anchor_view
;
41 config
.arrow
= views::BubbleBorder::TOP_LEFT
;
42 ExampleBubbleDelegateView
* bubble
= new ExampleBubbleDelegateView(config
);
43 views::BubbleDelegateView::CreateBubble(bubble
)->Show();