Lines 61-66
Link Here
|
61 |
|
61 |
|
62 |
private Rectangle lastBounds = new Rectangle(0, 0, 0, 0); |
62 |
private Rectangle lastBounds = new Rectangle(0, 0, 0, 0); |
63 |
|
63 |
|
|
|
64 |
int minWidth; |
65 |
int minHeight; |
66 |
|
64 |
private class WrapperLayout extends Layout implements ICachingLayout { |
67 |
private class WrapperLayout extends Layout implements ICachingLayout { |
65 |
protected Point computeSize(Composite composite, int wHint, int hHint, |
68 |
protected Point computeSize(Composite composite, int wHint, int hHint, |
66 |
boolean flushCache) { |
69 |
boolean flushCache) { |
Lines 71-77
Link Here
|
71 |
|
74 |
|
72 |
cache.setControl(children[0]); |
75 |
cache.setControl(children[0]); |
73 |
|
76 |
|
74 |
return cache.computeSize(wHint, hHint); |
77 |
Point size = cache.computeSize(wHint, hHint); |
|
|
78 |
|
79 |
if (size.x == 0) { |
80 |
size.x = minWidth; |
81 |
} |
82 |
if (size.y == 0) { |
83 |
size.y = minHeight; |
84 |
} |
85 |
|
86 |
return size; |
75 |
} |
87 |
} |
76 |
|
88 |
|
77 |
protected void layout(Composite composite, boolean flushCache) { |
89 |
protected void layout(Composite composite, boolean flushCache) { |
Lines 103-114
Link Here
|
103 |
* @param parent |
115 |
* @param parent |
104 |
*/ |
116 |
*/ |
105 |
public CacheWrapper(Composite parent) { |
117 |
public CacheWrapper(Composite parent) { |
106 |
proxy = new Composite(parent, SWT.NONE); |
118 |
this(parent, 0, 0); |
107 |
|
|
|
108 |
proxy.setLayout(new WrapperLayout()); |
109 |
} |
119 |
} |
110 |
|
120 |
|
111 |
/** |
121 |
/** |
|
|
122 |
* Creates a <code>CacheWrapper</code> with the given parent |
123 |
* and the given minimum sizes. This is to prevent SWT from |
124 |
* using the default width and height of 64, see bug 70049. |
125 |
* |
126 |
* @param parent |
127 |
* @param minWidth |
128 |
* @param minHeight |
129 |
*/ |
130 |
public CacheWrapper(Composite parent, int minWidth, int minHeight) { |
131 |
this.minWidth = minWidth; |
132 |
this.minHeight = minHeight; |
133 |
proxy = new Composite(parent, SWT.NONE); |
134 |
proxy.setLayout(new WrapperLayout()); |
135 |
} |
136 |
|
137 |
/** |
112 |
* Flush the cache. Call this when the child has changed in order to force |
138 |
* Flush the cache. Call this when the child has changed in order to force |
113 |
* the size to be recomputed in the next resize event. |
139 |
* the size to be recomputed in the next resize event. |
114 |
*/ |
140 |
*/ |