Example usage for org.eclipse.swt.ole.win32 OleFrame OleFrame

List of usage examples for org.eclipse.swt.ole.win32 OleFrame OleFrame

Introduction

In this page you can find the example usage for org.eclipse.swt.ole.win32 OleFrame OleFrame.

Prototype

public OleFrame(Composite parent, int style) 

Source Link

Document

Create an OleFrame child widget using style bits to select a particular look or set of properties.

Usage

From source file:WordOLE.java

protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new FillLayout());

    oleFrame = new OleFrame(composite, SWT.NULL);

    if (getMenuBarManager() != null) {
        MenuItem windowMenu = new MenuItem(getMenuBarManager().getMenu(), SWT.CASCADE);
        windowMenu.setText("[Window]");

        MenuItem containerMenu = new MenuItem(getMenuBarManager().getMenu(), SWT.CASCADE);
        containerMenu.setText("[Container]");

        MenuItem fileMenu = new MenuItem(getMenuBarManager().getMenu(), SWT.CASCADE);
        fileMenu.setText("[File]");

        oleFrame.setWindowMenus(new MenuItem[] { windowMenu });
        oleFrame.setContainerMenus(new MenuItem[] { containerMenu });
        oleFrame.setFileMenus(new MenuItem[] { fileMenu });

        System.out.println("menu set");
    }//from   w  ww.ja  v  a2s .com

    clientSite = new OleClientSite(oleFrame, SWT.NULL, new File("test.doc"));
    // clientSite = new OleClientSite(oleFrame, SWT.NONE,
    // "Word.Document.8");

    //    clientSite = new OleControlSite(oleFrame, SWT.NONE,
    //    "Word.Document.8");

    System.out.println(clientSite.getProgramID() + ", " + clientSite);
    clientSite.doVerb(OLE.OLEIVERB_SHOW);

    return composite;
}

From source file:org.eclipse.swt.examples.ole.win32.OleBrowserView.java

/**
 * Creates the Web browser OleFrame.// ww  w  .j  ava2  s.c o  m
 */
private void createBrowserFrame() {
    // Every control must have an associated OleFrame:
    webFrame = new OleFrame(displayArea, SWT.NONE);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    gridData.horizontalSpan = 3;
    webFrame.setLayoutData(gridData);
}

From source file:org.eclipse.swt.examples.ole.win32.OLEExample.java

public void open(Display display) {
    Shell shell = new Shell(display);
    shell.setText("OLE Example");
    shell.setLayout(new FillLayout());

    Composite parent = new Composite(shell, SWT.NONE);
    parent.setLayout(new GridLayout(4, true));

    Composite buttons = new Composite(parent, SWT.NONE);
    buttons.setLayout(new GridLayout());
    GridData gridData = new GridData(SWT.BEGINNING, SWT.FILL, false, false);
    buttons.setLayoutData(gridData);/*from  w  ww .ja  va2  s .c o  m*/

    Composite displayArea = new Composite(parent, SWT.BORDER);
    displayArea.setLayout(new FillLayout());
    displayArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));

    Button excelButton = new Button(buttons, SWT.RADIO);
    excelButton.setText("New Excel Sheet");
    excelButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        if (((Button) e.widget).getSelection())
            newClientSite("Excel.Sheet");
    }));
    Button mediaPlayerButton = new Button(buttons, SWT.RADIO);
    mediaPlayerButton.setText("New MPlayer");
    mediaPlayerButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        if (((Button) e.widget).getSelection())
            newClientSite("MPlayer");
    }));
    Button powerPointButton = new Button(buttons, SWT.RADIO);
    powerPointButton.setText("New PowerPoint Slide");
    powerPointButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        if (((Button) e.widget).getSelection())
            newClientSite("PowerPoint.Slide");
    }));
    Button wordButton = new Button(buttons, SWT.RADIO);
    wordButton.setText("New Word Document");
    wordButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        if (((Button) e.widget).getSelection())
            newClientSite("Word.Document");
    }));
    new Label(buttons, SWT.NONE);
    Button openButton = new Button(buttons, SWT.RADIO);
    openButton.setText("Open file...");
    openButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        if (((Button) e.widget).getSelection())
            fileOpen();
    }));
    new Label(buttons, SWT.NONE);
    closeButton = new Button(buttons, SWT.RADIO);
    closeButton.setText("Close file");
    closeButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
        if (((Button) e.widget).getSelection())
            disposeClient();
    }));
    closeButton.setSelection(true);

    oleFrame = new OleFrame(displayArea, SWT.NONE);
    addFileMenu(oleFrame);

    shell.setSize(800, 600);
    shell.open();

    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}