/** * Returns the receiver's text, which is the string that the * is used as the <em>title</em>. If the text has not previously * been set, returns an empty string. * * @return the text * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText() { checkWidget(); return text; }
/** * Returns the receiver's text, which is the string that the * is used as the <em>title</em>. If the text has not previously * been set, returns an empty string. * * @return the text * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText () { checkWidget(); return text; }
/** * Returns the receiver's text, which is the string that the * is used as the <em>title</em>. If the text has not previously * been set, returns an empty string. * * @return the text * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText () { checkWidget (); return text; }
/** * Returns the receiver's text, which is the string that the * is used as the <em>title</em>. If the text has not previously * been set, returns an empty string. * * @return the text * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText () { checkWidget(); return text; }
/** * Returns the receiver's text, which is the string that the * is used as the <em>title</em>. If the text has not previously * been set, returns an empty string. * * @return the text * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText () { checkWidget(); return text; }
/** * Returns the receiver's text, which is the string that the * is used as the <em>title</em>. If the text has not previously * been set, returns an empty string. * * @return the text * * @exception SWTException <ul> * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ public String getText () { checkWidget (); return text; } boolean isTransparent() {
public Rectangle getClientArea () { checkWidget(); NSRect rect = contentView.bounds(); int width = Math.max (0, (int) rect.width - hMargin * 2); int height = Math.max (0, (int) rect.height - vMargin * 2); return new Rectangle((int)(rect.x) + hMargin, (int)(rect.y) + vMargin, width, height); }
checkWidget(); if( text == null ) { SWT.error( SWT.ERROR_NULL_ARGUMENT );
@Override public Rectangle getClientArea() { checkWidget(); Rectangle bounds = getBounds(); BoxDimensions trimmings = getThemeAdapter().getTrimmingSize( this ); int trimmingsWidth = trimmings.left + trimmings.right; int trimmingsHeight = trimmings.top + trimmings.bottom; BoxDimensions border = getBorder(); int borderWidth = border.left + border.right; int borderHeight = border.top + border.bottom; int width = Math.max( 0, bounds.width - trimmingsWidth - borderWidth ); int height = Math.max( 0, bounds.height - trimmingsHeight - borderHeight ); return new Rectangle( trimmings.left, trimmings.top, width, height ); }
@Override public Point computeSize( int wHint, int hHint, boolean changed ) { checkWidget(); Point result = super.computeSize( wHint, hHint, changed ); int length = text.length(); if( length != 0 ) { Font font = getFont(); Point stringExtent = TextSizeUtil.stringExtent( font, text ); BoxDimensions headTrimmings = getThemeAdapter().getHeaderTrimmingSize( this ); int headerWidth = stringExtent.x + headTrimmings.left + headTrimmings.right; result.x = Math.max( result.x, headerWidth ); } return result; }
public Rectangle computeTrim (int x, int y, int width, int height) { checkWidget (); NSBox widget = (NSBox)view; NSRect newRect = new NSRect(); newRect.x = x; newRect.y = y; newRect.width = width; newRect.height = height; NSRect oldRect = widget.frame(); ignoreResize = true; widget.setFrameFromContentFrame(newRect); newRect = widget.frame(); widget.setFrame(oldRect); ignoreResize = false; x = (int) Math.ceil(newRect.x) - hMargin; y = (int) Math.ceil(newRect.y) - vMargin; width = (int) Math.ceil(newRect.width) + (hMargin * 2); height = (int) Math.ceil(newRect.height) + (vMargin * 2); return super.computeTrim(x, y, width, height); }
@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget(); forceResize (); GtkAllocation allocation = new GtkAllocation(); OS.gtk_widget_get_allocation (clientHandle, allocation); int clientX = allocation.x; int clientY = allocation.y; x -= clientX; y -= clientY; width += clientX + clientX; height += clientX + clientY; return new Rectangle (x, y, width, height); }
@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget(); forceResize (); GtkAllocation allocation = new GtkAllocation(); OS.gtk_widget_get_allocation (clientHandle, allocation); int clientX = allocation.x; int clientY = allocation.y; x -= clientX; y -= clientY; width += clientX + clientX; height += clientX + clientY; return new Rectangle (x, y, width, height); }
@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget(); forceResize (); GtkAllocation allocation = new GtkAllocation(); OS.gtk_widget_get_allocation (clientHandle, allocation); int clientX = allocation.x; int clientY = allocation.y; x -= clientX; y -= clientY; width += clientX + clientX; height += clientX + clientY; return new Rectangle (x, y, width, height); }
@Override public void setFont (Font font) { checkWidget (); Rectangle oldRect = getClientAreaInPixels (); super.setFont (font); Rectangle newRect = getClientAreaInPixels (); if (!oldRect.equals (newRect)) sendResize (); }
checkWidget(); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); text = string;
@Override Rectangle getClientAreaInPixels () { checkWidget (); forceResize (); RECT rect = new RECT (); OS.GetClientRect (handle, rect); int /*long*/ newFont, oldFont = 0; int /*long*/ hDC = OS.GetDC (handle); newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); if (newFont != 0) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); int offsetY = OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed () ? 0 : 1; int x = CLIENT_INSET, y = tm.tmHeight + offsetY; int width = Math.max (0, rect.right - CLIENT_INSET * 2); int height = Math.max (0, rect.bottom - y - CLIENT_INSET); return new Rectangle (x, y, width, height); }
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) { checkWidget (); Point size = super.computeSizeInPixels (wHint, hHint, changed); int length = text.length (); if (length != 0) { String string = fixText (false); /* * If the group has text, and the text is wider than the * client area, pad the width so the text is not clipped. */ TCHAR buffer = new TCHAR (getCodePage (), string == null ? text : string, true); int /*long*/ newFont, oldFont = 0; int /*long*/ hDC = OS.GetDC (handle); newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); RECT rect = new RECT (); int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE; OS.DrawText (hDC, buffer, -1, rect, flags); if (newFont != 0) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); int offsetY = OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed () ? 0 : 1; size.x = Math.max (size.x, rect.right - rect.left + CLIENT_INSET * 6 + offsetY); } return size; }
checkWidget (); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); text = string;
@Override Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget (); Rectangle trim = super.computeTrimInPixels (x, y, width, height); int /*long*/ newFont, oldFont = 0; int /*long*/ hDC = OS.GetDC (handle); newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); if (newFont != 0) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); int offsetY = OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed () ? 0 : 1; trim.x -= CLIENT_INSET; trim.y -= tm.tmHeight + offsetY; trim.width += CLIENT_INSET * 2; trim.height += tm.tmHeight + CLIENT_INSET + offsetY; return trim; }