Changeset 145:d4b244e1e1ae

Show
Ignore:
Timestamp:
01/22/08 19:59:19 (7 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

CustomControlExample? compiles

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dsss.conf

    r143 r145  
    100100buildflags+=-g -gc 
    101101buildflags+=-Jdwtexamples/controlexample 
     102buildflags+=-version=CONTROL_EXAMPLE_MAIN 
    102103 
     104[dwtexamples/controlexample/CustomControlExample.d] 
     105buildflags+=-L-lgtk-x11-2.0 
     106buildflags+=-L-lgdk-x11-2.0 
     107buildflags+=-L-latk-1.0 
     108buildflags+=-L-lgdk_pixbuf-2.0 
     109buildflags+=-L-lgthread-2.0 
     110buildflags+=-L-lm 
     111buildflags+=-L-lpangocairo-1.0 
     112buildflags+=-L-lfontconfig 
     113buildflags+=-L-lXtst 
     114buildflags+=-L-lXext 
     115buildflags+=-L-lXrender 
     116buildflags+=-L-lXinerama 
     117buildflags+=-L-lXi 
     118buildflags+=-L-lXrandr 
     119buildflags+=-L-lXcursor 
     120buildflags+=-L-lXcomposite 
     121buildflags+=-L-lXdamage 
     122buildflags+=-L-lX11 
     123buildflags+=-L-lXfixes 
     124buildflags+=-L-lpango-1.0 
     125buildflags+=-L-lgobject-2.0 
     126buildflags+=-L-lgmodule-2.0 
     127buildflags+=-L-ldl 
     128buildflags+=-L-lglib-2.0 
     129buildflags+=-L-lcairo 
     130buildflags+=-g -gc 
     131buildflags+=-Jdwtexamples/controlexample 
     132buildflags+=-version=CUSTOM_CONTROL_EXAMPLE_MAIN 
  • dwtexamples/controlexample/CComboTab.d

    r144 r145  
    1 /******************************************************************************* 
     1/******************************************************************************* 
    22 * Copyright (c) 2000, 2007 IBM Corporation and others. 
    33 * All rights reserved. This program and the accompanying materials 
     
    3535    Button flatButton, readOnlyButton; 
    3636 
    37     static char[] [] ListData = {ControlExample.getResourceString("ListData1_0"), 
    38                                  ControlExample.getResourceString("ListData1_1"), 
    39                                  ControlExample.getResourceString("ListData1_2"), 
    40                                  ControlExample.getResourceString("ListData1_3"), 
    41                                  ControlExample.getResourceString("ListData1_4"), 
    42                                  ControlExample.getResourceString("ListData1_5"), 
    43                                  ControlExample.getResourceString("ListData1_6"), 
    44                                  ControlExample.getResourceString("ListData1_7"), 
    45                                  ControlExample.getResourceString("ListData1_8")}; 
     37    static char[] [] ListData; 
    4638 
    4739    /** 
     
    5042    this(ControlExample instance) { 
    5143        super(instance); 
     44        if( ListData is null ){ 
     45            ListData = [ 
     46                ControlExample.getResourceString("ListData1_0"), 
     47                ControlExample.getResourceString("ListData1_1"), 
     48                ControlExample.getResourceString("ListData1_2"), 
     49                ControlExample.getResourceString("ListData1_3"), 
     50                ControlExample.getResourceString("ListData1_4"), 
     51                ControlExample.getResourceString("ListData1_5"), 
     52                ControlExample.getResourceString("ListData1_6"), 
     53                ControlExample.getResourceString("ListData1_7"), 
     54                ControlExample.getResourceString("ListData1_8")]; 
     55        } 
    5256    } 
    5357 
  • dwtexamples/controlexample/CLabelTab.d

    r144 r145  
    1 /******************************************************************************* 
     1/******************************************************************************* 
    22 * Copyright (c) 2000, 2007 IBM Corporation and others. 
    33 * All rights reserved. This program and the accompanying materials 
     
    2323import dwt.widgets.Widget; 
    2424 
     25 
     26import dwtexamples.controlexample.AlignableTab; 
     27import dwtexamples.controlexample.ControlExample; 
     28 
     29import tango.text.convert.Format; 
     30 
    2531class CLabelTab : AlignableTab { 
    2632    /* Example widgets and groups that contain them */ 
     
    3440     * Creates the Tab within a given instance of ControlExample. 
    3541     */ 
    36     CLabelTab(ControlExample instance) { 
     42    this(ControlExample instance) { 
    3743        super(instance); 
    3844    } 
     
    7480        label2.setImage (instance.images[ControlExample.ciTarget]); 
    7581        label3 = new CLabel (textLabelGroup, style); 
    76         label3.setText(ControlExample.getResourceString("Example_string") + "\n" + ControlExample.getResourceString("One_Two_Three")); 
     82        label3.setText(Format( "{}\n{}", ControlExample.getResourceString("Example_string"), ControlExample.getResourceString("One_Two_Three"))); 
    7783    } 
    7884 
     
    96102     */ 
    97103    Widget [] getExampleWidgets () { 
    98         return new Widget [] {label1, label2, label3}
     104        return [ cast(Widget) label1, label2, label3]
    99105    } 
    100106 
     
    103109     * that can be used to set/get values in the example control(s). 
    104110     */ 
    105     String[] getMethodNames() { 
    106         return new String[] {"Text", "ToolTipText"}
     111    char[][] getMethodNames() { 
     112        return ["Text", "ToolTipText"]
    107113    } 
    108114 
     
    110116     * Gets the text for the tab folder item. 
    111117     */ 
    112     String getTabText () { 
     118    char[] getTabText () { 
    113119        return "CLabel"; 
    114120    } 
  • dwtexamples/controlexample/CTabFolderTab.d

    r144 r145  
    1 /******************************************************************************* 
     1/******************************************************************************* 
    22 * Copyright (c) 2000, 2007 IBM Corporation and others. 
    33 * All rights reserved. This program and the accompanying materials 
     
    4040import dwt.widgets.Widget; 
    4141 
     42import dwtexamples.controlexample.Tab; 
     43import dwtexamples.controlexample.ControlExample; 
     44 
     45import tango.text.convert.Format; 
     46 
    4247class CTabFolderTab : Tab { 
    4348    int lastSelectedTab = 0; 
     
    5055    Button topButton, bottomButton, flatButton, closeButton; 
    5156 
    52     static String [] CTabItems1 = {ControlExample.getResourceString("CTabItem1_0"), 
    53                                   ControlExample.getResourceString("CTabItem1_1"), 
    54                                   ControlExample.getResourceString("CTabItem1_2")}; 
     57    static char[] [] CTabItems1; 
    5558 
    5659    /* Controls and resources added to the "Fonts" group */ 
    57     static final int SELECTION_FOREGROUND_COLOR = 3; 
    58     static final int SELECTION_BACKGROUND_COLOR = 4; 
    59     static final int ITEM_FONT = 5; 
     60    static const int SELECTION_FOREGROUND_COLOR = 3; 
     61    static const int SELECTION_BACKGROUND_COLOR = 4; 
     62    static const int ITEM_FONT = 5; 
    6063    Color selectionForegroundColor, selectionBackgroundColor; 
    6164    Font itemFont; 
     
    6972    this(ControlExample instance) { 
    7073        super(instance); 
     74        if( CTabItems1 is null ){ 
     75            CTabItems1 = [ 
     76                ControlExample.getResourceString("CTabItem1_0"), 
     77                ControlExample.getResourceString("CTabItem1_1"), 
     78                ControlExample.getResourceString("CTabItem1_2")]; 
     79        } 
    7180    } 
    7281 
     
    8493        item.setText(ControlExample.getResourceString ("Item_Font")); 
    8594 
    86         shell.addDisposeListener(new DisposeListener()
     95        shell.addDisposeListener(new class() DisposeListener
    8796            public void widgetDisposed(DisposeEvent event) { 
    8897                if (selectionBackgroundColor !is null) selectionBackgroundColor.dispose(); 
     
    150159        simpleTabButton.setText (ControlExample.getResourceString("Set_Simple_Tabs")); 
    151160        simpleTabButton.setSelection(true); 
    152         simpleTabButton.addSelectionListener (new SelectionAdapter ()
     161        simpleTabButton.addSelectionListener (new class() SelectionAdapter
    153162            public void widgetSelected (SelectionEvent event) { 
    154163                setSimpleTabs(); 
     
    159168        singleTabButton.setText (ControlExample.getResourceString("Set_Single_Tabs")); 
    160169        singleTabButton.setSelection(false); 
    161         singleTabButton.addSelectionListener (new SelectionAdapter ()
     170        singleTabButton.addSelectionListener (new class() SelectionAdapter
    162171            public void widgetSelected (SelectionEvent event) { 
    163172                setSingleTabs(); 
     
    168177        showMinButton.setText (ControlExample.getResourceString("Set_Min_Visible")); 
    169178        showMinButton.setSelection(false); 
    170         showMinButton.addSelectionListener (new SelectionAdapter ()
     179        showMinButton.addSelectionListener (new class() SelectionAdapter
    171180            public void widgetSelected (SelectionEvent event) { 
    172181                setMinimizeVisible(); 
     
    177186        showMaxButton.setText (ControlExample.getResourceString("Set_Max_Visible")); 
    178187        showMaxButton.setSelection(false); 
    179         showMaxButton.addSelectionListener (new SelectionAdapter ()
     188        showMaxButton.addSelectionListener (new class() SelectionAdapter
    180189            public void widgetSelected (SelectionEvent event) { 
    181190                setMaximizeVisible(); 
     
    185194        imageButton = new Button (otherGroup, DWT.CHECK); 
    186195        imageButton.setText (ControlExample.getResourceString("Set_Image")); 
    187         imageButton.addSelectionListener (new SelectionAdapter ()
     196        imageButton.addSelectionListener (new class() SelectionAdapter
    188197            public void widgetSelected (SelectionEvent event) { 
    189198                setImages(); 
     
    194203        unselectedImageButton.setText (ControlExample.getResourceString("Set_Unselected_Image_Visible")); 
    195204        unselectedImageButton.setSelection(true); 
    196         unselectedImageButton.addSelectionListener (new SelectionAdapter ()
     205        unselectedImageButton.addSelectionListener (new class() SelectionAdapter
    197206            public void widgetSelected (SelectionEvent event) { 
    198207                setUnselectedImageVisible(); 
     
    202211        unselectedCloseButton.setText (ControlExample.getResourceString("Set_Unselected_Close_Visible")); 
    203212        unselectedCloseButton.setSelection(true); 
    204         unselectedCloseButton.addSelectionListener (new SelectionAdapter ()
     213        unselectedCloseButton.addSelectionListener (new class() SelectionAdapter
    205214            public void widgetSelected (SelectionEvent event) { 
    206215                setUnselectedCloseVisible(); 
     
    241250            item.setText(CTabItems1[i]); 
    242251            Text text = new Text(tabFolder1, DWT.READ_ONLY); 
    243             text.setText(ControlExample.getResourceString("CTabItem_content") + ": " + i); 
     252            text.setText(Format( "{}: {}", ControlExample.getResourceString("CTabItem_content"), i)); 
    244253            item.setControl(text); 
    245254        } 
    246         tabFolder1.addListener(DWT.Selection, new Listener()
     255        tabFolder1.addListener(DWT.Selection, new class() Listener
    247256            public void handleEvent(Event event) { 
    248257                lastSelectedTab = tabFolder1.getSelectionIndex(); 
     
    277286     * @return an array containing custom event names 
    278287     */ 
    279     String [] getCustomEventNames () { 
    280         return new String [] {"CTabFolderEvent"}
     288    char[] [] getCustomEventNames () { 
     289        return ["CTabFolderEvent"]
    281290    } 
    282291 
     
    294303     */ 
    295304    Widget [] getExampleWidgets () { 
    296         return new Widget [] {tabFolder1}
     305        return [ cast(Widget) tabFolder1]
    297306    } 
    298307 
     
    300309     * Gets the text for the tab folder item. 
    301310     */ 
    302     String getTabText () { 
     311    char[] getTabText () { 
    303312        return "CTabFolder"; 
    304313    } 
     
    307316     * Hooks the custom listener specified by eventName. 
    308317     */ 
    309     void hookCustomListener (final String eventName) { 
     318    void hookCustomListener (char[] eventName) { 
    310319        if (eventName is "CTabFolderEvent") { 
    311             tabFolder1.addCTabFolder2Listener (new CTabFolder2Adapter () { 
     320            tabFolder1.addCTabFolder2Listener (new class(eventName) CTabFolder2Adapter { 
     321                char[] name; 
     322                this( char[] name ){ this.name = name; } 
    312323                public void close (CTabFolderEvent event) { 
    313                     log (eventName, event); 
     324                    log (name, event); 
    314325                } 
    315326            }); 
  • dwtexamples/controlexample/ControlExample.d

    r144 r145  
    1212*******************************************************************************/ 
    1313module dwtexamples.controlexample.ControlExample; 
    14  
    15 pragma( msg, "The ControlExample: still work left" ); 
    16 pragma( msg, "todo: search for //PORTING_LEFT" ); 
    17 pragma( msg, "todo: Implement Get/Set API reflection" ); 
    18 pragma( msg, "todo: DateTimeTab not implemented" ); 
    19 pragma( msg, "todo: ExpandBarTab looks strange" ); 
    20 pragma( msg, "todo: ProgressBarTab crash on vertical" ); 
    21 pragma( msg, "todo: SliderTab horizontal arrow buttons are too high" ); 
    22 pragma( msg, "please report problems" ); 
    2314 
    2415import dwt.DWT; 
     
    8172} 
    8273 
    83 void main(){ 
    84     ControlExample.main( null ); 
     74version( CONTROL_EXAMPLE_MAIN ){ 
     75    void main(){ 
     76        Stdout.formatln( "The ControlExample: still work left" ); 
     77        Stdout.formatln( "todo: search for //PORTING_LEFT" ); 
     78        Stdout.formatln( "todo: Implement Get/Set API reflection" ); 
     79        Stdout.formatln( "todo: DateTimeTab not implemented" ); 
     80        Stdout.formatln( "todo: ExpandBarTab looks strange" ); 
     81        Stdout.formatln( "todo: ProgressBarTab crash on vertical" ); 
     82        Stdout.formatln( "todo: SliderTab horizontal arrow buttons are too high" ); 
     83        Stdout.formatln( "please report problems" ); 
     84        ControlExample.main( null ); 
     85    } 
    8586} 
    8687 
  • dwtexamples/controlexample/CustomControlExample.d

    r144 r145  
    1 /******************************************************************************* 
     1/******************************************************************************* 
    22 * Copyright (c) 2000, 2006 IBM Corporation and others. 
    33 * All rights reserved. This program and the accompanying materials 
     
    1919import dwt.widgets.Shell; 
    2020 
     21import dwtexamples.controlexample.ControlExample; 
     22import dwtexamples.controlexample.CComboTab; 
     23import dwtexamples.controlexample.CLabelTab; 
     24import dwtexamples.controlexample.CTabFolderTab; 
     25import dwtexamples.controlexample.SashFormTab; 
     26import dwtexamples.controlexample.StyledTextTab; 
     27 
     28import dwtexamples.controlexample.Tab; 
     29import tango.io.Stdout; 
     30 
     31version( CUSTOM_CONTROL_EXAMPLE_MAIN ){ 
     32    void main(){ 
     33        Stdout.formatln( "The CustomControlExample: still work left" ); 
     34        Stdout.formatln( "please report problems" ); 
     35        CustomControlExample.main( null ); 
     36    } 
     37} 
    2138 
    2239public class CustomControlExample : ControlExample { 
     
    3653     */ 
    3754    Tab[] createTabs() { 
    38         return new Tab [] { 
     55        return [ cast(Tab) 
    3956            new CComboTab (this), 
    4057            new CLabelTab (this), 
    4158            new CTabFolderTab (this), 
    4259            new SashFormTab (this), 
    43             new StyledTextTab (this), 
    44         }
     60            new StyledTextTab (this) 
     61        ]
    4562    } 
    4663 
     
    4865     * Invokes as a standalone program. 
    4966     */ 
    50     public static void main(String[] args) { 
     67    public static void main(char[][] args) { 
     68        Stdout.formatln( "{}", __LINE__ ); 
    5169        Display display = new Display(); 
     70        Stdout.formatln( "{}", __LINE__ ); 
    5271        Shell shell = new Shell(display); 
     72        Stdout.formatln( "{}", __LINE__ ); 
    5373        shell.setLayout(new FillLayout()); 
     74        Stdout.formatln( "{}", __LINE__ ); 
    5475        CustomControlExample instance = new CustomControlExample(shell); 
     76        Stdout.formatln( "{}", __LINE__ ); 
    5577        shell.setText(getResourceString("custom.window.title")); 
    5678        setShellSize(instance, shell); 
  • dwtexamples/controlexample/SashFormTab.d

    r144 r145  
    1 /******************************************************************************* 
     1/******************************************************************************* 
    22 * Copyright (c) 2000, 2007 IBM Corporation and others. 
    33 * All rights reserved. This program and the accompanying materials 
     
    2525import dwt.widgets.Widget; 
    2626 
     27import dwtexamples.controlexample.Tab; 
     28import dwtexamples.controlexample.ControlExample; 
     29 
     30 
    2731class SashFormTab : Tab { 
    2832    /* Example widgets and groups that contain them */ 
     
    3539    Button horizontalButton, verticalButton, smoothButton; 
    3640 
    37     static String [] ListData0 = {ControlExample.getResourceString("ListData0_0"), //$NON-NLS-1$ 
    38                                   ControlExample.getResourceString("ListData0_1"), //$NON-NLS-1$ 
    39                                   ControlExample.getResourceString("ListData0_2"), //$NON-NLS-1$ 
    40                                   ControlExample.getResourceString("ListData0_3"), //$NON-NLS-1$ 
    41                                   ControlExample.getResourceString("ListData0_4"), //$NON-NLS-1$ 
    42                                   ControlExample.getResourceString("ListData0_5"), //$NON-NLS-1$ 
    43                                   ControlExample.getResourceString("ListData0_6"), //$NON-NLS-1$ 
    44                                   ControlExample.getResourceString("ListData0_7")}; //$NON-NLS-1$ 
    45  
    46     static String [] ListData1 = {ControlExample.getResourceString("ListData1_0"), //$NON-NLS-1$ 
    47                                   ControlExample.getResourceString("ListData1_1"), //$NON-NLS-1$ 
    48                                   ControlExample.getResourceString("ListData1_2"), //$NON-NLS-1$ 
    49                                   ControlExample.getResourceString("ListData1_3"), //$NON-NLS-1$ 
    50                                   ControlExample.getResourceString("ListData1_4"), //$NON-NLS-1$ 
    51                                   ControlExample.getResourceString("ListData1_5"), //$NON-NLS-1$ 
    52                                   ControlExample.getResourceString("ListData1_6"), //$NON-NLS-1$ 
    53                                   ControlExample.getResourceString("ListData1_7")}; //$NON-NLS-1$ 
     41    static char[] [] ListData0; 
     42    static char[] [] ListData1; 
    5443 
    5544 
     
    5948    this(ControlExample instance) { 
    6049        super(instance); 
     50        if( ListData0 is null ){ 
     51            ListData0 = [ 
     52                ControlExample.getResourceString("ListData0_0"), //$NON-NLS-1$ 
     53                ControlExample.getResourceString("ListData0_1"), //$NON-NLS-1$ 
     54                ControlExample.getResourceString("ListData0_2"), //$NON-NLS-1$ 
     55                ControlExample.getResourceString("ListData0_3"), //$NON-NLS-1$ 
     56                ControlExample.getResourceString("ListData0_4"), //$NON-NLS-1$ 
     57                ControlExample.getResourceString("ListData0_5"), //$NON-NLS-1$ 
     58                ControlExample.getResourceString("ListData0_6"), //$NON-NLS-1$ 
     59                ControlExample.getResourceString("ListData0_7")]; //$NON-NLS-1$ 
     60 
     61        } 
     62        if( ListData1 is null ){ 
     63            ListData1 = [ 
     64                ControlExample.getResourceString("ListData1_0"), //$NON-NLS-1$ 
     65                ControlExample.getResourceString("ListData1_1"), //$NON-NLS-1$ 
     66                ControlExample.getResourceString("ListData1_2"), //$NON-NLS-1$ 
     67                ControlExample.getResourceString("ListData1_3"), //$NON-NLS-1$ 
     68                ControlExample.getResourceString("ListData1_4"), //$NON-NLS-1$ 
     69                ControlExample.getResourceString("ListData1_5"), //$NON-NLS-1$ 
     70                ControlExample.getResourceString("ListData1_6"), //$NON-NLS-1$ 
     71                ControlExample.getResourceString("ListData1_7")]; //$NON-NLS-1$ 
     72        } 
    6173    } 
    6274    void createExampleGroup () { 
     
    8597        text = new Text (form, DWT.MULTI | DWT.BORDER); 
    8698        text.setText (ControlExample.getResourceString("Multi_line")); //$NON-NLS-1$ 
    87         form.setWeights(new int[] {1, 1, 1}); 
     99        form.setWeights([1, 1, 1]); 
    88100    } 
    89101    /** 
     
    109121     */ 
    110122    Widget [] getExampleWidgets () { 
    111         return new Widget [] {form}
     123        return [ cast(Widget) form]
    112124    } 
    113125 
     
    115127     * Gets the text for the tab folder item. 
    116128     */ 
    117     String getTabText () { 
     129    char[] getTabText () { 
    118130        return "SashForm"; //$NON-NLS-1$ 
    119131    } 
  • dwtexamples/controlexample/StyledTextTab.d

    r144 r145  
    1 /******************************************************************************* 
     1/******************************************************************************* 
    22 * Copyright (c) 2000, 2007 IBM Corporation and others. 
    33 * All rights reserved. This program and the accompanying materials 
     
    1414 
    1515 
    16 import java.io.IOException; 
    17 import java.io.InputStream; 
     16import dwt.dwthelper.ByteArrayInputStream; 
    1817 
    1918 
     
    4241import dwt.widgets.Widget; 
    4342 
     43import dwtexamples.controlexample.ScrollableTab; 
     44import dwtexamples.controlexample.ControlExample; 
     45import tango.core.Exception; 
     46import tango.io.Stdout; 
     47 
    4448class StyledTextTab : ScrollableTab { 
    4549    /* Example widgets and groups that contain them */ 
     
    5559 
    5660    /* Variables for saving state. */ 
    57     String text; 
     61    char[] text; 
    5862    StyleRange[] styleRanges; 
    5963 
     
    6872     * Creates a bitmap image. 
    6973     */ 
    70     Image createBitmapImage (Display display, String name) { 
    71         InputStream sourceStream = ControlExample.class.getResourceAsStream (name + ".bmp"); 
    72         InputStream maskStream = ControlExample.class.getResourceAsStream (name + "_mask.bmp"); 
     74    Image createBitmapImage (Display display, void[] sourceData, void[] maskData ) { 
     75        InputStream sourceStream = new ByteArrayInputStream ( cast(byte[])sourceData ); 
     76        InputStream maskStream = new ByteArrayInputStream ( cast(byte[])maskData ); 
    7377        ImageData source = new ImageData (sourceStream); 
    7478        ImageData mask = new ImageData (maskStream); 
     
    7882            maskStream.close (); 
    7983        } catch (IOException e) { 
    80             e.printStackTrace (); 
     84            Stderr.formatln( "Stacktrace: {}", e ); 
    8185        } 
    8286        return result; 
     
    165169 
    166170        /* Get images */ 
    167         boldImage = createBitmapImage (display, "bold"); 
    168         italicImage = createBitmapImage (display, "italic"); 
    169         redImage = createBitmapImage (display, "red"); 
    170         yellowImage = createBitmapImage (display, "yellow"); 
    171         underlineImage = createBitmapImage (display, "underline"); 
    172         strikeoutImage = createBitmapImage (display, "strikeout"); 
     171        boldImage = createBitmapImage (display, import("bold.bmp"), import("bold_mask.bmp")); 
     172        italicImage = createBitmapImage (display, import("italic.bmp"), import("italic_mask.bmp")); 
     173        redImage = createBitmapImage (display, import("red.bmp"), import("red_mask.bmp")); 
     174        yellowImage = createBitmapImage (display, import("yellow.bmp"), import("yellow_mask.bmp")); 
     175        underlineImage = createBitmapImage (display, import("underline.bmp"), import("underline_mask.bmp")); 
     176        strikeoutImage = createBitmapImage (display, import("strikeout.bmp"), import("strikeout_mask.bmp")); 
    173177 
    174178        /* Create controls to modify the StyledText */ 
     
    206210        yellowButton = new Button (styledTextStyleGroup, DWT.PUSH); 
    207211        yellowButton.setImage (yellowImage); 
    208         SelectionListener styleListener = new SelectionAdapter ()
     212        SelectionListener styleListener = new class() SelectionAdapter
    209213            public void widgetSelected (SelectionEvent e) { 
    210214                Point sel = styledText.getSelectionRange(); 
     
    214218                    StyleRange range = styledText.getStyleRangeAtOffset(i); 
    215219                    if (range !is null) { 
    216                         style = (StyleRange)range.clone(); 
     220                        style = cast(StyleRange)range.clone(); 
    217221                        style.start = i; 
    218222                        style.length = 1; 
     
    234238            } 
    235239        }; 
    236         SelectionListener colorListener = new SelectionAdapter ()
     240        SelectionListener colorListener = new class() SelectionAdapter
    237241            public void widgetSelected (SelectionEvent e) { 
    238242                Point sel = styledText.getSelectionRange(); 
     
    248252                    StyleRange range = styledText.getStyleRangeAtOffset(i); 
    249253                    if (range !is null) { 
    250                         style = (StyleRange)range.clone(); 
     254                        style = cast(StyleRange)range.clone(); 
    251255                        style.start = i; 
    252256                        style.length = 1; 
     
    267271        redButton.addSelectionListener(colorListener); 
    268272        yellowButton.addSelectionListener(colorListener); 
    269         yellowButton.addDisposeListener(new DisposeListener ()
     273        yellowButton.addDisposeListener(new class() DisposeListener
    270274            public void widgetDisposed (DisposeEvent e) { 
    271275                boldImage.dispose(); 
     
    294298         * recalculate the preferred size correctly. 
    295299         */ 
    296         tabFolderPage.addControlListener(new ControlAdapter()
     300        tabFolderPage.addControlListener(new class() ControlAdapter
    297301            public void controlResized(ControlEvent e) { 
    298302                setExampleWidgetSize (); 
     
    319323     */ 
    320324    Widget [] getExampleWidgets () { 
    321         return new Widget [] {styledText}
     325        return [ cast(Widget) styledText]
    322326    } 
    323327 
     
    326330     * that can be used to set/get values in the example control(s). 
    327331     */ 
    328     String[] getMethodNames() { 
    329         return new String[] {"CaretOffset", "DoubleClickEnabled", "Editable", "HorizontalIndex", "HorizontalPixel", "Orientation", "Selection", "Tabs", "Text", "TextLimit", "ToolTipText", "TopIndex", "TopPixel", "WordWrap"}
     332    char[][] getMethodNames() { 
     333        return ["CaretOffset", "DoubleClickEnabled", "Editable", "HorizontalIndex", "HorizontalPixel", "Orientation", "Selection", "Tabs", "Text", "TextLimit", "ToolTipText", "TopIndex", "TopPixel", "WordWrap"]
    330334    } 
    331335 
     
    334338     * Gets the text for the tab folder item. 
    335339     */ 
    336     String getTabText () { 
     340    char[] getTabText () { 
    337341        return "StyledText"; 
    338342    }