Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Unified Diff: views/controls/scrollbar/native_scroll_bar_views.h

Issue 7669028: Adding a Views scrollbar implementation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Refactored the bitmap code to be shared with the native_scroll_bar_views Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..85cf8ea4ad5bf87faa693f497c1eb6650f8623ff
--- /dev/null
+++ b/views/controls/scrollbar/native_scroll_bar_views.h
@@ -0,0 +1,78 @@
+// 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/base_scroll_bar.h"
+#include "views/controls/scrollbar/native_scroll_bar_wrapper.h"
+#include "views/view.h"
+
+namespace gfx {
+class Canvas;
+}
+
+namespace views {
+
+class NativeScrollBar;
+
+// Views implementation for the scrollbar.
+class NativeScrollBarViews : public BaseScrollBar,
+ 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.
Ben Goodger (Google) 2011/08/23 16:05:15 View overrides:
+ virtual void Layout();
+ virtual gfx::Size GetPreferredSize();
+
+ // ScrollBar overrides:
+ virtual int GetLayoutSize() const OVERRIDE;
+
+ // BaseScrollBar overrides:
+ virtual void ScrollToPosition(int position);
+ virtual int GetScrollIncrement(bool is_page, bool is_positive);
+
+ // Overridden from View.
Ben Goodger (Google) 2011/08/23 16:05:15 Move adjacent to other View overrides, and update
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
+
+ // BaseButton::ButtonListener overrides:
+ virtual void ButtonPressed(Button* sender,
+ const views::Event& event) OVERRIDE;
+
+ // Overridden from NativeScrollBarWrapper.
Ben Goodger (Google) 2011/08/23 16:05:15 Change comment style to match the other section he
+ virtual int GetPosition() const;
+ virtual View* GetView();
+ virtual void Update(int viewport_size, int content_size, int current_pos);
+
+ // 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_;
+
+ 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_
+

Powered by Google App Engine
This is Rietveld 408576698