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 #ifndef VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 5 #ifndef VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
6 #define VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 6 #define VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/base/animation/animation_delegate.h" | 9 #include "ui/base/animation/animation_delegate.h" |
10 #include "views/bubble/bubble_border.h" | 10 #include "views/bubble/bubble_border.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 const SkColor& color); | 32 const SkColor& color); |
33 virtual ~BubbleDelegateView(); | 33 virtual ~BubbleDelegateView(); |
34 | 34 |
35 // Create a bubble Widget from the argument BubbleDelegateView. | 35 // Create a bubble Widget from the argument BubbleDelegateView. |
36 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate, | 36 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate, |
37 Widget* parent_widget); | 37 Widget* parent_widget); |
38 | 38 |
39 // WidgetDelegate overrides: | 39 // WidgetDelegate overrides: |
40 virtual View* GetInitiallyFocusedView() OVERRIDE; | 40 virtual View* GetInitiallyFocusedView() OVERRIDE; |
41 virtual View* GetContentsView() OVERRIDE; | 41 virtual View* GetContentsView() OVERRIDE; |
42 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; | |
43 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 42 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
44 | 43 |
45 bool close_on_esc() const { return close_on_esc_; } | 44 bool close_on_esc() const { return close_on_esc_; } |
46 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } | 45 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } |
47 | 46 |
48 // Get the arrow's anchor point in screen space. | 47 // Get the arrow's anchor point in screen space. |
49 virtual gfx::Point GetAnchorPoint(); | 48 virtual gfx::Point GetAnchorPoint(); |
50 | 49 |
51 // Get the arrow's location on the bubble. | 50 // Get the arrow's location on the bubble. |
52 virtual BubbleBorder::ArrowLocation GetArrowLocation() const; | 51 virtual BubbleBorder::ArrowLocation GetArrowLocation() const; |
53 | 52 |
54 // Get the color used for the background and border. | 53 // Get the color used for the background and border. |
55 virtual SkColor GetColor() const; | 54 virtual SkColor GetColor() const; |
56 | 55 |
| 56 // Show the bubble's widget (and |border_widget_| on Windows). |
| 57 void Show(); |
| 58 |
57 // Fade the bubble in or out via Widget transparency. | 59 // Fade the bubble in or out via Widget transparency. |
58 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. | 60 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. |
59 void StartFade(bool fade_in); | 61 void StartFade(bool fade_in); |
60 | 62 |
61 protected: | 63 protected: |
62 // View overrides: | 64 // View overrides: |
63 virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE; | 65 virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE; |
64 | 66 |
65 // Perform view initialization on the contents for bubble sizing. | 67 // Perform view initialization on the contents for bubble sizing. |
66 virtual void Init(); | 68 virtual void Init(); |
(...skipping 16 matching lines...) Expand all Loading... |
83 bool close_on_esc_; | 85 bool close_on_esc_; |
84 | 86 |
85 // The screen point where this bubble's arrow is anchored. | 87 // The screen point where this bubble's arrow is anchored. |
86 gfx::Point anchor_point_; | 88 gfx::Point anchor_point_; |
87 | 89 |
88 // The arrow's location on the bubble. | 90 // The arrow's location on the bubble. |
89 BubbleBorder::ArrowLocation arrow_location_; | 91 BubbleBorder::ArrowLocation arrow_location_; |
90 | 92 |
91 // The background color of the bubble. | 93 // The background color of the bubble. |
92 SkColor color_; | 94 SkColor color_; |
| 95 |
| 96 // The widget hosting the border for this bubble (only used on Windows). |
| 97 Widget* border_widget_; |
| 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
93 }; | 100 }; |
94 | 101 |
95 } // namespace views | 102 } // namespace views |
96 | 103 |
97 #endif // VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 104 #endif // VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
OLD | NEW |