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

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

Issue 2447523002: [ash-md] Added different highlighting modes to the InkDropImpl. (Closed)
Patch Set: Fixed InkDropHostView::GetInkDrop() to use CreateInkDrop(). Created 4 years, 1 month 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/custom_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> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
14 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
15 #include "ui/views/controls/button/custom_button.h" 15 #include "ui/views/controls/button/custom_button.h"
16 #include "ui/views/controls/image_view.h" 16 #include "ui/views/controls/image_view.h"
17 #include "ui/views/controls/label.h" 17 #include "ui/views/controls/label.h"
18 #include "ui/views/native_theme_delegate.h" 18 #include "ui/views/native_theme_delegate.h"
19 19
20 namespace views { 20 namespace views {
21 21
22 class InkDropRipple;
23 class InkDropHighlight;
24 class LabelButtonBorder; 22 class LabelButtonBorder;
25 class Painter; 23 class Painter;
26 24
27 // LabelButton is a button with text and an icon, it's not focusable by default. 25 // LabelButton is a button with text and an icon, it's not focusable by default.
28 class VIEWS_EXPORT LabelButton : public CustomButton, 26 class VIEWS_EXPORT LabelButton : public CustomButton,
29 public NativeThemeDelegate { 27 public NativeThemeDelegate {
30 public: 28 public:
31 // The length of the hover fade animation. 29 // The length of the hover fade animation.
32 static const int kHoverAnimationDurationMs; 30 static const int kHoverAnimationDurationMs;
33 31
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 96
99 // View: 97 // View:
100 void SetBorder(std::unique_ptr<Border> border) override; 98 void SetBorder(std::unique_ptr<Border> border) override;
101 gfx::Size GetPreferredSize() const override; 99 gfx::Size GetPreferredSize() const override;
102 int GetHeightForWidth(int w) const override; 100 int GetHeightForWidth(int w) const override;
103 void Layout() override; 101 void Layout() override;
104 const char* GetClassName() const override; 102 const char* GetClassName() const override;
105 void EnableCanvasFlippingForRTLUI(bool flip) override; 103 void EnableCanvasFlippingForRTLUI(bool flip) override;
106 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; 104 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
107 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; 105 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
106 std::unique_ptr<InkDrop> CreateInkDrop() override;
108 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override; 107 std::unique_ptr<InkDropRipple> CreateInkDropRipple() const override;
109 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override; 108 std::unique_ptr<InkDropHighlight> CreateInkDropHighlight() const override;
110 109
111 protected: 110 protected:
112 ImageView* image() const { return image_; } 111 ImageView* image() const { return image_; }
113 Label* label() const { return label_; } 112 Label* label() const { return label_; }
114 113
115 bool explicitly_set_normal_color() const { 114 bool explicitly_set_normal_color() const {
116 return explicitly_set_colors_[STATE_NORMAL]; 115 return explicitly_set_colors_[STATE_NORMAL];
117 } 116 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 173
175 // Resets |cached_preferred_size_| and marks |cached_preferred_size_valid_| 174 // Resets |cached_preferred_size_| and marks |cached_preferred_size_valid_|
176 // as false. 175 // as false.
177 void ResetCachedPreferredSize(); 176 void ResetCachedPreferredSize();
178 177
179 // Updates additional state related to focus or default status, rather than 178 // Updates additional state related to focus or default status, rather than
180 // merely the CustomButton::state(). E.g. ensures the label text color is 179 // merely the CustomButton::state(). E.g. ensures the label text color is
181 // correct for the current background. 180 // correct for the current background.
182 void ResetLabelEnabledColor(); 181 void ResetLabelEnabledColor();
183 182
183 // Returns true if the CreateInkDrop*() methods should create flood fill ink
184 // drop components.
185 bool UseFloodFillInkDrop() const;
186
184 // The image and label shown in the button. 187 // The image and label shown in the button.
185 ImageView* image_; 188 ImageView* image_;
186 Label* label_; 189 Label* label_;
187 190
188 // A separate view is necessary to hold the ink drop layer so that it can 191 // A separate view is necessary to hold the ink drop layer so that it can
189 // be stacked below |image_| and on top of |label_|, without resorting to 192 // be stacked below |image_| and on top of |label_|, without resorting to
190 // drawing |label_| on a layer (which can mess with subpixel anti-aliasing). 193 // drawing |label_| on a layer (which can mess with subpixel anti-aliasing).
191 View* ink_drop_container_; 194 View* ink_drop_container_;
192 195
193 // The cached font lists in the normal and bold style. 196 // The cached font lists in the normal and bold style.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 gfx::HorizontalAlignment horizontal_alignment_; 234 gfx::HorizontalAlignment horizontal_alignment_;
232 235
233 std::unique_ptr<Painter> focus_painter_; 236 std::unique_ptr<Painter> focus_painter_;
234 237
235 DISALLOW_COPY_AND_ASSIGN(LabelButton); 238 DISALLOW_COPY_AND_ASSIGN(LabelButton);
236 }; 239 };
237 240
238 } // namespace views 241 } // namespace views
239 242
240 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ 243 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_
OLDNEW
« no previous file with comments | « ui/views/controls/button/custom_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