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 "views/examples/bubble_example.h" | 5 #include "views/examples/bubble_example.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "views/bubble/bubble_delegate.h" | 8 #include "views/bubble/bubble_delegate.h" |
9 #include "views/controls/button/text_button.h" | 9 #include "views/controls/button/text_button.h" |
10 #include "views/controls/label.h" | 10 #include "views/controls/label.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 config = kFadeInConfig; | 81 config = kFadeInConfig; |
82 else if (sender == fade_out_) | 82 else if (sender == fade_out_) |
83 config = kFadeOutConfig; | 83 config = kFadeOutConfig; |
84 | 84 |
85 config.anchor_point.set_x(sender->width() / 2); | 85 config.anchor_point.set_x(sender->width() / 2); |
86 config.anchor_point.set_y(sender->height() / 2); | 86 config.anchor_point.set_y(sender->height() / 2); |
87 views::View::ConvertPointToScreen(sender, &config.anchor_point); | 87 views::View::ConvertPointToScreen(sender, &config.anchor_point); |
88 | 88 |
89 ExampleBubbleDelegateView* bubble_delegate = | 89 ExampleBubbleDelegateView* bubble_delegate = |
90 new ExampleBubbleDelegateView(config); | 90 new ExampleBubbleDelegateView(config); |
91 views::Widget* bubble = views::BubbleDelegateView::CreateBubble( | 91 views::BubbleDelegateView::CreateBubble(bubble_delegate, |
92 bubble_delegate, example_view()->GetWidget()); | 92 example_view()->GetWidget()); |
93 | 93 |
94 if (config.fade_in) | 94 if (config.fade_in) |
95 bubble_delegate->StartFade(true); | 95 bubble_delegate->StartFade(true); |
96 else | 96 else |
97 bubble->Show(); | 97 bubble_delegate->Show(); |
98 | 98 |
99 if (config.fade_out) { | 99 if (config.fade_out) { |
100 bubble_delegate->set_close_on_esc(false); | 100 bubble_delegate->set_close_on_esc(false); |
101 bubble_delegate->StartFade(false); | 101 bubble_delegate->StartFade(false); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 } // namespace examples | 105 } // namespace examples |
OLD | NEW |