10
|
1 /*******************************************************************************
|
90
|
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
|
10
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.viewers.ColumnPixelData;
|
|
14
|
|
15 import dwtx.jface.viewers.ColumnLayoutData;
|
|
16
|
|
17 import dwtx.core.runtime.Assert;
|
|
18
|
|
19 /**
|
|
20 * Describes the width of a table column in pixels, and
|
|
21 * whether the column is resizable.
|
|
22 * <p>
|
|
23 * This class may be instantiated; it is not intended to be subclassed.
|
|
24 * </p>
|
90
|
25 * @noextend This class is not intended to be subclassed by clients.
|
10
|
26 */
|
|
27 public class ColumnPixelData : ColumnLayoutData {
|
|
28
|
|
29 /**
|
|
30 * The column's width in pixels.
|
|
31 */
|
|
32 public int width;
|
|
33
|
|
34 /**
|
|
35 * Whether to allocate extra width to the column to account for
|
|
36 * trim taken by the column itself.
|
|
37 * The default is <code>false</code> for backwards compatibility, but
|
|
38 * the recommended practice is to specify <code>true</code>, and
|
|
39 * specify the desired width for the content of the column, rather
|
|
40 * than adding a fudge factor to the specified width.
|
|
41 *
|
|
42 * @since 3.1
|
|
43 */
|
|
44 public bool addTrim = false;
|
|
45
|
|
46 /**
|
|
47 * Creates a resizable column width of the given number of pixels.
|
|
48 *
|
|
49 * @param widthInPixels the width of column in pixels
|
|
50 */
|
|
51 public this(int widthInPixels) {
|
|
52 this(widthInPixels, true, false);
|
|
53 }
|
|
54
|
|
55 /**
|
|
56 * Creates a column width of the given number of pixels.
|
|
57 *
|
|
58 * @param widthInPixels the width of column in pixels
|
|
59 * @param resizable <code>true</code> if the column is resizable,
|
|
60 * and <code>false</code> if size of the column is fixed
|
|
61 */
|
|
62 public this(int widthInPixels, bool resizable) {
|
|
63 this(widthInPixels, resizable, false);
|
|
64 }
|
|
65
|
|
66 /**
|
|
67 * Creates a column width of the given number of pixels.
|
|
68 *
|
|
69 * @param widthInPixels
|
|
70 * the width of column in pixels
|
|
71 * @param resizable
|
|
72 * <code>true</code> if the column is resizable, and
|
|
73 * <code>false</code> if size of the column is fixed
|
|
74 * @param addTrim
|
|
75 * <code>true</code> to allocate extra width to the column to
|
|
76 * account for trim taken by the column itself,
|
|
77 * <code>false</code> to use the given width exactly
|
|
78 * @since 3.1
|
|
79 */
|
|
80 public this(int widthInPixels, bool resizable, bool addTrim) {
|
|
81 super(resizable);
|
|
82 Assert.isTrue(widthInPixels >= 0);
|
|
83 this.width = widthInPixels;
|
|
84 this.addTrim = addTrim;
|
|
85 }
|
|
86 }
|