Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Sash


   */
  public void layoutVertical()
  {
    Control[] c = getChildren();
    if ( c.length > 1 ) {
      final Sash sash = new Sash( this, SWT.VERTICAL );
      final int width = getBounds().width;
      FormData data = new FormData();
      data.top = new FormAttachment( 0, 0 ); // Attach to top
      data.bottom = new FormAttachment( 100, 0 ); // Attach to bottom
      data.left = new FormAttachment( location * 100 / width, 0 ); // Attach
                                                                    // halfway
                                                                    // across
      data.width = size;
      sash.setLayoutData( data );
      sash.addSelectionListener( new SelectionAdapter()
      {
        public void widgetSelected( SelectionEvent event )
        {
          // We reattach to the left edge, and we use the x value of the event
          // to determine the offset from the left
          ( (FormData)sash.getLayoutData() ).left = new FormAttachment( event.x * 100 / width, 0 );
          // Until the parent window does a layout, the sash will not be redrawn
          // in its new location.
          superLayout();
        }
      } );
View Full Code Here


   */
  public void layoutHorizontal()
  {
    Control[] c = getChildren();
    if ( c.length > 1 ) {
      final Sash sash = new Sash( this, SWT.HORIZONTAL );
      final int height = getBounds().height;
      FormData data = new FormData();
      data.left = new FormAttachment( 0, 0 ); // Attach halfway across
      data.right = new FormAttachment( 100, 0 ); // Attach to bottom
      data.top = new FormAttachment( location * 100 / height, 0 ); // Attach to
                                                                    // top
      data.width = size;
      sash.setLayoutData( data );
      sash.addSelectionListener( new SelectionAdapter()
      {
        public void widgetSelected( SelectionEvent event )
        {
          // We reattach to the left edge, and we use the x value of the event
          // to determine the offset from the left
          ( (FormData)sash.getLayoutData() ).top = new FormAttachment( event.y * 100 / height, 0 );
          // Until the parent window does a layout, the sash will not be redrawn
          // in its new location.
          superLayout();
        }
      } );
View Full Code Here

   * @return Sash
   *
   * @since 3.1
   */
  protected Sash createSash(final Composite composite, final Control rightControl) {
    final Sash sash = new Sash(composite, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    // the following listener resizes the tree control based on sash deltas.
    // If necessary, it will also grow/shrink the dialog.
    sash.addListener(SWT.Selection, new Listener() {
      /*
       * (non-Javadoc)
       *
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
        if (event.detail == SWT.DRAG) {
          return;
        }
        int shift = event.x - sash.getBounds().x;
        GridData data = (GridData) rightControl.getLayoutData();
        int newWidthHint = data.widthHint + shift;
        if (newWidthHint < 20) {
          return;
        }
View Full Code Here

      throw new UnsupportedOperationException("Trays not supported with custom layouts"); //$NON-NLS-1$
    }
    final Shell shell = getShell();
    leftSeparator = new Label(shell, SWT.SEPARATOR | SWT.VERTICAL);
    leftSeparator.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    sash = new Sash(shell, SWT.VERTICAL);
    sash.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    rightSeparator = new Label(shell, SWT.SEPARATOR | SWT.VERTICAL);
    rightSeparator.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    trayControl = tray.createContents(shell);
    Rectangle clientArea = shell.getClientArea();
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Sash

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.