Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Sash


   * @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;
        Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
View Full Code Here


    super(parent, 0);
    state = State.DEFAULT;
    vertical = (style & SWT.VERTICAL) != 0;
    smooth = (style & SWT.SMOOTH) != 0;
    setLayout(new FormLayout());
    sash = new Sash(this, vertical?SWT.HORIZONTAL:SWT.VERTICAL);
    setDivider(50, 6);
    sash.addSelectionListener(this);
    sash.addDragDetectListener(this);
    sash.addMouseListener(this);
    sash.addPaintListener(this);
View Full Code Here

        final Participant p = ((ParticipantEditorInput)getEditorInput()).getParticipant();
       
        SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
       
        Composite leftSide = new Composite(sashForm, SWT.NONE);
        new Sash(sashForm, SWT.NONE);
        Composite rightSide = new Composite(sashForm, SWT.NONE);
       
        sashForm.setWeights(new int[] { 65, 35 });
       
        // create a generic focus listener that saves the object when focus is lost
View Full Code Here

        final Participant p = ((ParticipantEditorInput)getEditorInput()).getParticipant();
       
        SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
       
        Composite leftSide = new Composite(sashForm, SWT.NONE);
        new Sash(sashForm, SWT.NONE);
        Composite rightSide = new Composite(sashForm, SWT.NONE);
       
        sashForm.setWeights(new int[] { 65, 35 });
       
        // create a generic focus listener that saves the object when focus is lost
View Full Code Here

       
        SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);

        // have to create the children before setting their weights
        Composite leftSide = new Composite(sashForm, SWT.NONE);
        new Sash(sashForm, SWT.NONE);
        Composite rightSide = new Composite(sashForm, SWT.NONE);

        sashForm.setWeights(new int[] { 65, 35 });
       
        // left side of sash
View Full Code Here

    this.presenter = presenter;
    setLayout(new FillLayout());

    this.leftComposite = new Composite(this, SWT.NONE);

    final Sash sash = new Sash(this, SWT.VERTICAL);

    this.rightComposite = new Composite(this, SWT.BORDER);

    final FormLayout form = new FormLayout();
    this.setLayout(form);

    FormData leftCompositeData = new FormData();
    leftCompositeData.left = new FormAttachment(0, 0);
    leftCompositeData.right = new FormAttachment(sash, 0);
    leftCompositeData.top = new FormAttachment(0, 0);
    leftCompositeData.bottom = new FormAttachment(100, 0);
    this.leftComposite.setLayoutData(leftCompositeData);

    final int limit = 20;
    final int percent = 20;
    final FormData sashData = new FormData();
    sashData.left = new FormAttachment(percent, 0);
    sashData.top = new FormAttachment(0, 0);
    sashData.bottom = new FormAttachment(100, 0);
    sash.setLayoutData(sashData);
    sash.addListener(SWT.Selection, new Listener() {

      @Override
      public void handleEvent(final Event e) {
        Rectangle sashRect = sash.getBounds();
        Rectangle shellRect = CharacterView.this.getClientArea();
        int right = shellRect.width - sashRect.width - limit;
        e.x = Math.max(Math.min(e.x, right), limit);
        if (e.x != sashRect.x) {
          sashData.left = new FormAttachment(0, e.x);
View Full Code Here

  private void hookSashListeners() {
    purgeSashes();
    Control [] children = getChildren();
    for (int i=0; i<children.length; i++) {
      if (children[i] instanceof Sash) {
        Sash sash = (Sash)children[i];
        if (sashes.contains(sash))
          continue;
        sash.addListener(SWT.Paint, listener);
        sash.addListener(SWT.MouseEnter, listener);
        sash.addListener(SWT.MouseExit, listener);
        sashes.add(sash);
      }
    }
  }
View Full Code Here

      }
    }
  }
  private void purgeSashes() {
    for (Iterator iter=sashes.iterator(); iter.hasNext();) {
      Sash sash = (Sash)iter.next();
      if (sash.isDisposed())
        iter.remove();
    }
  }
View Full Code Here

        iter.remove();
    }
  }

   private void onSashPaint(Event e) {
        Sash sash = (Sash)e.widget;
        FormColors colors = managedForm.getToolkit().getColors();
        boolean vertical = (sash.getStyle() & SWT.VERTICAL)!=0;
        GC gc = e.gc;
        Boolean hover = (Boolean)sash.getData("hover"); //$NON-NLS-1$
        gc.setBackground(colors.getColor(IFormColors.TB_BG));
        gc.setForeground(colors.getColor(IFormColors.TB_BORDER));
        Point size = sash.getSize();
        if (vertical) {
            if (hover!=null)
                gc.fillRectangle(0, 0, size.x, size.y);
            //else
                //gc.drawLine(1, 0, 1, size.y-1);
View Full Code Here

        }
      }
      annotationsTable.setSorter(new ViewerSorter());
      annotationsTable.setInput(matchingAnnotations);

      final Sash sash = new Sash(annotationsComposite, SWT.HORIZONTAL);

      final PropertySheetPage propertySheet = new PropertySheetPage();
      propertySheet.createControl(annotationsComposite);
      propertySheet.setPropertySourceProvider(new IPropertySourceProvider() {
        public IPropertySource getPropertySource(Object object) {
          if (object instanceof Annotation) {
            IPropertySource annotationPropertySource = new AnnotationPropertySource(((Annotation) object));
            return annotationPropertySource;
          }
          return null;
        }
      });

      annotationsTable.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
          propertySheet.selectionChanged(null, event.getSelection());
        }
      });

      final FormLayout form = new FormLayout();
      annotationsComposite.setLayout(form);

      FormData tableData = new FormData();
      tableData.top = new FormAttachment(0, 0);
      tableData.bottom = new FormAttachment(sash, 2);
      tableData.left = new FormAttachment(0, 0);
      tableData.right = new FormAttachment(100, 0);
      annotationsTable.getControl().setLayoutData(tableData);

      FormData propertiesData = new FormData();
      propertiesData.top = new FormAttachment(sash, 2);
      propertiesData.left = new FormAttachment(0, 0);
      propertiesData.right = new FormAttachment(100, 0);
      propertiesData.bottom = new FormAttachment(100, 0);
      propertySheet.getControl().setLayoutData(propertiesData);

      final FormData sashData = new FormData();
      sashData.top = new FormAttachment(60, 0);
      sashData.left = new FormAttachment(0, 0);
      sashData.right = new FormAttachment(100, 0);
      sash.setLayoutData(sashData);
      sash.addListener(SWT.Selection, new org.eclipse.swt.widgets.Listener() {
        public void handleEvent(Event e) {
          sashData.top = new FormAttachment(0, e.y);
          annotationsComposite.layout();
        }
      });
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.