| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_GTK_NINE_BOX_H_ | 5 #ifndef CHROME_BROWSER_GTK_NINE_BOX_H_ |
| 6 #define CHROME_BROWSER_GTK_NINE_BOX_H_ | 6 #define CHROME_BROWSER_GTK_NINE_BOX_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 // A NineBox manages a set of source images representing a 3x3 grid, where | 10 // A NineBox manages a set of source images representing a 3x3 grid, where |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class NineBox { | 21 class NineBox { |
| 22 public: | 22 public: |
| 23 // Construct a NineBox with nine images. Images are specified using resource | 23 // Construct a NineBox with nine images. Images are specified using resource |
| 24 // ids that will be passed to the resource bundle. Use 0 for no image. | 24 // ids that will be passed to the resource bundle. Use 0 for no image. |
| 25 NineBox(int top_left, int top, int top_right, int left, int center, int right, | 25 NineBox(int top_left, int top, int top_right, int left, int center, int right, |
| 26 int bottom_left, int bottom, int bottom_right); | 26 int bottom_left, int bottom, int bottom_right); |
| 27 ~NineBox(); | 27 ~NineBox(); |
| 28 | 28 |
| 29 // Render the NineBox to |dst|. | 29 // Render the NineBox to |dst|. |
| 30 // The images will be tiled to fit into the widget. | 30 // The images will be tiled to fit into the widget. |
| 31 void RenderToWidget(GtkWidget* dst); | 31 void RenderToWidget(GtkWidget* dst) const; |
| 32 | 32 |
| 33 // Render the top row of images to |dst| between |x1| and |x2|. | 33 // Render the top row of images to |dst| between |x1| and |x2|. |
| 34 // This is split from RenderToWidget so the toolbar can use it. | 34 // This is split from RenderToWidget so the toolbar can use it. |
| 35 void RenderTopCenterStrip(GtkWidget* dst, int x1, int x2, int y1); | 35 void RenderTopCenterStrip(GtkWidget* dst, int x1, int x2, int y1) const; |
| 36 |
| 37 // Change all pixels that are white in |images_| to have 0 opacity. |
| 38 void ChangeWhiteToTransparent(); |
| 39 |
| 40 // Set the shape of |widget| to match that of the ninebox. Note that |widget| |
| 41 // must have its own window and be allocated. Also, currently only the top |
| 42 // three images are used. |
| 43 // TODO(estade): extend this function to use all 9 images (if it's ever |
| 44 // needed). |
| 45 void ContourWidget(GtkWidget* widget) const; |
| 36 | 46 |
| 37 private: | 47 private: |
| 38 // Repeatedly stamp src across dst. | 48 // Repeatedly stamp src across dst. |
| 39 void TileImage(GtkWidget* dst, GdkPixbuf* src, | 49 void TileImage(GtkWidget* dst, GdkPixbuf* src, |
| 40 int x1, int y1, int x2, int y2); | 50 int x1, int y1, int x2, int y2) const; |
| 41 | 51 |
| 42 GdkPixbuf* images_[9]; | 52 GdkPixbuf* images_[9]; |
| 43 }; | 53 }; |
| 44 | 54 |
| 45 #endif // CHROME_BROWSER_GTK_NINE_BOX_H_ | 55 #endif // CHROME_BROWSER_GTK_NINE_BOX_H_ |
| OLD | NEW |