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