diff dwtx/draw2d/Cursors.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
line wrap: on
line diff
--- a/dwtx/draw2d/Cursors.d	Sun Aug 03 03:07:30 2008 +0200
+++ b/dwtx/draw2d/Cursors.d	Sun Aug 03 17:01:51 2008 +0200
@@ -85,115 +85,230 @@
 /**
  * @see DWT#CURSOR_ARROW
  */
-public static const Cursor ARROW;
+private static Cursor ARROW_;
+public static Cursor ARROW(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return ARROW_;
+}
+
 /**
  * @see DWT#CURSOR_SIZEN
  */
-public static const Cursor SIZEN;
+private static Cursor SIZEN_;
+public static Cursor SIZEN(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZEN_;
+}
+
 /**
  * @see DWT#CURSOR_SIZENE
  */
-public static const Cursor SIZENE;
+private static Cursor SIZENE_;
+public static Cursor SIZENE(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZENE_;
+}
+
 /**
  * @see DWT#CURSOR_SIZEE
  */
-public static const Cursor SIZEE;
+private static Cursor SIZEE_;
+public static Cursor SIZEE(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZEE_;
+}
+
 /**
  * @see DWT#CURSOR_SIZESE
  */
-public static const Cursor SIZESE;
+private static Cursor SIZESE_;
+public static Cursor SIZESE(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZESE_;
+}
+
 /**
  * @see DWT#CURSOR_SIZES
  */
-public static const Cursor SIZES;
+private static Cursor SIZES_;
+public static Cursor SIZES(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZES_;
+}
+
 /**
  * @see DWT#CURSOR_SIZESW
  */
-public static const Cursor SIZESW;
+private static Cursor SIZESW_;
+public static Cursor SIZESW(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZESW_;
+}
+
 /**
  * @see DWT#CURSOR_SIZEW
  */
-public static const Cursor SIZEW;
+private static Cursor SIZEW_;
+public static Cursor SIZEW(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZEW_;
+}
+
 /**
  * @see DWT#CURSOR_SIZENW
  */
-public static const Cursor SIZENW;
+private static Cursor SIZENW_;
+public static Cursor SIZENW(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZENW_;
+}
+
 /**
  * @see DWT#CURSOR_APPSTARTING
  */
-public static const Cursor APPSTARTING;
+private static Cursor APPSTARTING_;
+public static Cursor APPSTARTING(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return APPSTARTING_;
+}
+
 /**
  * @see DWT#CURSOR_CROSS
  */
-public static const Cursor CROSS;
+private static Cursor CROSS_;
+public static Cursor CROSS(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return CROSS_;
+}
+
 /**
  * @see DWT#CURSOR_HAND
  */
-public static const Cursor HAND;
+private static Cursor HAND_;
+public static Cursor HAND(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return HAND_;
+}
+
 /**
  * @see DWT#CURSOR_HELP
  */
-public static const Cursor HELP;
+private static Cursor HELP_;
+public static Cursor HELP(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return HELP_;
+}
+
 /**
  * @see DWT#CURSOR_IBEAM
  */
-public static const Cursor IBEAM;
+private static Cursor IBEAM_;
+public static Cursor IBEAM(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return IBEAM_;
+}
+
 /**
  * @see DWT#CURSOR_NO
  */
-public static const Cursor NO;
+private static Cursor NO_;
+public static Cursor NO(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return NO_;
+}
+
 /**
  * @see DWT#CURSOR_SIZEALL
  */
-public static const Cursor SIZEALL;
+private static Cursor SIZEALL_;
+public static Cursor SIZEALL(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZEALL_;
+}
+
 /**
  * @see DWT#CURSOR_SIZENESW
  */
-public static const Cursor SIZENESW;
+private static Cursor SIZENESW_;
+public static Cursor SIZENESW(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZENESW_;
+}
+
 /**
  * @see DWT#CURSOR_SIZENWSE
  */
-public static const Cursor SIZENWSE;
+private static Cursor SIZENWSE_;
+public static Cursor SIZENWSE(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZENWSE_;
+}
+
 /**
  * @see DWT#CURSOR_SIZEWE
  */
-public static const Cursor SIZEWE;
+private static Cursor SIZEWE_;
+public static Cursor SIZEWE(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZEWE_;
+}
+
 /**
  * @see DWT#CURSOR_SIZENS
  */
-public static const Cursor SIZENS;
+private static Cursor SIZENS_;
+public static Cursor SIZENS(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return SIZENS_;
+}
+
 /**
  * @see DWT#CURSOR_UPARROW
  */
