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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; | 137 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; |
138 | 138 |
139 // ui::AnimationDelegate overrides: | 139 // ui::AnimationDelegate overrides: |
140 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 140 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
141 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 141 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
142 | 142 |
143 // Perform view initialization on the contents for bubble sizing. | 143 // Perform view initialization on the contents for bubble sizing. |
144 virtual void Init(); | 144 virtual void Init(); |
145 | 145 |
146 // Set the anchor view or rect; set these before CreateBubble or Show. | 146 // Set the anchor view or rect; set these before CreateBubble or Show. |
147 // If an |anchor_view| is given the |anchor_rect| will be ignored, but an | |
148 // |anchor_offset| can be supplied to offset the final coordinates. This is | |
149 // especially needed when |move_with_anchor_| gets set. | |
147 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } | 150 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } |
148 void set_anchor_rect(const gfx::Rect& rect) { anchor_rect_ = rect; } | 151 void set_anchor_rect(const gfx::Rect& rect) { anchor_rect_ = rect; } |
152 void set_anchor_offset(const gfx::Point& offset) {anchor_offset_ = offset; } | |
xiyuan
2013/09/06 04:34:53
nit: the new fashion is to use Vector2d for offset
Mr4D (OOO till 08-26)
2013/09/06 17:57:31
Done.
| |
149 | 153 |
150 // Resize and potentially move the bubble to fit the content's preferred size. | 154 // Resize and potentially move the bubble to fit the content's preferred size. |
151 void SizeToContents(); | 155 void SizeToContents(); |
152 | 156 |
153 BubbleFrameView* GetBubbleFrameView() const; | 157 BubbleFrameView* GetBubbleFrameView() const; |
154 | 158 |
155 private: | 159 private: |
156 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); | 160 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); |
157 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, NonClientHitTest); | 161 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, NonClientHitTest); |
158 | 162 |
(...skipping 15 matching lines...) Expand all Loading... | |
174 bool close_on_esc_; | 178 bool close_on_esc_; |
175 bool close_on_deactivate_; | 179 bool close_on_deactivate_; |
176 | 180 |
177 // The view and widget to which this bubble is anchored. | 181 // The view and widget to which this bubble is anchored. |
178 View* anchor_view_; | 182 View* anchor_view_; |
179 Widget* anchor_widget_; | 183 Widget* anchor_widget_; |
180 | 184 |
181 // The anchor rect used in the absence of an anchor view. | 185 // The anchor rect used in the absence of an anchor view. |
182 gfx::Rect anchor_rect_; | 186 gfx::Rect anchor_rect_; |
183 | 187 |
188 // An anchor offset which will get added to the |anchor_view_|'s location. | |
189 gfx::Point anchor_offset_; | |
190 | |
184 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|. | 191 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|. |
185 bool move_with_anchor_; | 192 bool move_with_anchor_; |
186 | 193 |
187 // The arrow's location on the bubble. | 194 // The arrow's location on the bubble. |
188 BubbleBorder::Arrow arrow_; | 195 BubbleBorder::Arrow arrow_; |
189 | 196 |
190 // Bubble border shadow to use. | 197 // Bubble border shadow to use. |
191 BubbleBorder::Shadow shadow_; | 198 BubbleBorder::Shadow shadow_; |
192 | 199 |
193 // The background color of the bubble; and flag for when it's explicitly set. | 200 // The background color of the bubble; and flag for when it's explicitly set. |
(...skipping 25 matching lines...) Expand all Loading... | |
219 | 226 |
220 // Parent native window of the bubble. | 227 // Parent native window of the bubble. |
221 gfx::NativeView parent_window_; | 228 gfx::NativeView parent_window_; |
222 | 229 |
223 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 230 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
224 }; | 231 }; |
225 | 232 |
226 } // namespace views | 233 } // namespace views |
227 | 234 |
228 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 235 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
OLD | NEW |