Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: ui/views/controls/button/label_button.h

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/button/image_button.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
7 7
8 #include <memory>
9
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
9 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
13 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
14 #include "ui/views/controls/button/custom_button.h" 15 #include "ui/views/controls/button/custom_button.h"
15 #include "ui/views/controls/image_view.h" 16 #include "ui/views/controls/image_view.h"
16 #include "ui/views/controls/label.h" 17 #include "ui/views/controls/label.h"
17 #include "ui/views/native_theme_delegate.h" 18 #include "ui/views/native_theme_delegate.h"
18 19
19 namespace views { 20 namespace views {
20 21
21 class InkDropAnimation; 22 class InkDropAnimation;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 81
81 // Gets or sets the button's overall style; the default is |STYLE_TEXTBUTTON|. 82 // Gets or sets the button's overall style; the default is |STYLE_TEXTBUTTON|.
82 ButtonStyle style() const { return style_; } 83 ButtonStyle style() const { return style_; }
83 void SetStyle(ButtonStyle style); 84 void SetStyle(ButtonStyle style);
84 85
85 // Sets the spacing between the image and the text. Shrinking the spacing 86 // Sets the spacing between the image and the text. Shrinking the spacing
86 // will not shrink the overall button size, as it is monotonically increasing. 87 // will not shrink the overall button size, as it is monotonically increasing.
87 // Call SetMinSize(gfx::Size()) to clear the size if needed. 88 // Call SetMinSize(gfx::Size()) to clear the size if needed.
88 void SetImageLabelSpacing(int spacing); 89 void SetImageLabelSpacing(int spacing);
89 90
90 void SetFocusPainter(scoped_ptr<Painter> focus_painter); 91 void SetFocusPainter(std::unique_ptr<Painter> focus_painter);
91 Painter* focus_painter() { return focus_painter_.get(); } 92 Painter* focus_painter() { return focus_painter_.get(); }
92 93
93 // Creates the default border for this button. This can be overridden by 94 // Creates the default border for this button. This can be overridden by
94 // subclasses. 95 // subclasses.
95 virtual scoped_ptr<LabelButtonBorder> CreateDefaultBorder() const; 96 virtual std::unique_ptr<LabelButtonBorder> CreateDefaultBorder() const;
96 97
97 // View: 98 // View:
98 void SetBorder(scoped_ptr<Border> border) override; 99 void SetBorder(std::unique_ptr<Border> border) override;
99 gfx::Size GetPreferredSize() const override; 100 gfx::Size GetPreferredSize() const override;
100 int GetHeightForWidth(int w) const override; 101 int GetHeightForWidth(int w) const override;
101 void Layout() override; 102 void Layout() override;
102 const char* GetClassName() const override; 103 const char* GetClassName() const override;
103 void EnableCanvasFlippingForRTLUI(bool flip) override; 104 void EnableCanvasFlippingForRTLUI(bool flip) override;
104 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; 105 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
105 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; 106 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
106 scoped_ptr<InkDropAnimation> CreateInkDropAnimation() const override; 107 std::unique_ptr<InkDropAnimation> CreateInkDropAnimation() const override;
107 scoped_ptr<InkDropHover> CreateInkDropHover() const override; 108 std::unique_ptr<InkDropHover> CreateInkDropHover() const override;
108 gfx::Point GetInkDropCenter() const override; 109 gfx::Point GetInkDropCenter() const override;
109 110
110 protected: 111 protected:
111 ImageView* image() const { return image_; } 112 ImageView* image() const { return image_; }
112 Label* label() const { return label_; } 113 Label* label() const { return label_; }
113 114
114 // Returns the available area for the label and image. Subclasses can change 115 // Returns the available area for the label and image. Subclasses can change
115 // these bounds if they need room to do manual painting. 116 // these bounds if they need room to do manual painting.
116 virtual gfx::Rect GetChildAreaBounds(); 117 virtual gfx::Rect GetChildAreaBounds();
117 118
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 214
214 // Spacing between the image and the text. 215 // Spacing between the image and the text.
215 int image_label_spacing_; 216 int image_label_spacing_;
216 217
217 // Alignment of the button. This can be different from the alignment of the 218 // Alignment of the button. This can be different from the alignment of the
218 // text; for example, the label may be set to ALIGN_TO_HEAD (alignment matches 219 // text; for example, the label may be set to ALIGN_TO_HEAD (alignment matches
219 // text direction) while |this| is laid out as ALIGN_LEFT (alignment matches 220 // text direction) while |this| is laid out as ALIGN_LEFT (alignment matches
220 // UI direction). 221 // UI direction).
221 gfx::HorizontalAlignment horizontal_alignment_; 222 gfx::HorizontalAlignment horizontal_alignment_;
222 223
223 scoped_ptr<Painter> focus_painter_; 224 std::unique_ptr<Painter> focus_painter_;
224 225
225 DISALLOW_COPY_AND_ASSIGN(LabelButton); 226 DISALLOW_COPY_AND_ASSIGN(LabelButton);
226 }; 227 };
227 228
228 } // namespace views 229 } // namespace views
229 230
230 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ 231 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
OLDNEW
« no previous file with comments | « ui/views/controls/button/image_button.cc ('k') | ui/views/controls/button/label_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698