Mercurial > projects > dwt-addons
comparison dwtx/draw2d/graph/SubgraphBoundary.d @ 98:95307ad235d9
Added Draw2d code, still work in progress
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 00:52:14 +0200 |
parents | |
children | c3583c6ec027 |
comparison
equal
deleted
inserted
replaced
96:b492ba44e44d | 98:95307ad235d9 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2003, 2005 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 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.draw2d.graph.SubgraphBoundary; | |
14 | |
15 import dwt.dwthelper.utils; | |
16 import tango.text.convert.Format; | |
17 | |
18 import dwtx.draw2d.geometry.Insets; | |
19 import dwtx.draw2d.graph.Node; | |
20 import dwtx.draw2d.graph.Subgraph; | |
21 | |
22 /** | |
23 * For INTERNAL use only. | |
24 * @author hudsonr | |
25 * @since 2.1.2 | |
26 */ | |
27 class SubgraphBoundary : Node { | |
28 | |
29 /** | |
30 * constant indicating TOP. | |
31 */ | |
32 public static const int TOP = 0; | |
33 | |
34 /** | |
35 * constant indicating LEFT. | |
36 */ | |
37 public static const int LEFT = 1; | |
38 | |
39 /** | |
40 * constant indicating BOTTOM. | |
41 */ | |
42 public static const int BOTTOM = 2; | |
43 | |
44 /** | |
45 * constant indicating RIGHT. | |
46 */ | |
47 public static const int RIGHT = 3; | |
48 | |
49 /** | |
50 * Constructs a new boundary. | |
51 * @param s the subgraph | |
52 * @param p the padding | |
53 * @param side which side | |
54 */ | |
55 public this(Subgraph s, Insets p, int side) { | |
56 super(null, s); | |
57 this.width = s.width; | |
58 this.height = s.height; | |
59 this.padding = new Insets(); | |
60 switch (side) { | |
61 case LEFT : | |
62 width = s.insets.left; | |
63 y = s.y; | |
64 padding.left = p.left; | |
65 padding.right = s.innerPadding.left; | |
66 padding.top = padding.bottom = 0; | |
67 setParent(s.getParent()); | |
68 data = stringcast(Format("left({})", s )); //$NON-NLS-1$ //$NON-NLS-2$ | |
69 break; | |
70 case RIGHT : | |
71 width = s.insets.right; | |
72 y = s.y; | |
73 padding.right = p.right; | |
74 padding.left = s.innerPadding.right; | |
75 padding.top = padding.bottom = 0; | |
76 setParent(s.getParent()); | |
77 data = stringcast(Format("right({})", s )); //$NON-NLS-1$ //$NON-NLS-2$ | |
78 break; | |
79 case TOP : | |
80 height = s.insets.top; | |
81 //$TODO width of head/tail should be 0 | |
82 width = 5; | |
83 padding.top = p.top; | |
84 padding.bottom = s.innerPadding.top; | |
85 padding.left = padding.right = 0; | |
86 data = stringcast(Format("top({})", s )); //$NON-NLS-1$ //$NON-NLS-2$ | |
87 break; | |
88 case BOTTOM : | |
89 height = s.insets.bottom; | |
90 //$TODO width of head/tail should be 0 | |
91 width = 5; | |
92 padding.top = s.innerPadding.bottom; | |
93 padding.bottom = p.bottom; | |
94 padding.left = padding.right = 0; | |
95 data = stringcast(Format("bottom({})", s )); //$NON-NLS-1$ //$NON-NLS-2$ | |
96 break; | |
97 } | |
98 } | |
99 | |
100 } |