private static final int STATE_DISABLE = 3;
protected OriginalText text = null;
private int textState = STATE_NORMAL;
+ private static final int MARGIN = 5;
public TizenText(Composite parent, int style) {
super(parent, removeStyleOfContainer(style | SWT.DOUBLE_BUFFERED));
- this.setLayout(new GridLayout(1, false));
+ this.setLayout(new FormLayout());
text = new OriginalText(this, removeBorderStyle(style));
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- text.setLayoutData(gridData);
+ FormData layoutData = new FormData();
+ layoutData.top = new FormAttachment(0, MARGIN);
+ layoutData.bottom = new FormAttachment(100, -MARGIN);
+ layoutData.left = new FormAttachment(0, MARGIN);
+ layoutData.right = new FormAttachment(100, -MARGIN);
+ text.setLayoutData(layoutData);
text.setFont(TizenResourceManager.NORMAL_FONT);
addEventListener();
}
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
Point returnComputeSize = text.computeSize(wHint, hHint, changed);
+ int minHeight = (text.getFont().getFontData()[0].getHeight() * 2);
String osName = System.getProperty("os.name").toLowerCase();//$NON-NLS-1$
- if (osName.startsWith("mac")) {//$NON-NLS-1$
- returnComputeSize.y += 15;
+ if (returnComputeSize.y < minHeight) {
+ returnComputeSize.y = minHeight + MARGIN;
} else {
- returnComputeSize.y += 10;
+ if (osName.startsWith("mac")) {//$NON-NLS-1$
+ returnComputeSize.y += MARGIN;
+ }
}
+ returnComputeSize.x += MARGIN * 2;
return returnComputeSize;
}