OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 UI_VIEWS_BORDER_H_ | 5 #ifndef UI_VIEWS_BORDER_H_ |
6 #define UI_VIEWS_BORDER_H_ | 6 #define UI_VIEWS_BORDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // view->SetBorder(Border::CreateSolidBorder(1, SkColorSetRGB(25, 25, 112)); | 30 // view->SetBorder(Border::CreateSolidBorder(1, SkColorSetRGB(25, 25, 112)); |
31 // Once set on a view, the border is owned by the view. | 31 // Once set on a view, the border is owned by the view. |
32 // | 32 // |
33 // IMPORTANT NOTE: not all views support borders at this point. In order to | 33 // IMPORTANT NOTE: not all views support borders at this point. In order to |
34 // support the border, views should make sure to use bounds excluding the | 34 // support the border, views should make sure to use bounds excluding the |
35 // border (by calling View::GetLocalBoundsExcludingBorder) when doing layout and | 35 // border (by calling View::GetLocalBoundsExcludingBorder) when doing layout and |
36 // painting. | 36 // painting. |
37 // | 37 // |
38 //////////////////////////////////////////////////////////////////////////////// | 38 //////////////////////////////////////////////////////////////////////////////// |
39 | 39 |
40 class TextButtonBorder; | |
41 | |
42 class VIEWS_EXPORT Border { | 40 class VIEWS_EXPORT Border { |
43 public: | 41 public: |
44 Border(); | 42 Border(); |
45 virtual ~Border(); | 43 virtual ~Border(); |
46 | 44 |
47 // Convenience for creating a scoped_ptr with no Border. | 45 // Convenience for creating a scoped_ptr with no Border. |
48 static scoped_ptr<Border> NullBorder(); | 46 static scoped_ptr<Border> NullBorder(); |
49 | 47 |
50 // Creates a border that is a simple line of the specified thickness and | 48 // Creates a border that is a simple line of the specified thickness and |
51 // color. | 49 // color. |
(...skipping 27 matching lines...) Expand all Loading... |
79 virtual gfx::Insets GetInsets() const = 0; | 77 virtual gfx::Insets GetInsets() const = 0; |
80 | 78 |
81 // Returns the minimum size this border requires. Note that this may not be | 79 // Returns the minimum size this border requires. Note that this may not be |
82 // the same as the insets. For example, a Border may paint images to draw | 80 // the same as the insets. For example, a Border may paint images to draw |
83 // some graphical border around a view, and this would return the minimum size | 81 // some graphical border around a view, and this would return the minimum size |
84 // such that these images would not be clipped or overlapping -- but the | 82 // such that these images would not be clipped or overlapping -- but the |
85 // insets may be larger or smaller, depending on how the view wanted its | 83 // insets may be larger or smaller, depending on how the view wanted its |
86 // content laid out relative to these images. | 84 // content laid out relative to these images. |
87 virtual gfx::Size GetMinimumSize() const = 0; | 85 virtual gfx::Size GetMinimumSize() const = 0; |
88 | 86 |
89 // Manual RTTI for text buttons. | |
90 virtual TextButtonBorder* AsTextButtonBorder(); | |
91 virtual const TextButtonBorder* AsTextButtonBorder() const; | |
92 | |
93 private: | 87 private: |
94 DISALLOW_COPY_AND_ASSIGN(Border); | 88 DISALLOW_COPY_AND_ASSIGN(Border); |
95 }; | 89 }; |
96 | 90 |
97 } // namespace views | 91 } // namespace views |
98 | 92 |
99 #endif // UI_VIEWS_BORDER_H_ | 93 #endif // UI_VIEWS_BORDER_H_ |
OLD | NEW |