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_TRAY_BUBBLE_VIEW_H_ | 5 #ifndef UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" |
8 #include "ui/views/bubble/bubble_delegate.h" | 9 #include "ui/views/bubble/bubble_delegate.h" |
9 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
10 | 11 |
11 // Specialized bubble view for bubbles associated with a tray icon (e.g. the | 12 // Specialized bubble view for bubbles associated with a tray icon (e.g. the |
12 // Ash status area). Mostly this handles custom anchor location and arrow and | 13 // Ash status area). Mostly this handles custom anchor location and arrow and |
13 // border rendering. This also has its own delegate for handling mouse events | 14 // border rendering. This also has its own delegate for handling mouse events |
14 // and other implementation specific details. | 15 // and other implementation specific details. |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 class LocatedEvent; | 18 class LocatedEvent; |
18 } | 19 } |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 class View; | 22 class View; |
22 class Widget; | 23 class Widget; |
23 } | 24 } |
24 | 25 |
25 namespace views { | 26 namespace views { |
26 | 27 |
27 namespace internal { | 28 namespace internal { |
28 class TrayBubbleBorder; | 29 class TrayBubbleBorder; |
29 class TrayBubbleBackground; | 30 class TrayBubbleContentMask; |
30 } | 31 } |
31 | 32 |
32 class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView { | 33 class VIEWS_EXPORT TrayBubbleView : public views::BubbleDelegateView { |
33 public: | 34 public: |
34 enum AnchorType { | 35 enum AnchorType { |
35 ANCHOR_TYPE_TRAY, | 36 ANCHOR_TYPE_TRAY, |
36 ANCHOR_TYPE_BUBBLE | 37 ANCHOR_TYPE_BUBBLE |
37 }; | 38 }; |
38 | 39 |
39 enum AnchorAlignment { | 40 enum AnchorAlignment { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 82 |
82 InitParams(AnchorType anchor_type, | 83 InitParams(AnchorType anchor_type, |
83 AnchorAlignment anchor_alignment, | 84 AnchorAlignment anchor_alignment, |
84 int bubble_width); | 85 int bubble_width); |
85 AnchorType anchor_type; | 86 AnchorType anchor_type; |
86 AnchorAlignment anchor_alignment; | 87 AnchorAlignment anchor_alignment; |
87 int bubble_width; | 88 int bubble_width; |
88 int max_height; | 89 int max_height; |
89 bool can_activate; | 90 bool can_activate; |
90 bool close_on_deactivate; | 91 bool close_on_deactivate; |
91 SkColor top_color; | |
92 SkColor arrow_color; | 92 SkColor arrow_color; |
93 views::BubbleBorder::ArrowLocation arrow_location; | 93 views::BubbleBorder::ArrowLocation arrow_location; |
94 int arrow_offset; | 94 int arrow_offset; |
95 views::BubbleBorder::Shadow shadow; | 95 views::BubbleBorder::Shadow shadow; |
96 }; | 96 }; |
97 | 97 |
98 // Constructs and returns a TrayBubbleView. init_params may be modified. | 98 // Constructs and returns a TrayBubbleView. init_params may be modified. |
99 static TrayBubbleView* Create(gfx::NativeView parent_window, | 99 static TrayBubbleView* Create(gfx::NativeView parent_window, |
100 views::View* anchor, | 100 views::View* anchor, |
101 Delegate* delegate, | 101 Delegate* delegate, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // Overridden from views::View. | 155 // Overridden from views::View. |
156 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 156 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
157 virtual void ViewHierarchyChanged(bool is_add, | 157 virtual void ViewHierarchyChanged(bool is_add, |
158 views::View* parent, | 158 views::View* parent, |
159 views::View* child) OVERRIDE; | 159 views::View* child) OVERRIDE; |
160 | 160 |
161 private: | 161 private: |
162 InitParams params_; | 162 InitParams params_; |
163 Delegate* delegate_; | 163 Delegate* delegate_; |
164 internal::TrayBubbleBorder* bubble_border_; | 164 internal::TrayBubbleBorder* bubble_border_; |
165 internal::TrayBubbleBackground* bubble_background_; | 165 scoped_ptr<internal::TrayBubbleContentMask> bubble_content_mask_; |
166 bool is_gesture_dragging_; | 166 bool is_gesture_dragging_; |
167 | 167 |
168 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); | 168 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); |
169 }; | 169 }; |
170 | 170 |
171 } // namespace views | 171 } // namespace views |
172 | 172 |
173 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 173 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
OLD | NEW |