| 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 "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
| 11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
| 12 #include "ui/views/widget/widget_delegate.h" | 12 #include "ui/views/widget/widget_delegate.h" |
| 13 #include "ui/views/widget/widget_observer.h" | 13 #include "ui/views/widget/widget_observer.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class FontList; | 16 class FontList; |
| 17 class Rect; | 17 class Rect; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 | 21 |
| 22 class BubbleFrameView; | 22 class BubbleFrameView; |
| 23 | 23 |
| 24 // BubbleDelegateView creates frame and client views for bubble Widgets. | 24 // BubbleDelegateView creates frame and client views for bubble Widgets. |
| 25 // BubbleDelegateView itself is the client's contents view. | 25 // BubbleDelegateView itself is the client's contents view. |
| 26 // TODO(estade): remove this in favor of BubbleDialogDelegateView. |
| 26 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, | 27 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, |
| 27 public WidgetObserver { | 28 public WidgetObserver { |
| 28 public: | 29 public: |
| 29 // Internal class name. | 30 // Internal class name. |
| 30 static const char kViewClassName[]; | 31 static const char kViewClassName[]; |
| 31 | 32 |
| 32 enum class CloseReason { | 33 enum class CloseReason { |
| 33 DEACTIVATION, | 34 DEACTIVATION, |
| 34 ESCAPE, | 35 ESCAPE, |
| 35 CLOSE_BUTTON, | 36 CLOSE_BUTTON, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 CloseReason close_reason() const { return close_reason_; } | 106 CloseReason close_reason() const { return close_reason_; } |
| 106 | 107 |
| 107 // Get the arrow's anchor rect in screen space. | 108 // Get the arrow's anchor rect in screen space. |
| 108 virtual gfx::Rect GetAnchorRect() const; | 109 virtual gfx::Rect GetAnchorRect() const; |
| 109 | 110 |
| 110 // Allows delegates to provide custom parameters before widget initialization. | 111 // Allows delegates to provide custom parameters before widget initialization. |
| 111 virtual void OnBeforeBubbleWidgetInit(Widget::InitParams* params, | 112 virtual void OnBeforeBubbleWidgetInit(Widget::InitParams* params, |
| 112 Widget* widget) const; | 113 Widget* widget) const; |
| 113 | 114 |
| 114 // Creates and returns a view to be displayed at the bottom of the bubble. | 115 // Creates and returns a view to be displayed at the bottom of the bubble. |
| 115 virtual scoped_ptr<View> CreateFootnoteView(); | 116 virtual View* CreateFootnoteView(); |
| 116 | 117 |
| 117 // Sets |margins_| to a default picked for smaller bubbles. | 118 // Sets |margins_| to a default picked for smaller bubbles. |
| 118 void UseCompactMargins(); | 119 void UseCompactMargins(); |
| 119 | 120 |
| 120 // Sets the bubble alignment relative to the anchor. This may only be called | 121 // Sets the bubble alignment relative to the anchor. This may only be called |
| 121 // after calling CreateBubble. | 122 // after calling CreateBubble. |
| 122 void SetAlignment(BubbleBorder::BubbleAlignment alignment); | 123 void SetAlignment(BubbleBorder::BubbleAlignment alignment); |
| 123 | 124 |
| 124 // Sets the bubble arrow paint type. | 125 // Sets the bubble arrow paint type. |
| 125 void SetArrowPaintType(BubbleBorder::ArrowPaintType paint_type); | 126 void SetArrowPaintType(BubbleBorder::ArrowPaintType paint_type); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 gfx::NativeView parent_window_; | 211 gfx::NativeView parent_window_; |
| 211 | 212 |
| 212 CloseReason close_reason_; | 213 CloseReason close_reason_; |
| 213 | 214 |
| 214 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 215 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
| 215 }; | 216 }; |
| 216 | 217 |
| 217 } // namespace views | 218 } // namespace views |
| 218 | 219 |
| 219 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 220 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
| OLD | NEW |