| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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. | |
| 4 | |
| 5 #ifndef VIEWS_BORDER_H_ | |
| 6 #define VIEWS_BORDER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "third_party/skia/include/core/SkColor.h" | |
| 10 #include "ui/gfx/insets.h" | |
| 11 #include "ui/views/view.h" | |
| 12 | |
| 13 namespace gfx{ | |
| 14 class Canvas; | |
| 15 } | |
| 16 | |
| 17 namespace views { | |
| 18 | |
| 19 class View; | |
| 20 | |
| 21 //////////////////////////////////////////////////////////////////////////////// | |
| 22 // | |
| 23 // Border class. | |
| 24 // | |
| 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. | |
| 29 // | |
| 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 | |
| 33 // painting. | |
| 34 // | |
| 35 //////////////////////////////////////////////////////////////////////////////// | |
| 36 | |
| 37 class VIEWS_EXPORT Border { | |
| 38 public: | |
| 39 Border(); | |
| 40 virtual ~Border(); | |
| 41 | |
| 42 // Creates a border that is a simple line of the specified thickness and | |
| 43 // color. | |
| 44 static Border* CreateSolidBorder(int thickness, SkColor color); | |
| 45 | |
| 46 // Creates a border for reserving space. The returned border does not | |
| 47 // paint anything. | |
| 48 static Border* CreateEmptyBorder(int top, int left, int bottom, int right); | |
| 49 | |
| 50 // Renders the border for the specified view. | |
| 51 virtual void Paint(const View& view, gfx::Canvas* canvas) const = 0; | |
| 52 | |
| 53 // Sets the specified insets to the the border insets. | |
| 54 virtual void GetInsets(gfx::Insets* insets) const = 0; | |
| 55 | |
| 56 private: | |
| 57 DISALLOW_COPY_AND_ASSIGN(Border); | |
| 58 }; | |
| 59 | |
| 60 } // namespace views | |
| 61 | |
| 62 #endif // VIEWS_BORDER_H_ | |
| OLD | NEW |