-public static const Cursor UPARROW;
+private static Cursor UPARROW_;
+public static Cursor UPARROW(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return UPARROW_;
+}
+
 /**
  * @see DWT#CURSOR_WAIT
  */
-public static const Cursor WAIT;
+private static Cursor WAIT_;
+public static Cursor WAIT(){
+    if( !initStaticCtor_done ) initStaticCtor();
+    return WAIT_;
+}
 
-static this() {
-    ARROW   = new Cursor(null, DWT.CURSOR_ARROW);
-    SIZEN   = new Cursor(null, DWT.CURSOR_SIZEN);
-    SIZENE  = new Cursor(null, DWT.CURSOR_SIZENE);
-    SIZEE   = new Cursor(null, DWT.CURSOR_SIZEE);
-    SIZESE  = new Cursor(null, DWT.CURSOR_SIZESE);
-    SIZES   = new Cursor(null, DWT.CURSOR_SIZES);
-    SIZESW  = new Cursor(null, DWT.CURSOR_SIZESW);
-    SIZEW   = new Cursor(null, DWT.CURSOR_SIZEW);
-    SIZENW  = new Cursor(null, DWT.CURSOR_SIZENW);
-    SIZENS  = new Cursor(null, DWT.CURSOR_SIZENS);
-    SIZEWE  = new Cursor(null, DWT.CURSOR_SIZEWE);
-    APPSTARTING = new Cursor(null, DWT.CURSOR_APPSTARTING);
-    CROSS   = new Cursor(null, DWT.CURSOR_CROSS);
-    HAND    = new Cursor(null, DWT.CURSOR_HAND);
-    HELP    = new Cursor(null, DWT.CURSOR_HELP);
-    IBEAM   = new Cursor(null, DWT.CURSOR_IBEAM);
-    NO      = new Cursor(null, DWT.CURSOR_NO);
-    SIZEALL = new Cursor(null, DWT.CURSOR_SIZEALL);
-    SIZENESW = new Cursor(null, DWT.CURSOR_SIZENESW);
-    SIZENWSE = new Cursor(null, DWT.CURSOR_SIZENWSE);
-    UPARROW  = new Cursor(null, DWT.CURSOR_UPARROW);
-    WAIT     = new Cursor(null, DWT.CURSOR_WAIT);
+private static bool initStaticCtor_done = false;
+private static void initStaticCtor() {
+    synchronized(Cursor.classinfo){
+        if(!initStaticCtor_done){
+            ARROW_        = new Cursor(null, DWT.CURSOR_ARROW);
+            SIZEN_        = new Cursor(null, DWT.CURSOR_SIZEN);
+            SIZENE_       = new Cursor(null, DWT.CURSOR_SIZENE);
+            SIZEE_        = new Cursor(null, DWT.CURSOR_SIZEE);
+            SIZESE_       = new Cursor(null, DWT.CURSOR_SIZESE);
+            SIZES_        = new Cursor(null, DWT.CURSOR_SIZES);
+            SIZESW_       = new Cursor(null, DWT.CURSOR_SIZESW);
+            SIZEW_        = new Cursor(null, DWT.CURSOR_SIZEW);
+            SIZENW_       = new Cursor(null, DWT.CURSOR_SIZENW);
+            SIZENS_       = new Cursor(null, DWT.CURSOR_SIZENS);
+            SIZEWE_       = new Cursor(null, DWT.CURSOR_SIZEWE);
+            APPSTARTING_  = new Cursor(null, DWT.CURSOR_APPSTARTING);
+            CROSS_        = new Cursor(null, DWT.CURSOR_CROSS);
+            HAND_         = new Cursor(null, DWT.CURSOR_HAND);
+            HELP_         = new Cursor(null, DWT.CURSOR_HELP);
+            IBEAM_        = new Cursor(null, DWT.CURSOR_IBEAM);
+            NO_           = new Cursor(null, DWT.CURSOR_NO);
+            SIZEALL_      = new Cursor(null, DWT.CURSOR_SIZEALL);
+            SIZENESW_     = new Cursor(null, DWT.CURSOR_SIZENESW);
+            SIZENWSE_     = new Cursor(null, DWT.CURSOR_SIZENWSE);
+            UPARROW_      = new Cursor(null, DWT.CURSOR_UPARROW);
+            WAIT_         = new Cursor(null, DWT.CURSOR_WAIT);
+            initStaticCtor_done = true;
+        }
+    }
 }
 
 }