Package org.eclipse.swt.graphics

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


   
    private void paintTextOverlay( final GC gc,
                                   final TextStyle style,
                                   final String text )
    {
        final TextLayout layout = new TextLayout( this.display );
        layout.setText( text );
        layout.setStyle( style, 0, text.length() - 1 );
       
        final Rectangle clientArea = this.textControl.getClientArea();
        gc.fillRectangle( clientArea );

        layout.setWidth( clientArea.width - TEXT_OFFSET.x * 2 );
        layout.draw( gc, TEXT_OFFSET.x, TEXT_OFFSET.y );
    }
View Full Code Here


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

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

                    final Rectangle bounds = item.getBounds( i );
                    final Point offset = ( i == 0 ? IMAGE_OFFSET_PRIMARY_COLUMN : IMAGE_OFFSET_SECONDARY_COLUMN );
                    event.gc.drawImage( image, bounds.x + offset.x, bounds.y + offset.y );
                }
               
                final TextLayout layout = new TextLayout( display );
                layout.setText( text );
                layout.setStyle( style, 0, text.length() - 1 );
               
                final Point offset = ( i == 0 ? TEXT_OFFSET_PRIMARY_COLUMN : TEXT_OFFSET_SECONDARY_COLUMN );
               
                final Rectangle clientArea = item.getTextBounds( i );
                layout.setWidth( clientArea.width );
                layout.draw( event.gc, clientArea.x + offset.x, clientArea.y + offset.y );
            }
        }
    }
View Full Code Here

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

        String s = text;
        int p = s.indexOf(POINT);
        if (p >= 0)
            s = s.substring(0, p);

        TextLayout textLayout = getSharedTextLayout(event.display);
        textLayout.setText(s + ",000"); //$NON-NLS-1$

        return textLayout.getBounds();
    }
View Full Code Here

        }

        String text = format.format(value / Values.Share.divider());
        Rectangle size = getSize(event, text);

        TextLayout textLayout = getSharedTextLayout(event.display);
        textLayout.setText(text);

        Rectangle layoutBounds = textLayout.getBounds();
        int x = event.x + tableItem.width - Math.min(size.width, tableItem.width);
        int y = tableItem.y + Math.max(0, (tableItem.height - layoutBounds.height) / 2);

        textLayout.draw(event.gc, x, y);

        if (oldForeground != null)
            event.gc.setForeground(oldForeground);
    }
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.