| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "ui/base/animation/animation_delegate.h" | 10 #include "ui/base/animation/animation_delegate.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 void StartFade(bool fade_in); | 94 void StartFade(bool fade_in); |
| 95 | 95 |
| 96 // Reset fade and opacity of bubble. Restore the opacity of the | 96 // Reset fade and opacity of bubble. Restore the opacity of the |
| 97 // bubble to the setting before StartFade() was called. | 97 // bubble to the setting before StartFade() was called. |
| 98 void ResetFade(); | 98 void ResetFade(); |
| 99 | 99 |
| 100 // Sets the bubble alignment relative to the anchor. | 100 // Sets the bubble alignment relative to the anchor. |
| 101 void SetAlignment(BubbleBorder::BubbleAlignment alignment); | 101 void SetAlignment(BubbleBorder::BubbleAlignment alignment); |
| 102 | 102 |
| 103 protected: | 103 protected: |
| 104 // Get bubble bounds from the anchor point and client view's preferred size. |
| 105 virtual gfx::Rect GetBubbleBounds(); |
| 106 |
| 104 // View overrides: | 107 // View overrides: |
| 105 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 108 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 106 | 109 |
| 107 // ui::AnimationDelegate overrides: | 110 // ui::AnimationDelegate overrides: |
| 108 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 111 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 109 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 112 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 110 | 113 |
| 111 // Perform view initialization on the contents for bubble sizing. | 114 // Perform view initialization on the contents for bubble sizing. |
| 112 virtual void Init(); | 115 virtual void Init(); |
| 113 | 116 |
| 114 // Set the anchor view, this must be done before calling CreateBubble or Show. | 117 // Set the anchor view, this must be done before calling CreateBubble or Show. |
| 115 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } | 118 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } |
| 116 | 119 |
| 117 bool move_with_anchor() const { return move_with_anchor_; } | 120 bool move_with_anchor() const { return move_with_anchor_; } |
| 118 void set_move_with_anchor(bool move_with_anchor) { | 121 void set_move_with_anchor(bool move_with_anchor) { |
| 119 move_with_anchor_ = move_with_anchor; | 122 move_with_anchor_ = move_with_anchor; |
| 120 } | 123 } |
| 121 | 124 |
| 122 // Resizes and potentially moves the Bubble to best accommodate the | 125 // Resizes and potentially moves the Bubble to best accommodate the |
| 123 // contents preferred size. | 126 // contents preferred size. |
| 124 void SizeToContents(); | 127 void SizeToContents(); |
| 125 | 128 |
| 126 BubbleFrameView* GetBubbleFrameView() const; | 129 BubbleFrameView* GetBubbleFrameView() const; |
| 127 | 130 |
| 128 private: | 131 private: |
| 129 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, NonClientHitTest); | 132 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, NonClientHitTest); |
| 130 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); | 133 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); |
| 131 | 134 |
| 132 // Get bubble bounds from the anchor point and client view's preferred size. | |
| 133 gfx::Rect GetBubbleBounds(); | |
| 134 | |
| 135 #if defined(OS_WIN) && !defined(USE_AURA) | 135 #if defined(OS_WIN) && !defined(USE_AURA) |
| 136 // Get bounds for the Windows-only widget that hosts the bubble's contents. | 136 // Get bounds for the Windows-only widget that hosts the bubble's contents. |
| 137 gfx::Rect GetBubbleClientBounds() const; | 137 gfx::Rect GetBubbleClientBounds() const; |
| 138 #endif | 138 #endif |
| 139 | 139 |
| 140 // Fade animation for bubble. | 140 // Fade animation for bubble. |
| 141 scoped_ptr<ui::SlideAnimation> fade_animation_; | 141 scoped_ptr<ui::SlideAnimation> fade_animation_; |
| 142 | 142 |
| 143 // Flags controlling bubble closure on the escape key and deactivation. | 143 // Flags controlling bubble closure on the escape key and deactivation. |
| 144 bool close_on_esc_; | 144 bool close_on_esc_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 172 | 172 |
| 173 // Parent native window of the bubble. | 173 // Parent native window of the bubble. |
| 174 gfx::NativeView parent_window_; | 174 gfx::NativeView parent_window_; |
| 175 | 175 |
| 176 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); | 176 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 } // namespace views | 179 } // namespace views |
| 180 | 180 |
| 181 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ | 181 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ |
| OLD | NEW |