blob: 70d5a83d37a8be4860ccceb27dac41a5b2095b38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_H_
#define UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_H_
#include <string>
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "ui/views/controls/scrollbar/scroll_bar.h"
#include "ui/views/view.h"
namespace ui {
class NativeTheme;
}
namespace views {
class NativeScrollBarWrapper;
// The NativeScrollBar class is a scrollbar that uses platform's
// native control.
class VIEWS_EXPORT NativeScrollBar : public ScrollBar {
public:
// The scroll-bar's class name.
static const char kViewClassName[];
// Create new scrollbar, either horizontal or vertical.
explicit NativeScrollBar(bool is_horiz);
virtual ~NativeScrollBar();
// Return the system sizes.
static int GetHorizontalScrollBarHeight(const ui::NativeTheme* theme);
static int GetVerticalScrollBarWidth(const ui::NativeTheme* theme);
private:
friend class NativeScrollBarTest;
FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, Scrolling);
// Overridden from View.
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
virtual void ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
// Overrideen from View for keyboard UI purpose.
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
virtual bool OnMouseWheel(const ui::MouseWheelEvent& e) OVERRIDE;
// Overridden from ui::EventHandler.
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
// Overridden from ScrollBar.
virtual void Update(int viewport_size,
int content_size,
int current_pos) OVERRIDE;
virtual int GetPosition() const OVERRIDE;
virtual int GetLayoutSize() const OVERRIDE;
// init border
NativeScrollBarWrapper* native_wrapper_;
DISALLOW_COPY_AND_ASSIGN(NativeScrollBar);
};
} // namespace views
#endif // UI_VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_H_
|