| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| 11 #include "ui/views/layout/box_layout.h" | 11 #include "ui/views/layout/box_layout.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 30 BubbleBorder::NONE, false, false }; | 30 BubbleBorder::NONE, false, false }; |
| 31 BubbleConfig kArrowConfig = { ASCIIToUTF16("Arrow"), SK_ColorGRAY, NULL, | 31 BubbleConfig kArrowConfig = { ASCIIToUTF16("Arrow"), SK_ColorGRAY, NULL, |
| 32 BubbleBorder::TOP_LEFT, false, false }; | 32 BubbleBorder::TOP_LEFT, false, false }; |
| 33 BubbleConfig kFadeInConfig = { ASCIIToUTF16("FadeIn"), SK_ColorYELLOW, NULL, | 33 BubbleConfig kFadeInConfig = { ASCIIToUTF16("FadeIn"), SK_ColorYELLOW, NULL, |
| 34 BubbleBorder::BOTTOM_RIGHT, true, false }; | 34 BubbleBorder::BOTTOM_RIGHT, true, false }; |
| 35 BubbleConfig kFadeOutConfig = { ASCIIToUTF16("FadeOut"), SK_ColorWHITE, NULL, | 35 BubbleConfig kFadeOutConfig = { ASCIIToUTF16("FadeOut"), SK_ColorWHITE, NULL, |
| 36 BubbleBorder::LEFT_TOP, false, true }; | 36 BubbleBorder::LEFT_TOP, false, true }; |
| 37 | 37 |
| 38 class ExampleBubbleDelegateView : public BubbleDelegateView { | 38 class ExampleBubbleDelegateView : public BubbleDelegateView { |
| 39 public: | 39 public: |
| 40 ExampleBubbleDelegateView(const BubbleConfig& config) | 40 explicit ExampleBubbleDelegateView(const BubbleConfig& config) |
| 41 : BubbleDelegateView(config.anchor_view, config.arrow), | 41 : BubbleDelegateView(config.anchor_view, config.arrow), |
| 42 label_(config.label) { | 42 label_(config.label) { |
| 43 set_color(config.color); | 43 set_color(config.color); |
| 44 } | 44 } |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 virtual void Init() OVERRIDE { | 47 virtual void Init() OVERRIDE { |
| 48 SetLayoutManager(new FillLayout()); | 48 SetLayoutManager(new FillLayout()); |
| 49 Label* label = new Label(label_); | 49 Label* label = new Label(label_); |
| 50 AddChildView(label); | 50 AddChildView(label); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |