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

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

Issue 284033002: Allow TextButton derivatives to override drawing of certain parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/views/controls/button/text_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_TEXT_BUTTON_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void SetShowMultipleIconStates(bool show_multiple_icon_states); 153 void SetShowMultipleIconStates(bool show_multiple_icon_states);
154 154
155 void SetFocusPainter(scoped_ptr<Painter> focus_painter); 155 void SetFocusPainter(scoped_ptr<Painter> focus_painter);
156 Painter* focus_painter() { return focus_painter_.get(); } 156 Painter* focus_painter() { return focus_painter_.get(); }
157 157
158 // Paint the button into the specified canvas. If |mode| is |PB_FOR_DRAG|, the 158 // Paint the button into the specified canvas. If |mode| is |PB_FOR_DRAG|, the
159 // function paints a drag image representation into the canvas. 159 // function paints a drag image representation into the canvas.
160 enum PaintButtonMode { PB_NORMAL, PB_FOR_DRAG }; 160 enum PaintButtonMode { PB_NORMAL, PB_FOR_DRAG };
161 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode); 161 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode);
162 162
163 // Paint the button's text into the specified canvas. If |mode| is
164 // |PB_FOR_DRAG|, the function paints a drag image representation. Derived
165 // can override this function to change only the text rendering.
166 virtual void OnPaintText(gfx::Canvas* canvas, PaintButtonMode mode);
sky 2014/05/15 16:55:12 Why is this public?
Roger Tawa OOO till Jul 10th 2014/05/15 17:19:27 No good reason. Made it protected.
167
163 // Overridden from View: 168 // Overridden from View:
164 virtual gfx::Size GetPreferredSize() OVERRIDE; 169 virtual gfx::Size GetPreferredSize() OVERRIDE;
165 virtual gfx::Size GetMinimumSize() OVERRIDE; 170 virtual gfx::Size GetMinimumSize() OVERRIDE;
166 virtual int GetHeightForWidth(int w) OVERRIDE; 171 virtual int GetHeightForWidth(int w) OVERRIDE;
167 virtual void OnEnabledChanged() OVERRIDE; 172 virtual void OnEnabledChanged() OVERRIDE;
168 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 173 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
169 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 174 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
170 virtual const char* GetClassName() const OVERRIDE; 175 virtual const char* GetClassName() const OVERRIDE;
171 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE; 176 virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
172 177
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 void set_full_justification(bool full_justification); 326 void set_full_justification(bool full_justification);
322 327
323 // Overridden from View: 328 // Overridden from View:
324 virtual gfx::Size GetPreferredSize() OVERRIDE; 329 virtual gfx::Size GetPreferredSize() OVERRIDE;
325 virtual const char* GetClassName() const OVERRIDE; 330 virtual const char* GetClassName() const OVERRIDE;
326 331
327 // Overridden from TextButtonBase: 332 // Overridden from TextButtonBase:
328 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; 333 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE;
329 334
330 protected: 335 protected:
336 // Paint the button's icon into the specified canvas. If |mode| is
337 // |PB_FOR_DRAG|, the function paints a drag image representation. Derived
338 // can override this function to change only the icon rendering.
339 virtual void OnPaintIcon(gfx::Canvas* canvas, PaintButtonMode mode);
340
331 gfx::ImageSkia icon() const { return icon_; } 341 gfx::ImageSkia icon() const { return icon_; }
332 342
333 virtual const gfx::ImageSkia& GetImageToPaint() const; 343 virtual const gfx::ImageSkia& GetImageToPaint() const;
334 344
335 // Overridden from NativeThemeDelegate: 345 // Overridden from NativeThemeDelegate:
336 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; 346 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE;
337 347
338 // Overridden from TextButtonBase: 348 // Overridden from TextButtonBase:
339 virtual void GetExtraParams( 349 virtual void GetExtraParams(
340 ui::NativeTheme::ExtraParams* params) const OVERRIDE; 350 ui::NativeTheme::ExtraParams* params) const OVERRIDE;
(...skipping 24 matching lines...) Expand all
365 // True if the icon and the text are aligned along both the left and right 375 // True if the icon and the text are aligned along both the left and right
366 // margins of the button. 376 // margins of the button.
367 bool full_justification_; 377 bool full_justification_;
368 378
369 DISALLOW_COPY_AND_ASSIGN(TextButton); 379 DISALLOW_COPY_AND_ASSIGN(TextButton);
370 }; 380 };
371 381
372 } // namespace views 382 } // namespace views
373 383
374 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ 384 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/button/text_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698