OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ | |
6 #define VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ | |
7 #pragma once | |
8 | |
9 #include "ui/gfx/native_theme.h" | |
10 #include "ui/gfx/point.h" | |
11 #include "views/controls/button/button.h" | |
12 #include "views/controls/scrollbar/base_scroll_bar.h" | |
13 #include "views/controls/scrollbar/native_scroll_bar_wrapper.h" | |
14 #include "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 // Creates new scrollbar, either horizontal or vertical. | |
30 explicit NativeScrollBarViews(NativeScrollBar* native_scroll_bar); | |
31 virtual ~NativeScrollBarViews(); | |
32 | |
33 private: | |
34 // View overrides: | |
35 virtual void Layout(); | |
36 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | |
37 virtual gfx::Size GetPreferredSize(); | |
38 | |
39 // ScrollBar overrides: | |
40 virtual int GetLayoutSize() const OVERRIDE; | |
41 | |
42 // BaseScrollBar overrides: | |
43 virtual void ScrollToPosition(int position); | |
44 virtual int GetScrollIncrement(bool is_page, bool is_positive); | |
45 | |
46 // BaseButton::ButtonListener overrides: | |
47 virtual void ButtonPressed(Button* sender, | |
48 const views::Event& event) OVERRIDE; | |
49 | |
50 // NativeScrollBarWrapper overrides: | |
51 virtual int GetPosition() const; | |
52 virtual View* GetView(); | |
53 virtual void Update(int viewport_size, int content_size, int current_pos); | |
54 | |
55 // Returns the area for the track. This is the area of the scrollbar minus | |
56 // the size of the arrow buttons. | |
57 virtual gfx::Rect GetTrackBounds() const OVERRIDE; | |
58 | |
59 // The NativeScrollBar we are bound to. | |
60 NativeScrollBar* native_scroll_bar_; | |
61 | |
62 // The scroll bar buttons (Up/Down, Left/Right). | |
63 Button* prev_button_; | |
64 Button* next_button_; | |
65 | |
66 gfx::NativeTheme::ExtraParams params_; | |
67 gfx::NativeTheme::Part part_; | |
68 gfx::NativeTheme::State state_; | |
69 | |
70 DISALLOW_COPY_AND_ASSIGN(NativeScrollBarViews); | |
71 }; | |
72 | |
73 } // namespace views | |
74 | |
75 #endif // VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ | |
76 | |
OLD | NEW |