Lines 196-207
Link Here
|
196 |
return extent; |
196 |
return extent; |
197 |
} |
197 |
} |
198 |
|
198 |
|
199 |
Point computeSize (Control control, boolean flushCache) { |
199 |
Point computeSize (Control control, boolean flushCache, double totalWidthWeight, double totalHeightWeight, int containerWidth, int containerHeight) { |
200 |
int wHint = SWT.DEFAULT, hHint = SWT.DEFAULT; |
200 |
int wHint = SWT.DEFAULT, hHint = SWT.DEFAULT; |
201 |
RowData data = (RowData) control.getLayoutData (); |
201 |
RowData data = (RowData) control.getLayoutData (); |
202 |
if (data != null) { |
202 |
if (data != null) { |
203 |
wHint = data.width; |
203 |
wHint = Math.max(data.width, (data.widthWeight > 0)?(int)(totalWidthWeight/data.widthWeight*containerWidth):data.width ); |
204 |
hHint = data.height; |
204 |
hHint = Math.max(data.height, (data.heightWeight > 0)?(int)(totalHeightWeight/data.heightWeight*containerHeight):data.height); |
205 |
} |
205 |
} |
206 |
return control.computeSize (wHint, hHint, flushCache); |
206 |
return control.computeSize (wHint, hHint, flushCache); |
207 |
} |
207 |
} |
Lines 229-249
Link Here
|
229 |
Point layoutHorizontal (Composite composite, boolean move, boolean wrap, int width, boolean flushCache) { |
229 |
Point layoutHorizontal (Composite composite, boolean move, boolean wrap, int width, boolean flushCache) { |
230 |
Control [] children = composite.getChildren (); |
230 |
Control [] children = composite.getChildren (); |
231 |
int count = 0; |
231 |
int count = 0; |
|
|
232 |
int totalWidthWeight = 0; |
233 |
int totalHeightWeight = 0; |
234 |
|
232 |
for (int i=0; i<children.length; i++) { |
235 |
for (int i=0; i<children.length; i++) { |
233 |
Control control = children [i]; |
236 |
Control control = children [i]; |
234 |
RowData data = (RowData) control.getLayoutData (); |
237 |
RowData data = (RowData) control.getLayoutData (); |
235 |
if (data == null || !data.exclude) { |
238 |
if (data == null || !data.exclude) { |
236 |
children [count++] = children [i]; |
239 |
children [count++] = children [i]; |
|
|
240 |
if( data != null ) { |
241 |
totalWidthWeight += data.widthWeight; |
242 |
totalHeightWeight += data.heightWeight; |
243 |
} |
237 |
} |
244 |
} |
238 |
} |
245 |
} |
239 |
if (count == 0) { |
246 |
if (count == 0) { |
240 |
return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom); |
247 |
return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom); |
241 |
} |
248 |
} |
242 |
int childWidth = 0, childHeight = 0, maxHeight = 0; |
249 |
int childWidth = 0, childHeight = 0, maxHeight = 0; |
|
|
250 |
|
251 |
Rectangle rect = composite.getClientArea (); |
243 |
if (!pack) { |
252 |
if (!pack) { |
244 |
for (int i=0; i<count; i++) { |
253 |
for (int i=0; i<count; i++) { |
245 |
Control child = children [i]; |
254 |
Control child = children [i]; |
246 |
Point size = computeSize (child, flushCache); |
255 |
Point size = computeSize (child, flushCache,totalWidthWeight,totalHeightWeight,rect.width,rect.height); |
247 |
childWidth = Math.max (childWidth, size.x); |
256 |
childWidth = Math.max (childWidth, size.x); |
248 |
childHeight = Math.max (childHeight, size.y); |
257 |
childHeight = Math.max (childHeight, size.y); |
249 |
} |
258 |
} |
Lines 251-257
Link Here
|
251 |
} |
260 |
} |
252 |
int clientX = 0, clientY = 0; |
261 |
int clientX = 0, clientY = 0; |
253 |
if (move) { |
262 |
if (move) { |
254 |
Rectangle rect = composite.getClientArea (); |
263 |
|
255 |
clientX = rect.x; |
264 |
clientX = rect.x; |
256 |
clientY = rect.y; |
265 |
clientY = rect.y; |
257 |
} |
266 |
} |
Lines 266-272
Link Here
|
266 |
for (int i=0; i<count; i++) { |
275 |
for (int i=0; i<count; i++) { |
267 |
Control child = children [i]; |
276 |
Control child = children [i]; |
268 |
if (pack) { |
277 |
if (pack) { |
269 |
Point size = computeSize (child, flushCache); |
278 |
Point size = computeSize (child, flushCache,totalWidthWeight,totalHeightWeight,rect.width,rect.height); |
270 |
childWidth = size.x; |
279 |
childWidth = size.x; |
271 |
childHeight = size.y; |
280 |
childHeight = size.y; |
272 |
} |
281 |
} |
Lines 336-356
Link Here
|
336 |
Point layoutVertical (Composite composite, boolean move, boolean wrap, int height, boolean flushCache) { |
345 |
Point layoutVertical (Composite composite, boolean move, boolean wrap, int height, boolean flushCache) { |
337 |
Control [] children = composite.getChildren (); |
346 |
Control [] children = composite.getChildren (); |
338 |
int count = 0; |
347 |
int count = 0; |
|
|
348 |
int totalWidthWeight = 0; |
349 |
int totalHeightWeight = 0; |
350 |
|
339 |
for (int i=0; i<children.length; i++) { |
351 |
for (int i=0; i<children.length; i++) { |
340 |
Control control = children [i]; |
352 |
Control control = children [i]; |
341 |
RowData data = (RowData) control.getLayoutData (); |
353 |
RowData data = (RowData) control.getLayoutData (); |
342 |
if (data == null || !data.exclude) { |
354 |
if (data == null || !data.exclude) { |
343 |
children [count++] = children [i]; |
355 |
children [count++] = children [i]; |
|
|
356 |
if( data != null ) { |
357 |
totalWidthWeight += data.widthWeight; |
358 |
totalHeightWeight += data.heightWeight; |
359 |
} |
344 |
} |
360 |
} |
345 |
} |
361 |
} |
346 |
if (count == 0) { |
362 |
if (count == 0) { |
347 |
return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom); |
363 |
return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom); |
348 |
} |
364 |
} |
349 |
int childWidth = 0, childHeight = 0, maxWidth = 0; |
365 |
int childWidth = 0, childHeight = 0, maxWidth = 0; |
|
|
366 |
Rectangle rect = composite.getClientArea (); |
367 |
|
350 |
if (!pack) { |
368 |
if (!pack) { |
351 |
for (int i=0; i<count; i++) { |
369 |
for (int i=0; i<count; i++) { |
352 |
Control child = children [i]; |
370 |
Control child = children [i]; |
353 |
Point size = computeSize (child, flushCache); |
371 |
Point size = computeSize (child, flushCache,totalWidthWeight,totalHeightWeight,rect.width,rect.height); |
354 |
childWidth = Math.max (childWidth, size.x); |
372 |
childWidth = Math.max (childWidth, size.x); |
355 |
childHeight = Math.max (childHeight, size.y); |
373 |
childHeight = Math.max (childHeight, size.y); |
356 |
} |
374 |
} |
Lines 358-364
Link Here
|
358 |
} |
376 |
} |
359 |
int clientX = 0, clientY = 0; |
377 |
int clientX = 0, clientY = 0; |
360 |
if (move) { |
378 |
if (move) { |
361 |
Rectangle rect = composite.getClientArea (); |
379 |
|
362 |
clientX = rect.x; |
380 |
clientX = rect.x; |
363 |
clientY = rect.y; |
381 |
clientY = rect.y; |
364 |
} |
382 |
} |
Lines 373-379
Link Here
|
373 |
for (int i=0; i<count; i++) { |
391 |
for (int i=0; i<count; i++) { |
374 |
Control child = children [i]; |
392 |
Control child = children [i]; |
375 |
if (pack) { |
393 |
if (pack) { |
376 |
Point size = computeSize (child, flushCache); |
394 |
Point size = computeSize (child, flushCache,totalWidthWeight,totalHeightWeight,rect.width,rect.height); |
377 |
childWidth = size.x; |
395 |
childWidth = size.x; |
378 |
childHeight = size.y; |
396 |
childHeight = size.y; |
379 |
} |
397 |
} |