OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_BORDER_H_ | 5 #ifndef VIEWS_BORDER_H_ |
6 #define VIEWS_BORDER_H_ | 6 #define VIEWS_BORDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/gfx/insets.h" | 10 #include "ui/gfx/insets.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // view->set_border(Border::CreateSolidBorder(1, SkColorSetRGB(25, 25, 112)); | 27 // view->set_border(Border::CreateSolidBorder(1, SkColorSetRGB(25, 25, 112)); |
28 // Once set on a view, the border is owned by the view. | 28 // Once set on a view, the border is owned by the view. |
29 // | 29 // |
30 // IMPORTANT NOTE: not all views support borders at this point. In order to | 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 | 31 // support the border, views should make sure to use bounds excluding the |
32 // border (by calling View::GetLocalBoundsExcludingBorder) when doing layout and | 32 // border (by calling View::GetLocalBoundsExcludingBorder) when doing layout and |
33 // painting. | 33 // painting. |
34 // | 34 // |
35 //////////////////////////////////////////////////////////////////////////////// | 35 //////////////////////////////////////////////////////////////////////////////// |
36 | 36 |
37 class VIEWS_API Border { | 37 class VIEWS_EXPORT Border { |
38 public: | 38 public: |
39 Border(); | 39 Border(); |
40 virtual ~Border(); | 40 virtual ~Border(); |
41 | 41 |
42 // Creates a border that is a simple line of the specified thickness and | 42 // Creates a border that is a simple line of the specified thickness and |
43 // color. | 43 // color. |
44 static Border* CreateSolidBorder(int thickness, SkColor color); | 44 static Border* CreateSolidBorder(int thickness, SkColor color); |
45 | 45 |
46 // Creates a border for reserving space. The returned border does not | 46 // Creates a border for reserving space. The returned border does not |
47 // paint anything. | 47 // paint anything. |
48 static Border* CreateEmptyBorder(int top, int left, int bottom, int right); | 48 static Border* CreateEmptyBorder(int top, int left, int bottom, int right); |
49 | 49 |
50 // Renders the border for the specified view. | 50 // Renders the border for the specified view. |
51 virtual void Paint(const View& view, gfx::Canvas* canvas) const = 0; | 51 virtual void Paint(const View& view, gfx::Canvas* canvas) const = 0; |
52 | 52 |
53 // Sets the specified insets to the the border insets. | 53 // Sets the specified insets to the the border insets. |
54 virtual void GetInsets(gfx::Insets* insets) const = 0; | 54 virtual void GetInsets(gfx::Insets* insets) const = 0; |
55 | 55 |
56 private: | 56 private: |
57 DISALLOW_COPY_AND_ASSIGN(Border); | 57 DISALLOW_COPY_AND_ASSIGN(Border); |
58 }; | 58 }; |
59 | 59 |
60 } // namespace views | 60 } // namespace views |
61 | 61 |
62 #endif // VIEWS_BORDER_H_ | 62 #endif // VIEWS_BORDER_H_ |
OLD | NEW |