| 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_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 <array> | 8 #include <array> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return explicitly_set_colors_[STATE_NORMAL]; | 117 return explicitly_set_colors_[STATE_NORMAL]; |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Returns the available area for the label and image. Subclasses can change | 120 // Returns the available area for the label and image. Subclasses can change |
| 121 // these bounds if they need room to do manual painting. | 121 // these bounds if they need room to do manual painting. |
| 122 virtual gfx::Rect GetChildAreaBounds(); | 122 virtual gfx::Rect GetChildAreaBounds(); |
| 123 | 123 |
| 124 // Sets the font list used by this button. | 124 // Sets the font list used by this button. |
| 125 virtual void SetFontList(const gfx::FontList& font_list); | 125 virtual void SetFontList(const gfx::FontList& font_list); |
| 126 | 126 |
| 127 // Returns true if the CreateInkDrop*() methods should create flood fill ink |
| 128 // drop components. |
| 129 virtual bool ShouldUseFloodFillInkDrop() const; |
| 130 |
| 127 // View: | 131 // View: |
| 128 void OnPaint(gfx::Canvas* canvas) override; | 132 void OnPaint(gfx::Canvas* canvas) override; |
| 129 void OnFocus() override; | 133 void OnFocus() override; |
| 130 void OnBlur() override; | 134 void OnBlur() override; |
| 131 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 135 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 132 | 136 |
| 133 // CustomButton: | 137 // CustomButton: |
| 134 void StateChanged(ButtonState old_state) override; | 138 void StateChanged(ButtonState old_state) override; |
| 135 | 139 |
| 136 // Fills |params| with information about the button. | 140 // Fills |params| with information about the button. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 182 |
| 179 // Resets |cached_preferred_size_| and marks |cached_preferred_size_valid_| | 183 // Resets |cached_preferred_size_| and marks |cached_preferred_size_valid_| |
| 180 // as false. | 184 // as false. |
| 181 void ResetCachedPreferredSize(); | 185 void ResetCachedPreferredSize(); |
| 182 | 186 |
| 183 // Updates additional state related to focus or default status, rather than | 187 // Updates additional state related to focus or default status, rather than |
| 184 // merely the CustomButton::state(). E.g. ensures the label text color is | 188 // merely the CustomButton::state(). E.g. ensures the label text color is |
| 185 // correct for the current background. | 189 // correct for the current background. |
| 186 void ResetLabelEnabledColor(); | 190 void ResetLabelEnabledColor(); |
| 187 | 191 |
| 188 // Returns true if the CreateInkDrop*() methods should create flood fill ink | |
| 189 // drop components. | |
| 190 bool UseFloodFillInkDrop() const; | |
| 191 | |
| 192 // The image and label shown in the button. | 192 // The image and label shown in the button. |
| 193 ImageView* image_; | 193 ImageView* image_; |
| 194 Label* label_; | 194 Label* label_; |
| 195 | 195 |
| 196 // A separate view is necessary to hold the ink drop layer so that it can | 196 // A separate view is necessary to hold the ink drop layer so that it can |
| 197 // be stacked below |image_| and on top of |label_|, without resorting to | 197 // be stacked below |image_| and on top of |label_|, without resorting to |
| 198 // drawing |label_| on a layer (which can mess with subpixel anti-aliasing). | 198 // drawing |label_| on a layer (which can mess with subpixel anti-aliasing). |
| 199 InkDropContainerView* ink_drop_container_; | 199 InkDropContainerView* ink_drop_container_; |
| 200 | 200 |
| 201 // The cached font lists in the normal and bold style. | 201 // The cached font lists in the normal and bold style. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 gfx::HorizontalAlignment horizontal_alignment_; | 239 gfx::HorizontalAlignment horizontal_alignment_; |
| 240 | 240 |
| 241 std::unique_ptr<Painter> focus_painter_; | 241 std::unique_ptr<Painter> focus_painter_; |
| 242 | 242 |
| 243 DISALLOW_COPY_AND_ASSIGN(LabelButton); | 243 DISALLOW_COPY_AND_ASSIGN(LabelButton); |
| 244 }; | 244 }; |
| 245 | 245 |
| 246 } // namespace views | 246 } // namespace views |
| 247 | 247 |
| 248 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 248 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| OLD | NEW |