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

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

Issue 13142003: Fix app list position in windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 7 years, 8 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
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } 56 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; }
57 57
58 bool close_on_deactivate() const { return close_on_deactivate_; } 58 bool close_on_deactivate() const { return close_on_deactivate_; }
59 void set_close_on_deactivate(bool close_on_deactivate) { 59 void set_close_on_deactivate(bool close_on_deactivate) {
60 close_on_deactivate_ = close_on_deactivate; 60 close_on_deactivate_ = close_on_deactivate;
61 } 61 }
62 62
63 View* anchor_view() const { return anchor_view_; } 63 View* anchor_view() const { return anchor_view_; }
64 Widget* anchor_widget() const { return anchor_widget_; } 64 Widget* anchor_widget() const { return anchor_widget_; }
65 65
66 // The anchor point is used in the absence of an anchor view. 66 // The anchor rect is used in the absence of an anchor view.
67 const gfx::Point& anchor_point() const { return anchor_point_; } 67 const gfx::Rect& anchor_rect() const { return anchor_rect_; }
68 68
69 BubbleBorder::ArrowLocation arrow_location() const { return arrow_location_; } 69 BubbleBorder::ArrowLocation arrow_location() const { return arrow_location_; }
70 void set_arrow_location(BubbleBorder::ArrowLocation arrow_location) { 70 void set_arrow_location(BubbleBorder::ArrowLocation arrow_location) {
71 arrow_location_ = arrow_location; 71 arrow_location_ = arrow_location;
72 } 72 }
73 73
74 BubbleBorder::Shadow shadow() const { return shadow_; } 74 BubbleBorder::Shadow shadow() const { return shadow_; }
75 void set_shadow(BubbleBorder::Shadow shadow) { shadow_ = shadow; } 75 void set_shadow(BubbleBorder::Shadow shadow) { shadow_ = shadow; }
76 76
77 SkColor color() const { return color_; } 77 SkColor color() const { return color_; }
78 void set_color(SkColor color) { 78 void set_color(SkColor color) {
79 color_ = color; 79 color_ = color;
80 color_explicitly_set_ = true; 80 color_explicitly_set_ = true;
81 } 81 }
82 82
83 const gfx::Insets& margins() const { return margins_; } 83 const gfx::Insets& margins() const { return margins_; }
84 void set_margins(const gfx::Insets& margins) { margins_ = margins; } 84 void set_margins(const gfx::Insets& margins) { margins_ = margins; }
85 85
86 void set_anchor_insets(const gfx::Insets& insets) { anchor_insets_ = insets; } 86 const gfx::Insets& anchor_view_insets() const { return anchor_view_insets_; }
87 const gfx::Insets& anchor_insets() const { return anchor_insets_; } 87 void set_anchor_view_insets(const gfx::Insets& insets) {
88 anchor_view_insets_ = insets;
89 }
88 90
89 gfx::NativeView parent_window() const { return parent_window_; } 91 gfx::NativeView parent_window() const { return parent_window_; }
90 void set_parent_window(gfx::NativeView window) { parent_window_ = window; } 92 void set_parent_window(gfx::NativeView window) { parent_window_ = window; }
91 93
92 bool use_focusless() const { return use_focusless_; } 94 bool use_focusless() const { return use_focusless_; }
93 void set_use_focusless(bool use_focusless) { 95 void set_use_focusless(bool use_focusless) {
94 use_focusless_ = use_focusless; 96 use_focusless_ = use_focusless;
95 } 97 }
96 98
97 bool accept_events() const { return accept_events_; } 99 bool accept_events() const { return accept_events_; }
(...skipping 16 matching lines...) Expand all
114 116
115 // Reset fade and opacity of bubble. Restore the opacity of the 117 // Reset fade and opacity of bubble. Restore the opacity of the
116 // bubble to the setting before StartFade() was called. 118 // bubble to the setting before StartFade() was called.
117 void ResetFade(); 119 void ResetFade();
118 120
119 // Sets the bubble alignment relative to the anchor. This may only be called 121 // Sets the bubble alignment relative to the anchor. This may only be called
120 // after calling CreateBubble. 122 // after calling CreateBubble.
121 void SetAlignment(BubbleBorder::BubbleAlignment alignment); 123 void SetAlignment(BubbleBorder::BubbleAlignment alignment);
122 124
123 protected: 125 protected:
124 // Get bubble bounds from the anchor point and client view's preferred size. 126 // Get bubble bounds from the anchor rect and client view's preferred size.
125 virtual gfx::Rect GetBubbleBounds(); 127 virtual gfx::Rect GetBubbleBounds();
126 128
127 // View overrides: 129 // View overrides:
128 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 130 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
129 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; 131 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
130 132
131 // ui::AnimationDelegate overrides: 133 // ui::AnimationDelegate overrides:
132 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 134 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
133 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 135 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
134 136
135 // Perform view initialization on the contents for bubble sizing. 137 // Perform view initialization on the contents for bubble sizing.
136 virtual void Init(); 138 virtual void Init();
137 139
138 // Set the anchor view, this (or set_anchor_point) must be done before 140 // Set the anchor view, this (or set_anchor_rect) must be done before
139 // calling CreateBubble or Show. 141 // calling CreateBubble or Show.
140 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } 142 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; }
141 143 void set_anchor_rect(gfx::Rect anchor_rect) {
142 // The anchor point or anchor view must be set before calling CreateBubble or 144 anchor_rect_ = anchor_rect;
143 // Show.
144 void set_anchor_point(gfx::Point anchor_point) {
145 anchor_point_ = anchor_point;
146 } 145 }
147 146
148 bool move_with_anchor() const { return move_with_anchor_; } 147 bool move_with_anchor() const { return move_with_anchor_; }
149 void set_move_with_anchor(bool move_with_anchor) { 148 void set_move_with_anchor(bool move_with_anchor) {
150 move_with_anchor_ = move_with_anchor; 149 move_with_anchor_ = move_with_anchor;
151 } 150 }
152 151
153 // Resizes and potentially moves the Bubble to best accommodate the 152 // Resizes and potentially moves the Bubble to best accommodate the
154 // contents preferred size. 153 // contents preferred size.
155 void SizeToContents(); 154 void SizeToContents();
(...skipping 16 matching lines...) Expand all
172 scoped_ptr<ui::SlideAnimation> fade_animation_; 171 scoped_ptr<ui::SlideAnimation> fade_animation_;
173 172
174 // Flags controlling bubble closure on the escape key and deactivation. 173 // Flags controlling bubble closure on the escape key and deactivation.
175 bool close_on_esc_; 174 bool close_on_esc_;
176 bool close_on_deactivate_; 175 bool close_on_deactivate_;
177 176
178 // The view and widget to which this bubble is anchored. 177 // The view and widget to which this bubble is anchored.
179 View* anchor_view_; 178 View* anchor_view_;
180 Widget* anchor_widget_; 179 Widget* anchor_widget_;
181 180
182 // The anchor point used in the absence of an anchor view. 181 // The anchor rect used in the absence of an anchor view.
183 gfx::Point anchor_point_; 182 gfx::Rect anchor_rect_;
184 183
185 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|. 184 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|.
186 bool move_with_anchor_; 185 bool move_with_anchor_;
187 186
188 // The arrow's location on the bubble. 187 // The arrow's location on the bubble.
189 BubbleBorder::ArrowLocation arrow_location_; 188 BubbleBorder::ArrowLocation arrow_location_;
190 189
191 // Bubble border shadow to use. 190 // Bubble border shadow to use.
192 BubbleBorder::Shadow shadow_; 191 BubbleBorder::Shadow shadow_;
193 192
194 // The background color of the bubble; and flag for when it's explicitly set. 193 // The background color of the bubble; and flag for when it's explicitly set.
195 SkColor color_; 194 SkColor color_;
196 bool color_explicitly_set_; 195 bool color_explicitly_set_;
197 196
198 // The margins between the content and the inside of the border. 197 // The margins between the content and the inside of the border.
199 gfx::Insets margins_; 198 gfx::Insets margins_;
200 199
201 // Insets applied to the |anchor_view_| bounds. 200 // Insets applied to the |anchor_view_| bounds.
202 gfx::Insets anchor_insets_; 201 gfx::Insets anchor_view_insets_;
203 202
204 // Original opacity of the bubble. 203 // Original opacity of the bubble.
205 int original_opacity_; 204 int original_opacity_;
206 205
207 // The widget hosting the border for this bubble (non-Aura Windows only). 206 // The widget hosting the border for this bubble (non-Aura Windows only).
208 Widget* border_widget_; 207 Widget* border_widget_;
209 208
210 // If true (defaults to false), the bubble does not take user focus upon 209 // If true (defaults to false), the bubble does not take user focus upon
211 // display. 210 // display.
212 bool use_focusless_; 211 bool use_focusless_;
(...skipping 11 matching lines...) Expand all
224 223
225 // Parent native window of the bubble. 224 // Parent native window of the bubble.
226 gfx::NativeView parent_window_; 225 gfx::NativeView parent_window_;
227 226
228 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); 227 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
229 }; 228 };
230 229
231 } // namespace views 230 } // namespace views
232 231
233 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 232 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698