Mercurial > projects > dwt-addons
comparison dwtx/draw2d/CheckBox.d @ 103:2d6540440fe6
Replace static ctors with lazy init.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 03 Aug 2008 17:01:51 +0200 |
parents | 95307ad235d9 |
children |
comparison
equal
deleted
inserted
replaced
102:0de61c6f08ca | 103:2d6540440fe6 |
---|---|
31 : Toggle | 31 : Toggle |
32 { | 32 { |
33 | 33 |
34 private Label label = null; | 34 private Label label = null; |
35 | 35 |
36 static const Image | 36 private static Image |
37 UNCHECKED, | 37 UNCHECKED_, |
38 CHECKED; | 38 CHECKED_; |
39 | 39 |
40 static this(){ | 40 package static Image UNCHECKED(){ |
41 UNCHECKED = createImage( getImportData!("dwtx.draw2d.checkboxenabledoff.gif")); //$NON-NLS-1$ | 41 if( UNCHECKED_ is null ){ |
42 CHECKED = createImage( getImportData!("dwtx.draw2d.checkboxenabledon.gif")); //$NON-NLS-1$ | 42 synchronized( CheckBox.classinfo ){ |
43 if( UNCHECKED_ is null ){ | |
44 UNCHECKED_ = createImage( getImportData!("dwtx.draw2d.checkboxenabledoff.gif")); | |
45 } | |
46 } | |
47 } | |
48 assert( UNCHECKED_ ); | |
49 return UNCHECKED_; | |
50 } | |
51 package static Image CHECKED(){ | |
52 if( CHECKED_ is null ){ | |
53 synchronized( CheckBox.classinfo ){ | |
54 if( CHECKED_ is null ){ | |
55 CHECKED_ = createImage( getImportData!("dwtx.draw2d.checkboxenabledon.gif")); | |
56 } | |
57 } | |
58 } | |
59 assert( CHECKED_ ); | |
60 return CHECKED_; | |
43 } | 61 } |
44 | 62 |
45 private static Image createImage( ImportData importdata ) { | 63 private static Image createImage( ImportData importdata ) { |
46 Image image = new Image(null, new ImageData(new ByteArrayInputStream( cast(byte[]) importdata.data))); | 64 Image image = new Image(null, new ImageData(new ByteArrayInputStream( cast(byte[]) importdata.data))); |
47 return image; | 65 return image; |