Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / views / controls / scrollbar / native_scroll_bar_views.h
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.
4
5 #ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_
6 #define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_
7
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"
15
16 namespace gfx {
17 class Canvas;
18 }
19
20 namespace views {
21
22 class NativeScrollBar;
23
24 // Views implementation for the scrollbar.
25 class VIEWS_EXPORT NativeScrollBarViews : public BaseScrollBar,
26                                           public ButtonListener,
27                                           public NativeScrollBarWrapper {
28  public:
29   static const char kViewClassName[];
30
31   // Creates new scrollbar, either horizontal or vertical.
32   explicit NativeScrollBarViews(NativeScrollBar* native_scroll_bar);
33   ~NativeScrollBarViews() override;
34
35  private:
36   // View overrides:
37   void Layout() override;
38   void OnPaint(gfx::Canvas* canvas) override;
39   gfx::Size GetPreferredSize() const override;
40   const char* GetClassName() const override;
41
42   // ScrollBar overrides:
43   int GetLayoutSize() const override;
44
45   // BaseScrollBar overrides:
46   void ScrollToPosition(int position) override;
47   int GetScrollIncrement(bool is_page, bool is_positive) override;
48
49   // BaseButton::ButtonListener overrides:
50   void ButtonPressed(Button* sender, const ui::Event& event) override;
51
52   // NativeScrollBarWrapper overrides:
53   int GetPosition() const override;
54   View* GetView() override;
55   void Update(int viewport_size, int content_size, int current_pos) override;
56
57   // Returns the area for the track. This is the area of the scrollbar minus
58   // the size of the arrow buttons.
59   gfx::Rect GetTrackBounds() const override;
60
61   // The NativeScrollBar we are bound to.
62   NativeScrollBar* native_scroll_bar_;
63
64   // The scroll bar buttons (Up/Down, Left/Right).
65   Button* prev_button_;
66   Button* next_button_;
67
68   ui::NativeTheme::ExtraParams params_;
69   ui::NativeTheme::Part part_;
70   ui::NativeTheme::State state_;
71
72   DISALLOW_COPY_AND_ASSIGN(NativeScrollBarViews);
73 };
74
75 }  // namespace views
76
77 #endif  // UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_