| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 VIEWS_CONTROLS_IMAGE_VIEW_H_ | 5 #ifndef VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| 6 #define VIEWS_CONTROLS_IMAGE_VIEW_H_ | 6 #define VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| 7 | 7 |
| 8 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
| 9 #include "views/view.h" | 9 #include "views/view.h" |
| 10 | 10 |
| 11 class ChromeCanvas; | 11 namespace gfx { |
| 12 class Canvas; |
| 13 } |
| 12 | 14 |
| 13 namespace views { | 15 namespace views { |
| 14 | 16 |
| 15 ///////////////////////////////////////////////////////////////////////////// | 17 ///////////////////////////////////////////////////////////////////////////// |
| 16 // | 18 // |
| 17 // ImageView class. | 19 // ImageView class. |
| 18 // | 20 // |
| 19 // An ImageView can display an image from an SkBitmap. If a size is provided, | 21 // An ImageView can display an image from an SkBitmap. If a size is provided, |
| 20 // the ImageView will resize the provided image to fit if it is too big or will | 22 // the ImageView will resize the provided image to fit if it is too big or will |
| 21 // center the image if smaller. Otherwise, the preferred size matches the | 23 // center the image if smaller. Otherwise, the preferred size matches the |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 void SetVerticalAlignment(Alignment va); | 66 void SetVerticalAlignment(Alignment va); |
| 65 Alignment GetVerticalAlignment(); | 67 Alignment GetVerticalAlignment(); |
| 66 | 68 |
| 67 // Set / Get the tooltip text. | 69 // Set / Get the tooltip text. |
| 68 void SetTooltipText(const std::wstring& tooltip); | 70 void SetTooltipText(const std::wstring& tooltip); |
| 69 std::wstring GetTooltipText(); | 71 std::wstring GetTooltipText(); |
| 70 | 72 |
| 71 // Return whether the image should be centered inside the view. | 73 // Return whether the image should be centered inside the view. |
| 72 // Overriden from View | 74 // Overriden from View |
| 73 virtual gfx::Size GetPreferredSize(); | 75 virtual gfx::Size GetPreferredSize(); |
| 74 virtual void Paint(ChromeCanvas* canvas); | 76 virtual void Paint(gfx::Canvas* canvas); |
| 75 | 77 |
| 76 // Overriden from View. | 78 // Overriden from View. |
| 77 virtual bool GetTooltipText(int x, int y, std::wstring* tooltip); | 79 virtual bool GetTooltipText(int x, int y, std::wstring* tooltip); |
| 78 | 80 |
| 79 private: | 81 private: |
| 80 // Compute the image origin given the desired size and the receiver alignment | 82 // Compute the image origin given the desired size and the receiver alignment |
| 81 // properties. | 83 // properties. |
| 82 void ComputeImageOrigin(int image_width, int image_height, int *x, int *y); | 84 void ComputeImageOrigin(int image_width, int image_height, int *x, int *y); |
| 83 | 85 |
| 84 // Whether the image size is set. | 86 // Whether the image size is set. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 98 | 100 |
| 99 // The current tooltip text. | 101 // The current tooltip text. |
| 100 std::wstring tooltip_text_; | 102 std::wstring tooltip_text_; |
| 101 | 103 |
| 102 DISALLOW_EVIL_CONSTRUCTORS(ImageView); | 104 DISALLOW_EVIL_CONSTRUCTORS(ImageView); |
| 103 }; | 105 }; |
| 104 | 106 |
| 105 } // namespace views | 107 } // namespace views |
| 106 | 108 |
| 107 #endif // VIEWS_CONTROLS_IMAGE_VIEW_H_ | 109 #endif // VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| OLD | NEW |