Mercurial > projects > dwt-addons
annotate dwtx/jface/layout/TableColumnLayout.d @ 43:ea8ff534f622
Fix override and super aliases
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 11 Apr 2008 01:24:25 +0200 |
parents | b6c35faf97c8 |
children |
rev | line source |
---|---|
10 | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | |
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 * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation | |
10 * - fix for bug 178280 | |
11 * IBM Corporation - API refactoring and general maintenance | |
12 * Port to the D programming language: | |
13 * Frank Benoit <benoit@tionex.de> | |
14 *******************************************************************************/ | |
15 | |
16 module dwtx.jface.layout.TableColumnLayout; | |
17 | |
18 import dwtx.jface.layout.AbstractColumnLayout; | |
19 | |
20 import dwt.widgets.Composite; | |
21 import dwt.widgets.Layout; | |
22 import dwt.widgets.Scrollable; | |
23 import dwt.widgets.Table; | |
24 import dwt.widgets.TableColumn; | |
25 import dwt.widgets.Widget; | |
26 import dwtx.jface.viewers.ColumnLayoutData; | |
27 import dwtx.jface.viewers.ColumnPixelData; | |
28 | |
29 /** | |
30 * The TableColumnLayout is the {@link Layout} used to maintain | |
31 * {@link TableColumn} sizes in a {@link Table}. | |
32 * | |
33 * <p> | |
34 * <b>You can only add the {@link Layout} to a container whose <i>only</i> | |
35 * child is the {@link Table} control you want the {@link Layout} applied to. | |
36 * Don't assign the layout directly the {@link Table}</b> | |
37 * </p> | |
38 * | |
39 * @since 3.3 | |
40 */ | |
41 public class TableColumnLayout : AbstractColumnLayout { | |
42 | |
43 /* | |
44 * (non-Javadoc) | |
45 * | |
46 * @see dwtx.jface.layout.AbstractColumnLayout#getColumnCount(dwt.widgets.Scrollable) | |
47 */ | |
43
ea8ff534f622
Fix override and super aliases
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
48 override int getColumnCount(Scrollable tableTree) { |
10 | 49 return (cast(Table) tableTree).getColumnCount(); |
50 } | |
51 | |
52 /* | |
53 * (non-Javadoc) | |
54 * | |
55 * @see dwtx.jface.layout.AbstractColumnLayout#setColumnWidths(dwt.widgets.Scrollable, | |
56 * int[]) | |
57 */ | |
43
ea8ff534f622
Fix override and super aliases
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
58 override void setColumnWidths(Scrollable tableTree, int[] widths) { |
10 | 59 TableColumn[] columns = (cast(Table) tableTree).getColumns(); |
60 for (int i = 0; i < widths.length; i++) { | |
61 columns[i].setWidth(widths[i]); | |
62 } | |
63 } | |
64 | |
65 /* | |
66 * (non-Javadoc) | |
67 * | |
68 * @see dwtx.jface.layout.AbstractColumnLayout#getLayoutData(int) | |
69 */ | |
43
ea8ff534f622
Fix override and super aliases
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
70 override ColumnLayoutData getLayoutData(Scrollable tableTree, int columnIndex) { |
10 | 71 TableColumn column = (cast(Table) tableTree).getColumn(columnIndex); |
72 return cast(ColumnLayoutData) column.getData(LAYOUT_DATA); | |
73 } | |
74 | |
75 Composite getComposite(Widget column) { | |
76 return (cast(TableColumn) column).getParent().getParent(); | |
77 } | |
78 | |
79 /* (non-Javadoc) | |
80 * @see dwtx.jface.layout.AbstractColumnLayout#updateColumnData(dwt.widgets.Widget) | |
81 */ | |
43
ea8ff534f622
Fix override and super aliases
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
82 override void updateColumnData(Widget column) { |
10 | 83 TableColumn tColumn = cast(TableColumn) column; |
84 Table t = tColumn.getParent(); | |
85 | |
86 if( ! IS_GTK || t.getColumn(t.getColumnCount()-1) !is tColumn ){ | |
87 tColumn.setData(LAYOUT_DATA,new ColumnPixelData(tColumn.getWidth())); | |
88 layout(t.getParent(), true); | |
89 } | |
90 } | |
91 } |