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.ColumnWeightData;
|
|
14
|
|
15 import dwtx.jface.viewers.ColumnLayoutData;
|
|
16
|
|
17 import dwtx.core.runtime.Assert;
|
|
18
|
|
19 import dwt.dwthelper.utils;
|
|
20
|
|
21 /**
|
|
22 * Describes the width of a table column in terms of a weight,
|
|
23 * a minimum width, and whether the column is resizable.
|
|
24 * <p>
|
|
25 * This class may be instantiated; it is not intended to be subclassed.
|
|
26 * </p>
|
90
|
27 * @noextend This class is not intended to be subclassed by clients.
|
10
|
28 */
|
|
29 public class ColumnWeightData : ColumnLayoutData {
|
|
30
|
|
31 /**
|
|
32 * Default width of a column (in pixels).
|
|
33 */
|
|
34 public static const int MINIMUM_WIDTH = 20;
|
|
35
|
|
36 /**
|
|
37 * The column's minimum width in pixels.
|
|
38 */
|
|
39 public int minimumWidth;
|
|
40
|
|
41 /**
|
|
42 * The column's weight.
|
|
43 */
|
|
44 public int weight;
|
|
45
|
|
46 /**
|
|
47 * Creates a resizable column width with the given weight and a default
|
|
48 * minimum width.
|
|
49 *
|
|
50 * @param weight the weight of the column
|
|
51 */
|
|
52 public this(int weight) {
|
|
53 this(weight, true);
|
|
54 }
|
|
55
|
|
56 /**
|
|
57 * Creates a resizable column width with the given weight and minimum width.
|
|
58 *
|
|
59 * @param weight the weight of the column
|
|
60 * @param minimumWidth the minimum width of the column in pixels
|
|
61 */
|
|
62 public this(int weight, int minimumWidth) {
|
|
63 this(weight, minimumWidth, true);
|
|
64 }
|
|
65
|
|
66 /**
|
|
67 * Creates a column width with the given weight and minimum width.
|
|
68 *
|
|
69 * @param weight the weight of the column
|
|
70 * @param minimumWidth the minimum width of the column in pixels
|
|
71 * @param resizable <code>true</code> if the column is resizable,
|
|
72 * and <code>false</code> if size of the column is fixed
|
|
73 */
|
|
74 public this(int weight, int minimumWidth, bool resizable) {
|
|
75 super(resizable);
|
|
76 Assert.isTrue(weight >= 0);
|
|
77 Assert.isTrue(minimumWidth >= 0);
|
|
78 this.weight = weight;
|
|
79 this.minimumWidth = minimumWidth;
|
|
80 }
|
|
81
|
|
82 /**
|
|
83 * Creates a column width with the given weight and a default
|
|
84 * minimum width.
|
|
85 *
|
|
86 * @param weight the weight of the column
|
|
87 * @param resizable <code>true</code> if the column is resizable,
|
|
88 * and <code>false</code> if size of the column is fixed
|
|
89 */
|
|
90 public this(int weight, bool resizable) {
|
|
91 this(weight, MINIMUM_WIDTH, resizable);
|
|
92 }
|
|
93 }
|