提交 c7941652 编写于 作者: J jurgen

Image combo fix (predefined width)

Former-commit-id: 588b75a3
上级 56092c9c
......@@ -72,6 +72,7 @@ public class CImageCombo extends Composite {
private Text text;
private Table table;
private int visibleItemCount = 4;
private int widthHint = SWT.DEFAULT;
private Shell popup;
private Button arrow;
private boolean hasFocus;
......@@ -207,6 +208,11 @@ public class CImageCombo extends Composite {
//initAccessible();
}
public void setWidthHint(int widthHint)
{
this.widthHint = widthHint;
}
private void setEnabled(boolean enabled, boolean force)
{
if (force || enabled != isEnabled()) {
......@@ -260,7 +266,7 @@ public class CImageCombo extends Composite {
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
TableItem newItem = new TableItem(this.table, SWT.FILL);
TableItem newItem = new TableItem(this.table, SWT.NONE);
newItem.setText(string);
newItem.setData(data);
if (image != null) {
......@@ -403,6 +409,9 @@ public class CImageCombo extends Composite {
height = Math.max(hHint, Math.max(textSize.y, arrowSize.y) + 2 * borderWidth);
width = Math.max(wHint, Math.max(textWidth + 2 * spacer + arrowSize.x + 2 * borderWidth, listSize.x));
if (widthHint != SWT.DEFAULT) {
width = widthHint;
}
return new Point(width + 10, height);
}
......@@ -1493,4 +1502,33 @@ public class CImageCombo extends Composite {
}
}
@Override
public void layout()
{
super.layout(); //To change body of overridden methods use File | Settings | File Templates.
}
@Override
public void layout(boolean changed)
{
super.layout(changed); //To change body of overridden methods use File | Settings | File Templates.
}
@Override
public void layout(boolean changed, boolean all)
{
super.layout(changed, all); //To change body of overridden methods use File | Settings | File Templates.
}
@Override
public void layout(Control[] changed)
{
super.layout(changed); //To change body of overridden methods use File | Settings | File Templates.
}
@Override
public void layout(Control[] changed, int flags)
{
super.layout(changed, flags); //To change body of overridden methods use File | Settings | File Templates.
}
}
......@@ -723,10 +723,11 @@ public class DataSourceManagementToolbar implements DBPRegistryListener, DBPEven
connectionCombo = new CImageCombo(comboGroup, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
GridData gd = new GridData();
gd.widthHint = 120;
gd.minimumWidth = 120;
gd.widthHint = 160;
gd.minimumWidth = 160;
connectionCombo.setLayoutData(gd);
connectionCombo.setVisibleItemCount(15);
connectionCombo.setWidthHint(160);
connectionCombo.setToolTipText(CoreMessages.toolbar_datasource_selector_combo_datasource_tooltip);
connectionCombo.add(DBIcon.TREE_DATABASE.getImage(), EMPTY_SELECTION_TEXT, null);
connectionCombo.select(0);
......@@ -748,10 +749,11 @@ public class DataSourceManagementToolbar implements DBPRegistryListener, DBPEven
databaseCombo = new CImageCombo(comboGroup, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
gd = new GridData();
gd.widthHint = 120;
gd.minimumWidth = 120;
gd.widthHint = 140;
gd.minimumWidth = 140;
databaseCombo.setLayoutData(gd);
databaseCombo.setVisibleItemCount(15);
databaseCombo.setWidthHint(140);
databaseCombo.setToolTipText(CoreMessages.toolbar_datasource_selector_combo_database_tooltip);
databaseCombo.add(DBIcon.TREE_DATABASE.getImage(), EMPTY_SELECTION_TEXT, null);
databaseCombo.select(0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册