void setWidthInPixels (int width) { if (wrapWidth == width) return; freeRuns(); wrapWidth = width; setWidth(); }
void setWrapIndentInPixels (int wrapIndent) { if (this.wrapIndent == wrapIndent) return; this.wrapIndent = wrapIndent; OS.pango_layout_set_indent(layout, (indent - wrapIndent) * OS.PANGO_SCALE); if (wrapWidth != -1) setWidth(); }
void setWidthInPixels (int width) { if (wrapWidth == width) return; freeRuns(); wrapWidth = width; setWidth(); }
void setWrapIndentInPixels (int wrapIndent) { if (this.wrapIndent == wrapIndent) return; this.wrapIndent = wrapIndent; OS.pango_layout_set_indent(layout, (indent - wrapIndent) * OS.PANGO_SCALE); if (wrapWidth != -1) setWidth(); }
void setWidthInPixels (int width) { if (wrapWidth == width) return; freeRuns(); wrapWidth = width; setWidth(); }
void setWrapIndentInPixels (int wrapIndent) { if (this.wrapIndent == wrapIndent) return; this.wrapIndent = wrapIndent; OS.pango_layout_set_indent(layout, (indent - wrapIndent) * OS.PANGO_SCALE); if (wrapWidth != -1) setWidth(); }
Point getSize (int maxWidth) { int textWidth = 0, messageWidth = 0; if (layoutText != null) { layoutText.setWidth (-1); textWidth = layoutText.getBounds ().width; } if (layoutMessage != null) { layoutMessage.setWidth (-1); messageWidth = layoutMessage.getBounds ().width; } int messageTrim = 2 * INSET + 2 * BORDER + 2 * PADDING; boolean hasImage = layoutText != null && (style & SWT.BALLOON) != 0 && (style & (SWT.ICON_ERROR | SWT.ICON_INFORMATION | SWT.ICON_WARNING)) != 0; int textTrim = messageTrim + (hasImage ? IMAGE_SIZE : 0); int width = Math.min (maxWidth, Math.max (textWidth + textTrim, messageWidth + messageTrim)); int textHeight = 0, messageHeight = 0; if (layoutText != null) { layoutText.setWidth (maxWidth - textTrim); textHeight = layoutText.getBounds ().height; } if (layoutMessage != null) { layoutMessage.setWidth (maxWidth - messageTrim); messageHeight = layoutMessage.getBounds ().height; } int height = 2 * BORDER + 2 * PADDING + messageHeight; if (layoutText != null) height += Math.max (IMAGE_SIZE, textHeight) + 2 * PADDING; return new Point (width, height); }
void setIndentInPixels (int indent) { checkLayout(); if (indent < 0) return; if (this.indent == indent) return; this.indent = indent; OS.pango_layout_set_indent(layout, (indent - wrapIndent) * OS.PANGO_SCALE); if (wrapWidth != -1) setWidth(); }
void setIndentInPixels (int indent) { checkLayout(); if (indent < 0) return; if (this.indent == indent) return; this.indent = indent; OS.pango_layout_set_indent(layout, (indent - wrapIndent) * OS.PANGO_SCALE); if (wrapWidth != -1) setWidth(); }
void setIndentInPixels (int indent) { checkLayout(); if (indent < 0) return; if (this.indent == indent) return; this.indent = indent; OS.pango_layout_set_indent(layout, (indent - wrapIndent) * OS.PANGO_SCALE); if (wrapWidth != -1) setWidth(); }
@Override int setBounds(int x, int y, int width, int height, boolean move, boolean resize) { int result = super.setBounds (x, y, width,height, move, resize); if ((result & RESIZED) != 0) { layout.setWidth (DPIUtil.autoScaleDown((width > 0 ? width : -1))); redraw (); } return result; }
@Override int setBounds(int x, int y, int width, int height, boolean move, boolean resize) { int result = super.setBounds (x, y, width,height, move, resize); if ((result & RESIZED) != 0) { layout.setWidth (DPIUtil.autoScaleDown((width > 0 ? width : -1))); redraw (); } return result; }
@Override int setBounds(int x, int y, int width, int height, boolean move, boolean resize) { int result = super.setBounds (x, y, width,height, move, resize); if ((result & RESIZED) != 0) { layout.setWidth (DPIUtil.autoScaleDown((width > 0 ? width : -1))); redraw (); } return result; }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; int width, height; int layoutWidth = layout.getWidth (); //TEMPORARY CODE if (wHint == 0) { layout.setWidth (1); Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); width = 0; height = rect.height; } else { layout.setWidth (DPIUtil.autoScaleDown(wHint)); Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); width = rect.width; height = rect.height; } layout.setWidth (layoutWidth); if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; int border = getBorderWidthInPixels (); width += border * 2; height += border * 2; return new Point (width, height); }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; int width, height; int layoutWidth = layout.getWidth (); //TEMPORARY CODE if (wHint == 0) { layout.setWidth (1); Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); width = 0; height = rect.height; } else { layout.setWidth (DPIUtil.autoScaleDown(wHint)); Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); width = rect.width; height = rect.height; } layout.setWidth (layoutWidth); if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; int border = getBorderWidthInPixels (); width += border * 2; height += border * 2; return new Point (width, height); }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; int width, height; int layoutWidth = layout.getWidth (); //TEMPORARY CODE if (wHint == 0) { layout.setWidth (1); Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); width = 0; height = rect.height; } else { layout.setWidth (DPIUtil.autoScaleDown(wHint)); Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); width = rect.width; height = rect.height; } layout.setWidth (layoutWidth); if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; int border = getBorderWidthInPixels (); width += border * 2; height += border * 2; return new Point (width, height); }
@Override LRESULT WM_SIZE (int /*long*/ wParam, int /*long*/ lParam) { LRESULT result = super.WM_SIZE (wParam, lParam); RECT rect = new RECT (); OS.GetClientRect (handle, rect); layout.setWidth (DPIUtil.autoScaleDown(rect.right > 0 ? rect.right : -1)); if (!useCommonControl()) { redraw (); } return result; }
TextLayout layout = renderer.getTextLayout(lineIndex); int wrapWidth = layout.getWidth(); if (wordWrap) layout.setWidth(wHint == 0 ? 1 : wHint == SWT.DEFAULT ? SWT.DEFAULT : Math.max(1, wHint - leftMargin - rightMargin)); Rectangle rect = layout.getBounds(); height += rect.height; width = Math.max(width, rect.width); layout.setWidth(wrapWidth); renderer.disposeTextLayout(layout); if (isFixedLineHeight() && height > maxHeight) break;
/** * 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 String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName; Font font= JFaceResources.getFont(symbolicFontName); fTextLayout.setFont(font); fTextLayout.setWidth(-1); font= JFaceResources.getFontRegistry().getBold(symbolicFontName); fBoldStyle= new TextStyle(font, null, null); // Compute and set tab width fTextLayout.setText(" "); //$NON-NLS-1$ int tabWidth= fTextLayout.getBounds().width; fTextLayout.setTabs(new int[] { tabWidth }); fTextLayout.setText(""); //$NON-NLS-1$ }
/** * 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 String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName; Font font= JFaceResources.getFont(symbolicFontName); fTextLayout.setFont(font); fTextLayout.setWidth(-1); font= JFaceResources.getFontRegistry().getBold(symbolicFontName); fBoldStyle= new TextStyle(font, null, null); // Compute and set tab width fTextLayout.setText(" "); //$NON-NLS-1$ int tabWidth= fTextLayout.getBounds().width; fTextLayout.setTabs(new int[] { tabWidth }); fTextLayout.setText(""); //$NON-NLS-1$ }