Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / views / controls / separator.cc
blob9a9bbbdc881c4892648a69d5c28b29e349a2b153
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/views/controls/separator.h"
7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/gfx/canvas.h"
10 namespace views {
12 // static
13 const char Separator::kViewClassName[] = "Separator";
15 // The separator size in pixels.
16 const int kSeparatorSize = 1;
18 // Default color of the separator.
19 const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);
21 Separator::Separator(Orientation orientation)
22 : orientation_(orientation),
23 color_(kDefaultColor),
24 size_(kSeparatorSize) {
25 SetFocusable(false);
28 Separator::~Separator() {
31 void Separator::SetColor(SkColor color) {
32 color_ = color;
33 SchedulePaint();
36 void Separator::SetPreferredSize(int size) {
37 if (size != size_) {
38 size_ = size;
39 PreferredSizeChanged();
43 ////////////////////////////////////////////////////////////////////////////////
44 // Separator, View overrides:
46 gfx::Size Separator::GetPreferredSize() const {
47 if (orientation_ == HORIZONTAL)
48 return gfx::Size(width(), size_);
49 return gfx::Size(size_, height());
52 void Separator::GetAccessibleState(ui::AXViewState* state) {
53 state->role = ui::AX_ROLE_SPLITTER;
56 void Separator::OnPaint(gfx::Canvas* canvas) {
57 canvas->FillRect(GetContentsBounds(), color_);
60 const char* Separator::GetClassName() const {
61 return kViewClassName;
64 } // namespace views