Mercurial > projects > dwt-addons
diff dwtx/ui/internal/forms/widgets/FormTextModel.d @ 78:4ac9946b9fb5
Forms work with first test
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 24 May 2008 08:33:56 +0200 |
parents | 5d489b9f966c |
children | 7ffeace6c47f |
line wrap: on
line diff
--- a/dwtx/ui/internal/forms/widgets/FormTextModel.d Sat May 24 06:59:31 2008 +0200 +++ b/dwtx/ui/internal/forms/widgets/FormTextModel.d Sat May 24 08:33:56 2008 +0200 @@ -19,45 +19,14 @@ import dwtx.ui.internal.forms.widgets.ControlSegment; import dwtx.ui.internal.forms.widgets.ImageSegment; import dwtx.ui.internal.forms.widgets.ObjectSegment; +import dwtx.ui.internal.forms.widgets.SWTUtil; import dwt.DWT; import dwtx.ui.forms.HyperlinkSettings; import dwt.dwthelper.utils; import dwt.dwthelper.InputStream; -pragma(msg,"FIXME temp type "~__FILE__); -public class FormTextModel { - public static const String BOLD_FONT_ID = "f.____bold"; //$NON-NLS-1$ - public this() ; - public Paragraph[] getParagraphs() ; - public String getAccessibleText() ; - public void parseTaggedText(String taggedText, bool expandURLs) ; - public void parseInputStream(InputStream is_, bool expandURLs) ; - public void parseRegularText(String regularText, bool convertURLs) ; - public HyperlinkSettings getHyperlinkSettings() ; - public void setHyperlinkSettings(HyperlinkSettings settings) ; - IFocusSelectable[] getFocusSelectableSegments() ; - public IHyperlinkSegment getHyperlink(int index) ; - public IHyperlinkSegment findHyperlinkAt(int x, int y) ; - public int getHyperlinkCount() ; - public int indexOf(IHyperlinkSegment link) ; - public ParagraphSegment findSegmentAt(int x, int y) ; - public void clearCache(String fontId) ; - public IFocusSelectable getSelectedSegment() ; - public int getSelectedSegmentIndex() ; - public bool linkExists(IHyperlinkSegment link) ; - public bool traverseFocusSelectableObjects(bool next) ; - public IFocusSelectable getNextFocusSegment(bool next) ; - public bool restoreSavedLink() ; - public void selectLink(IHyperlinkSegment link) ; - public void select(IFocusSelectable selectable) ; - public bool hasFocusSegments() ; - public void dispose() ; - public bool isWhitespaceNormalized() ; - public void setWhitespaceNormalized(bool whitespaceNormalized) ; -} -/++ static import tango.text.xml.Document; import tango.util.collection.ArraySeq; public class FormTextModel { @@ -113,7 +82,13 @@ } return sbuf.toString(); } - + public void parseTaggedText(String taggedText, bool expandURLs) { + implMissing(__FILE__,__LINE__); + } + public void parseInputStream(InputStream is_, bool expandURLs) { + implMissing(__FILE__,__LINE__); + } +/++ /* * @see ITextModel#parse(String) */ @@ -366,12 +341,12 @@ segment.setVerticalAlignment(ImageSegment.BOTTOM); } } - +++/ private void appendText(String value, StringBuffer buf, int[] spaceCounter) { if (!whitespaceNormalized) buf.append(value); else { - for (int j = 0; j < value.length(); j++) { + for (int j = 0; j < value.length; j++) { char c = value.charAt(j); if (c is ' ' || c is '\t') { // space @@ -401,7 +376,7 @@ appendText(text, buf, spaceCounter); return buf.toString(); } - +/++ private String getSingleNodeText(Node node) { return getNormalizedText(node.getNodeValue()); } @@ -545,7 +520,7 @@ p.parseRegularText(text, expandURLs, wrapAllowed, getHyperlinkSettings(), fontId, colorId); } - +++/ public void parseRegularText(String regularText, bool convertURLs) { reset(); @@ -558,7 +533,7 @@ paragraphs.append(p); int pstart = 0; - for (int i = 0; i < regularText.length(); i++) { + for (int i = 0; i < regularText.length; i++) { char c = regularText.charAt(i); if (p is null) { p = new Paragraph(true); @@ -581,7 +556,7 @@ public HyperlinkSettings getHyperlinkSettings() { // #132723 cannot have null settings - if (hyperlinkSettingsisnull) + if (hyperlinkSettings is null) hyperlinkSettings = new HyperlinkSettings(SWTUtil.getStandardDisplay()); return hyperlinkSettings; } @@ -608,7 +583,7 @@ ParagraphSegment[] segments = p.getSegments(); for (int j = 0; j < segments.length; j++) { if (null !is cast(IFocusSelectable)segments[j] ) - result ~= segments[j]; + result ~= cast(IFocusSelectable)segments[j]; } } selectableSegments = result; @@ -681,7 +656,7 @@ } public bool linkExists(IHyperlinkSegment link) { - if (selectableSegmentsisnull) + if (selectableSegments is null) return false; for (int i=0; i<selectableSegments.length; i++) { if (selectableSegments[i] is link) @@ -743,7 +718,7 @@ if (selectables is null) return; for (int i = 0; i < selectables.length; i++) { - if (selectables[i].equals(selectable)) { + if ((cast(Object)selectables[i]).opEquals(cast(Object)selectable)) { selectedSegmentIndex = i; break; } @@ -779,4 +754,3 @@ this.whitespaceNormalized = whitespaceNormalized; } } -++/ \ No newline at end of file