OLD | NEW |
(Empty) | |
| 1 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_ |
| 2 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_ |
| 3 #pragma once |
| 4 |
| 5 #include "ui/views/bubble/bubble_delegate.h" |
| 6 |
| 7 namespace views { |
| 8 class View; |
| 9 } |
| 10 |
| 11 namespace ash { |
| 12 namespace internal { |
| 13 |
| 14 // Specialized bubble view for system and web notification bubbles. |
| 15 // Mostly this handles custom anchor location and arrow and border rendering. |
| 16 class SystemTrayBubbleView : public views::BubbleDelegateView { |
| 17 public: |
| 18 class Host { |
| 19 public: |
| 20 Host() {} |
| 21 virtual ~Host() {} |
| 22 |
| 23 virtual void BubbleViewDestroyed() = 0; |
| 24 virtual gfx::Rect GetAnchorRect() const = 0; |
| 25 virtual void OnMouseEnteredView() = 0; |
| 26 virtual void OnMouseExitedView() = 0; |
| 27 |
| 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(Host); |
| 30 }; |
| 31 |
| 32 SystemTrayBubbleView(views::View* anchor, |
| 33 views::BubbleBorder::ArrowLocation arrow_location, |
| 34 Host* host, |
| 35 bool can_activate); |
| 36 virtual ~SystemTrayBubbleView(); |
| 37 |
| 38 void SetBubbleBorder(int arrow_offset); |
| 39 void UpdateAnchor(); |
| 40 void SetMaxHeight(int height); |
| 41 |
| 42 // Called when the host is destroyed. |
| 43 void reset_host() { host_ = NULL; } |
| 44 |
| 45 void set_bubble_width(int width) { bubble_width_ = width; } |
| 46 |
| 47 protected: |
| 48 // Overridden from views::WidgetDelegate. |
| 49 virtual bool CanActivate() const OVERRIDE; |
| 50 |
| 51 // Overridden from views::BubbleDelegateView. |
| 52 virtual void Init() OVERRIDE; |
| 53 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
| 54 virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
| 55 |
| 56 // Overridden from views::View. |
| 57 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 58 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
| 59 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
| 60 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 61 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
| 62 virtual void ViewHierarchyChanged(bool is_add, |
| 63 views::View* parent, |
| 64 views::View* child) OVERRIDE; |
| 65 |
| 66 Host* host_; |
| 67 bool can_activate_; |
| 68 int max_height_; |
| 69 int bubble_width_; |
| 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView); |
| 72 }; |
| 73 |
| 74 } // namespace internal |
| 75 } // namespace ash |
| 76 |
| 77 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_VIEW_H_ |
OLD | NEW |