diff dwt/custom/ScrolledCompositeLayout.d @ 41:6337764516f1

Sync dwt/custom with dwt-linux (took copy of complete folder)
author Frank Benoit <benoit@tionex.de>
date Tue, 07 Oct 2008 16:29:55 +0200
parents e831403a80a9
children
line wrap: on
line diff
--- a/dwt/custom/ScrolledCompositeLayout.d	Tue Oct 07 14:41:31 2008 +0200
+++ b/dwt/custom/ScrolledCompositeLayout.d	Tue Oct 07 16:29:55 2008 +0200
@@ -7,25 +7,35 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
-module dwt.custom;
+module dwt.custom.ScrolledCompositeLayout;
+
 
-import dwt.*;
-import dwt.graphics.*;
-import dwt.widgets.*;
+import dwt.DWT;
+import dwt.graphics.Point;
+import dwt.graphics.Rectangle;
+import dwt.widgets.Composite;
+import dwt.widgets.Control;
+import dwt.widgets.Layout;
+import dwt.widgets.ScrollBar;
+import dwt.custom.ScrolledComposite;
+
+import Math = tango.math.Math;
 
 /**
  * This class provides the layout for ScrolledComposite
- * 
+ *
  * @see ScrolledComposite
  */
 class ScrolledCompositeLayout : Layout {
-    
+
     bool inLayout = false;
     static final int DEFAULT_WIDTH  = 64;
     static final int DEFAULT_HEIGHT = 64;
-    
-protected Point computeSize(Composite composite, int wHint, int hHint, bool flushCache) {
+
+protected override Point computeSize(Composite composite, int wHint, int hHint, bool flushCache) {
     ScrolledComposite sc = cast(ScrolledComposite)composite;
     Point size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT);
     if (sc.content !is null) {
@@ -41,11 +51,11 @@
     return size;
 }
 
-protected bool flushCache(Control control) {
+protected override bool flushCache(Control control) {
     return true;
 }
 
-protected void layout(Composite composite, bool flushCache) {
+protected override void layout(Composite composite, bool flushCache) {
     if (inLayout) return;
     ScrolledComposite sc = cast(ScrolledComposite)composite;
     if (sc.content is null) return;
@@ -72,7 +82,7 @@
     }
     Rectangle hostRect = sc.getClientArea();
     if (sc.expandHorizontal) {
-        contentRect.width = Math.max(sc.minWidth, hostRect.width);  
+        contentRect.width = Math.max(sc.minWidth, hostRect.width);
     }
     if (sc.expandVertical) {
         contentRect.height = Math.max(sc.minHeight, hostRect.height);
@@ -105,7 +115,7 @@
             contentRect.y = -vSelection;
         }
     }
-    
+
     sc.content.setBounds (contentRect);
     inLayout = false;
 }