xref: /webtrees/app/Report/ReportBaseTextbox.php (revision 54452b04856df5056fa76d9764beb95110c35d02)
1<?php
2/**
3 * webtrees: online genealogy
4 * Copyright (C) 2019 webtrees development team
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16declare(strict_types=1);
17
18namespace Fisharebest\Webtrees\Report;
19
20/**
21 * Class ReportBaseTextbox
22 */
23class ReportBaseTextbox extends ReportBaseElement
24{
25    /**
26     * Array of elements in the TextBox
27     *
28     * @var ReportBaseElement[]|string[]
29     */
30    public $elements = [];
31
32    /**
33     *  Background color in HTML code
34     *
35     * @var string
36     */
37    public $bgcolor;
38    /**
39     * Whether or not paint the background
40     *
41     * @var bool
42     */
43    public $fill;
44
45    /**
46     * Position the left corner of this box on the page(expressed in points). The default is the current position.
47     *
48     * @var float
49     */
50    public $left;
51    /**
52     * Position the top corner of this box on the page(expressed in points). the default is the current position
53     *
54     * @var float
55     */
56    public $top;
57    /**
58     * After this box is finished rendering, should the next section of text start immediately after the this box or should it start on a new line under this box. 0 = no new line, 1 = force new line. Default is 0
59     *
60     * @var bool
61     */
62    public $newline;
63
64    /** @var bool Unused? */
65    public $pagecheck;
66
67    /** @var bool Whether to print a border */
68    public $border;
69
70    /**
71     * Style of rendering
72     *
73     * <ul>
74     * <li>D or empty string: Draw (default).</li>
75     * <li>F: Fill.</li>
76     * <li>DF or FD: Draw and fill.</li>
77     * <li>CNZ: Clipping mode (using the even-odd rule to determine which regions lie inside the clipping path).</li>
78     *<li>CEO: Clipping mode (using the nonzero winding number rule to determine which regions lie inside the clipping path).</li>
79     * </ul>
80     *
81     * @var string
82     */
83    public $style;
84
85    /**
86     * @var array Border style of rectangle. Array with keys among the following:
87     * <ul>
88     * <li>all: Line style of all borders. Array like for {@link SetLineStyle SetLineStyle}.</li>
89     * <li>L, T, R, B or combinations: Line style of left, top, right or bottom border. Array like for {@link SetLineStyle SetLineStyle}.</li>
90     * </ul>
91     * Not yet in use
92     * var $borderstyle;
93     */
94
95    /**
96     * The starting height of this cell. If the text wraps the height will automatically be adjusted
97     *
98     * @var float
99     */
100    public $height;
101    /**
102     * Setting the width to 0 will make it the width from the current location to the right margin
103     *
104     * @var float
105     */
106    public $width;
107    /**
108     * Use cell padding or not
109     *
110     * @var bool
111     */
112    public $padding;
113    /**
114     * Resets this box last height after it’s done
115     */
116    public $reseth;
117
118    /**
119     * TextBox - Element - Base
120     *
121     * @param float  $width   Text box width
122     * @param float  $height  Text box height
123     * @param bool   $border
124     * @param string $bgcolor Background color code in HTML
125     * @param bool   $newline
126     * @param float  $left
127     * @param float  $top
128     * @param bool   $pagecheck
129     * @param string $style
130     * @param bool   $fill
131     * @param bool   $padding
132     * @param bool   $reseth
133     */
134    public function __construct($width, $height, $border, $bgcolor, $newline, $left, $top, $pagecheck, $style, $fill, $padding, $reseth)
135    {
136        $this->border    = $border;
137        $this->bgcolor   = $bgcolor;
138        $this->fill      = $fill;
139        $this->height    = $height;
140        $this->left      = $left;
141        $this->newline   = $newline;
142        $this->pagecheck = $pagecheck;
143        $this->style     = $style;
144        $this->top       = $top;
145        $this->width     = $width;
146        $this->padding   = $padding;
147        $this->reseth    = $reseth;
148    }
149
150    /**
151     * Add an element to the TextBox
152     *
153     * @param ReportBaseElement|string $element
154     *
155     * @return void
156     */
157    public function addElement($element)
158    {
159        $this->elements[] = $element;
160    }
161}
162