if (!OS.IsWinCE) {
if (!OS.IsWinCE && parent.hFont == 0) { NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA (); info.cbSize = NONCLIENTMETRICS.sizeof;
int getPreferredWidth (int hTheme, int hDC) {		int width = ExpandItem.TEXT_INSET * 2 + ExpandBar.HEADER_HEIGHT;	if (image != null) {		width += ExpandItem.TEXT_INSET + imageWidth;	}	if (text.length() > 0) {		RECT rect = new RECT ();		TCHAR buffer = new TCHAR (parent.getCodePage (), text, false);					if (hTheme != 0) {			OS.GetThemeTextExtent (hTheme, hDC, OS.EBP_NORMALGROUPHEAD, 0, buffer.chars, buffer.length(), OS.DT_SINGLELINE, null, rect);					} else {			NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();			info.cbSize = NONCLIENTMETRICS.sizeof;			int hFont = 0, oldFont = 0;			if (!OS.IsWinCE) {				if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {					LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont;					hFont = OS.CreateFontIndirect (logFont);					oldFont = OS.SelectObject (hDC, hFont);				}			}			OS.DrawText (hDC, buffer, buffer.length (), rect, OS.DT_CALCRECT);			if (hFont != 0) {				OS.SelectObject (hDC, oldFont);				OS.DeleteObject (hFont);			}		}		width += (rect.right - rect.left);	}	return width;}