Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 } | 60 } |
| 61 | 61 |
| 62 View* anchor_view() const { return anchor_view_; } | 62 View* anchor_view() const { return anchor_view_; } |
| 63 Widget* anchor_widget() const { return anchor_widget_; } | 63 Widget* anchor_widget() const { return anchor_widget_; } |
| 64 | 64 |
| 65 BubbleBorder::ArrowLocation arrow_location() const { return arrow_location_; } | 65 BubbleBorder::ArrowLocation arrow_location() const { return arrow_location_; } |
| 66 void set_arrow_location(BubbleBorder::ArrowLocation arrow_location) { | 66 void set_arrow_location(BubbleBorder::ArrowLocation arrow_location) { |
| 67 arrow_location_ = arrow_location; | 67 arrow_location_ = arrow_location; |
| 68 } | 68 } |
| 69 | 69 |
| 70 BubbleBorder::Shadow border_shadow() const { return border_shadow_; } | |
| 71 void set_border_shadow(BubbleBorder::Shadow border_shadow) { | |
|
msw
2012/09/18 19:33:42
nit: this fits on one line if you s/|border_shadow
xiyuan
2012/09/19 18:20:09
Done.
| |
| 72 border_shadow_ = border_shadow; | |
| 73 } | |
| 74 | |
| 70 SkColor color() const { return color_; } | 75 SkColor color() const { return color_; } |
| 71 void set_color(SkColor color) { color_ = color; } | 76 void set_color(SkColor color) { color_ = color; } |
| 72 | 77 |
| 73 const gfx::Insets& margins() const { return margins_; } | 78 const gfx::Insets& margins() const { return margins_; } |
| 74 void set_margins(const gfx::Insets& margins) { margins_ = margins; } | 79 void set_margins(const gfx::Insets& margins) { margins_ = margins; } |
| 75 | 80 |
| 76 void set_anchor_insets(const gfx::Insets& insets) { anchor_insets_ = insets; } | 81 void set_anchor_insets(const gfx::Insets& insets) { anchor_insets_ = insets; } |
| 77 const gfx::Insets& anchor_insets() const { return anchor_insets_; } | 82 const gfx::Insets& anchor_insets() const { return anchor_insets_; } |
| 78 | 83 |
| 79 gfx::NativeView parent_window() const { return parent_window_; } | 84 gfx::NativeView parent_window() const { return parent_window_; } |
| 80 void set_parent_window(gfx::NativeView window) { parent_window_ = window; } | 85 void set_parent_window(gfx::NativeView window) { parent_window_ = window; } |
| 81 | 86 |
| 82 bool use_focusless() const { return use_focusless_; } | 87 bool use_focusless() const { return use_focusless_; } |
| 83 void set_use_focusless(bool use_focusless) { | 88 void set_use_focusless(bool use_focusless) { |
| 84 use_focusless_ = use_focusless; | 89 use_focusless_ = use_focusless; |
| 85 } | 90 } |
| 86 | 91 |
| 87 bool accept_events() const { return accept_events_; } | 92 bool accept_events() const { return accept_events_; } |
| 88 void set_accept_events(bool accept_events) { accept_events_ = accept_events; } | 93 void set_accept_events(bool accept_events) { accept_events_ = accept_events; } |
| 89 | 94 |
| 90 bool try_mirroring_arrow() const { return try_mirroring_arrow_; } | 95 bool try_fit_bubble() const { return try_fit_bubble_; } |
|
msw
2012/09/18 19:33:42
This name seems worse; consider adjust_if_offscree
xiyuan
2012/09/19 18:20:09
Done.
| |
| 91 void set_try_mirroring_arrow(bool try_mirroring_arrow) { | 96 void set_try_fit_bubble(bool try_fit_bubble) { |
| 92 try_mirroring_arrow_ = try_mirroring_arrow; | 97 try_fit_bubble_ = try_fit_bubble; |
| 93 } | 98 } |
| 94 | 99 |
| 95 // Get the arrow's anchor rect in screen space. | 100 // Get the arrow's anchor rect in screen space. |
| 96 virtual gfx::Rect GetAnchorRect(); | 101 virtual gfx::Rect GetAnchorRect(); |
| 97 | 102 |
| 98 // Show the bubble's widget (and |border_widget_| on Windows). | 103 // Show the bubble's widget (and |border_widget_| on Windows). |
| 99 void Show(); | 104 void Show(); |
| 100 | 105 |
| 101 // Fade the bubble in or out via Widget transparency. | 106 // Fade the bubble in or out via Widget transparency. |
| 102 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. | 107 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 | 171 |
| 167 // The anchor point used in the absence of an anchor view. | 172 // The anchor point used in the absence of an anchor view. |
| 168 gfx::Point anchor_point_; | 173 gfx::Point anchor_point_; |
| 169 | 174 |
| 170 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|. | 175 // If true, the bubble will re-anchor (and may resize) with |anchor_widget_|. |
| 171 bool move_with_anchor_; | 176 bool move_with_anchor_; |
| 172 | 177 |
| 173 // The arrow's location on the bubble. | 178 // The arrow's location on the bubble. |
| 174 BubbleBorder::ArrowLocation arrow_location_; | 179 BubbleBorder::ArrowLocation arrow_location_; |
| 175 | 180 |
| 181 // Bubble border shadow to use. | |
| 182 BubbleBorder::Shadow border_shadow_; | |
| 183 | |
| 176 // The background color of the bubble. | 184 // The background color of the bubble. |
| 177 SkColor color_; | 185 SkColor color_; |
| 178 | 186 |
| 179 // The margins between the content and the inside of the border. | 187 // The margins between the content and the inside of the border. |
| 180 gfx::Insets margins_; | 188 gfx::Insets margins_; |
| 181 | 189 |
| 182 // Insets applied to the |anchor_view_| bounds. | 190 // Insets applied to the |anchor_view_| bounds. |
| 183 gfx::Insets anchor_insets_; | 191 gfx::Insets anchor_insets_; |
| 184 | 192 |
| 185 // Original opacity of the bubble. | 193 // Original opacity of the bubble. |
| 186 int original_opacity_; | 194 int original_opacity_; |
| 187 | 195 |
| 188 // The widget hosting the border for this bubble (non-Aura Windows only). | 196 // The widget hosting the border for this bubble (non-Aura Windows only). |
| 189 Widget* border_widget_; | 197 Widget* border_widget_; |
| 190 | 198 |
| 191 // Create a popup window for focusless bubbles on Linux/ChromeOS. | 199 // Create a popup window for focusless bubbles on Linux/ChromeOS. |
| 192 // These bubbles are not interactive and should not gain focus. | 200 // These bubbles are not interactive and should not gain focus. |
| 193 bool use_focusless_; | 201 bool use_focusless_; |
| 194 | 202 |
| 195 // Specifies whether the popup accepts events or lets them pass through. | 203 // Specifies whether the popup accepts events or lets them pass through. |
| 196 bool accept_events_; | 204 bool accept_events_; |
| 197 | 205 |
| 198 // If true (defaults to true), the arrow may be mirrored to fit the | 206 // If true (defaults to true), the arrow may be mirrored and moved o fit the |
|
msw
2012/09/18 19:33:42
nit: s/o/to
xiyuan
2012/09/19 18:20:09
Done.
| |
| 199 // bubble on screen better. | 207 // bubble on screen better. It would be a no-op if bubble has no arrow. |
|
msw
2012/09/18 19:33:42
nit: "*the* bubble"
xiyuan
2012/09/19 18:20:09
Done.
| |
| 200 bool try_mirroring_arrow_; | 208 bool try_fit_bubble_; |
| 201 | 209 |
| 202 // Parent native window of the bubble. | 210 // Parent native window of the bubble. |
| 203 gfx::NativeView parent_window_; | 211 gfx::NativeView parent_window_; |
| 204 | 212 |
| 205 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 213 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
| 206 }; | 214 }; |
| 207 | 215 |
| 208 } // namespace views | 216 } // namespace views |
| 209 | 217 |
| 210 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 218 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
| OLD | NEW |