Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: ui/views/bubble/bubble_delegate.h

Issue 23622020: Fixing the dynamic positioning (move with anchor) for the app launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit test Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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; }
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
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698