| 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_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/gfx/geometry/insets.h" | 12 #include "ui/gfx/geometry/insets.h" |
| 12 #include "ui/views/border.h" | 13 #include "ui/views/border.h" |
| 13 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
| 14 #include "ui/views/painter.h" | 15 #include "ui/views/painter.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 | 18 |
| 18 // An empty Border with customizable insets used by a LabelButton. | 19 // An empty Border with customizable insets used by a LabelButton. |
| 19 class VIEWS_EXPORT LabelButtonBorder : public Border { | 20 class VIEWS_EXPORT LabelButtonBorder : public Border { |
| 20 public: | 21 public: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void Paint(const View& view, gfx::Canvas* canvas) override; | 55 void Paint(const View& view, gfx::Canvas* canvas) override; |
| 55 gfx::Size GetMinimumSize() const override; | 56 gfx::Size GetMinimumSize() const override; |
| 56 | 57 |
| 57 // Get or set the painter used for the specified |focused| button |state|. | 58 // Get or set the painter used for the specified |focused| button |state|. |
| 58 // LabelButtonAssetBorder takes and retains ownership of |painter|. | 59 // LabelButtonAssetBorder takes and retains ownership of |painter|. |
| 59 Painter* GetPainter(bool focused, Button::ButtonState state); | 60 Painter* GetPainter(bool focused, Button::ButtonState state); |
| 60 void SetPainter(bool focused, Button::ButtonState state, Painter* painter); | 61 void SetPainter(bool focused, Button::ButtonState state, Painter* painter); |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 // The painters used for each unfocused or focused button state. | 64 // The painters used for each unfocused or focused button state. |
| 64 scoped_ptr<Painter> painters_[2][Button::STATE_COUNT]; | 65 std::unique_ptr<Painter> painters_[2][Button::STATE_COUNT]; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(LabelButtonAssetBorder); | 67 DISALLOW_COPY_AND_ASSIGN(LabelButtonAssetBorder); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace views | 70 } // namespace views |
| 70 | 71 |
| 71 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ | 72 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ |
| OLD | NEW |