virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode);
// Overridden from View:
- virtual gfx::Size GetPreferredSize() OVERRIDE;
- virtual gfx::Size GetMinimumSize() OVERRIDE;
- virtual int GetHeightForWidth(int w) OVERRIDE;
+ virtual gfx::Size GetPreferredSize() const OVERRIDE;
+ virtual gfx::Size GetMinimumSize() const OVERRIDE;
+ virtual int GetHeightForWidth(int w) const OVERRIDE;
virtual void OnEnabledChanged() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
void UpdateTextSize();
// Calculate the size of the text size without setting any of the members.
- void CalculateTextSize(gfx::Size* text_size, int max_width);
+ void CalculateTextSize(gfx::Size* text_size, int max_width) const;
+
+ // Paint the button's text into the specified canvas. If |mode| is
+ // |PB_FOR_DRAG|, the function paints a drag image representation. Derived
+ // can override this function to change only the text rendering.
+ virtual void OnPaintText(gfx::Canvas* canvas, PaintButtonMode mode);
void set_color_enabled(SkColor color) { color_enabled_ = color; }
void set_color_disabled(SkColor color) { color_disabled_ = color; }
base::string16 text_;
// The size of the text string.
- gfx::Size text_size_;
+ mutable gfx::Size text_size_;
// Track the size of the largest text string seen so far, so that
// changing text_ will not resize the button boundary.
void set_full_justification(bool full_justification);
// Overridden from View:
- virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual gfx::Size GetPreferredSize() const OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
// Overridden from TextButtonBase:
virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE;
protected:
+ // Paint the button's icon into the specified canvas. If |mode| is
+ // |PB_FOR_DRAG|, the function paints a drag image representation. Derived
+ // can override this function to change only the icon rendering.
+ virtual void OnPaintIcon(gfx::Canvas* canvas, PaintButtonMode mode);
+
gfx::ImageSkia icon() const { return icon_; }
virtual const gfx::ImageSkia& GetImageToPaint() const;