| 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_TRAY_BUBBLE_VIEW_H_ | 5 #ifndef UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
| 6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 6 #define UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/views/bubble/bubble_delegate.h" | 9 #include "ui/views/bubble/bubble_delegate.h" |
| 10 #include "ui/views/mouse_watcher.h" | 10 #include "ui/views/mouse_watcher.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 views::BubbleBorder::Shadow shadow; | 110 views::BubbleBorder::Shadow shadow; |
| 111 views::BubbleBorder::BubbleAlignment arrow_alignment; | 111 views::BubbleBorder::BubbleAlignment arrow_alignment; |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 // Constructs and returns a TrayBubbleView. init_params may be modified. | 114 // Constructs and returns a TrayBubbleView. init_params may be modified. |
| 115 static TrayBubbleView* Create(gfx::NativeView parent_window, | 115 static TrayBubbleView* Create(gfx::NativeView parent_window, |
| 116 views::View* anchor, | 116 views::View* anchor, |
| 117 Delegate* delegate, | 117 Delegate* delegate, |
| 118 InitParams* init_params); | 118 InitParams* init_params); |
| 119 | 119 |
| 120 virtual ~TrayBubbleView(); | 120 ~TrayBubbleView() override; |
| 121 | 121 |
| 122 // Sets up animations, and show the bubble. Must occur after CreateBubble() | 122 // Sets up animations, and show the bubble. Must occur after CreateBubble() |
| 123 // is called. | 123 // is called. |
| 124 void InitializeAndShowBubble(); | 124 void InitializeAndShowBubble(); |
| 125 | 125 |
| 126 // Called whenever the bubble size or location may have changed. | 126 // Called whenever the bubble size or location may have changed. |
| 127 void UpdateBubble(); | 127 void UpdateBubble(); |
| 128 | 128 |
| 129 // Sets the maximum bubble height and resizes the bubble. | 129 // Sets the maximum bubble height and resizes the bubble. |
| 130 void SetMaxHeight(int height); | 130 void SetMaxHeight(int height); |
| 131 | 131 |
| 132 // Sets the bubble width. | 132 // Sets the bubble width. |
| 133 void SetWidth(int width); | 133 void SetWidth(int width); |
| 134 | 134 |
| 135 // Sets whether or not to paint the bubble border arrow. | 135 // Sets whether or not to paint the bubble border arrow. |
| 136 void SetArrowPaintType(views::BubbleBorder::ArrowPaintType arrow_paint_type); | 136 void SetArrowPaintType(views::BubbleBorder::ArrowPaintType arrow_paint_type); |
| 137 | 137 |
| 138 // Returns the border insets. Called by TrayEventFilter. | 138 // Returns the border insets. Called by TrayEventFilter. |
| 139 gfx::Insets GetBorderInsets() const; | 139 gfx::Insets GetBorderInsets() const; |
| 140 | 140 |
| 141 // Called when the delegate is destroyed. | 141 // Called when the delegate is destroyed. |
| 142 void reset_delegate() { delegate_ = NULL; } | 142 void reset_delegate() { delegate_ = NULL; } |
| 143 | 143 |
| 144 Delegate* delegate() { return delegate_; } | 144 Delegate* delegate() { return delegate_; } |
| 145 | 145 |
| 146 void set_gesture_dragging(bool dragging) { is_gesture_dragging_ = dragging; } | 146 void set_gesture_dragging(bool dragging) { is_gesture_dragging_ = dragging; } |
| 147 bool is_gesture_dragging() const { return is_gesture_dragging_; } | 147 bool is_gesture_dragging() const { return is_gesture_dragging_; } |
| 148 | 148 |
| 149 // Overridden from views::WidgetDelegate. | 149 // Overridden from views::WidgetDelegate. |
| 150 virtual bool CanActivate() const override; | 150 bool CanActivate() const override; |
| 151 virtual views::NonClientFrameView* CreateNonClientFrameView( | 151 views::NonClientFrameView* CreateNonClientFrameView( |
| 152 views::Widget* widget) override; | 152 views::Widget* widget) override; |
| 153 virtual bool WidgetHasHitTestMask() const override; | 153 bool WidgetHasHitTestMask() const override; |
| 154 virtual void GetWidgetHitTestMask(gfx::Path* mask) const override; | 154 void GetWidgetHitTestMask(gfx::Path* mask) const override; |
| 155 | 155 |
| 156 // Overridden from views::BubbleDelegateView. | 156 // Overridden from views::BubbleDelegateView. |
| 157 virtual gfx::Rect GetAnchorRect() const override; | 157 gfx::Rect GetAnchorRect() const override; |
| 158 | 158 |
| 159 // Overridden from views::View. | 159 // Overridden from views::View. |
| 160 virtual gfx::Size GetPreferredSize() const override; | 160 gfx::Size GetPreferredSize() const override; |
| 161 virtual gfx::Size GetMaximumSize() const override; | 161 gfx::Size GetMaximumSize() const override; |
| 162 virtual int GetHeightForWidth(int width) const override; | 162 int GetHeightForWidth(int width) const override; |
| 163 virtual void OnMouseEntered(const ui::MouseEvent& event) override; | 163 void OnMouseEntered(const ui::MouseEvent& event) override; |
| 164 virtual void OnMouseExited(const ui::MouseEvent& event) override; | 164 void OnMouseExited(const ui::MouseEvent& event) override; |
| 165 virtual void GetAccessibleState(ui::AXViewState* state) override; | 165 void GetAccessibleState(ui::AXViewState* state) override; |
| 166 | 166 |
| 167 // Overridden from MouseWatcherListener | 167 // Overridden from MouseWatcherListener |
| 168 virtual void MouseMovedOutOfHost() override; | 168 void MouseMovedOutOfHost() override; |
| 169 | 169 |
| 170 protected: | 170 protected: |
| 171 TrayBubbleView(gfx::NativeView parent_window, | 171 TrayBubbleView(gfx::NativeView parent_window, |
| 172 views::View* anchor, | 172 views::View* anchor, |
| 173 Delegate* delegate, | 173 Delegate* delegate, |
| 174 const InitParams& init_params); | 174 const InitParams& init_params); |
| 175 | 175 |
| 176 // Overridden from views::BubbleDelegateView. | 176 // Overridden from views::BubbleDelegateView. |
| 177 virtual void Init() override; | 177 void Init() override; |
| 178 | 178 |
| 179 // Overridden from views::View. | 179 // Overridden from views::View. |
| 180 virtual void ChildPreferredSizeChanged(View* child) override; | 180 void ChildPreferredSizeChanged(View* child) override; |
| 181 virtual void ViewHierarchyChanged( | 181 void ViewHierarchyChanged( |
| 182 const ViewHierarchyChangedDetails& details) override; | 182 const ViewHierarchyChangedDetails& details) override; |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 InitParams params_; | 185 InitParams params_; |
| 186 Delegate* delegate_; | 186 Delegate* delegate_; |
| 187 int preferred_width_; | 187 int preferred_width_; |
| 188 internal::TrayBubbleBorder* bubble_border_; | 188 internal::TrayBubbleBorder* bubble_border_; |
| 189 scoped_ptr<internal::TrayBubbleContentMask> bubble_content_mask_; | 189 scoped_ptr<internal::TrayBubbleContentMask> bubble_content_mask_; |
| 190 bool is_gesture_dragging_; | 190 bool is_gesture_dragging_; |
| 191 | 191 |
| 192 // True once the mouse cursor was actively moved by the user over the bubble. | 192 // True once the mouse cursor was actively moved by the user over the bubble. |
| 193 // Only then the OnMouseExitedView() event will get passed on to listeners. | 193 // Only then the OnMouseExitedView() event will get passed on to listeners. |
| 194 bool mouse_actively_entered_; | 194 bool mouse_actively_entered_; |
| 195 | 195 |
| 196 // Used to find any mouse movements. | 196 // Used to find any mouse movements. |
| 197 scoped_ptr<MouseWatcher> mouse_watcher_; | 197 scoped_ptr<MouseWatcher> mouse_watcher_; |
| 198 | 198 |
| 199 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); | 199 DISALLOW_COPY_AND_ASSIGN(TrayBubbleView); |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 } // namespace views | 202 } // namespace views |
| 203 | 203 |
| 204 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ | 204 #endif // UI_VIEWS_BUBBLE_TRAY_BUBBLE_VIEW_H_ |
| OLD | NEW |