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/focus_border.h"
7 #include "ui/gfx/canvas.h"
8 #include "ui/gfx/rect.h"
9 #include "ui/views/view.h"
13 class DashedFocusBorder : public FocusBorder {
16 int left_inset, int top_inset, int right_inset, int bottom_inset)
17 : left_inset_(left_inset),
18 top_inset_(top_inset),
19 right_inset_(right_inset),
20 bottom_inset_(bottom_inset) {
23 virtual void Paint(const View& view, gfx::Canvas* canvas) const OVERRIDE {
24 gfx::Rect rect(view.GetLocalBounds());
25 rect.Inset(left_inset_, top_inset_, right_inset_, bottom_inset_);
26 canvas->DrawFocusRect(rect);
35 DISALLOW_COPY_AND_ASSIGN(DashedFocusBorder);
39 FocusBorder::~FocusBorder() {
43 FocusBorder* FocusBorder::CreateDashedFocusBorder() {
44 return new DashedFocusBorder(0, 0, 0, 0);
48 FocusBorder* FocusBorder::CreateDashedFocusBorder(
49 int left, int top, int right, int bottom) {
50 return new DashedFocusBorder(left, top, right, bottom);
53 FocusBorder::FocusBorder() {