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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Fade-in calls Widget::Show; fade-out calls Widget::Close upon completion. | 106 // Fade-in calls Widget::Show; fade-out calls Widget::Close upon completion. |
107 void StartFade(bool fade_in); | 107 void StartFade(bool fade_in); |
108 | 108 |
109 // Restores bubble opacity to its value before StartFade() was called. | 109 // Restores bubble opacity to its value before StartFade() was called. |
110 void ResetFade(); | 110 void ResetFade(); |
111 | 111 |
112 // Sets the bubble alignment relative to the anchor. This may only be called | 112 // Sets the bubble alignment relative to the anchor. This may only be called |
113 // after calling CreateBubble. | 113 // after calling CreateBubble. |
114 void SetAlignment(BubbleBorder::BubbleAlignment alignment); | 114 void SetAlignment(BubbleBorder::BubbleAlignment alignment); |
115 | 115 |
| 116 // Offset the arrow location this many pixels from the corner. Does only work |
| 117 // with arrow locations which do not use CENTER. |
| 118 void SetArrowOffset(int offset); |
| 119 |
116 protected: | 120 protected: |
117 // Get bubble bounds from the anchor rect and client view's preferred size. | 121 // Get bubble bounds from the anchor rect and client view's preferred size. |
118 virtual gfx::Rect GetBubbleBounds(); | 122 virtual gfx::Rect GetBubbleBounds(); |
119 | 123 |
120 // View overrides: | 124 // View overrides: |
121 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 125 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
122 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 126 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; |
123 | 127 |
124 // ui::AnimationDelegate overrides: | 128 // ui::AnimationDelegate overrides: |
125 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 129 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 166 |
163 // The anchor rect used in the absence of an anchor view. | 167 // The anchor rect used in the absence of an anchor view. |
164 gfx::Rect anchor_rect_; | 168 gfx::Rect anchor_rect_; |
165 | 169 |
166 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|. | 170 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|. |
167 bool move_with_anchor_; | 171 bool move_with_anchor_; |
168 | 172 |
169 // The arrow's location on the bubble. | 173 // The arrow's location on the bubble. |
170 BubbleBorder::Arrow arrow_; | 174 BubbleBorder::Arrow arrow_; |
171 | 175 |
| 176 // The offset of the arrow from the corner of the bubble. |
| 177 int arrow_offset_; |
| 178 |
172 // Bubble border shadow to use. | 179 // Bubble border shadow to use. |
173 BubbleBorder::Shadow shadow_; | 180 BubbleBorder::Shadow shadow_; |
174 | 181 |
175 // The background color of the bubble; and flag for when it's explicitly set. | 182 // The background color of the bubble; and flag for when it's explicitly set. |
176 SkColor color_; | 183 SkColor color_; |
177 bool color_explicitly_set_; | 184 bool color_explicitly_set_; |
178 | 185 |
179 // The margins between the content and the inside of the border. | 186 // The margins between the content and the inside of the border. |
180 gfx::Insets margins_; | 187 gfx::Insets margins_; |
181 | 188 |
(...skipping 19 matching lines...) Expand all Loading... |
201 | 208 |
202 // Parent native window of the bubble. | 209 // Parent native window of the bubble. |
203 gfx::NativeView parent_window_; | 210 gfx::NativeView parent_window_; |
204 | 211 |
205 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 212 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
206 }; | 213 }; |
207 | 214 |
208 } // namespace views | 215 } // namespace views |
209 | 216 |
210 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 217 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
OLD | NEW |