Mercurial > projects > dwt-mac
comparison dwt/custom/ScrolledCompositeLayout.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 380af2bdd8e5 |
children | 6337764516f1 |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
24 bool inLayout = false; | 24 bool inLayout = false; |
25 static final int DEFAULT_WIDTH = 64; | 25 static final int DEFAULT_WIDTH = 64; |
26 static final int DEFAULT_HEIGHT = 64; | 26 static final int DEFAULT_HEIGHT = 64; |
27 | 27 |
28 protected Point computeSize(Composite composite, int wHint, int hHint, bool flushCache) { | 28 protected Point computeSize(Composite composite, int wHint, int hHint, bool flushCache) { |
29 ScrolledComposite sc = (ScrolledComposite)composite; | 29 ScrolledComposite sc = cast(ScrolledComposite)composite; |
30 Point size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); | 30 Point size = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); |
31 if (sc.content !is null) { | 31 if (sc.content !is null) { |
32 Point preferredSize = sc.content.computeSize(wHint, hHint, flushCache); | 32 Point preferredSize = sc.content.computeSize(wHint, hHint, flushCache); |
33 Point currentSize = sc.content.getSize(); | 33 Point currentSize = sc.content.getSize(); |
34 size.x = sc.getExpandHorizontal() ? preferredSize.x : currentSize.x; | 34 size.x = sc.getExpandHorizontal() ? preferredSize.x : currentSize.x; |
45 return true; | 45 return true; |
46 } | 46 } |
47 | 47 |
48 protected void layout(Composite composite, bool flushCache) { | 48 protected void layout(Composite composite, bool flushCache) { |
49 if (inLayout) return; | 49 if (inLayout) return; |
50 ScrolledComposite sc = (ScrolledComposite)composite; | 50 ScrolledComposite sc = cast(ScrolledComposite)composite; |
51 if (sc.content is null) return; | 51 if (sc.content is null) return; |
52 ScrollBar hBar = sc.getHorizontalBar(); | 52 ScrollBar hBar = sc.getHorizontalBar(); |
53 ScrollBar vBar = sc.getVerticalBar(); | 53 ScrollBar vBar = sc.getVerticalBar(); |
54 if (hBar !is null) { | 54 if (hBar !is null) { |
55 if (hBar.getSize().y >= sc.getSize().y) { | 55 if (hBar.getSize().y >= sc.getSize().y) { |