OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_SHELF_OVERFLOW_BUBBLE_VIEW_H_ | |
6 #define ASH_COMMON_SHELF_OVERFLOW_BUBBLE_VIEW_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/macros.h" | |
10 #include "ui/views/bubble/bubble_dialog_delegate.h" | |
11 | |
12 namespace views { | |
13 class View; | |
14 } | |
15 | |
16 namespace ash { | |
17 class WmShelf; | |
18 | |
19 namespace test { | |
20 class OverflowBubbleViewTestAPI; | |
21 } | |
22 | |
23 // OverflowBubbleView hosts a ShelfView to display overflown items. | |
24 // Exports to access this class from OverflowBubbleViewTestAPI. | |
25 class ASH_EXPORT OverflowBubbleView : public views::BubbleDialogDelegateView { | |
26 public: | |
27 explicit OverflowBubbleView(WmShelf* wm_shelf); | |
28 ~OverflowBubbleView() override; | |
29 | |
30 // |anchor| is the overflow button on the main shelf. |shelf_view| is the | |
31 // ShelfView containing the overflow items. | |
32 void InitOverflowBubble(views::View* anchor, views::View* shelf_view); | |
33 | |
34 // views::BubbleDialogDelegateView overrides: | |
35 int GetDialogButtons() const override; | |
36 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, | |
37 views::Widget* bubble_widget) const override; | |
38 gfx::Rect GetBubbleBounds() override; | |
39 | |
40 private: | |
41 friend class test::OverflowBubbleViewTestAPI; | |
42 | |
43 const gfx::Size GetContentsSize() const; | |
44 | |
45 // Gets arrow location based on shelf alignment. | |
46 views::BubbleBorder::Arrow GetBubbleArrow() const; | |
47 | |
48 void ScrollByXOffset(int x_offset); | |
49 void ScrollByYOffset(int y_offset); | |
50 | |
51 // views::View overrides: | |
52 gfx::Size GetPreferredSize() const override; | |
53 void Layout() override; | |
54 void ChildPreferredSizeChanged(views::View* child) override; | |
55 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; | |
56 | |
57 // ui::EventHandler overrides: | |
58 void OnScrollEvent(ui::ScrollEvent* event) override; | |
59 | |
60 WmShelf* wm_shelf_; | |
61 views::View* shelf_view_; // Owned by views hierarchy. | |
62 gfx::Vector2d scroll_offset_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); | |
65 }; | |
66 | |
67 } // namespace ash | |
68 | |
69 #endif // ASH_COMMON_SHELF_OVERFLOW_BUBBLE_VIEW_H_ | |
OLD | NEW |