#include "base/logging.h"
#include "ui/events/event.h"
+#include "ui/gfx/canvas.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/border.h"
#include "ui/views/controls/scrollbar/native_scroll_bar.h"
DISALLOW_COPY_AND_ASSIGN(ScrollViewWithBorder);
};
+class ScrollCornerView : public views::View {
+ public:
+ ScrollCornerView() {}
+
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
+ ui::NativeTheme::ExtraParams ignored;
+ GetNativeTheme()->Paint(canvas->sk_canvas(),
+ ui::NativeTheme::kScrollbarCorner,
+ ui::NativeTheme::kNormal,
+ GetLocalBounds(),
+ ignored);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScrollCornerView);
+};
+
// Returns the position for the view so that it isn't scrolled off the visible
// region.
int CheckScrollBounds(int viewport_size, int content_size, int current_pos) {
header_viewport_(new Viewport()),
horiz_sb_(new NativeScrollBar(true)),
vert_sb_(new NativeScrollBar(false)),
- resize_corner_(NULL),
+ corner_view_(new ScrollCornerView()),
min_height_(-1),
max_height_(-1),
hide_horizontal_scrollbar_(false) {
horiz_sb_->set_controller(this);
vert_sb_->SetVisible(false);
vert_sb_->set_controller(this);
- if (resize_corner_)
- resize_corner_->SetVisible(false);
+ corner_view_->SetVisible(false);
}
ScrollView::~ScrollView() {
// deleted.
delete horiz_sb_;
delete vert_sb_;
-
- if (resize_corner_ && !resize_corner_->parent())
- delete resize_corner_;
+ delete corner_view_;
}
// static
&horiz_sb_required,
&vert_sb_required);
}
- bool resize_corner_required = resize_corner_ && horiz_sb_required &&
- vert_sb_required;
+ bool corner_view_required = horiz_sb_required && vert_sb_required;
// Take action.
SetControlVisibility(horiz_sb_, horiz_sb_required);
SetControlVisibility(vert_sb_, vert_sb_required);
- SetControlVisibility(resize_corner_, resize_corner_required);
+ SetControlVisibility(corner_view_, corner_view_required);
// Non-default.
if (horiz_sb_required) {
vert_sb_width + width_offset,
viewport_bounds.bottom());
}
- if (resize_corner_required) {
+ if (corner_view_required) {
// Show the resize corner.
- resize_corner_->SetBounds(viewport_bounds.right(),
- viewport_bounds.bottom(),
- vert_sb_width,
- horiz_sb_height);
+ corner_view_->SetBounds(viewport_bounds.right(),
+ viewport_bounds.bottom(),
+ vert_sb_width,
+ horiz_sb_height);
}
// Update to the real client size with the visible scrollbars.