Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Sash


*/
public class SashControl {

  public static void createVerticalSash(final int limit,int init_percent, final Composite parent,final Composite composite1,final Composite composite2) {
   
    final Sash sash = new Sash (parent, SWT.VERTICAL | SWT.BORDER);
   
    FormData composite1_data = new FormData ();
    composite1_data.left = new FormAttachment (0,0);
    composite1_data.right = new FormAttachment (sash,0);
    composite1_data.top = new FormAttachment (0,0);
    composite1_data.bottom = new FormAttachment (100,0);
   
    composite1.setLayoutData(composite1_data);
   
    FormData composite2_data = new FormData ();
    composite2_data.left = new FormAttachment (sash, 0);
    composite2_data.right = new FormAttachment (100, 0);
    composite2_data.top = new FormAttachment (0, 0);
    composite2_data.bottom = new FormAttachment (100, 0);
   
    composite2.setLayoutData (composite2_data);
   
    final FormData sash_data = new FormData ();
    sash_data.left = new FormAttachment (init_percent,0);
    sash_data.top = new FormAttachment (0,0);
    sash_data.bottom = new FormAttachment (100,0);
   
    sash.setLayoutData(sash_data);
   
    sash.addListener (SWT.Selection, new Listener () {
      public void handleEvent (Event e) {
        Rectangle sashRect = sash.getBounds ();
        Rectangle shellRect = parent.getClientArea ();
        int right = shellRect.width - sashRect.width - limit;
        e.x = Math.max (Math.min (e.x, right), limit);
        if (e.x != sashRect.x)  {
          sash_data.left = new FormAttachment (0, e.x);
          //sashData_messages.right = new FormAttachment (0, e.x+4);
//          parent.layout();
//          composite1.layout();
//          composite2.layout();
        }
      }
    });
   
    sash.addListener(SWT.MouseUp, new Listener () {
      public void handleEvent (Event e) {
       
        parent.layout();
        composite1.layout();
        composite2.layout();
View Full Code Here


   
  }
 
  public static void createHorizontalSash(final int limit,int init_percent, final Composite parent,final Composite composite1,final Composite composite2) {
 
    final Sash sash = new Sash (parent, SWT.HORIZONTAL | SWT.BORDER);
   
    FormData composite1_data = new FormData ();
    composite1_data.left = new FormAttachment (0);
    composite1_data.right = new FormAttachment (100);
    composite1_data.top = new FormAttachment (0);
    composite1_data.bottom = new FormAttachment (sash);
    composite1.setLayoutData (composite1_data);
   
    FormData composite2_data = new FormData ();
    composite2_data.left = new FormAttachment (0, 0);
    composite2_data.right = new FormAttachment (100, 0);
    composite2_data.top = new FormAttachment (sash, 0);
    composite2_data.bottom = new FormAttachment (100, 0);
    composite2.setLayoutData (composite2_data);
   
    final FormData sash_data = new FormData ();
    sash_data.left = new FormAttachment (0);
    sash_data.right = new FormAttachment (100);
    sash_data.top = new FormAttachment (init_percent, 0);
    //sash_data.bottom = new FormAttachment (init_percent+2, 0);
    sash.setLayoutData (sash_data);
   
    sash.addListener (SWT.Selection, new Listener () {
      public void handleEvent (Event e) {
        Rectangle sashRect = sash.getBounds ();
        Rectangle shellRect = parent.getClientArea ();
        int right = shellRect.height - sashRect.height - limit;
        e.y = Math.max (Math.min (e.y, right), limit);
        if (e.y != sashRect.y)  {
          sash_data.top = new FormAttachment (0,e.y);
          //sash_data.bottom = new FormAttachment (0,e.y+4);
          //parent.layout();
          //composite1.layout();
          //composite2.layout();
        }
      }
    });
   
    sash.addListener(SWT.MouseUp, new Listener () {
      public void handleEvent (Event e) {
       
        parent.layout();
        composite1.layout();
        composite2.layout();
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<Sash> iter = sashes.iterator(); iter.hasNext();) {
            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;
        boolean vertical = (sash.getStyle() & SWT.VERTICAL) != 0;
        GC gc = e.gc;
        Boolean hover = (Boolean) sash.getData("hover"); //$NON-NLS-1$
        gc.setBackground(bg);
        gc.setForeground(fg);
        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

    if (focusControl != null && isContained(shell, focusControl)) {
      nonTrayFocusControl = focusControl;
    }
    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

   * @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

     *
     * @since 3.1
     */
    private void doCreateControl() {
        if (sash == null) {
          sash = new Sash(this.rootContainer.getParent(), style | SWT.SMOOTH);
          sash.addSelectionListener(selectionListener);
          sash.setEnabled(enabled);
            sash.setBounds(bounds);
        }
    }
View Full Code Here

  private final Composite frame;
  private final StyledText mainTextArea;

    private static final int limit = 20, percent = 80;
  public static void buildSplit(final Composite parent, Control c1, Control c2) {
      final Sash sash = new Sash(parent, SWT.VERTICAL);

      FormData c1Data = new FormData();
      c1Data.left = new FormAttachment(0, 0);
      c1Data.right = new FormAttachment(sash, 0);
      c1Data.top = new FormAttachment(0, 0);
      c1Data.bottom = new FormAttachment(100, 0);
      c1.setLayoutData(c1Data);

      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(Event e) {
          Rectangle sashRect = sash.getBounds();
          Rectangle shellRect = parent.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

        // Show pane fast.
        ctrl.setEnabled(true); // Add focus support.
        Composite parent = ctrl.getParent();

        boolean horizontal = Geometry.isHorizontal(side);
        sash = new Sash(parent, Geometry
                .getSwtHorizontalOrVerticalConstant(horizontal));

        sash.addSelectionListener(selectionListener);

        Rectangle clientArea = newClientComposite.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.