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 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "ui/base/animation/animation_delegate.h" | 10 #include "ui/base/animation/animation_delegate.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 | 61 |
62 View* anchor_view() const { return anchor_view_; } | 62 View* anchor_view() const { return anchor_view_; } |
63 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } | 63 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } |
64 | 64 |
65 bool use_focusless() const { return use_focusless_; } | 65 bool use_focusless() const { return use_focusless_; } |
66 void set_use_focusless(bool use_focusless) { | 66 void set_use_focusless(bool use_focusless) { |
67 use_focusless_ = use_focusless; | 67 use_focusless_ = use_focusless; |
68 } | 68 } |
69 | 69 |
70 // Get the arrow's anchor point in screen space. | 70 // Get the arrow's anchor rect in screen space. |
71 virtual gfx::Point GetAnchorPoint(); | 71 virtual gfx::Rect GetAnchorRect(); |
72 | 72 |
73 // Get the arrow's location on the bubble. | 73 // Get the arrow's location on the bubble. |
74 virtual BubbleBorder::ArrowLocation GetArrowLocation() const; | 74 virtual BubbleBorder::ArrowLocation GetArrowLocation() const; |
75 | 75 |
76 // Get the color used for the background and border. | 76 // Get the color used for the background and border. |
77 virtual SkColor GetColor() const; | 77 virtual SkColor GetColor() const; |
78 | 78 |
79 // Show the bubble's widget (and |border_widget_| on Windows). | 79 // Show the bubble's widget (and |border_widget_| on Windows). |
80 void Show(); | 80 void Show(); |
81 | 81 |
82 // Fade the bubble in or out via Widget transparency. | 82 // Fade the bubble in or out via Widget transparency. |
83 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. | 83 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. |
84 void StartFade(bool fade_in); | 84 void StartFade(bool fade_in); |
85 | 85 |
86 // Reset fade and opacity of bubble. Restore the opacity of the | 86 // Reset fade and opacity of bubble. Restore the opacity of the |
87 // bubble to the setting before StartFade() was called. | 87 // bubble to the setting before StartFade() was called. |
88 void ResetFade(); | 88 void ResetFade(); |
89 | 89 |
| 90 // Sets the bubble alignment relative to the anchor. |
| 91 void SetAlignment(BubbleBorder::BubbleAlignment alignment); |
| 92 |
90 // The default bubble background color. | 93 // The default bubble background color. |
91 static const SkColor kBackgroundColor; | 94 static const SkColor kBackgroundColor; |
92 | 95 |
93 protected: | 96 protected: |
94 // View overrides: | 97 // View overrides: |
95 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 98 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
96 | 99 |
97 // ui::AnimationDelegate overrides: | 100 // ui::AnimationDelegate overrides: |
98 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 101 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
99 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 102 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // Create a popup window for focusless bubbles on Linux/ChromeOS. | 151 // Create a popup window for focusless bubbles on Linux/ChromeOS. |
149 // These bubbles are not interactive and should not gain focus. | 152 // These bubbles are not interactive and should not gain focus. |
150 bool use_focusless_; | 153 bool use_focusless_; |
151 | 154 |
152 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 155 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
153 }; | 156 }; |
154 | 157 |
155 } // namespace views | 158 } // namespace views |
156 | 159 |
157 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 160 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
OLD | NEW |