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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_
8 #include "base/compiler_specific.h"
9 #include "ui/gfx/point.h"
10 #include "ui/native_theme/native_theme.h"
11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/scrollbar/base_scroll_bar.h"
13 #include "ui/views/controls/scrollbar/native_scroll_bar_wrapper.h"
14 #include "ui/views/view.h"
22 class NativeScrollBar
;
24 // Views implementation for the scrollbar.
25 class VIEWS_EXPORT NativeScrollBarViews
: public BaseScrollBar
,
26 public ButtonListener
,
27 public NativeScrollBarWrapper
{
29 static const char kViewClassName
[];
31 // Creates new scrollbar, either horizontal or vertical.
32 explicit NativeScrollBarViews(NativeScrollBar
* native_scroll_bar
);
33 virtual ~NativeScrollBarViews();
37 virtual void Layout() OVERRIDE
;
38 virtual void OnPaint(gfx::Canvas
* canvas
) OVERRIDE
;
39 virtual gfx::Size
GetPreferredSize() const OVERRIDE
;
40 virtual const char* GetClassName() const OVERRIDE
;
42 // ScrollBar overrides:
43 virtual int GetLayoutSize() const OVERRIDE
;
45 // BaseScrollBar overrides:
46 virtual void ScrollToPosition(int position
) OVERRIDE
;
47 virtual int GetScrollIncrement(bool is_page
, bool is_positive
) OVERRIDE
;
49 // BaseButton::ButtonListener overrides:
50 virtual void ButtonPressed(Button
* sender
,
51 const ui::Event
& event
) OVERRIDE
;
53 // NativeScrollBarWrapper overrides:
54 virtual int GetPosition() const OVERRIDE
;
55 virtual View
* GetView() OVERRIDE
;
56 virtual void Update(int viewport_size
,
58 int current_pos
) OVERRIDE
;
60 // Returns the area for the track. This is the area of the scrollbar minus
61 // the size of the arrow buttons.
62 virtual gfx::Rect
GetTrackBounds() const OVERRIDE
;
64 // The NativeScrollBar we are bound to.
65 NativeScrollBar
* native_scroll_bar_
;
67 // The scroll bar buttons (Up/Down, Left/Right).
71 ui::NativeTheme::ExtraParams params_
;
72 ui::NativeTheme::Part part_
;
73 ui::NativeTheme::State state_
;
75 DISALLOW_COPY_AND_ASSIGN(NativeScrollBarViews
);
80 #endif // UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_