blob: ea05faeddb456c21711fc212f0c8c19351f88c5c [file] [log] [blame]
// Copyright (c) 2011 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.
#pragma once
#include <string>
#include "base/gtest_prod_util.h"
#include "views/controls/scrollbar/scroll_bar.h"
#include "views/view.h"
namespace views {
class NativeScrollBarWrapper;
// The NativeScrollBar class is a scrollbar that uses platform's
// native control.
class VIEWS_EXPORT NativeScrollBar : public ScrollBar {
// 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();
static int GetVerticalScrollBarWidth();
friend class NativeScrollBarTest;
FRIEND_TEST_ALL_PREFIXES(NativeScrollBarTest, Scrolling);
// Overridden from View.
virtual gfx::Size GetPreferredSize();
virtual void Layout();
virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
virtual std::string GetClassName() const;
// Overrideen from View for keyboard UI purpose.
virtual bool OnKeyPressed(const KeyEvent& event);
virtual bool OnMouseWheel(const MouseWheelEvent& e);
// Overridden from ScrollBar.
virtual void Update(int viewport_size, int content_size, int current_pos);
virtual int GetPosition() const;
virtual int GetLayoutSize() const;
// init border
NativeScrollBarWrapper* native_wrapper_;
} // namespace views