Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changes between Version 1 and Version 2 of JFaceTextExample

Show
Ignore:
Author:
keinfarbton (IP: 84.161.64.165)
Timestamp:
10/26/08 13:22:48 (15 years ago)
Comment:

win screenshot and source

Legend:

Unmodified
Added
Removed
Modified
  • JFaceTextExample

    v1 v2  
    66[[Image(http://downloads.dsource.org/projects/dwt/screenshots/linux/jface/JFace.Text.SourceViewerTest.png)]] 
    77 
     8Simple example on WinXp [[br]] 
     9[[Image(http://downloads.dsource.org/projects/dwt/screenshots/win/jface/JFace.Text.SourceViewerTest.png)]] 
     10 
     11Source: 
     12{{{ 
     13#!d 
     14import dwt.std; 
     15import dwtx.jface.text.Document; 
     16import dwtx.jface.text.source.CompositeRuler; 
     17import dwtx.jface.text.source.LineNumberRulerColumn; 
     18import dwtx.jface.text.source.AnnotationRulerColumn; 
     19import dwtx.jface.text.source.SourceViewer; 
     20import dwtx.jface.window.ApplicationWindow; 
     21 
     22version(JIVE) import jive.stacktrace; 
     23 
     24const char[] startText = `void main() 
     25{ 
     26    ApplicationWindow w = new SourceViewerTest(); 
     27    w.setBlockOnOpen( true ); 
     28    w.open(); 
     29    Display.getCurrent.dispose(); 
     30} 
     31`; 
     32 
     33class SourceViewerTest : ApplicationWindow { 
     34    this() { 
     35        super( null ); 
     36    } 
     37 
     38    protected Control createContents( Composite parent ) { 
     39        getShell.setText( "SourceViewerTest" ); 
     40        getShell.setSize( 350, 400 ); 
     41        Display disp = getShell.getDisplay(); 
     42        Composite container = new Composite( parent, DWT.NONE ); 
     43        container.setLayout( new FillLayout() ); 
     44 
     45        CompositeRuler ruler = new CompositeRuler(); 
     46 
     47        LineNumberRulerColumn lineCol = new LineNumberRulerColumn(); 
     48        lineCol.setBackground( disp.getSystemColor( DWT.COLOR_GRAY ) ); 
     49        lineCol.setForeground( disp.getSystemColor( DWT.COLOR_BLUE ) ); 
     50        ruler.addDecorator( 0, lineCol ); 
     51 
     52        Document doc = new Document( startText ); 
     53 
     54        SourceViewer sv = new SourceViewer( container, ruler, DWT.BORDER | DWT.H_SCROLL | DWT.V_SCROLL ); 
     55        sv.setDocument( doc ); 
     56 
     57        return container; 
     58    } 
     59} 
     60 
     61void main() { 
     62    ApplicationWindow w = new SourceViewerTest(); 
     63    w.setBlockOnOpen( true ); 
     64    w.open(); 
     65    Display.getCurrent.dispose(); 
     66} 
     67}}} 
     68 
     69 
     70