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