Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.TextLayout$StyleItem


     * Creates and initializes the text layout used to compute the size hint.
     *
     * @since 3.2
     */
    private void createTextLayout() {
        fTextLayout = new TextLayout(fBrowser.getDisplay());

        // Initialize fonts
        final String symbolicFontName = fSymbolicFontName == null ? JFaceResources.DIALOG_FONT
                : fSymbolicFontName;
        Font font = JFaceResources.getFont(symbolicFontName);
View Full Code Here


  }

  private TextLayout getSharedTextLayout(Display display) {
    if (cachedTextLayout == null) {
      int orientation = viewer.getControl().getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
      cachedTextLayout = new TextLayout(display);
      cachedTextLayout.setOrientation(orientation);
    }
    return cachedTextLayout;
  }
View Full Code Here

      return;
   
    ViewerCell cell= getViewerCell(event, element);
    boolean applyColors = useColors(event);
   
    TextLayout layout = getSharedTextLayout(event.display);
   
    int textWidthDelta = deltaOfLastMeasure = updateTextLayout(layout, cell, applyColors);

    event.width += textWidthDelta;
  }
View Full Code Here

      }
    }

    Rectangle textBounds = cell.getTextBounds();
    if (textBounds != null) {
      TextLayout textLayout= getSharedTextLayout(event.display);
      // text layout already configured in measure(Event, Object)
     
      Rectangle layoutBounds = textLayout.getBounds();
 
      int x = textBounds.x;
      int y = textBounds.y
          + Math.max(0, (textBounds.height - layoutBounds.height) / 2);
 
      textLayout.draw(gc, x, y);
    }

    if (drawFocus(event)) {
      Rectangle focusBounds = cell.getViewerRow().getBounds();
      gc.drawFocus(focusBounds.x, focusBounds.y, focusBounds.width + deltaOfLastMeasure,
View Full Code Here

            int width = 100;
            int height = 12;

            Display display = viewer.getControl().getDisplay();

            TextLayout layout = new TextLayout(display);
            String label = ((EncounterParticipant)element).getLabel();
            layout.setText(label);

            width = layout.getBounds().width;
            height = layout.getBounds().height - 1;

            // TODO: check if there are conditions, and increase the box height accordingly

            event.setBounds(new Rectangle(event.x, event.y, width, height));
        }
View Full Code Here

    int l = t.length();
    int max = l / 2;
    int min = 0;
    int mid = (max + min) / 2 - 1;
    if (mid <= 0) return t;
    TextLayout layout = new TextLayout(Display.getDefault());
    layout.setText(t);
    mid = validateOffset(layout, mid);
    while (min < mid && mid < max)
    {
      String s1 = t.substring(0, mid);
      String s2 = t.substring(validateOffset(layout, l - mid), l);
      int l1 = gc.textExtent(s1, drawFlags).x;
      int l2 = gc.textExtent(s2, drawFlags).x;
      if (l1 + w + l2 > width)
      {
        max = mid;
        mid = validateOffset(layout, (max + min) / 2);
      }
      else if (l1 + w + l2 < width)
      {
        min = mid;
        mid = validateOffset(layout, (max + min) / 2);
      }
      else
      {
        min = max;
      }
    }
    String result = mid == 0 ? t : t.substring(0, mid) + ELLIPSIS
        + t.substring(validateOffset(layout, l - mid), l);
    layout.dispose();
    return result;
  }
View Full Code Here

   * to compute the size hint.
   *
   * @since 3.2
   */
  private void createTextLayout() {
    fTextLayout= new TextLayout(fBrowser.getDisplay());
   
    // Initialize fonts
    Font font= fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName);
    fTextLayout.setFont(font);
    fTextLayout.setWidth(-1);
View Full Code Here

    Composite tableComposite = new Composite(composite, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite);
    TableColumnLayout tableColumnLayout = new TableColumnLayout();
    tableComposite.setLayout(tableColumnLayout);
    table = new Table(tableComposite, SWT.SINGLE | SWT.FULL_SELECTION);
    textLayout = new TextLayout(table.getDisplay());
    textLayout.setOrientation(getDefaultOrientation());
    Font boldFont = resourceManager.createFont(FontDescriptor.createFrom(
        table.getFont()).setStyle(SWT.BOLD));
    textLayout.setFont(table.getFont());
    textLayout.setText(QuickAccessMessages.QuickAccess_AvailableCategories);
View Full Code Here

    return (StyleRange[])item.getData(STYLED_RANGES_KEY + column);
  }

  private TableOwnerDrawSupport(Table table) {
    int orientation= table.getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
    fLayout= new TextLayout(table.getDisplay());
    fLayout.setOrientation(orientation);
  }
View Full Code Here

    return (StyleRange[])item.getData(STYLED_RANGES_KEY + column);
  }

  private TableOwnerDrawSupport(Table table) {
    int orientation= table.getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
    fLayout= new TextLayout(table.getDisplay());
    fLayout.setOrientation(orientation);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.TextLayout$StyleItem

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.