1 // Copyright (c) 2006-2008 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 #ifndef VIEWS_BORDER_H_
6 #define VIEWS_BORDER_H_
9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/gfx/insets.h"
11 #include "views/view.h"
21 ////////////////////////////////////////////////////////////////////////////////
25 // The border class is used to display a border around a view.
26 // To set a border on a view, just call SetBorder on the view, for example:
27 // view->set_border(Border::CreateSolidBorder(1, SkColorSetRGB(25, 25, 112));
28 // Once set on a view, the border is owned by the view.
30 // IMPORTANT NOTE: not all views support borders at this point. In order to
31 // support the border, views should make sure to use bounds excluding the
32 // border (by calling View::GetLocalBoundsExcludingBorder) when doing layout and
35 ////////////////////////////////////////////////////////////////////////////////
42 // Creates a border that is a simple line of the specified thickness and
44 static Border
* CreateSolidBorder(int thickness
, SkColor color
);
46 // Creates a border for reserving space. The returned border does not
48 static Border
* CreateEmptyBorder(int top
, int left
, int bottom
, int right
);
50 // Renders the border for the specified view.
51 virtual void Paint(const View
& view
, gfx::Canvas
* canvas
) const = 0;
53 // Sets the specified insets to the the border insets.
54 virtual void GetInsets(gfx::Insets
* insets
) const = 0;
57 DISALLOW_COPY_AND_ASSIGN(Border
);
62 #endif // VIEWS_BORDER_H_