OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/examples/bubble_example.h" | 5 #include "ui/views/examples/bubble_example.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "ui/views/bubble/bubble_delegate.h" | 8 #include "ui/views/bubble/bubble_delegate.h" |
9 #include "ui/views/controls/button/text_button.h" | 9 #include "ui/views/controls/button/text_button.h" |
10 #include "ui/views/controls/label.h" | 10 #include "ui/views/controls/label.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 round_ = new TextButton(this, kRoundConfig.label); | 64 round_ = new TextButton(this, kRoundConfig.label); |
65 arrow_ = new TextButton(this, kArrowConfig.label); | 65 arrow_ = new TextButton(this, kArrowConfig.label); |
66 fade_in_ = new TextButton(this, kFadeInConfig.label); | 66 fade_in_ = new TextButton(this, kFadeInConfig.label); |
67 fade_out_ = new TextButton(this, kFadeOutConfig.label); | 67 fade_out_ = new TextButton(this, kFadeOutConfig.label); |
68 container->AddChildView(round_); | 68 container->AddChildView(round_); |
69 container->AddChildView(arrow_); | 69 container->AddChildView(arrow_); |
70 container->AddChildView(fade_in_); | 70 container->AddChildView(fade_in_); |
71 container->AddChildView(fade_out_); | 71 container->AddChildView(fade_out_); |
72 } | 72 } |
73 | 73 |
74 void BubbleExample::ButtonPressed(Button* sender, const Event& event) { | 74 void BubbleExample::ButtonPressed(Button* sender, const ui::Event& event) { |
75 BubbleConfig config; | 75 BubbleConfig config; |
76 if (sender == round_) | 76 if (sender == round_) |
77 config = kRoundConfig; | 77 config = kRoundConfig; |
78 else if (sender == arrow_) | 78 else if (sender == arrow_) |
79 config = kArrowConfig; | 79 config = kArrowConfig; |
80 else if (sender == fade_in_) | 80 else if (sender == fade_in_) |
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_view = sender; | 85 config.anchor_view = sender; |
86 ExampleBubbleDelegateView* bubble_delegate = | 86 ExampleBubbleDelegateView* bubble_delegate = |
87 new ExampleBubbleDelegateView(config); | 87 new ExampleBubbleDelegateView(config); |
88 BubbleDelegateView::CreateBubble(bubble_delegate); | 88 BubbleDelegateView::CreateBubble(bubble_delegate); |
89 | 89 |
90 if (config.fade_in) | 90 if (config.fade_in) |
91 bubble_delegate->StartFade(true); | 91 bubble_delegate->StartFade(true); |
92 else | 92 else |
93 bubble_delegate->Show(); | 93 bubble_delegate->Show(); |
94 | 94 |
95 if (config.fade_out) { | 95 if (config.fade_out) { |
96 bubble_delegate->set_close_on_esc(false); | 96 bubble_delegate->set_close_on_esc(false); |
97 bubble_delegate->StartFade(false); | 97 bubble_delegate->StartFade(false); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 } // namespace examples | 101 } // namespace examples |
102 } // namespace views | 102 } // namespace views |
OLD | NEW |