Chromium Code Reviews| Index: ui/views/controls/image_view.h |
| diff --git a/ui/views/controls/image_view.h b/ui/views/controls/image_view.h |
| index 272aec0f156adf44578a6ff0179c53952b550866..5b36c0bafd719f512093544f6a883e3244a528a9 100644 |
| --- a/ui/views/controls/image_view.h |
| +++ b/ui/views/controls/image_view.h |
| @@ -5,7 +5,9 @@ |
| #ifndef UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| #define UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| +#include "third_party/skia/include/core/SkColor.h" |
| #include "ui/gfx/image/image_skia.h" |
| +#include "ui/gfx/vector_icons.h" |
| #include "ui/views/view.h" |
| namespace gfx { |
| @@ -52,14 +54,16 @@ class VIEWS_EXPORT ImageView : public View { |
| // The returned image is still owned by the ImageView. |
| const gfx::ImageSkia& GetImage(); |
| + // Tells the view to draw a monochrome vector image identified by |id| using |
| + // |color|. Since the size of the view and the image will be set to |
|
Peter Kasting
2015/07/01 22:26:58
Nit: I think you want to remove "Since" (sentence
Evan Stade
2015/07/02 00:08:06
Done.
|
| + // |image_size|. |
| + void SetVectorIcon(gfx::VectorIconId id, |
| + SkColor color, |
| + const gfx::Size& image_size); |
| + |
| // Set the desired image size for the receiving ImageView. |
| void SetImageSize(const gfx::Size& image_size); |
| - // Return the preferred size for the receiving view. Returns false if the |
| - // preferred size is not defined, which means that the view uses the image |
| - // size. |
| - bool GetImageSize(gfx::Size* image_size) const; |
| - |
| // Returns the actual bounds of the visible image inside the view. |
| gfx::Rect GetImageBounds() const; |
| @@ -96,6 +100,8 @@ class VIEWS_EXPORT ImageView : public View { |
| private: |
| void OnPaintImage(gfx::Canvas* canvas); |
| + void OnPaintVectorIcon(gfx::Canvas* canvas); |
| + |
| // Returns true if |img| is the same as the last image we painted. This is |
| // intended to be a quick check, not exhaustive. In other words it's possible |
| // for this to return false even though the images are in fact equal. |
| @@ -114,6 +120,14 @@ class VIEWS_EXPORT ImageView : public View { |
| // The underlying image. |
| gfx::ImageSkia image_; |
| + // The ID of the vector icon that should be drawn, or gfx::VECTOR_ICON_NONE. |
| + // This is drawn in addition to |image_|, but in most cases you probably want |
| + // one or the other and not both. |
| + gfx::VectorIconId vector_id_; |
|
Peter Kasting
2015/07/01 22:26:58
Does it make sense to make bitmap and vector image
Evan Stade
2015/07/02 00:08:06
I'm not a huge fan of classes that hold implementa
Peter Kasting
2015/07/02 00:23:53
That latter wouldn't be a concern if the bitmap cl
Evan Stade
2015/07/02 00:58:24
Like GetImageSize, which was a public function but
Peter Kasting
2015/07/02 08:06:11
Having added and then ripped out tons of different
|
| + |
| + // The color to use when drawing the vector icon. |
| + SkColor vector_color_; |
| + |
| // Horizontal alignment. |
| Alignment horiz_alignment_; |