Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 int bottom, | 72 int bottom, |
| 73 int right, | 73 int right, |
| 74 SkColor color); | 74 SkColor color); |
| 75 | 75 |
| 76 // Creates a Border from the specified Painter. | 76 // Creates a Border from the specified Painter. |
| 77 // |insets| define size of an area allocated for a Border. | 77 // |insets| define size of an area allocated for a Border. |
| 78 static std::unique_ptr<Border> CreateBorderPainter( | 78 static std::unique_ptr<Border> CreateBorderPainter( |
| 79 std::unique_ptr<Painter> painter, | 79 std::unique_ptr<Painter> painter, |
| 80 const gfx::Insets& insets); | 80 const gfx::Insets& insets); |
| 81 | 81 |
| 82 // Returns true if a FocusRing should be used in concert with this border. | |
| 83 // Returns false by default. | |
| 84 virtual bool ShouldAddFocusRing() const; | |
|
sky
2016/10/06 19:34:42
Adding functions specific to certain controls does
Evan Stade
2016/10/06 20:14:18
It could, but I strayed from that approach because
| |
| 85 | |
| 82 // Renders the border for the specified view. | 86 // Renders the border for the specified view. |
| 83 virtual void Paint(const View& view, gfx::Canvas* canvas) = 0; | 87 virtual void Paint(const View& view, gfx::Canvas* canvas) = 0; |
| 84 | 88 |
| 85 // Returns the border insets. | 89 // Returns the border insets. |
| 86 virtual gfx::Insets GetInsets() const = 0; | 90 virtual gfx::Insets GetInsets() const = 0; |
| 87 | 91 |
| 88 // Returns the minimum size this border requires. Note that this may not be | 92 // Returns the minimum size this border requires. Note that this may not be |
| 89 // the same as the insets. For example, a Border may paint images to draw | 93 // the same as the insets. For example, a Border may paint images to draw |
| 90 // some graphical border around a view, and this would return the minimum size | 94 // some graphical border around a view, and this would return the minimum size |
| 91 // such that these images would not be clipped or overlapping -- but the | 95 // such that these images would not be clipped or overlapping -- but the |
| 92 // insets may be larger or smaller, depending on how the view wanted its | 96 // insets may be larger or smaller, depending on how the view wanted its |
| 93 // content laid out relative to these images. | 97 // content laid out relative to these images. |
| 94 virtual gfx::Size GetMinimumSize() const = 0; | 98 virtual gfx::Size GetMinimumSize() const = 0; |
| 95 | 99 |
| 96 private: | 100 private: |
| 97 DISALLOW_COPY_AND_ASSIGN(Border); | 101 DISALLOW_COPY_AND_ASSIGN(Border); |
| 98 }; | 102 }; |
| 99 | 103 |
| 100 } // namespace views | 104 } // namespace views |
| 101 | 105 |
| 102 #endif // UI_VIEWS_BORDER_H_ | 106 #endif // UI_VIEWS_BORDER_H_ |
| OLD | NEW |