Mercurial > projects > dwt-addons
annotate dwtx/ui/internal/forms/widgets/BreakSegment.d @ 104:04b47443bb01
Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 07 Aug 2008 15:01:33 +0200 |
parents | e193036d82c9 |
children |
rev | line source |
---|---|
75 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 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.ui.internal.forms.widgets.BreakSegment; | |
14 | |
76 | 15 import dwtx.ui.internal.forms.widgets.ParagraphSegment; |
16 import dwtx.ui.internal.forms.widgets.Locator; | |
17 import dwtx.ui.internal.forms.widgets.SelectionData; | |
18 | |
75 | 19 import dwt.graphics.FontMetrics; |
20 import dwt.graphics.GC; | |
21 import dwt.graphics.Rectangle; | |
22 | |
76 | 23 import dwt.dwthelper.utils; |
104
04b47443bb01
Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections.
Frank Benoit <benoit@tionex.de>
parents:
76
diff
changeset
|
24 import dwtx.dwtxhelper.Collection; |
76 | 25 |
75 | 26 /** |
27 * This segment serves as break within a paragraph. It has no data - | |
28 * just starts a new line and resets the locator. | |
29 */ | |
30 | |
76 | 31 public class BreakSegment : ParagraphSegment { |
75 | 32 /* (non-Javadoc) |
33 * @see dwtx.ui.forms.internal.widgets.ParagraphSegment#advanceLocator(dwt.graphics.GC, int, dwtx.ui.forms.internal.widgets.Locator, java.util.Hashtable) | |
34 */ | |
35 public bool advanceLocator(GC gc, int wHint, Locator locator, | |
36 Hashtable objectTable, bool computeHeightOnly) { | |
76 | 37 if (locator.rowHeight is 0) { |
75 | 38 FontMetrics fm = gc.getFontMetrics(); |
39 locator.rowHeight = fm.getHeight(); | |
40 } | |
76 | 41 if (computeHeightOnly) locator.collectHeights(); |
75 | 42 locator.x = locator.indent; |
43 locator.y += locator.rowHeight; | |
44 locator.rowHeight = 0; | |
45 locator.leading = 0; | |
46 return true; | |
47 } | |
48 | |
49 public void paint(GC gc, bool hover, Hashtable resourceTable, bool selected, SelectionData selData, Rectangle repaintRegion) { | |
50 //nothing to paint | |
51 } | |
52 public bool contains(int x, int y) { | |
53 return false; | |
54 } | |
55 public bool intersects(Rectangle rect) { | |
56 return false; | |
57 } | |
58 /* (non-Javadoc) | |
59 * @see dwtx.ui.internal.forms.widgets.ParagraphSegment#layout(dwt.graphics.GC, int, dwtx.ui.internal.forms.widgets.Locator, java.util.Hashtable, bool, dwtx.ui.internal.forms.widgets.SelectionData) | |
60 */ | |
61 public void layout(GC gc, int width, Locator locator, Hashtable ResourceTable, | |
62 bool selected) { | |
63 locator.resetCaret(); | |
76 | 64 if (locator.rowHeight is 0) { |
75 | 65 FontMetrics fm = gc.getFontMetrics(); |
66 locator.rowHeight = fm.getHeight(); | |
67 } | |
68 locator.y += locator.rowHeight; | |
69 locator.rowHeight = 0; | |
76 | 70 locator.rowCounter++; |
75 | 71 } |
72 | |
73 /* (non-Javadoc) | |
74 * @see dwtx.ui.internal.forms.widgets.ParagraphSegment#computeSelection(dwt.graphics.GC, java.util.Hashtable, bool, dwtx.ui.internal.forms.widgets.SelectionData) | |
75 */ | |
76 public void computeSelection(GC gc, Hashtable resourceTable, SelectionData selData) { | |
77 selData.markNewLine(); | |
78 } | |
79 } |