use of org.eclipse.swt.layout.RowLayout in project eclipse.platform.swt by eclipse.
the class DNDExample method createDragOperations.
private void createDragOperations(Composite parent) {
parent.setLayout(new RowLayout(SWT.VERTICAL));
final Button moveButton = new Button(parent, SWT.CHECK);
moveButton.setText("DND.DROP_MOVE");
moveButton.addSelectionListener(widgetSelectedAdapter(e -> {
Button b = (Button) e.widget;
if (b.getSelection()) {
dragOperation |= DND.DROP_MOVE;
} else {
dragOperation = dragOperation & ~DND.DROP_MOVE;
if (dragOperation == 0) {
dragOperation = DND.DROP_MOVE;
moveButton.setSelection(true);
}
}
if (dragEnabled) {
createDragSource();
}
}));
Button copyButton = new Button(parent, SWT.CHECK);
copyButton.setText("DND.DROP_COPY");
copyButton.addSelectionListener(widgetSelectedAdapter(e -> {
Button b = (Button) e.widget;
if (b.getSelection()) {
dragOperation |= DND.DROP_COPY;
} else {
dragOperation = dragOperation & ~DND.DROP_COPY;
if (dragOperation == 0) {
dragOperation = DND.DROP_MOVE;
moveButton.setSelection(true);
}
}
if (dragEnabled) {
createDragSource();
}
}));
Button linkButton = new Button(parent, SWT.CHECK);
linkButton.setText("DND.DROP_LINK");
linkButton.addSelectionListener(widgetSelectedAdapter(e -> {
Button b = (Button) e.widget;
if (b.getSelection()) {
dragOperation |= DND.DROP_LINK;
} else {
dragOperation = dragOperation & ~DND.DROP_LINK;
if (dragOperation == 0) {
dragOperation = DND.DROP_MOVE;
moveButton.setSelection(true);
}
}
if (dragEnabled) {
createDragSource();
}
}));
// initialize state
moveButton.setSelection(true);
copyButton.setSelection(true);
linkButton.setSelection(true);
dragOperation |= DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
}
use of org.eclipse.swt.layout.RowLayout in project eclipse.platform.swt by eclipse.
the class DNDExample method createDropTypes.
private void createDropTypes(Composite parent) {
parent.setLayout(new RowLayout(SWT.VERTICAL));
Button textButton = new Button(parent, SWT.CHECK);
textButton.setText("Text Transfer");
textButton.addSelectionListener(widgetSelectedAdapter(e -> {
Button b = (Button) e.widget;
if (b.getSelection()) {
addDropTransfer(TextTransfer.getInstance());
} else {
removeDropTransfer(TextTransfer.getInstance());
}
}));
Button b = new Button(parent, SWT.CHECK);
b.setText("RTF Transfer");
b.addSelectionListener(widgetSelectedAdapter(e -> {
Button eb = (Button) e.widget;
if (eb.getSelection()) {
addDropTransfer(RTFTransfer.getInstance());
} else {
removeDropTransfer(RTFTransfer.getInstance());
}
}));
b = new Button(parent, SWT.CHECK);
b.setText("HTML Transfer");
b.addSelectionListener(widgetSelectedAdapter(e -> {
Button eb = (Button) e.widget;
if (eb.getSelection()) {
addDropTransfer(HTMLTransfer.getInstance());
} else {
removeDropTransfer(HTMLTransfer.getInstance());
}
}));
b = new Button(parent, SWT.CHECK);
b.setText("URL Transfer");
b.addSelectionListener(widgetSelectedAdapter(e -> {
Button eb = (Button) e.widget;
if (eb.getSelection()) {
addDropTransfer(URLTransfer.getInstance());
} else {
removeDropTransfer(URLTransfer.getInstance());
}
}));
b = new Button(parent, SWT.CHECK);
b.setText("File Transfer");
b.addSelectionListener(widgetSelectedAdapter(e -> {
Button eb = (Button) e.widget;
if (eb.getSelection()) {
addDropTransfer(FileTransfer.getInstance());
} else {
removeDropTransfer(FileTransfer.getInstance());
}
}));
// initialize state
textButton.setSelection(true);
addDropTransfer(TextTransfer.getInstance());
}
use of org.eclipse.swt.layout.RowLayout in project eclipse.platform.swt by eclipse.
the class GraphicsExample method createControlPanel.
/**
* Creates the control panel
* @param parent
*/
void createControlPanel(Composite parent) {
Group group;
tabControlPanel = group = new Group(parent, SWT.NONE);
// $NON-NLS-1$
group.setText(getResourceString("Settings"));
tabControlPanel.setLayout(new RowLayout());
}
use of org.eclipse.swt.layout.RowLayout in project eclipse.platform.swt by eclipse.
the class Bug306067_DesktopEffectShellEvent method main.
public static void main(String[] args) {
Device.DEBUG = true;
display = new Display();
shell = new Shell(display);
shell.setLayout(new RowLayout());
// create the drop down shell
dropDownShell = new Shell(shell, SWT.ON_TOP | SWT.DROP_DOWN);
dropDownShell.setLayout(new RowLayout());
dropDownShell.setVisible(false);
dropDownShell.addListener(SWT.Deactivate, event -> {
System.out.println("dropDownShell entering Deactivate event handler and will hide the dropdown shell");
hideDropDown();
});
dropDownShell.addListener(SWT.Close, event -> hideDropDown());
// create the button
button = new Button(shell, SWT.PUSH);
button.setText("Open");
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!dropDownShell.isVisible()) {
System.out.println("Open button entering widgetSelected event handler and will show the dropdown shell");
showDropDown();
}
}
});
button.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
System.out.println("Open button entering mouseDown event handler");
super.mouseDown(e);
}
@Override
public void mouseUp(MouseEvent e) {
System.out.println("Open button entering mouseUp event handler");
super.mouseUp(e);
}
});
shell.setSize(300, 300);
shell.addDisposeListener(e -> {
if (dropDownShell != null && !dropDownShell.isDisposed()) {
dropDownShell.dispose();
dropDownShell = null;
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
use of org.eclipse.swt.layout.RowLayout in project eclipse.platform.swt by eclipse.
the class Bug509514_IncorrectToDisplayLocation method main.
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
final RowLayout layout = new RowLayout(SWT.VERTICAL);
layout.fill = true;
shell.setLayout(layout);
final Combo combo = new Combo(shell, SWT.BORDER);
installPopup(combo);
final Text text = new Text(shell, SWT.BORDER);
installPopup(text);
shell.setSize(400, 300);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
Aggregations