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 <string> | |
10 | |
11 #include "views/bubble/bubble_border.h" | 9 #include "views/bubble/bubble_border.h" |
12 #include "views/view.h" | |
13 #include "views/widget/widget_delegate.h" | 10 #include "views/widget/widget_delegate.h" |
14 | 11 |
15 namespace views { | 12 namespace views { |
16 class BubbleBorder; | 13 |
17 class BubbleFrameView; | 14 class BubbleFrameView; |
18 class BubbleView; | 15 class BubbleView; |
19 class View; | |
20 | 16 |
21 // BubbleDelegate interface to create bubble frame view and bubble client view. | 17 // BubbleDelegateView creates frame and client views for bubble Widgets. |
18 // BubbleDelegateView itself is the client's contents view. | |
22 // | 19 // |
23 /////////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////////// |
24 class VIEWS_EXPORT BubbleDelegate : public WidgetDelegate { | 21 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView { |
25 public: | 22 public: |
26 virtual BubbleDelegate* AsBubbleDelegate() OVERRIDE; | 23 virtual ~BubbleDelegateView(); |
24 | |
25 // Construct a Bubble Widget from the argument BubbleDelegateView. | |
26 static Widget* ConstructBubble(BubbleDelegateView* bubble_delegate, | |
27 Widget* parent_widget); | |
28 | |
29 // WidgetDelegate overrides: | |
30 virtual View* GetContentsView() OVERRIDE { return this; } | |
27 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; | 31 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; |
28 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 32 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
29 | 33 |
30 virtual SkColor GetFrameBackgroundColor() = 0; | 34 // Override Init to perform Contents View initialization for bubble sizing. |
31 virtual gfx::Rect GetBounds() = 0; | 35 virtual void Init() {} |
32 virtual BubbleBorder::ArrowLocation GetFrameArrowLocation() = 0; | |
33 | 36 |
34 const BubbleView* GetBubbleView() const; | 37 // Get the arrow's target point in screen space. |
38 virtual gfx::Point GetArrowPoint() const; | |
alicet1
2011/10/14 00:21:17
Is this the same as the anchor point? if so can it
| |
39 | |
40 // Get the arrow's location on the bubble. | |
41 virtual BubbleBorder::ArrowLocation GetArrowLocation() const { | |
42 return BubbleBorder::TOP_LEFT; | |
43 } | |
44 | |
45 // Get the color used for the background and border. | |
46 virtual SkColor GetColor() const { return SK_ColorWHITE; } | |
47 | |
35 BubbleView* GetBubbleView(); | 48 BubbleView* GetBubbleView(); |
36 | |
37 const BubbleFrameView* GetBubbleFrameView() const; | |
38 BubbleFrameView* GetBubbleFrameView(); | 49 BubbleFrameView* GetBubbleFrameView(); |
39 | |
40 protected: | |
41 virtual ~BubbleDelegate() {} | |
42 }; | |
43 | |
44 // BubbleDelegateView to create bubble frame view and bubble client view. | |
45 // | |
46 /////////////////////////////////////////////////////////////////////////////// | |
47 class VIEWS_EXPORT BubbleDelegateView : public BubbleDelegate, public View { | |
48 public: | |
49 explicit BubbleDelegateView(Widget* frame); | |
50 virtual ~BubbleDelegateView(); | |
51 | |
52 // Overridden from WidgetDelegate: | |
53 virtual Widget* GetWidget() OVERRIDE; | |
54 virtual const Widget* GetWidget() const OVERRIDE; | |
55 | |
56 private: | |
57 Widget* frame_; | |
58 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | |
59 }; | 50 }; |
60 | 51 |
61 } // namespace views | 52 } // namespace views |
62 | 53 |
63 #endif // VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 54 #endif // VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
OLD | NEW |