Examples of Sash


Examples of org.eclipse.swt.widgets.Sash

      return// We have a maximized control, so we don't need to worry about the sash.
     
    // Let's get the list of all sashes the sash form now has. If there is more than one then just disable the sashinfo.
    // If there is no current sash, and there is only one sash, then create the sashinfo for it.
    Control[] children = getChildren();
    Sash newSash = null;
    for (int i = 0; i < children.length; i++) {
      if (children[i] instanceof Sash)
        if (newSash == null)
          newSash = (Sash) children[i];
        else {
          // We have more than one sash, so need to disable current sash, if we have one.
          if (currentSashInfo != null)
            currentSashInfo.enabled = false;
          return// Don't go on.
       
    }
   
    if (newSash == null)
      return// We have no sashes at all.
   
    // Now we need to see if this is a new sash.
    if (currentSashInfo == null || currentSashInfo.sash == null) {
      if (currentSashInfo == null)
        currentSashInfo = new SashInfo(newSash);
      else
        currentSashInfo.sash = newSash;
      newSash.addPaintListener(new PaintListener() {
        /**
         * @see org.eclipse.swt.events.PaintListener#paintControl(PaintEvent)
         */
        public void paintControl(PaintEvent e) {
          // Need to find the index of the sash we're interested in.
         
          GC gc = e.gc;
          Color oldFg = gc.getForeground();
          Color oldBg = gc.getBackground();
         
          drawArrow(gc, currentSashInfo.sashLocs[0], currentSashInfo.cursorOver == 0)// Draw first arrow
          if (currentSashInfo.sashLocs.length > 1)
            drawArrow(gc, currentSashInfo.sashLocs[1], currentSashInfo.cursorOver == 1)// Draw second arrow         
         
          if (currentSashInfo.sashBorderLeft)
            drawSashBorder(gc, currentSashInfo.sash, true);
          if (currentSashInfo.sashBorderRight)
            drawSashBorder(gc, currentSashInfo.sash, false);
           
          gc.setForeground(oldFg);
          gc.setBackground(oldBg);
        }

      });
     
      newSash.addControlListener(new ControlListener() {
        /**
         * @see org.eclipse.swt.events.ControlAdapter#controlMoved(ControlEvent)
         */
        public void controlMoved(ControlEvent e) {
          recomputeSashInfo();
        }
       
        /**
         * @see org.eclipse.swt.events.ControlAdapter#controlResized(ControlEvent)
         */
        public void controlResized(ControlEvent e) {
          recomputeSashInfo();
        }
               

      });
     
      newSash.addDisposeListener(new DisposeListener() {
        /**
         * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(DisposeEvent)
         */
        public void widgetDisposed(DisposeEvent e) {
          // Need to clear out the widget from current.
          currentSashInfo= null;
        }
      });
     
      // This is a kludge because we can't override the set cursor hit test.
      newSash.addMouseMoveListener(new MouseMoveListener() {
        /**
         * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(MouseEvent)
         */
        public void mouseMove(MouseEvent e) {
          // See if within one of the arrows.
          int x = e.x;
          int y = e.y;
          for (int i=0; i<currentSashInfo.sashLocs.length; i++) {
            int[] locs = currentSashInfo.sashLocs[i];
            boolean vertical = getOrientation() == SWT.VERTICAL;
            int loc = vertical ? x : y;
            int locIndex = vertical ? X_INDEX : Y_INDEX;
            int sizeIndex = vertical ? WIDTH_INDEX : HEIGHT_INDEX;
            if (locs[locIndex] <= loc && loc <= locs[locIndex]+locs[sizeIndex]) {         
//              if (currentSashInfo.cursorOver == NO_ARROW) {
//                currentSashInfo.sash.setCursor(Cursors.ARROW);
//              }
              if (currentSashInfo.cursorOver != i) {
                currentSashInfo.cursorOver = i;
                currentSashInfo.sash.redraw();
                switch (locs[ARROW_TYPE_INDEX]) {
                  case UP_ARROW:
                  case DOWN_ARROW:
                    currentSashInfo.sash.setToolTipText("Restore")//$NON-NLS-1$
                    break;
                  case UP_MAX_ARROW:
                  case DOWN_MAX_ARROW:
                    currentSashInfo.sash.setToolTipText("Maximize")//$NON-NLS-1$
                    break;
                }
              }
              return;
            }
          }
          if (currentSashInfo.cursorOver != NO_ARROW) {
            currentSashInfo.sash.setCursor(null);
            currentSashInfo.cursorOver = NO_ARROW;
            currentSashInfo.sash.redraw();
            currentSashInfo.sash.setToolTipText(null);
          }
        }
       
      });
     
      // Need to know when we leave so that we can clear the cursor feedback if set.
      newSash.addMouseTrackListener(new MouseTrackAdapter() {
        /**
         * @see org.eclipse.swt.events.MouseTrackAdapter#mouseExit(MouseEvent)
         */
        public void mouseExit(MouseEvent e) {
          if (currentSashInfo.cursorOver != NO_ARROW) {
            // Undo the cursor.
            currentSashInfo.sash.setCursor(null);
            currentSashInfo.cursorOver = NO_ARROW;
            currentSashInfo.sash.redraw();
            currentSashInfo.sash.setToolTipText(null);
          }           
        }       
      });
     
      // Want to handle mouse down as a selection.
      newSash.addMouseListener(new MouseAdapter() {
        /**
         * @see org.eclipse.swt.events.MouseAdapter#mouseDown(MouseEvent)
         */
        public void mouseDown(MouseEvent e) {
          inMouseClick = true;
View Full Code Here

Examples of org.eclipse.swt.widgets.Sash

    mform.addPart(detailsPart);
    registerPages(detailsPart);
  }
 
  private void onSashPaint(Event e) {
    Sash sash = (Sash)e.widget;
    IManagedForm form = (IManagedForm)sash.getParent().getData("form"); //$NON-NLS-1$
    FormColors colors = form.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

Examples of org.eclipse.swt.widgets.Sash

    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

Examples of org.eclipse.swt.widgets.Sash

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

Examples of org.eclipse.swt.widgets.Sash

        scrollPalette((ScrollBar) event.widget);
      }
    });

    // Sash to see more of image or image data.
    sash = new Sash(shell, SWT.HORIZONTAL);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    sash.setLayoutData(gridData);
    sash.addSelectionListener(new SelectionAdapter() {
View Full Code Here

Examples of org.eclipse.swt.widgets.Sash

  void createControls(final Composite parent) {
    tabs = createTabs();
    createToolBar(parent);
    createTabList(parent);
    hSash = new Sash(parent, SWT.HORIZONTAL);
    createTabDesc(parent);
    vSash = new Sash(parent, SWT.VERTICAL);
    createCanvas(parent);
    createControlPanel(parent);

    FormData data;
    FormLayout layout = new FormLayout();
View Full Code Here

Examples of org.eclipse.swt.widgets.Sash

    /* Create the sashes */
    int style = getDefaultStyle();
    if (smoothButton.getSelection())
      style |= SWT.SMOOTH;
    vSash = new Sash(sashComp, SWT.VERTICAL | style);
    hSash = new Sash(sashComp, SWT.HORIZONTAL | style);

    /* Add the listeners */
    hSash.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        Rectangle rect = vSash.getParent().getClientArea();
View Full Code Here

Examples of org.eclipse.swt.widgets.Sash

    mform.addPart(detailsPart);
    registerPages(detailsPart);
  }
 
  private void onSashPaint(Event e) {
    Sash sash = (Sash)e.widget;
    IManagedForm form = (IManagedForm)sash.getParent().getData("form"); //$NON-NLS-1$
    FormColors colors = form.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

Examples of org.eclipse.swt.widgets.Sash

    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

Examples of org.eclipse.swt.widgets.Sash

        }
      }
    }
    private void purgeSashes() {
      for (Iterator iter=sashes.iterator(); iter.hasNext();) {
        Sash sash = (Sash)iter.next();
        if (sash.isDisposed())
          iter.remove();
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.