summaryrefslogtreecommitdiffstats
path: root/views/controls/separator.cc
blob: 8dd0312018318980a8a3124ca291c2afc3a292e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// 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.

#include "views/controls/separator.h"

#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/gfx/canvas.h"

namespace views {

// static
const char Separator::kViewClassName[] = "views/Separator";

// The separator height in pixels.
const int kSeparatorHeight = 1;

// Default color of the separator.
const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);

Separator::Separator() {
  set_focusable(false);
}

Separator::~Separator() {
}

////////////////////////////////////////////////////////////////////////////////
// Separator, View overrides:

gfx::Size Separator::GetPreferredSize() {
  return gfx::Size(width(), kSeparatorHeight);
}

void Separator::GetAccessibleState(ui::AccessibleViewState* state) {
  state->role = ui::AccessibilityTypes::ROLE_SEPARATOR;
}

void Separator::Paint(gfx::Canvas* canvas) {
  canvas->FillRectInt(kDefaultColor, x(), y(), width(), height());
}

std::string Separator::GetClassName() const {
  return kViewClassName;
}

}  // namespace views