unknowIfGuestInDream / tlstudio

Currently includes SWT examples, and will support jface and other examples in the future
Eclipse Public License 2.0
1 stars 0 forks source link

[Feature Request] CheckBoxCellEditor #159

Closed unknowIfGuestInDream closed 3 weeks ago

unknowIfGuestInDream commented 3 weeks ago

Checklist

Describe the feature

Many CheckboxCelleditor https://github.com/OpenSoftwareSolutions/PDFReporter-Studio/blob/744a9d7ebc7873171e85bf78b626ded57d4ad7bd/com.jaspersoft.studio/src/com/jaspersoft/studio/property/descriptor/checkbox/CheckboxCellEditor.java#L23

并未创建chenkbox的实现 https://github.com/nbhusare/emf/blob/a3c96b8f23b04556f394e81aca47febe88ee64a0/plugins/org.eclipse.emf.edit.ui/src/org/eclipse/emf/edit/ui/provider/PropertyDescriptor.java#L764

https://github.com/chaupal/jp2p-ui/blob/d9dbb274dbc33867902e486d414d7d60352ab81f/Workspace/org.chaupal.jp2p.ui/src/org/chaupal/jp2p/ui/celleditors/CheckBoxCellEditor.java#L17

Additional context

No response

unknowIfGuestInDream commented 1 week ago
private Image makeShot(Control control, boolean type) {
    /* Hopefully no platform uses exactly this color because we'll make
       it transparent in the image.*/
    Color greenScreen = new Color(control.getDisplay(), 222, 223, 224);

    shell = new Shell(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            SWT.NO_TRIM | SWT.NO_BACKGROUND);

    // otherwise we have a default gray color
    shell.setBackground(greenScreen);

    Button button = new Button(shell, SWT.CHECK | SWT.NO_BACKGROUND);
    button.setBackground(greenScreen);
    button.setSelection(type);

    // otherwise an image is located in a corner
    button.setLocation(1, 1);
    Point bsize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);

    // otherwise an image is stretched by width
    bsize.x = Math.max(bsize.x - 1, bsize.y - 1);
    bsize.y = Math.max(bsize.x - 1, bsize.y - 1);
    button.setSize(bsize);

    GC gc = new GC(shell);
    Point shellSize = new Point(32, 32);
    shell.setSize(shellSize);
    shell.open();

    Image image = new Image(control.getDisplay(), bsize.x, bsize.y);
    gc.copyArea(image, 0, 0);
    gc.dispose();
    shell.close();

    ImageData imageData = image.getImageData();
    imageData.transparentPixel = imageData.palette.getPixel(greenScreen
            .getRGB());

    Image img = new Image(control.getDisplay(), imageData);
    image.dispose();

    return img;
}
unknowIfGuestInDream commented 1 week ago

Snippet061FakedNativeCellEditor