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_WAYLAND_H_ | |
Ben Goodger (Google)
2011/08/16 17:58:45
qq: won't Wayland just use the views-based scrollb
| |
6 #define VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_WAYLAND_H_ | |
7 #pragma once | |
8 | |
9 #include "views/controls/native_control_wayland.h" | |
10 #include "views/controls/scrollbar/native_scroll_bar_wrapper.h" | |
11 | |
12 namespace ui { | |
13 class WaylandWidget; | |
14 } // namespace ui | |
15 | |
16 namespace views { | |
17 | |
18 class ScrollBarContainer; | |
19 | |
20 class NativeScrollBarWayland : public NativeControlWayland, | |
21 public NativeScrollBarWrapper { | |
22 public: | |
23 // Creates new scrollbar, either horizontal or vertical. | |
24 explicit NativeScrollBarWayland(NativeScrollBar* native_scroll_bar); | |
25 virtual ~NativeScrollBarWayland(); | |
26 | |
27 private: | |
28 // Overridden from View for layout purpose. | |
29 virtual void Layout(); | |
30 virtual gfx::Size GetPreferredSize(); | |
31 | |
32 // Overridden from View for keyboard UI purpose. | |
33 virtual bool OnKeyPressed(const KeyEvent& event); | |
34 virtual bool OnMouseWheel(const MouseWheelEvent& e); | |
35 | |
36 // Overridden from NativeControlGtk. | |
37 virtual void CreateNativeControl(); | |
38 | |
39 // Overridden from NativeScrollBarWrapper. | |
40 virtual int GetPosition() const; | |
41 virtual View* GetView(); | |
42 virtual void Update(int viewport_size, int content_size, int current_pos); | |
43 | |
44 // Moves the scrollbar by the given value. Negative value is allowed. | |
45 // (moves upward) | |
46 void MoveBy(int o); | |
47 | |
48 // Moves the scrollbar by the page (viewport) size. | |
49 void MovePage(bool positive); | |
50 | |
51 // Moves the scrollbar by predefined step size. | |
52 void MoveStep(bool positive); | |
53 | |
54 // Moves the scrollbar to the given position. MoveTo(0) moves it to the top. | |
55 void MoveTo(int p); | |
56 | |
57 // Moves the scrollbar to the end. | |
58 void MoveToBottom(); | |
59 | |
60 // Invoked when the scrollbar's position is changed. | |
61 void ValueChanged(); | |
62 | |
63 static void CallValueChanged(ui::WaylandWidget* widget, | |
64 NativeScrollBarWayland* scroll_bar); | |
65 | |
66 // The NativeScrollBar we are bound to. | |
67 NativeScrollBar* native_scroll_bar_; | |
68 | |
69 private: | |
70 DISALLOW_COPY_AND_ASSIGN(NativeScrollBarWayland); | |
71 }; | |
72 | |
73 } // namespace views | |
74 | |
75 #endif // #ifndef VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_WAYLAND_H_ | |
76 | |
OLD | NEW |