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

Side by Side Diff: ui/views/controls/image_view.h

Issue 2881183003: Add views::View::set_preferred_size, use it in a few places. (Closed)
Patch Set: auto* Created 3 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
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_IMAGE_VIEW_H_ 5 #ifndef UI_VIEWS_CONTROLS_IMAGE_VIEW_H_
6 #define UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ 6 #define UI_VIEWS_CONTROLS_IMAGE_VIEW_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/gfx/image/image_skia.h" 9 #include "ui/gfx/image/image_skia.h"
10 #include "ui/views/view.h" 10 #include "ui/views/view.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Set / Get the vertical alignment. 67 // Set / Get the vertical alignment.
68 void SetVerticalAlignment(Alignment va); 68 void SetVerticalAlignment(Alignment va);
69 Alignment GetVerticalAlignment() const; 69 Alignment GetVerticalAlignment() const;
70 70
71 // Set / Get the tooltip text. 71 // Set / Get the tooltip text.
72 void SetTooltipText(const base::string16& tooltip); 72 void SetTooltipText(const base::string16& tooltip);
73 base::string16 GetTooltipText() const; 73 base::string16 GetTooltipText() const;
74 74
75 // Overriden from View: 75 // Overriden from View:
76 gfx::Size GetPreferredSize() const override;
77 void OnPaint(gfx::Canvas* canvas) override; 76 void OnPaint(gfx::Canvas* canvas) override;
78 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; 77 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
79 const char* GetClassName() const override; 78 const char* GetClassName() const override;
80 bool GetTooltipText(const gfx::Point& p, 79 bool GetTooltipText(const gfx::Point& p,
81 base::string16* tooltip) const override; 80 base::string16* tooltip) const override;
81 gfx::Size CalculatePreferredSize() const override;
82 82
83 private: 83 private:
84 void OnPaintImage(gfx::Canvas* canvas); 84 void OnPaintImage(gfx::Canvas* canvas);
85 85
86 // Returns true if |img| is the same as the last image we painted. This is 86 // Returns true if |img| is the same as the last image we painted. This is
87 // intended to be a quick check, not exhaustive. In other words it's possible 87 // intended to be a quick check, not exhaustive. In other words it's possible
88 // for this to return false even though the images are in fact equal. 88 // for this to return false even though the images are in fact equal.
89 bool IsImageEqual(const gfx::ImageSkia& img) const; 89 bool IsImageEqual(const gfx::ImageSkia& img) const;
90 90
91 // Returns the size the image will be painted. 91 // Returns the size the image will be painted.
(...skipping 27 matching lines...) Expand all
119 // Address of bytes we last painted. This is used only for comparison, so its 119 // Address of bytes we last painted. This is used only for comparison, so its
120 // safe to cache. 120 // safe to cache.
121 void* last_painted_bitmap_pixels_; 121 void* last_painted_bitmap_pixels_;
122 122
123 DISALLOW_COPY_AND_ASSIGN(ImageView); 123 DISALLOW_COPY_AND_ASSIGN(ImageView);
124 }; 124 };
125 125
126 } // namespace views 126 } // namespace views
127 127
128 #endif // UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ 128 #endif // UI_VIEWS_CONTROLS_IMAGE_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.cc ('k') | ui/views/controls/image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698