1 // Copyright (c) 2011 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.
5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_SCROLL_VIEW_CONTAINER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_SCROLL_VIEW_CONTAINER_H_
8 #include "ui/views/view.h"
9 #include "ui/views/bubble/bubble_border.h"
10 #include "ui/views/controls/menu/menu_types.h"
16 // MenuScrollViewContainer contains the SubmenuView (through a MenuScrollView)
17 // and two scroll buttons. The scroll buttons are only visible and enabled if
18 // the preferred height of the SubmenuView is bigger than our bounds.
19 class MenuScrollViewContainer
: public View
{
21 explicit MenuScrollViewContainer(SubmenuView
* content_view
);
23 // Returns the buttons for scrolling up/down.
24 View
* scroll_down_button() const { return scroll_down_button_
; }
25 View
* scroll_up_button() const { return scroll_up_button_
; }
27 // External function to check if the bubble border is usd.
28 bool HasBubbleBorder();
30 // Offsets the Arrow from the default location.
31 void SetBubbleArrowOffset(int offset
);
34 void OnPaintBackground(gfx::Canvas
* canvas
) override
;
35 void Layout() override
;
36 gfx::Size
GetPreferredSize() const override
;
37 void GetAccessibleState(ui::AXViewState
* state
) override
;
41 void OnBoundsChanged(const gfx::Rect
& previous_bounds
) override
;
44 // Create the default border.
45 void CreateDefaultBorder();
47 // Create the bubble border.
48 void CreateBubbleBorder();
50 BubbleBorder::Arrow
BubbleBorderTypeFromAnchor(MenuAnchorPosition anchor
);
54 // The scroll buttons.
55 View
* scroll_up_button_
;
56 View
* scroll_down_button_
;
59 MenuScrollView
* scroll_view_
;
62 SubmenuView
* content_view_
;
64 // If set the currently set border is a bubble border.
65 BubbleBorder::Arrow arrow_
;
67 // Weak reference to the currently set border.
68 BubbleBorder
* bubble_border_
;
70 DISALLOW_COPY_AND_ASSIGN(MenuScrollViewContainer
);
75 #endif // UI_VIEWS_CONTROLS_MENU_MENU_SCROLL_VIEW_CONTAINER_H_