mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Fine tune command input field control positioning. Added a small margin after the input field.
This commit is contained in:
parent
c672c4e328
commit
d79b101de5
1 changed files with 11 additions and 3 deletions
|
@ -30,6 +30,7 @@ import org.eclipse.swt.events.KeyListener;
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
|
@ -117,6 +118,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
||||||
*/
|
*/
|
||||||
private Text fInputField;
|
private Text fInputField;
|
||||||
private Sash fSash;
|
private Sash fSash;
|
||||||
|
private Composite fPanel;
|
||||||
public CommandInputFieldWithHistory(int maxHistorySize) {
|
public CommandInputFieldWithHistory(int maxHistorySize) {
|
||||||
fMaxSize=maxHistorySize;
|
fMaxSize=maxHistorySize;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +235,7 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
||||||
Rectangle containerRect = parent.getClientArea ();
|
Rectangle containerRect = parent.getClientArea ();
|
||||||
|
|
||||||
int h=fInputField.getLineHeight();
|
int h=fInputField.getLineHeight();
|
||||||
// make sure the input filed hight is a multiple of the line height
|
// make sure the input filed height is a multiple of the line height
|
||||||
gdata.heightHint = Math.max(((containerRect.height-e.y-sashRect.height)/h)*h,h);
|
gdata.heightHint = Math.max(((containerRect.height-e.y-sashRect.height)/h)*h,h);
|
||||||
// do not show less then one line
|
// do not show less then one line
|
||||||
e.y=Math.min(e.y,containerRect.height-h);
|
e.y=Math.min(e.y,containerRect.height-h);
|
||||||
|
@ -243,7 +245,12 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
||||||
parent.redraw();
|
parent.redraw();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fInputField=new Text(parent, SWT.MULTI|SWT.BORDER|SWT.WRAP|SWT.V_SCROLL);
|
fPanel = new Composite(parent, SWT.NONE);
|
||||||
|
GridLayout layout = new GridLayout();
|
||||||
|
layout.marginWidth = 0; layout.marginHeight = 0; layout.marginTop = 0; layout.marginBottom = 2;
|
||||||
|
fPanel.setLayout(layout);
|
||||||
|
fPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
|
||||||
|
fInputField=new Text(fPanel, SWT.MULTI|SWT.BORDER|SWT.WRAP|SWT.V_SCROLL);
|
||||||
GridData data=new GridData(SWT.FILL, SWT.FILL, true, false);
|
GridData data=new GridData(SWT.FILL, SWT.FILL, true, false);
|
||||||
boolean installDecoration=true;
|
boolean installDecoration=true;
|
||||||
if(installDecoration) {
|
if(installDecoration) {
|
||||||
|
@ -306,8 +313,9 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
fSash.dispose();
|
fSash.dispose();
|
||||||
fSash=null;
|
fSash=null;
|
||||||
|
fPanel.dispose();
|
||||||
|
fPanel=null;
|
||||||
fInputField.dispose();
|
fInputField.dispose();
|
||||||
fInputField=null;
|
fInputField=null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue