75
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2005 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.ui.forms.widgets.LayoutComposite;
|
|
14
|
|
15 import dwtx.ui.forms.widgets.TableWrapLayout;
|
|
16 import dwtx.ui.forms.widgets.ColumnLayout;
|
|
17
|
|
18 import dwt.graphics.Point;
|
|
19 import dwt.widgets.Composite;
|
|
20 import dwt.widgets.Layout;
|
|
21
|
|
22 import dwt.dwthelper.utils;
|
|
23
|
|
24 /**
|
|
25 * The class overrides default method for computing size in Composite by
|
|
26 * accepting size returned from layout managers as-is. The default code accepts
|
|
27 * width or height hint assuming it is correct. However, it is possible that
|
|
28 * the computation using the provided width hint results in a real size that is
|
|
29 * larger. This can result in wrapped text widgets being clipped, asking to
|
|
30 * render in bounds narrower than the longest word.
|
|
31 */
|
|
32 /* package */class LayoutComposite : Composite {
|
|
33 public this(Composite parent, int style) {
|
|
34 super(parent, style);
|
|
35 setMenu(parent.getMenu());
|
|
36 }
|
|
37 public Point computeSize(int wHint, int hHint, bool changed) {
|
|
38 Layout layout = getLayout();
|
|
39 if (null !is cast(TableWrapLayout)layout )
|
|
40 return (cast(TableWrapLayout) layout).computeSize(cast(Composite)this, wHint, hHint,
|
|
41 changed);
|
|
42 if (null !is cast(ColumnLayout)layout )
|
|
43 return (cast(ColumnLayout) layout).computeSize(cast(Composite)this, wHint, hHint,
|
|
44 changed);
|
|
45 return super.computeSize(wHint, hHint, changed);
|
|
46 }
|
|
47 }
|