Chromium Code Reviews| Index: views/controls/scrollbar/native_scroll_bar_views.h |
| diff --git a/views/controls/scrollbar/native_scroll_bar_views.h b/views/controls/scrollbar/native_scroll_bar_views.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5a234bd5b0e7c8cc5b65fd5e226c4c30d8c26f4a |
| --- /dev/null |
| +++ b/views/controls/scrollbar/native_scroll_bar_views.h |
| @@ -0,0 +1,97 @@ |
| +// 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. |
| + |
| +#ifndef VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ |
| +#define VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ |
| +#pragma once |
| + |
| +#include "ui/gfx/native_theme.h" |
| +#include "ui/gfx/point.h" |
| +#include "views/controls/button/button.h" |
| +#include "views/controls/scrollbar/native_scroll_bar_wrapper.h" |
| +#include "views/view.h" |
| + |
| +namespace gfx { |
| +class Canvas; |
| +} |
| + |
| +namespace views { |
| + |
| +class ScrollBarContainer; |
| +class ScrollBarThumb; |
| + |
| +// Views implementation for the scrollbar. |
| +class NativeScrollBarViews : public View, |
| + public ButtonListener, |
| + public NativeScrollBarWrapper { |
| + public: |
| + // Creates new scrollbar, either horizontal or vertical. |
| + explicit NativeScrollBarViews(NativeScrollBar* native_scroll_bar); |
| + virtual ~NativeScrollBarViews(); |
| + |
| + private: |
| + // Overridden from View for layout purpose. |
| + virtual void Layout(); |
| + virtual gfx::Size GetPreferredSize(); |
| + |
| + // Overridden from View for keyboard UI purpose. |
| + virtual bool OnKeyPressed(const KeyEvent& event) OVERRIDE; |
| + virtual bool OnMousePressed(const MouseEvent& event) OVERRIDE; |
| + virtual void OnMouseEntered(const MouseEvent& event) OVERRIDE; |
| + virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; |
| + virtual bool OnMouseWheel(const MouseWheelEvent& e) OVERRIDE; |
| + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| + |
| + // BaseButton::ButtonListener overrides: |
| + virtual void ButtonPressed(Button* sender, |
| + const views::Event& event) OVERRIDE; |
| + |
| + // Overridden from NativeScrollBarWrapper. |
| + virtual int GetPosition() const; |
| + virtual View* GetView(); |
| + virtual void Update(int viewport_size, int content_size, int current_pos); |
| + |
| + // Moves the scrollbar by the given value. Negative value is allowed. |
| + // (moves upward) |
| + void MoveBy(int o); |
|
Ben Goodger (Google)
2011/08/19 17:44:33
What is the unit. Pixels or something else?
|
| + |
| + // Moves the scrollbar by the page (viewport) size. |
| + void MovePage(bool positive); |
|
Ben Goodger (Google)
2011/08/19 17:44:33
I would prefer if this expressed direction up or d
|
| + |
| + // Moves the scrollbar by predefined step size. |
| + void MoveStep(bool positive); |
|
Ben Goodger (Google)
2011/08/19 17:44:33
MoveByStep.
|
| + |
| + // Moves the scrollbar to the given position. MoveTo(0) moves it to the top. |
| + void MoveTo(int p); |
| + |
| + // Moves the scrollbar to the end. |
| + void MoveToBottom(); |
|
Ben Goodger (Google)
2011/08/19 17:44:33
Prefer start/end terminology to top/bottom left/ri
|
| + |
| + // Invoked when the scrollbar's position is changed. |
| + void ValueChanged(); |
| + |
| + // Returns the area for the track. This is the area of the scrollbar minus |
| + // the size of the arrow buttons. |
| + gfx::Rect GetTrackBounds() const; |
| + |
| + // The NativeScrollBar we are bound to. |
| + NativeScrollBar* native_scroll_bar_; |
| + |
| + // The scroll bar buttons (Up/Down, Left/Right). |
| + Button* prev_button_; |
| + Button* next_button_; |
| + |
| + ScrollBarThumb* thumb_; |
| + |
| + gfx::NativeTheme::ExtraParams params_; |
| + gfx::NativeTheme::Part part_; |
| + gfx::NativeTheme::State state_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NativeScrollBarViews); |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // #ifndef VIEWS_CONTROLS_SCROLLBAR_NATIVE_SCROLL_BAR_VIEWS_H_ |
| + |