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" |
(...skipping 27 matching lines...) Expand all Loading... |
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 BubbleDelegateView* AsBubbleDelegate() OVERRIDE; | 42 virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE; |
43 virtual bool CanActivate() const OVERRIDE; | 43 virtual bool CanActivate() const OVERRIDE; |
44 virtual bool ShouldShowCloseButton() const OVERRIDE; | 44 virtual bool ShouldShowCloseButton() const OVERRIDE; |
45 virtual View* GetContentsView() OVERRIDE; | 45 virtual View* GetContentsView() OVERRIDE; |
46 virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; | 46 virtual NonClientFrameView* CreateNonClientFrameView(Widget* widget) OVERRIDE; |
47 | 47 |
| 48 // WidgetDelegateView overrides: |
| 49 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 50 |
48 // WidgetObserver overrides: | 51 // WidgetObserver overrides: |
49 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; | 52 virtual void OnWidgetDestroying(Widget* widget) OVERRIDE; |
50 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE; | 53 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE; |
51 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; | 54 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; |
52 virtual void OnWidgetBoundsChanged(Widget* widget, | 55 virtual void OnWidgetBoundsChanged(Widget* widget, |
53 const gfx::Rect& new_bounds) OVERRIDE; | 56 const gfx::Rect& new_bounds) OVERRIDE; |
54 | 57 |
55 bool close_on_esc() const { return close_on_esc_; } | 58 bool close_on_esc() const { return close_on_esc_; } |
56 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } | 59 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } |
57 | 60 |
(...skipping 14 matching lines...) Expand all Loading... |
72 | 75 |
73 SkColor color() const { return color_; } | 76 SkColor color() const { return color_; } |
74 void set_color(SkColor color) { | 77 void set_color(SkColor color) { |
75 color_ = color; | 78 color_ = color; |
76 color_explicitly_set_ = true; | 79 color_explicitly_set_ = true; |
77 } | 80 } |
78 | 81 |
79 const gfx::Insets& margins() const { return margins_; } | 82 const gfx::Insets& margins() const { return margins_; } |
80 void set_margins(const gfx::Insets& margins) { margins_ = margins; } | 83 void set_margins(const gfx::Insets& margins) { margins_ = margins; } |
81 | 84 |
| 85 void set_match_title_margins(bool match_title_margins) { |
| 86 match_title_margins_ = match_title_margins; |
| 87 } |
| 88 |
82 const gfx::Insets& anchor_view_insets() const { return anchor_view_insets_; } | 89 const gfx::Insets& anchor_view_insets() const { return anchor_view_insets_; } |
83 void set_anchor_view_insets(const gfx::Insets& i) { anchor_view_insets_ = i; } | 90 void set_anchor_view_insets(const gfx::Insets& i) { anchor_view_insets_ = i; } |
84 | 91 |
85 gfx::NativeView parent_window() const { return parent_window_; } | 92 gfx::NativeView parent_window() const { return parent_window_; } |
86 void set_parent_window(gfx::NativeView window) { parent_window_ = window; } | 93 void set_parent_window(gfx::NativeView window) { parent_window_ = window; } |
87 | 94 |
88 bool use_focusless() const { return use_focusless_; } | 95 bool use_focusless() const { return use_focusless_; } |
89 void set_use_focusless(bool focusless) { use_focusless_ = focusless; } | 96 void set_use_focusless(bool focusless) { use_focusless_ = focusless; } |
90 | 97 |
91 bool accept_events() const { return accept_events_; } | 98 bool accept_events() const { return accept_events_; } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Bubble border shadow to use. | 191 // Bubble border shadow to use. |
185 BubbleBorder::Shadow shadow_; | 192 BubbleBorder::Shadow shadow_; |
186 | 193 |
187 // The background color of the bubble; and flag for when it's explicitly set. | 194 // The background color of the bubble; and flag for when it's explicitly set. |
188 SkColor color_; | 195 SkColor color_; |
189 bool color_explicitly_set_; | 196 bool color_explicitly_set_; |
190 | 197 |
191 // The margins between the content and the inside of the border. | 198 // The margins between the content and the inside of the border. |
192 gfx::Insets margins_; | 199 gfx::Insets margins_; |
193 | 200 |
| 201 // Whether this bubble should match the bubble frame view's title margins. |
| 202 bool match_title_margins_; |
| 203 |
194 // Insets applied to the |anchor_view_| bounds. | 204 // Insets applied to the |anchor_view_| bounds. |
195 gfx::Insets anchor_view_insets_; | 205 gfx::Insets anchor_view_insets_; |
196 | 206 |
197 // Original opacity of the bubble. | 207 // Original opacity of the bubble. |
198 int original_opacity_; | 208 int original_opacity_; |
199 | 209 |
200 // The widget hosting the border for this bubble (non-Aura Windows only). | 210 // The widget hosting the border for this bubble (non-Aura Windows only). |
201 Widget* border_widget_; | 211 Widget* border_widget_; |
202 | 212 |
203 // If true, the bubble does not take focus on display; default is false. | 213 // If true, the bubble does not take focus on display; default is false. |
204 bool use_focusless_; | 214 bool use_focusless_; |
205 | 215 |
206 // Specifies whether the bubble (or its border) handles mouse events, etc. | 216 // Specifies whether the bubble (or its border) handles mouse events, etc. |
207 bool accept_events_; | 217 bool accept_events_; |
208 bool border_accepts_events_; | 218 bool border_accepts_events_; |
209 | 219 |
210 // If true (defaults to true), the arrow may be mirrored and moved to fit the | 220 // If true (defaults to true), the arrow may be mirrored and moved to fit the |
211 // bubble on screen better. It would be a no-op if the bubble has no arrow. | 221 // bubble on screen better. It would be a no-op if the bubble has no arrow. |
212 bool adjust_if_offscreen_; | 222 bool adjust_if_offscreen_; |
213 | 223 |
214 // Parent native window of the bubble. | 224 // Parent native window of the bubble. |
215 gfx::NativeView parent_window_; | 225 gfx::NativeView parent_window_; |
216 | 226 |
217 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 227 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
218 }; | 228 }; |
219 | 229 |
220 } // namespace views | 230 } // namespace views |
221 | 231 |
222 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 232 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
OLD | NEW |