Mercurial > projects > dwt-samples
comparison jface.text/Simple.d @ 169:9a850c264e3b
Add JFace Text example
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 26 Oct 2008 14:00:52 +0100 |
parents | |
children | 33d9146198b2 |
comparison
equal
deleted
inserted
replaced
167:d97169edcd8c | 169:9a850c264e3b |
---|---|
1 module test; | |
2 | |
3 import dwt.DWT; | |
4 import dwt.layout.FillLayout; | |
5 import dwt.widgets.Composite; | |
6 import dwt.widgets.Control; | |
7 import dwt.widgets.Display; | |
8 import dwt.widgets.Shell; | |
9 import dwtx.jface.text.Document; | |
10 import dwtx.jface.text.source.CompositeRuler; | |
11 import dwtx.jface.text.source.LineNumberRulerColumn; | |
12 import dwtx.jface.text.source.AnnotationRulerColumn; | |
13 import dwtx.jface.text.source.SourceViewer; | |
14 import dwtx.jface.window.ApplicationWindow; | |
15 | |
16 version(JIVE) import jive.stacktrace; | |
17 | |
18 class SourceViewerTest : ApplicationWindow | |
19 { | |
20 this() | |
21 { | |
22 super( null ); | |
23 } | |
24 | |
25 protected Control createContents( Composite parent ) | |
26 { | |
27 getShell.setText( "SourceViewerTest" ); | |
28 getShell.setSize( 350, 400 ); | |
29 Display disp = getShell.getDisplay(); | |
30 Composite container = new Composite( parent, DWT.NONE ); | |
31 container.setLayout( new FillLayout() ); | |
32 | |
33 CompositeRuler ruler = new CompositeRuler(); | |
34 | |
35 LineNumberRulerColumn lineCol = new LineNumberRulerColumn(); | |
36 lineCol.setBackground( disp.getSystemColor( DWT.COLOR_GRAY ) ); | |
37 lineCol.setForeground( disp.getSystemColor( DWT.COLOR_BLUE ) ); | |
38 ruler.addDecorator( 0, lineCol ); | |
39 | |
40 Document doc = new Document( `void main() | |
41 { | |
42 ApplicationWindow w = new SourceViewerTest(); | |
43 w.setBlockOnOpen( true ); | |
44 w.open(); | |
45 Display.getCurrent.dispose(); | |
46 } | |
47 ` ); | |
48 | |
49 SourceViewer sv = new SourceViewer( container, ruler, DWT.BORDER | DWT.H_SCROLL | DWT.V_SCROLL ); | |
50 sv.setDocument( doc ); | |
51 | |
52 return container; | |
53 } | |
54 } | |
55 | |
56 void main() | |
57 { | |
58 ApplicationWindow w = new SourceViewerTest(); | |
59 w.setBlockOnOpen( true ); | |
60 w.open(); | |
61 Display.getCurrent.dispose(); | |
62 } | |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | |
69 | |
70 |