| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // View overrides: | 116 // View overrides: |
| 117 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 117 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 118 | 118 |
| 119 // ui::AnimationDelegate overrides: | 119 // ui::AnimationDelegate overrides: |
| 120 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 120 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 121 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 121 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 122 | 122 |
| 123 // Perform view initialization on the contents for bubble sizing. | 123 // Perform view initialization on the contents for bubble sizing. |
| 124 virtual void Init(); | 124 virtual void Init(); |
| 125 | 125 |
| 126 // Set the anchor view, this must be done before calling CreateBubble or Show. | 126 // Set the anchor view, this (or set_anchor_point) must be done before |
| 127 // calling CreateBubble or Show. |
| 127 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } | 128 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } |
| 128 | 129 |
| 130 // Sets the anchor point used in the absence of an anchor view. This |
| 131 // (or set_anchor_view) must be set before calling CreateBubble or Show. |
| 132 void set_anchor_point(gfx::Point anchor_point) { |
| 133 anchor_point_ = anchor_point; |
| 134 } |
| 135 |
| 129 bool move_with_anchor() const { return move_with_anchor_; } | 136 bool move_with_anchor() const { return move_with_anchor_; } |
| 130 void set_move_with_anchor(bool move_with_anchor) { | 137 void set_move_with_anchor(bool move_with_anchor) { |
| 131 move_with_anchor_ = move_with_anchor; | 138 move_with_anchor_ = move_with_anchor; |
| 132 } | 139 } |
| 133 | 140 |
| 134 // Resizes and potentially moves the Bubble to best accommodate the | 141 // Resizes and potentially moves the Bubble to best accommodate the |
| 135 // contents preferred size. | 142 // contents preferred size. |
| 136 void SizeToContents(); | 143 void SizeToContents(); |
| 137 | 144 |
| 138 BubbleFrameView* GetBubbleFrameView() const; | 145 BubbleFrameView* GetBubbleFrameView() const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 150 scoped_ptr<ui::SlideAnimation> fade_animation_; | 157 scoped_ptr<ui::SlideAnimation> fade_animation_; |
| 151 | 158 |
| 152 // Flags controlling bubble closure on the escape key and deactivation. | 159 // Flags controlling bubble closure on the escape key and deactivation. |
| 153 bool close_on_esc_; | 160 bool close_on_esc_; |
| 154 bool close_on_deactivate_; | 161 bool close_on_deactivate_; |
| 155 | 162 |
| 156 // The view and widget to which this bubble is anchored. | 163 // The view and widget to which this bubble is anchored. |
| 157 View* anchor_view_; | 164 View* anchor_view_; |
| 158 Widget* anchor_widget_; | 165 Widget* anchor_widget_; |
| 159 | 166 |
| 167 // The anchor point used in the absence of an anchor view. |
| 168 gfx::Point anchor_point_; |
| 169 |
| 160 // 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_|. |
| 161 bool move_with_anchor_; | 171 bool move_with_anchor_; |
| 162 | 172 |
| 163 // The arrow's location on the bubble. | 173 // The arrow's location on the bubble. |
| 164 BubbleBorder::ArrowLocation arrow_location_; | 174 BubbleBorder::ArrowLocation arrow_location_; |
| 165 | 175 |
| 166 // The background color of the bubble. | 176 // The background color of the bubble. |
| 167 SkColor color_; | 177 SkColor color_; |
| 168 | 178 |
| 169 // The margins between the content and the inside of the border. | 179 // The margins between the content and the inside of the border. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 191 | 201 |
| 192 // Parent native window of the bubble. | 202 // Parent native window of the bubble. |
| 193 gfx::NativeView parent_window_; | 203 gfx::NativeView parent_window_; |
| 194 | 204 |
| 195 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 205 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
| 196 }; | 206 }; |
| 197 | 207 |
| 198 } // namespace views | 208 } // namespace views |
| 199 | 209 |
| 200 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 210 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
| OLD | NEW |