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

Side by Side Diff: ui/base/nine_image_painter_factory.h

Issue 806433002: Support horizontal/vertical only images in NineImagePainter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | ui/gfx/nine_image_painter.cc » ('j') | ui/gfx/nine_image_painter.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BASE_NINE_IMAGE_PAINTER_FACTORY_H_ 5 #ifndef UI_BASE_NINE_IMAGE_PAINTER_FACTORY_H_
6 #define UI_BASE_NINE_IMAGE_PAINTER_FACTORY_H_ 6 #define UI_BASE_NINE_IMAGE_PAINTER_FACTORY_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/base/ui_base_export.h" 9 #include "ui/base/ui_base_export.h"
10 10
11 // A macro to define arrays of IDR constants used with CreateImageGridPainter. 11 // A macro to define arrays of IDR constants used with CreateImageGridPainter.
12 #define IMAGE_GRID(x) { x ## _TOP_LEFT, x ## _TOP, x ## _TOP_RIGHT, \ 12 #define IMAGE_GRID(x) { x ## _TOP_LEFT, x ## _TOP, x ## _TOP_RIGHT, \
13 x ## _LEFT, x ## _CENTER, x ## _RIGHT, \ 13 x ## _LEFT, x ## _CENTER, x ## _RIGHT, \
14 x ## _BOTTOM_LEFT, x ## _BOTTOM, x ## _BOTTOM_RIGHT, } 14 x ## _BOTTOM_LEFT, x ## _BOTTOM, x ## _BOTTOM_RIGHT, }
15 15
16 // Defines a empty image for used in macro for creating image grid for a ring of 16 // Defines a empty image for used in macro for creating image grid for a ring of
17 // eight images. 17 // eight images.
18 #define EMPTY_IMAGE 0 18 #define EMPTY_IMAGE 0
19 19
20 // A macro to define arrays of IDR constants used with CreateImageGridPainter 20 // A macro to define arrays of IDR constants used with CreateImageGridPainter
21 // where only a ring of eight images is provided and center image is empty. 21 // where only a ring of eight images is provided and center image is empty.
22 #define IMAGE_GRID_NO_CENTER(x) { x ## _TOP_LEFT, x ## _TOP, x ## _TOP_RIGHT, \ 22 #define IMAGE_GRID_NO_CENTER(x) { x ## _TOP_LEFT, x ## _TOP, x ## _TOP_RIGHT, \
23 x ## _LEFT, EMPTY_IMAGE, x ## _RIGHT, \ 23 x ## _LEFT, EMPTY_IMAGE, x ## _RIGHT, \
24 x ## _BOTTOM_LEFT, x ## _BOTTOM, x ## _BOTTOM_RIGHT, } 24 x ## _BOTTOM_LEFT, x ## _BOTTOM, x ## _BOTTOM_RIGHT, }
25 25
26 // A macro to define arrays of IDR constants used with CreateImageGridPainter
27 // where it can only be streched horizontally.
28 #define IMAGE_GRID_HORIZONTAL(x) { x ## _LEFT, x ## _CENTER, x ## _RIGHT, \
29 EMPTY_IMAGE, EMPTY_IMAGE, EMPTY_IMAGE, \
30 EMPTY_IMAGE, EMPTY_IMAGE, EMPTY_IMAGE}
31
32 // A macro to define arrays of IDR constants used with CreateImageGridPainter
33 // where it can only be streched vertically.
34 #define IMAGE_GRID_VERTICAL(x) { x ## _TOP, EMPTY_IMAGE, EMPTY_IMAGE, \
35 x ## _CENTER, EMPTY_IMAGE, EMPTY_IMAGE, \
36 x ## _BOTTOM, EMPTY_IMAGE, EMPTY_IMAGE}
26 37
27 namespace gfx { 38 namespace gfx {
28 class NineImagePainter; 39 class NineImagePainter;
29 } 40 }
30 41
31 namespace ui { 42 namespace ui {
32 43
33 // Creates a NineImagePainter from an array of image ids. It's expected the 44 // Creates a NineImagePainter from an array of image ids. It's expected the
34 // array came from the IMAGE_GRID macro. 45 // array came from the IMAGE_GRID macro.
35 UI_BASE_EXPORT scoped_ptr<gfx::NineImagePainter> CreateNineImagePainter( 46 UI_BASE_EXPORT scoped_ptr<gfx::NineImagePainter> CreateNineImagePainter(
36 const int image_ids[]); 47 const int image_ids[]);
37 48
38 } // namespace ui 49 } // namespace ui
39 50
40 #endif // UI_BASE_NINE_IMAGE_PAINTER_FACTORY_H_ 51 #endif // UI_BASE_NINE_IMAGE_PAINTER_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/nine_image_painter.cc » ('j') | ui/gfx/nine_image_painter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698