Roll src/third_party/WebKit 4526c29:30f3df0 (svn 190187:190189)
[chromium-blink-merge.git] / ui / base / nine_image_painter_factory.h
blobd09f95c8428bd4192715e06c954f72c8ed04c55c
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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_NINE_IMAGE_PAINTER_FACTORY_H_
6 #define UI_BASE_NINE_IMAGE_PAINTER_FACTORY_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/base/ui_base_export.h"
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, \
13 x ## _LEFT, x ## _CENTER, x ## _RIGHT, \
14 x ## _BOTTOM_LEFT, x ## _BOTTOM, x ## _BOTTOM_RIGHT, }
16 // Defines a empty image for used in macro for creating image grid for a ring of
17 // eight images.
18 #define EMPTY_IMAGE 0
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.
22 #define IMAGE_GRID_NO_CENTER(x) { x ## _TOP_LEFT, x ## _TOP, x ## _TOP_RIGHT, \
23 x ## _LEFT, EMPTY_IMAGE, x ## _RIGHT, \
24 x ## _BOTTOM_LEFT, x ## _BOTTOM, x ## _BOTTOM_RIGHT, }
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}
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}
38 namespace gfx {
39 class NineImagePainter;
42 namespace ui {
44 // Creates a NineImagePainter from an array of image ids. It's expected the
45 // array came from the IMAGE_GRID macro.
46 UI_BASE_EXPORT scoped_ptr<gfx::NineImagePainter> CreateNineImagePainter(
47 const int image_ids[]);
49 } // namespace ui
51 #endif // UI_BASE_NINE_IMAGE_PAINTER_FACTORY_H_