| 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 "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 20 matching lines...) Expand all Loading... |
| 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 ExampleBubbleDelegateView(const BubbleConfig& config) |
| 41 : BubbleDelegateView(config.anchor_view, config.arrow, config.color), | 41 : BubbleDelegateView(config.anchor_view, config.arrow), |
| 42 label_(config.label) {} | 42 label_(config.label) { |
| 43 set_color(config.color); |
| 44 } |
| 43 | 45 |
| 44 protected: | 46 protected: |
| 45 virtual void Init() OVERRIDE { | 47 virtual void Init() OVERRIDE { |
| 46 SetLayoutManager(new FillLayout()); | 48 SetLayoutManager(new FillLayout()); |
| 47 Label* label = new Label(label_); | 49 Label* label = new Label(label_); |
| 48 AddChildView(label); | 50 AddChildView(label); |
| 49 } | 51 } |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 string16 label_; | 54 string16 label_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 bubble_delegate->Show(); | 93 bubble_delegate->Show(); |
| 92 | 94 |
| 93 if (config.fade_out) { | 95 if (config.fade_out) { |
| 94 bubble_delegate->set_close_on_esc(false); | 96 bubble_delegate->set_close_on_esc(false); |
| 95 bubble_delegate->StartFade(false); | 97 bubble_delegate->StartFade(false); |
| 96 } | 98 } |
| 97 } | 99 } |
| 98 | 100 |
| 99 } // namespace examples | 101 } // namespace examples |
| 100 } // namespace views | 102 } // namespace views |
| OLD | NEW |