OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "views/bubble/bubble_border.h" | 6 #include "views/bubble/bubble_border.h" |
7 #include "views/bubble/bubble_delegate.h" | 7 #include "views/bubble/bubble_delegate.h" |
8 #include "views/bubble/bubble_view.h" | 8 #include "views/bubble/bubble_view.h" |
9 #include "views/controls/label.h" | 9 #include "views/controls/label.h" |
10 #include "views/widget/widget.h" | 10 #include "views/widget/widget.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void CreateBubble(const BubbleConfig& config, | 44 void CreateBubble(const BubbleConfig& config, |
45 gfx::NativeWindow parent) { | 45 gfx::NativeWindow parent) { |
46 views::Widget* bubble_widget = new views::Widget; | 46 views::Widget* bubble_widget = new views::Widget; |
47 views::Widget::InitParams params(views::Widget::InitParams::TYPE_BUBBLE); | 47 views::Widget::InitParams params(views::Widget::InitParams::TYPE_BUBBLE); |
48 params.delegate = new ExampleBubbleDelegateView(config, bubble_widget); | 48 params.delegate = new ExampleBubbleDelegateView(config, bubble_widget); |
49 params.transparent = true; | 49 params.transparent = true; |
50 params.bounds = config.bound; | 50 params.bounds = config.bound; |
51 params.parent = parent; | 51 params.parent = parent; |
52 bubble_widget->Init(params); | 52 bubble_widget->Init(params); |
53 bubble_widget->client_view()->AsBubbleView()->AddChildView( | 53 bubble_widget->client_view()->AsBubbleView()->AddChildView( |
54 new views::Label(L"I am a " + config.label)); | 54 new views::Label(L"I am a " + UTF16ToWideHack(config.label))); |
55 } | 55 } |
56 | 56 |
57 void CreatePointyBubble(gfx::NativeWindow parent, const gfx::Point& origin) { | 57 void CreatePointyBubble(gfx::NativeWindow parent, const gfx::Point& origin) { |
58 BubbleConfig config; | 58 BubbleConfig config; |
59 config.label = ASCIIToUTF16("PointyBubble"); | 59 config.label = ASCIIToUTF16("PointyBubble"); |
60 config.color = SK_ColorWHITE; | 60 config.color = SK_ColorWHITE; |
61 config.bound = gfx::Rect(origin.x(), origin.y(), 180, 180); | 61 config.bound = gfx::Rect(origin.x(), origin.y(), 180, 180); |
62 config.arrow = views::BubbleBorder::TOP_LEFT; | 62 config.arrow = views::BubbleBorder::TOP_LEFT; |
63 config.fade_out = false; | 63 config.fade_out = false; |
64 CreateBubble(config, parent); | 64 CreateBubble(config, parent); |
65 } | 65 } |
66 | 66 |
67 } // namespace examples | 67 } // namespace examples |
68 } // namespace aura_shell | 68 } // namespace aura_shell |
OLD | NEW |