summaryrefslogtreecommitdiff
path: root/chromium/ash/shelf/overflow_bubble_view.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ash/shelf/overflow_bubble_view.h')
-rw-r--r--chromium/ash/shelf/overflow_bubble_view.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/chromium/ash/shelf/overflow_bubble_view.h b/chromium/ash/shelf/overflow_bubble_view.h
new file mode 100644
index 00000000000..f5bfdc12050
--- /dev/null
+++ b/chromium/ash/shelf/overflow_bubble_view.h
@@ -0,0 +1,69 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_SHELF_OVERFLOW_BUBBLE_VIEW_H_
+#define ASH_SHELF_OVERFLOW_BUBBLE_VIEW_H_
+
+#include "ash/ash_export.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "ui/views/bubble/bubble_delegate.h"
+
+namespace ash {
+
+namespace test {
+class OverflowBubbleViewTestAPI;
+}
+
+namespace internal {
+
+class ShelfLayoutManager;
+class ShelfView;
+
+// OverflowBubbleView hosts a ShelfView to display overflown items.
+// Exports to access this class from OverflowBubbleViewTestAPI.
+class ASH_EXPORT OverflowBubbleView : public views::BubbleDelegateView {
+ public:
+ OverflowBubbleView();
+ virtual ~OverflowBubbleView();
+
+ void InitOverflowBubble(views::View* anchor, ShelfView* shelf_view);
+
+ // views::BubbleDelegateView overrides:
+ virtual gfx::Rect GetBubbleBounds() OVERRIDE;
+
+ private:
+ friend class test::OverflowBubbleViewTestAPI;
+
+ bool IsHorizontalAlignment() const;
+
+ const gfx::Size GetContentsSize() const;
+
+ // Gets arrow location based on shelf alignment.
+ views::BubbleBorder::Arrow GetBubbleArrow() const;
+
+ void ScrollByXOffset(int x_offset);
+ void ScrollByYOffset(int y_offset);
+
+ // views::View overrides:
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void Layout() OVERRIDE;
+ virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE;
+ virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
+
+ // ui::EventHandler overrides:
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
+
+ ShelfLayoutManager* GetShelfLayoutManagerForLauncher() const;
+
+ ShelfView* shelf_view_; // Owned by views hierarchy.
+ gfx::Vector2d scroll_offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_SHELF_OVERFLOW_BUBBLE_VIEW_H_