Add ICU message format support
[chromium-blink-merge.git] / ui / views / controls / separator.cc
blobe16346127ba4010be0e23670e856280dff926eda
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 gfx::Size size =
48 orientation_ == HORIZONTAL ? gfx::Size(1, size_) : gfx::Size(size_, 1);
49 gfx::Insets insets = GetInsets();
50 size.Enlarge(insets.width(), insets.height());
51 return size;
54 void Separator::GetAccessibleState(ui::AXViewState* state) {
55 state->role = ui::AX_ROLE_SPLITTER;
58 void Separator::OnPaint(gfx::Canvas* canvas) {
59 canvas->FillRect(GetContentsBounds(), color_);
62 const char* Separator::GetClassName() const {
63 return kViewClassName;
66 } // namespace views