summaryrefslogtreecommitdiffstats
path: root/ui/views/controls/scrollbar
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-14 23:10:10 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-14 23:10:10 +0000
commit1e25fbf5e01d0ea8045c43288ee58fc7d0b3a3a2 (patch)
tree9f277e5e69c7b6a9586f827d425d6b66ea29d466 /ui/views/controls/scrollbar
parent84d9ab4c2dc42dd7d18672c2855c92589bf9208b (diff)
downloadchromium_src-1e25fbf5e01d0ea8045c43288ee58fc7d0b3a3a2.zip
chromium_src-1e25fbf5e01d0ea8045c43288ee58fc7d0b3a3a2.tar.gz
chromium_src-1e25fbf5e01d0ea8045c43288ee58fc7d0b3a3a2.tar.bz2
Revert 136996 - ui: Move NativeTheme files into ui/base/native_theme/ directory.
BUG=103304,125844 R=ben@chromium.org TBR=tony@chromium.org Review URL: https://chromiumcodereview.appspot.com/10310136 TBR=tfarina@chromium.org Review URL: https://chromiumcodereview.appspot.com/10387121 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls/scrollbar')
-rw-r--r--ui/views/controls/scrollbar/native_scroll_bar_views.cc110
-rw-r--r--ui/views/controls/scrollbar/native_scroll_bar_views.h10
2 files changed, 62 insertions, 58 deletions
diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.cc b/ui/views/controls/scrollbar/native_scroll_bar_views.cc
index 0d61986..7eb2a08 100644
--- a/ui/views/controls/scrollbar/native_scroll_bar_views.cc
+++ b/ui/views/controls/scrollbar/native_scroll_bar_views.cc
@@ -41,9 +41,9 @@ class ScrollBarButton : public BaseScrollBarButton {
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
private:
- ui::NativeTheme::ExtraParams GetNativeThemeParams() const;
- ui::NativeTheme::Part GetNativeThemePart() const;
- ui::NativeTheme::State GetNativeThemeState() const;
+ gfx::NativeTheme::ExtraParams GetNativeThemeParams() const;
+ gfx::NativeTheme::Part GetNativeThemePart() const;
+ gfx::NativeTheme::State GetNativeThemeState() const;
Type type_;
};
@@ -63,9 +63,9 @@ class ScrollBarThumb : public BaseScrollBarThumb {
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
private:
- ui::NativeTheme::ExtraParams GetNativeThemeParams() const;
- ui::NativeTheme::Part GetNativeThemePart() const;
- ui::NativeTheme::State GetNativeThemeState() const;
+ gfx::NativeTheme::ExtraParams GetNativeThemeParams() const;
+ gfx::NativeTheme::Part GetNativeThemePart() const;
+ gfx::NativeTheme::State GetNativeThemeState() const;
ScrollBar* scroll_bar_;
};
@@ -86,21 +86,22 @@ ScrollBarButton::~ScrollBarButton() {
}
gfx::Size ScrollBarButton::GetPreferredSize() {
- const ui::NativeTheme* native_theme = ui::NativeTheme::instance();
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
return native_theme->GetPartSize(GetNativeThemePart(),
GetNativeThemeState(),
GetNativeThemeParams());
}
void ScrollBarButton::OnPaint(gfx::Canvas* canvas) {
- const ui::NativeTheme* native_theme = ui::NativeTheme::instance();
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
gfx::Rect bounds(GetPreferredSize());
native_theme->Paint(canvas->sk_canvas(), GetNativeThemePart(),
GetNativeThemeState(), bounds, GetNativeThemeParams());
}
-ui::NativeTheme::ExtraParams ScrollBarButton::GetNativeThemeParams() const {
- ui::NativeTheme::ExtraParams params;
+gfx::NativeTheme::ExtraParams
+ ScrollBarButton::GetNativeThemeParams() const {
+ gfx::NativeTheme::ExtraParams params;
switch (state_) {
case CustomButton::BS_HOT:
@@ -114,37 +115,39 @@ ui::NativeTheme::ExtraParams ScrollBarButton::GetNativeThemeParams() const {
return params;
}
-ui::NativeTheme::Part ScrollBarButton::GetNativeThemePart() const {
+gfx::NativeTheme::Part
+ ScrollBarButton::GetNativeThemePart() const {
switch (type_) {
case UP:
- return ui::NativeTheme::kScrollbarUpArrow;
+ return gfx::NativeTheme::kScrollbarUpArrow;
case DOWN:
- return ui::NativeTheme::kScrollbarDownArrow;
+ return gfx::NativeTheme::kScrollbarDownArrow;
case LEFT:
- return ui::NativeTheme::kScrollbarLeftArrow;
+ return gfx::NativeTheme::kScrollbarLeftArrow;
case RIGHT:
- return ui::NativeTheme::kScrollbarRightArrow;
+ return gfx::NativeTheme::kScrollbarRightArrow;
default:
- return ui::NativeTheme::kScrollbarUpArrow;
+ return gfx::NativeTheme::kScrollbarUpArrow;
}
}
-ui::NativeTheme::State ScrollBarButton::GetNativeThemeState() const {
- ui::NativeTheme::State state;
+gfx::NativeTheme::State
+ ScrollBarButton::GetNativeThemeState() const {
+ gfx::NativeTheme::State state;
switch (state_) {
case CustomButton::BS_HOT:
- state = ui::NativeTheme::kHovered;
+ state = gfx::NativeTheme::kHovered;
break;
case CustomButton::BS_PUSHED:
- state = ui::NativeTheme::kPressed;
+ state = gfx::NativeTheme::kPressed;
break;
case CustomButton::BS_DISABLED:
- state = ui::NativeTheme::kDisabled;
+ state = gfx::NativeTheme::kDisabled;
break;
case CustomButton::BS_NORMAL:
default:
- state = ui::NativeTheme::kNormal;
+ state = gfx::NativeTheme::kNormal;
break;
}
@@ -165,14 +168,14 @@ ScrollBarThumb::~ScrollBarThumb() {
}
gfx::Size ScrollBarThumb::GetPreferredSize() {
- const ui::NativeTheme* native_theme = ui::NativeTheme::instance();
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
return native_theme->GetPartSize(GetNativeThemePart(),
GetNativeThemeState(),
GetNativeThemeParams());
}
void ScrollBarThumb::OnPaint(gfx::Canvas* canvas) {
- const ui::NativeTheme* native_theme = ui::NativeTheme::instance();
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
native_theme->Paint(canvas->sk_canvas(),
GetNativeThemePart(),
@@ -181,8 +184,9 @@ void ScrollBarThumb::OnPaint(gfx::Canvas* canvas) {
GetNativeThemeParams());
}
-ui::NativeTheme::ExtraParams ScrollBarThumb::GetNativeThemeParams() const {
- ui::NativeTheme::ExtraParams params;
+gfx::NativeTheme::ExtraParams
+ ScrollBarThumb::GetNativeThemeParams() const {
+ gfx::NativeTheme::ExtraParams params;
switch (GetState()) {
case CustomButton::BS_HOT:
@@ -196,28 +200,28 @@ ui::NativeTheme::ExtraParams ScrollBarThumb::GetNativeThemeParams() const {
return params;
}
-ui::NativeTheme::Part ScrollBarThumb::GetNativeThemePart() const {
+gfx::NativeTheme::Part ScrollBarThumb::GetNativeThemePart() const {
if (scroll_bar_->IsHorizontal())
- return ui::NativeTheme::kScrollbarHorizontalThumb;
- return ui::NativeTheme::kScrollbarVerticalThumb;
+ return gfx::NativeTheme::kScrollbarHorizontalThumb;
+ return gfx::NativeTheme::kScrollbarVerticalThumb;
}
-ui::NativeTheme::State ScrollBarThumb::GetNativeThemeState() const {
- ui::NativeTheme::State state;
+gfx::NativeTheme::State ScrollBarThumb::GetNativeThemeState() const {
+ gfx::NativeTheme::State state;
switch (GetState()) {
case CustomButton::BS_HOT:
- state = ui::NativeTheme::kHovered;
+ state = gfx::NativeTheme::kHovered;
break;
case CustomButton::BS_PUSHED:
- state = ui::NativeTheme::kPressed;
+ state = gfx::NativeTheme::kPressed;
break;
case CustomButton::BS_DISABLED:
- state = ui::NativeTheme::kDisabled;
+ state = gfx::NativeTheme::kDisabled;
break;
case CustomButton::BS_NORMAL:
default:
- state = ui::NativeTheme::kNormal;
+ state = gfx::NativeTheme::kNormal;
break;
}
@@ -242,15 +246,15 @@ NativeScrollBarViews::NativeScrollBarViews(NativeScrollBar* scroll_bar)
prev_button_ = new ScrollBarButton(this, ScrollBarButton::LEFT);
next_button_ = new ScrollBarButton(this, ScrollBarButton::RIGHT);
- part_ = ui::NativeTheme::kScrollbarHorizontalTrack;
+ part_ = gfx::NativeTheme::kScrollbarHorizontalTrack;
} else {
prev_button_ = new ScrollBarButton(this, ScrollBarButton::UP);
next_button_ = new ScrollBarButton(this, ScrollBarButton::DOWN);
- part_ = ui::NativeTheme::kScrollbarVerticalTrack;
+ part_ = gfx::NativeTheme::kScrollbarVerticalTrack;
}
- state_ = ui::NativeTheme::kNormal;
+ state_ = gfx::NativeTheme::kNormal;
AddChildView(prev_button_);
AddChildView(next_button_);
@@ -281,7 +285,7 @@ void NativeScrollBarViews::Layout() {
}
void NativeScrollBarViews::OnPaint(gfx::Canvas* canvas) {
- const ui::NativeTheme* native_theme = ui::NativeTheme::instance();
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
gfx::Rect bounds = GetTrackBounds();
if (bounds.IsEmpty())
@@ -382,20 +386,20 @@ NativeScrollBarWrapper* NativeScrollBarWrapper::CreateWrapper(
// static
int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() {
- const ui::NativeTheme* native_theme = ui::NativeTheme::instance();
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
- ui::NativeTheme::ExtraParams button_params;
+ gfx::NativeTheme::ExtraParams button_params;
button_params.scrollbar_arrow.is_hovering = false;
gfx::Size button_size = native_theme->GetPartSize(
- ui::NativeTheme::kScrollbarLeftArrow,
- ui::NativeTheme::kNormal,
+ gfx::NativeTheme::kScrollbarLeftArrow,
+ gfx::NativeTheme::kNormal,
button_params);
- ui::NativeTheme::ExtraParams thumb_params;
+ gfx::NativeTheme::ExtraParams thumb_params;
thumb_params.scrollbar_thumb.is_hovering = false;
gfx::Size track_size = native_theme->GetPartSize(
- ui::NativeTheme::kScrollbarHorizontalThumb,
- ui::NativeTheme::kNormal,
+ gfx::NativeTheme::kScrollbarHorizontalThumb,
+ gfx::NativeTheme::kNormal,
thumb_params);
return std::max(track_size.height(), button_size.height());
@@ -403,20 +407,20 @@ int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() {
// static
int NativeScrollBarWrapper::GetVerticalScrollBarWidth() {
- const ui::NativeTheme* native_theme = ui::NativeTheme::instance();
+ const gfx::NativeTheme* native_theme = gfx::NativeTheme::instance();
- ui::NativeTheme::ExtraParams button_params;
+ gfx::NativeTheme::ExtraParams button_params;
button_params.scrollbar_arrow.is_hovering = false;
gfx::Size button_size = native_theme->GetPartSize(
- ui::NativeTheme::kScrollbarUpArrow,
- ui::NativeTheme::kNormal,
+ gfx::NativeTheme::kScrollbarUpArrow,
+ gfx::NativeTheme::kNormal,
button_params);
- ui::NativeTheme::ExtraParams thumb_params;
+ gfx::NativeTheme::ExtraParams thumb_params;
thumb_params.scrollbar_thumb.is_hovering = false;
gfx::Size track_size = native_theme->GetPartSize(
- ui::NativeTheme::kScrollbarVerticalThumb,
- ui::NativeTheme::kNormal,
+ gfx::NativeTheme::kScrollbarVerticalThumb,
+ gfx::NativeTheme::kNormal,
thumb_params);
return std::max(track_size.width(), button_size.width());
diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.h b/ui/views/controls/scrollbar/native_scroll_bar_views.h
index 0335e7f..136338c 100644
--- a/ui/views/controls/scrollbar/native_scroll_bar_views.h
+++ b/ui/views/controls/scrollbar/native_scroll_bar_views.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,7 +7,7 @@
#pragma once
#include "base/compiler_specific.h"
-#include "ui/base/native_theme/native_theme.h"
+#include "ui/gfx/native_theme.h"
#include "ui/gfx/point.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/scrollbar/base_scroll_bar.h"
@@ -69,9 +69,9 @@ class VIEWS_EXPORT NativeScrollBarViews : public BaseScrollBar,
Button* prev_button_;
Button* next_button_;
- ui::NativeTheme::ExtraParams params_;
- ui::NativeTheme::Part part_;
- ui::NativeTheme::State state_;
+ gfx::NativeTheme::ExtraParams params_;
+ gfx::NativeTheme::Part part_;
+ gfx::NativeTheme::State state_;
DISALLOW_COPY_AND_ASSIGN(NativeScrollBarViews);
};