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 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "ui/base/animation/animation_delegate.h" | 9 #include "ui/base/animation/animation_delegate.h" |
10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
11 #include "ui/views/widget/widget.h" | |
12 #include "ui/views/widget/widget_delegate.h" | 11 #include "ui/views/widget/widget_delegate.h" |
| 12 #include "ui/views/widget/widget_observer.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 class SlideAnimation; | 15 class SlideAnimation; |
16 } // namespace ui | 16 } |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 | 19 |
20 class BubbleFrameView; | 20 class BubbleFrameView; |
21 | 21 |
22 // BubbleDelegateView creates frame and client views for bubble Widgets. | 22 // BubbleDelegateView creates frame and client views for bubble Widgets. |
23 // BubbleDelegateView itself is the client's contents view. | 23 // BubbleDelegateView itself is the client's contents view. |
24 // | 24 // |
25 /////////////////////////////////////////////////////////////////////////////// | 25 /////////////////////////////////////////////////////////////////////////////// |
26 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, | 26 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, |
27 public ui::AnimationDelegate, | 27 public ui::AnimationDelegate, |
28 public Widget::Observer { | 28 public WidgetObserver { |
29 public: | 29 public: |
30 // The default bubble background color. | 30 // The default bubble background color. |
31 static const SkColor kBackgroundColor; | 31 static const SkColor kBackgroundColor; |
32 | 32 |
33 BubbleDelegateView(); | 33 BubbleDelegateView(); |
34 BubbleDelegateView(View* anchor_view, | 34 BubbleDelegateView(View* anchor_view, |
35 BubbleBorder::ArrowLocation arrow_location); | 35 BubbleBorder::ArrowLocation arrow_location); |
36 virtual ~BubbleDelegateView(); | 36 virtual ~BubbleDelegateView(); |
37 | 37 |
38 // Create and initialize the bubble Widget(s) with proper bounds. | 38 // Create and initialize the bubble Widget(s) with proper bounds. |
39 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); | 39 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); |
40 | 40 |
41 // WidgetDelegate overrides: | 41 // WidgetDelegate overrides: |
42 virtual View* GetInitiallyFocusedView() OVERRIDE; | 42 virtual View* GetInitiallyFocusedView() OVERRIDE; |
43 virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE; | 43 virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE; |
44 virtual View* GetContentsView() OVERRIDE; | 44 virtual View* GetContentsView() OVERRIDE; |
45 virtual NonClientFrameView* CreateNonClientFrameView( | 45 virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; |
46 views::Widget* widget) OVERRIDE; | |
47 | 46 |
48 // Widget::Observer overrides: | 47 // WidgetObserver overrides: |
49 virtual void OnWidgetClosing(Widget* widget) OVERRIDE; | 48 virtual void OnWidgetClosing(Widget* widget) OVERRIDE; |
50 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE; | 49 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE; |
51 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; | 50 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; |
52 virtual void OnWidgetMoved(Widget* widget) OVERRIDE; | 51 virtual void OnWidgetMoved(Widget* widget) OVERRIDE; |
53 | 52 |
54 bool close_on_esc() const { return close_on_esc_; } | 53 bool close_on_esc() const { return close_on_esc_; } |
55 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } | 54 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } |
56 | 55 |
57 bool close_on_deactivate() const { return close_on_deactivate_; } | 56 bool close_on_deactivate() const { return close_on_deactivate_; } |
58 void set_close_on_deactivate(bool close_on_deactivate) { | 57 void set_close_on_deactivate(bool close_on_deactivate) { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 169 |
171 // Parent native window of the bubble. | 170 // Parent native window of the bubble. |
172 gfx::NativeView parent_window_; | 171 gfx::NativeView parent_window_; |
173 | 172 |
174 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 173 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
175 }; | 174 }; |
176 | 175 |
177 } // namespace views | 176 } // namespace views |
178 | 177 |
179 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 178 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
OLD | NEW |