diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT')
26 files changed, 275 insertions, 139 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h b/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h index ff490b6586..b5a4031a66 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h +++ b/bundles/org.eclipse.swt/Eclipse SWT/common/library/swt.h @@ -129,7 +129,7 @@ extern int IS_JNI_1_2; static int initialized = 0; \ static FARPROC var = NULL; \ if (!initialized) { \ - HMODULE hm = LoadLibraryA(name##_LIB); \ + HMODULE hm = LoadLibrary(name##_LIB); \ if (hm) var = GetProcAddress(hm, #name); \ initialized = 1; \ } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java index 108d86b828..d93d5b40ce 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java @@ -255,7 +255,7 @@ float computePoints(LOGFONT logFont, long /*int*/ hFont) { * we must subtract the internal leading, which requires a TEXTMETRIC. */ long /*int*/ oldFont = OS.SelectObject(hDC, hFont); - TEXTMETRIC lptm = new TEXTMETRIC (); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.GetTextMetrics(hDC, lptm); OS.SelectObject(hDC, oldFont); pixels = logFont.lfHeight - lptm.tmInternalLeading; @@ -337,7 +337,7 @@ long /*int*/ EnumFontFamProc (long /*int*/ lpelfe, long /*int*/ lpntme, long /*i pixels = newPixels; } LOGFONT logFont = logFonts [nFonts]; - if (logFont == null) logFont = new LOGFONT (); + if (logFont == null) logFont = OS.IsUnicode ? (LOGFONT)new LOGFONTW () : new LOGFONTA (); OS.MoveMemory (logFont, lpelfe, LOGFONT.sizeof); logFonts [nFonts] = logFont; if (logFont.lfHeight > 0) { @@ -514,11 +514,11 @@ public FontData [] getFontList (String faceName, boolean scalable) { if (lpEnumFontFamProc == 0) SWT.error (SWT.ERROR_NO_MORE_CALLBACKS); /* Initialize the instance variables */ - metrics = new TEXTMETRIC (); + metrics = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); pixels = new int[nFonts]; logFonts = new LOGFONT [nFonts]; for (int i=0; i<logFonts.length; i++) { - logFonts [i] = new LOGFONT (); + logFonts [i] = OS.IsUnicode ? (LOGFONT) new LOGFONTW () : new LOGFONTA (); } nFonts = 0; @@ -537,12 +537,16 @@ public FontData [] getFontList (String faceName, boolean scalable) { offset = nFonts; for (int i=0; i<offset; i++) { LOGFONT lf = logFonts [i]; - OS.EnumFontFamilies (hDC, lf.lfFaceName, lpEnumFontFamProc, scalable ? 1 : 0); + if (OS.IsUnicode) { + OS.EnumFontFamiliesW (hDC, ((LOGFONTW)lf).lfFaceName, lpEnumFontFamProc, scalable ? 1 : 0); + } else { + OS.EnumFontFamiliesA (hDC, ((LOGFONTA)lf).lfFaceName, lpEnumFontFamProc, scalable ? 1 : 0); + } } } else { /* Use the character encoding for the default locale */ TCHAR lpFaceName = new TCHAR (0, faceName, true); - OS.EnumFontFamilies (hDC, lpFaceName.chars, lpEnumFontFamProc, scalable ? 1 : 0); + OS.EnumFontFamilies (hDC, lpFaceName, lpEnumFontFamProc, scalable ? 1 : 0); } int logPixelsY = OS.GetDeviceCaps(hDC, OS.LOGPIXELSY); internal_dispose_GC (hDC, null); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java index dce8d59ac7..1897698841 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Font.java @@ -193,7 +193,7 @@ public boolean equals(Object object) { */ public FontData[] getFontData() { if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - LOGFONT logFont = new LOGFONT (); + LOGFONT logFont = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); OS.GetObject(handle, LOGFONT.sizeof, logFont); return new FontData[] {FontData.win32_new(logFont, device.computePoints(logFont, handle))}; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java index 06840aad1b..931d74f0ec 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java @@ -82,7 +82,7 @@ public final class FontData { * Constructs a new uninitialized font data. */ public FontData() { - data = new LOGFONT (); + data = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); // We set the charset field so that // wildcard searching will work properly // out of the box @@ -159,7 +159,7 @@ public FontData(String string) { start = end + 1; end = string.indexOf('|', start); - data = new LOGFONT (); + data = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); data.lfCharSet = (byte)OS.DEFAULT_CHARSET; setName(name); setHeight(height); @@ -173,7 +173,7 @@ public FontData(String string) { String version2 = string.substring(start, end); if (platform.equals("WINDOWS") && version2.equals("1")) { //$NON-NLS-1$//$NON-NLS-2$ - LOGFONT newData = new LOGFONT (); + LOGFONT newData = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); try { start = end + 1; end = string.indexOf('|', start); @@ -234,8 +234,15 @@ public FontData(String string) { setStyle(style); return; } - int length = Math.min(newData.lfFaceName.length - 1, string.length() - start); - string.getChars(start, start + length, newData.lfFaceName, 0); + TCHAR buffer = new TCHAR(0, string.substring(start), false); + int length = Math.min(OS.LF_FACESIZE - 1, buffer.length()); + if (OS.IsUnicode) { + char[] lfFaceName = ((LOGFONTW)newData).lfFaceName; + System.arraycopy(buffer.chars, 0, lfFaceName, 0, length); + } else { + byte[] lfFaceName = ((LOGFONTA)newData).lfFaceName; + System.arraycopy(buffer.bytes, 0, lfFaceName, 0, length); + } data = newData; } } @@ -256,7 +263,7 @@ public FontData(String string) { */ public FontData(String name, int height, int style) { if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - data = new LOGFONT (); + data = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); setName(name); setHeight(height); setStyle(style); @@ -268,7 +275,7 @@ public FontData(String name, int height, int style) { /*public*/ FontData(String name, float height, int style) { if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - data = new LOGFONT (); + data = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); setName(name); setHeight(height); setStyle(style); @@ -414,7 +421,14 @@ public String getLocale () { * @see #setName */ public String getName() { - char[] chars = data.lfFaceName; + char[] chars; + if (OS.IsUnicode) { + chars = ((LOGFONTW)data).lfFaceName; + } else { + chars = new char[OS.LF_FACESIZE]; + byte[] bytes = ((LOGFONTA)data).lfFaceName; + OS.MultiByteToWideChar (OS.CP_ACP, OS.MB_PRECOMPOSED, bytes, bytes.length, chars, chars.length); + } int index = 0; while (index < chars.length) { if (chars [index] == 0) break; @@ -557,10 +571,17 @@ public void setName(String name) { if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); /* The field lfFaceName must be NULL terminated */ - char[] lfFaceName = data.lfFaceName; - int length = Math.min(lfFaceName.length - 1, name.length()); - name.getChars (0, length, lfFaceName, 0); - for (int i = length; i < lfFaceName.length; i++) lfFaceName[i] = 0; + TCHAR buffer = new TCHAR(0, name, true); + int length = Math.min(OS.LF_FACESIZE - 1, buffer.length()); + if (OS.IsUnicode) { + char[] lfFaceName = ((LOGFONTW)data).lfFaceName; + for (int i = 0; i < lfFaceName.length; i++) lfFaceName[i] = 0; + System.arraycopy(buffer.chars, 0, lfFaceName, 0, length); + } else { + byte[] lfFaceName = ((LOGFONTA)data).lfFaceName; + for (int i = 0; i < lfFaceName.length; i++) lfFaceName[i] = 0; + System.arraycopy(buffer.bytes, 0, lfFaceName, 0, length); + } } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java index 089f7b36de..2842ef5971 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java @@ -539,13 +539,20 @@ static long /*int*/ createGdipFont(long /*int*/ hDC, long /*int*/ hFont, long /* long /*int*/ family = 0; if (!Gdip.Font_IsAvailable(font)) { Gdip.Font_delete(font); - LOGFONT logFont = new LOGFONT (); + LOGFONT logFont = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); OS.GetObject(hFont, LOGFONT.sizeof, logFont); int size = Math.abs(logFont.lfHeight); int style = Gdip.FontStyleRegular; if (logFont.lfWeight == 700) style |= Gdip.FontStyleBold; if (logFont.lfItalic != 0) style |= Gdip.FontStyleItalic; - char[] chars = logFont.lfFaceName; + char[] chars; + if (OS.IsUnicode) { + chars = ((LOGFONTW)logFont).lfFaceName; + } else { + chars = new char[OS.LF_FACESIZE]; + byte[] bytes = ((LOGFONTA)logFont).lfFaceName; + OS.MultiByteToWideChar (OS.CP_ACP, OS.MB_PRECOMPOSED, bytes, bytes.length, chars, chars.length); + } int index = 0; while (index < chars.length) { if (chars [index] == 0) break; @@ -575,9 +582,9 @@ static long /*int*/ createGdipFont(long /*int*/ hDC, long /*int*/ hFont, long /* } if (outFont != null && font != 0) { long /*int*/ hHeap = OS.GetProcessHeap(); - long /*int*/ pLogFont = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, LOGFONT.sizeof); + long /*int*/ pLogFont = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, LOGFONTW.sizeof); Gdip.Font_GetLogFontW(font, graphics, pLogFont); - outFont[0] = OS.CreateFontIndirect(pLogFont); + outFont[0] = OS.CreateFontIndirectW(pLogFont); OS.HeapFree(hHeap, 0, pLogFont); } } @@ -2115,7 +2122,7 @@ void drawStringInPixels (String string, int x, int y, boolean isTransparent) { if ((data.style & SWT.MIRRORED) != 0) { if (!isTransparent) { size = new SIZE(); - OS.GetTextExtentPoint32(handle, buffer, length, size); + OS.GetTextExtentPoint32W(handle, buffer, length, size); rect = new RECT (); rect.left = x; rect.right = x + size.cx; @@ -2126,13 +2133,13 @@ void drawStringInPixels (String string, int x, int y, boolean isTransparent) { x--; } if (OS.GetROP2(handle) != OS.R2_XORPEN) { - OS.ExtTextOut(handle, x, y, flags, rect, buffer, length, null); + OS.ExtTextOutW(handle, x, y, flags, rect, buffer, length, null); } else { int foreground = OS.GetTextColor(handle); if (isTransparent) { if (size == null) { size = new SIZE(); - OS.GetTextExtentPoint32(handle, buffer, length, size); + OS.GetTextExtentPoint32W(handle, buffer, length, size); } int width = size.cx, height = size.cy; long /*int*/ hBitmap = OS.CreateCompatibleBitmap(handle, width, height); @@ -2143,7 +2150,7 @@ void drawStringInPixels (String string, int x, int y, boolean isTransparent) { OS.SetBkMode(memDC, OS.TRANSPARENT); OS.SetTextColor(memDC, foreground); OS.SelectObject(memDC, OS.GetCurrentObject(handle, OS.OBJ_FONT)); - OS.ExtTextOut(memDC, 0, 0, 0, null, buffer, length, null); + OS.ExtTextOutW(memDC, 0, 0, 0, null, buffer, length, null); OS.BitBlt(handle, x, y, width, height, memDC, 0, 0, OS.SRCINVERT); OS.SelectObject(memDC, hOldBitmap); OS.DeleteDC(memDC); @@ -2151,7 +2158,7 @@ void drawStringInPixels (String string, int x, int y, boolean isTransparent) { } else { int background = OS.GetBkColor(handle); OS.SetTextColor(handle, foreground ^ background); - OS.ExtTextOut(handle, x, y, flags, rect, buffer, length, null); + OS.ExtTextOutW(handle, x, y, flags, rect, buffer, length, null); OS.SetTextColor(handle, foreground); } } @@ -2316,7 +2323,7 @@ void drawTextInPixels (String string, int x, int y, int flags) { boolean useGDIP (long /*int*/ hdc, char[] buffer) { short[] glyphs = new short[buffer.length]; - OS.GetGlyphIndices(hdc, buffer, buffer.length, glyphs, OS.GGI_MARK_NONEXISTING_GLYPHS); + OS.GetGlyphIndicesW(hdc, buffer, buffer.length, glyphs, OS.GGI_MARK_NONEXISTING_GLYPHS); for (int i = 0; i < glyphs.length; i++) { if (glyphs [i] == -1) { switch (buffer[i]) { @@ -2341,7 +2348,7 @@ void drawText(long /*int*/ gdipGraphics, String string, int x, int y, int flags, if (hFont == 0 && data.font != null) hFont = data.font.handle; long /*int*/ oldFont = 0; if (hFont != 0) oldFont = OS.SelectObject(hdc, hFont); - TEXTMETRIC lptm = new TEXTMETRIC(); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.GetTextMetrics(hdc, lptm); boolean gdip = useGDIP(hdc, chars); if (hFont != 0) OS.SelectObject(hdc, oldFont); @@ -2437,7 +2444,7 @@ RectF drawText(long /*int*/ gdipGraphics, char[] buffer, int start, int length, buffer = temp; } if ((data.style & SWT.MIRRORED) != 0) OS.SetLayout(hdc, OS.GetLayout(hdc) | OS.LAYOUT_RTL); - OS.GetCharacterPlacement(hdc, buffer, length, 0, result, dwFlags); + OS.GetCharacterPlacementW(hdc, buffer, length, 0, result, dwFlags); if ((data.style & SWT.MIRRORED) != 0) OS.SetLayout(hdc, OS.GetLayout(hdc) & ~OS.LAYOUT_RTL); if (hFont != 0) OS.SelectObject(hdc, oldFont); Gdip.Graphics_ReleaseHDC(gdipGraphics, hdc); @@ -3260,10 +3267,10 @@ public int getCharWidth(char ch) { } /* It wasn't a truetype font */ - TEXTMETRIC lptm = new TEXTMETRIC(); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.GetTextMetrics(handle, lptm); SIZE size = new SIZE(); - OS.GetTextExtentPoint32(handle, new char[]{ch}, 1, size); + OS.GetTextExtentPoint32W(handle, new char[]{ch}, 1, size); return size.cx - lptm.tmOverhang; } @@ -3434,7 +3441,7 @@ public Font getFont () { public FontMetrics getFontMetrics() { if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); checkGC(FONT); - TEXTMETRIC lptm = new TEXTMETRIC(); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.GetTextMetrics(handle, lptm); return FontMetrics.win32_new(lptm); } @@ -4895,13 +4902,13 @@ Point stringExtentInPixels (String string) { SIZE size = new SIZE(); if (length == 0) { // OS.GetTextExtentPoint32(handle, SPACE, SPACE.length(), size); - OS.GetTextExtentPoint32(handle, new char[]{' '}, 1, size); + OS.GetTextExtentPoint32W(handle, new char[]{' '}, 1, size); return new Point(0, size.cy); } else { // TCHAR buffer = new TCHAR (getCodePage(), string, false); char[] buffer = new char [length]; string.getChars(0, length, buffer, 0); - OS.GetTextExtentPoint32(handle, buffer, length, size); + OS.GetTextExtentPoint32W(handle, buffer, length, size); return new Point(size.cx, size.cy); } } @@ -4976,7 +4983,8 @@ Point textExtentInPixels(String string, int flags) { } if (string.length () == 0) { SIZE size = new SIZE(); - OS.GetTextExtentPoint32(handle, new char [] {' '}, 1, size); +// OS.GetTextExtentPoint32(handle, SPACE, SPACE.length(), size); + OS.GetTextExtentPoint32W(handle, new char [] {' '}, 1, size); return new Point(0, size.cy); } RECT rect = new RECT(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index e3c730ca8f..4f5cb30248 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -409,7 +409,7 @@ void computeRuns (GC gc) { if (run.lineBreak || i == allRuns.length - 1) { /* Update the run metrics if the last run is a hard break. */ if (lineRunCount == 1 && (i == allRuns.length - 1 || !run.softBreak)) { - TEXTMETRIC lptm = new TEXTMETRIC(); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.SelectObject(srcHdc, getItemFont(run)); OS.GetTextMetrics(srcHdc, lptm); run.ascentInPoints = DPIUtil.autoScaleDown(getDevice(), lptm.tmAscent); @@ -1977,7 +1977,7 @@ public FontMetrics getLineMetrics (int lineIndex) { if (!(0 <= lineIndex && lineIndex < runs.length)) SWT.error(SWT.ERROR_INVALID_RANGE); long /*int*/ hDC = device.internal_new_GC(null); long /*int*/ srcHdc = OS.CreateCompatibleDC(hDC); - TEXTMETRIC lptm = new TEXTMETRIC(); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.SelectObject(srcHdc, font != null ? font.handle : device.systemFont.handle); OS.GetTextMetrics(srcHdc, lptm); OS.DeleteDC(srcHdc); @@ -3510,7 +3510,7 @@ void shape (final long /*int*/ hdc, final StyleItem run) { OS.EnumEnhMetaFile(0, metaFile, address, 0, null); OS.DeleteEnhMetaFile(metaFile); callback.dispose(); - newFont = OS.CreateFontIndirect(emr.elfw.elfLogFont); + newFont = OS.CreateFontIndirectW(emr.elfw.elfLogFont); } else { /* * The run is composed only by white spaces, this happens when a run is split @@ -3525,7 +3525,7 @@ void shape (final long /*int*/ hdc, final StyleItem run) { StyleItem pRun = allRuns[index - 1]; if (pRun.analysis.eScript == run.analysis.eScript) { long /*int*/ pFont = getItemFont(pRun); - LOGFONT logFont = new LOGFONT (); + LOGFONT logFont = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); OS.GetObject(pFont, LOGFONT.sizeof, logFont); newFont = OS.CreateFontIndirect(logFont); } @@ -3537,7 +3537,7 @@ void shape (final long /*int*/ hdc, final StyleItem run) { OS.SelectObject(hdc, getItemFont(nRun)); shape(hdc, nRun); long /*int*/ nFont = getItemFont(nRun); - LOGFONT logFont = new LOGFONT (); + LOGFONT logFont = OS.IsUnicode ? (LOGFONT)new LOGFONTW() : new LOGFONTA(); OS.GetObject(nFont, LOGFONT.sizeof, logFont); newFont = OS.CreateFontIndirect(logFont); } @@ -3572,7 +3572,7 @@ void shape (final long /*int*/ hdc, final StyleItem run) { OS.VtblCall(4, mLangFontLink2, chars, chars.length, 0, dwCodePages, cchCodePages); /* MapFont() */ if (OS.VtblCall(10, mLangFontLink2, hdc, dwCodePages[0], chars[0], hNewFont) == OS.S_OK) { - LOGFONT logFont = new LOGFONT (); + LOGFONT logFont = OS.IsUnicode ? (LOGFONT)new LOGFONTW () : new LOGFONTA (); OS.GetObject(hNewFont[0], LOGFONT.sizeof, logFont); /* ReleaseFont() */ OS.VtblCall(8, mLangFontLink2, hNewFont[0]); @@ -3611,7 +3611,7 @@ void shape (final long /*int*/ hdc, final StyleItem run) { if (style != null) { OUTLINETEXTMETRIC lotm = null; if (style.underline || style.strikeout) { - lotm = new OUTLINETEXTMETRIC(); + lotm = OS.IsUnicode ? (OUTLINETEXTMETRIC)new OUTLINETEXTMETRICW() : new OUTLINETEXTMETRICA(); if (OS.GetOutlineTextMetrics(hdc, OUTLINETEXTMETRIC.sizeof, lotm) == 0) { lotm = null; } @@ -3630,9 +3630,9 @@ void shape (final long /*int*/ hdc, final StyleItem run) { } else { TEXTMETRIC lptm = null; if (lotm != null) { - lptm = lotm.otmTextMetrics; + lptm = OS.IsUnicode ? (TEXTMETRIC)((OUTLINETEXTMETRICW)lotm).otmTextMetrics : ((OUTLINETEXTMETRICA)lotm).otmTextMetrics; } else { - lptm = new TEXTMETRIC(); + lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.GetTextMetrics(hdc, lptm); } run.ascentInPoints = DPIUtil.autoScaleDown(getDevice(), lptm.tmAscent); @@ -3653,7 +3653,7 @@ void shape (final long /*int*/ hdc, final StyleItem run) { run.ascentInPoints += style.rise; run.descentInPoints -= style.rise; } else { - TEXTMETRIC lptm = new TEXTMETRIC(); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.GetTextMetrics(hdc, lptm); run.ascentInPoints = DPIUtil.autoScaleDown(getDevice(), lptm.tmAscent); run.descentInPoints = DPIUtil.autoScaleDown(getDevice(), lptm.tmDescent); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java index 9c9c31e6b2..a14fe35802 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java @@ -151,7 +151,7 @@ public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, } // render transparently to avoid overlapping segments. fixes bug 40006 int oldBkMode = OS.SetBkMode(gc.handle, OS.TRANSPARENT); - OS.ExtTextOut(gc.handle, x, y, ETO_GLYPH_INDEX , null, renderBuffer, renderBuffer.length, renderDx); + OS.ExtTextOutW(gc.handle, x, y, ETO_GLYPH_INDEX , null, renderBuffer, renderBuffer.length, renderDx); OS.SetBkMode(gc.handle, oldBkMode); } /** @@ -527,18 +527,18 @@ public static int resolveTextDirection (String text) { for (int i = 0; i < length; i++) { char ch = text.charAt(i); rtlProbe[0] = ch; - OS.GetCharacterPlacement(hdc, rtlProbe, rtlProbe.length, 0, result, OS.GCP_REORDER); + OS.GetCharacterPlacementW(hdc, rtlProbe, rtlProbe.length, 0, result, OS.GCP_REORDER); OS.MoveMemory(order, result.lpOrder, 4); if (order[0] == 2) { textDirection = SWT.RIGHT_TO_LEFT; break; } ltrProbe[2] = ch; - OS.GetCharacterPlacement(hdc, ltrProbe, ltrProbe.length, 0, result, OS.GCP_REORDER); + OS.GetCharacterPlacementW(hdc, ltrProbe, ltrProbe.length, 0, result, OS.GCP_REORDER); OS.MoveMemory(order, result.lpOrder + 4, 4); if (order[0] == 1) { numberProbe[2] = ch; - OS.GetCharacterPlacement(hdc, numberProbe, numberProbe.length, 0, result, OS.GCP_REORDER); + OS.GetCharacterPlacementW(hdc, numberProbe, numberProbe.length, 0, result, OS.GCP_REORDER); OS.MoveMemory(order, result.lpOrder, 4); if (order[0] == 0) { textDirection = SWT.LEFT_TO_RIGHT; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java index 166c532d33..683124f205 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java @@ -355,7 +355,7 @@ int computeLeftMargin () { long /*int*/ hDC = OS.GetDC (handle); long /*int*/ newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); - TEXTMETRIC lptm = new TEXTMETRIC (); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, lptm); int length = text.length (); if (length == 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java index 2e2be436dd..e54b15371f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java @@ -497,11 +497,11 @@ void setIMEFont () { long /*int*/ hIMC = OS.ImmGetContext (hwnd); /* Save the current IME font */ if (oldFont == null) { - oldFont = new LOGFONT (); + oldFont = OS.IsUnicode ? (LOGFONT) new LOGFONTW () : new LOGFONTA (); if (!OS.ImmGetCompositionFont (hIMC, oldFont)) oldFont = null; } /* Set new IME font */ - LOGFONT logFont = new LOGFONT (); + LOGFONT logFont = OS.IsUnicode ? (LOGFONT) new LOGFONTW () : new LOGFONTA (); if (OS.GetObject (hFont, LOGFONT.sizeof, logFont) != 0) { OS.ImmSetCompositionFont (hIMC, logFont); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java index 489f706544..1f6d201cfd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java @@ -1935,9 +1935,16 @@ LRESULT wmNotify (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { display.lockActiveWindow = false; break; } - case OS.TTN_GETDISPINFO: { - NMTTDISPINFO lpnmtdi = new NMTTDISPINFO (); - OS.MoveMemory (lpnmtdi, lParam, NMTTDISPINFO.sizeof); + case OS.TTN_GETDISPINFOA: + case OS.TTN_GETDISPINFOW: { + NMTTDISPINFO lpnmtdi; + if (hdr.code == OS.TTN_GETDISPINFOA) { + lpnmtdi = new NMTTDISPINFOA (); + OS.MoveMemory ((NMTTDISPINFOA)lpnmtdi, lParam, NMTTDISPINFOA.sizeof); + } else { + lpnmtdi = new NMTTDISPINFOW (); + OS.MoveMemory ((NMTTDISPINFOW)lpnmtdi, lParam, NMTTDISPINFOW.sizeof); + } String string = toolTipText (lpnmtdi); if (string != null) { Shell shell = getShell (); @@ -1979,8 +1986,16 @@ LRESULT wmNotify (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { lpnmtdi.uFlags &= ~OS.TTF_RTLREADING; } } - shell.setToolTipText (lpnmtdi, chars); - OS.MoveMemory (lParam, lpnmtdi, NMTTDISPINFO.sizeof); + + if (hdr.code == OS.TTN_GETDISPINFOA) { + byte [] bytes = new byte [chars.length * 2]; + OS.WideCharToMultiByte (getCodePage (), 0, chars, chars.length, bytes, bytes.length, null, null); + shell.setToolTipText (lpnmtdi, bytes); + OS.MoveMemory (lParam, (NMTTDISPINFOA)lpnmtdi, NMTTDISPINFOA.sizeof); + } else { + shell.setToolTipText (lpnmtdi, chars); + OS.MoveMemory (lParam, (NMTTDISPINFOW)lpnmtdi, NMTTDISPINFOW.sizeof); + } return LRESULT.ZERO; } break; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java index 4cf84ac2cb..8913fbad64 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java @@ -111,7 +111,8 @@ long /*int*/ BrowseCallbackProc (long /*int*/ hwnd, long /*int*/ uMsg, long /*in OS.SetWindowText (hwnd, buffer); } break; - case OS.BFFM_VALIDATEFAILED: + case OS.BFFM_VALIDATEFAILEDA: + case OS.BFFM_VALIDATEFAILEDW: /* Use the character encoding for the default locale */ int length = OS.wcslen (lParam); TCHAR buffer = new TCHAR (0, length); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java index 9ae48a25ef..2d2e705ec3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java @@ -1789,7 +1789,14 @@ public Control getFocusControl () { } String getFontName (LOGFONT logFont) { - char[] chars = logFont.lfFaceName; + char[] chars; + if (OS.IsUnicode) { + chars = ((LOGFONTW)logFont).lfFaceName; + } else { + chars = new char[OS.LF_FACESIZE]; + byte[] bytes = ((LOGFONTA)logFont).lfFaceName; + OS.MultiByteToWideChar (OS.CP_ACP, OS.MB_PRECOMPOSED, bytes, bytes.length, chars, chars.length); + } int index = 0; while (index < chars.length) { if (chars [index] == 0) break; @@ -2359,10 +2366,10 @@ public Font getSystemFont () { checkDevice (); if (systemFont != null) return systemFont; long /*int*/ hFont = 0; - NONCLIENTMETRICS info = new NONCLIENTMETRICS (); + NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA (); info.cbSize = NONCLIENTMETRICS.sizeof; if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) { - LOGFONT logFont = info.lfMessageFont; + LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfMessageFont : ((NONCLIENTMETRICSA)info).lfMessageFont; hFont = OS.CreateFontIndirect (logFont); lfSystemFont = hFont != 0 ? logFont : null; } @@ -4063,10 +4070,10 @@ void saveResources () { resources = newResources; } if (systemFont != null) { - NONCLIENTMETRICS info = new NONCLIENTMETRICS (); + NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA (); info.cbSize = NONCLIENTMETRICS.sizeof; if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) { - LOGFONT logFont = info.lfMessageFont; + LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfMessageFont : ((NONCLIENTMETRICSA)info).lfMessageFont; if (lfSystemFont == null || logFont.lfCharSet != lfSystemFont.lfCharSet || logFont.lfHeight != lfSystemFont.lfHeight || diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java index 90f8ee42d8..5031230dc7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java @@ -145,10 +145,10 @@ static int checkStyle (int style) { if (hFont != 0) { hCurrentFont = hFont; } else { - NONCLIENTMETRICS info = new NONCLIENTMETRICS (); + NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA (); info.cbSize = NONCLIENTMETRICS.sizeof; if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) { - LOGFONT logFont = info.lfCaptionFont; + LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont; hCurrentFont = OS.CreateFontIndirect (logFont); } } @@ -273,10 +273,10 @@ void drawWidget (GC gc, RECT clipRect) { if (hFont != 0) { hCurrentFont = hFont; } else { - NONCLIENTMETRICS info = new NONCLIENTMETRICS (); + NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA (); info.cbSize = NONCLIENTMETRICS.sizeof; if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) { - LOGFONT logFont = info.lfCaptionFont; + LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont; hCurrentFont = OS.CreateFontIndirect (logFont); } } @@ -314,7 +314,7 @@ Control findThemeControl () { int getBandHeight () { long /*int*/ hDC = OS.GetDC (handle); long /*int*/ oldHFont = OS.SelectObject (hDC, hFont == 0 ? defaultFont () : hFont); - TEXTMETRIC lptm = new TEXTMETRIC (); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW() : new TEXTMETRICA(); OS.GetTextMetrics (hDC, lptm); OS.SelectObject (hDC, oldHFont); OS.ReleaseDC (handle, hDC); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java index b9512fcd6d..1ee4245968 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandItem.java @@ -202,7 +202,7 @@ void drawItem (GC gc, long /*int*/ hTheme, RECT clipRect, boolean drawFocus) { if (text.length () > 0) { rect.left += ExpandItem.TEXT_INSET; TCHAR buffer; - if ((style & SWT.FLIP_TEXT_DIRECTION) != 0) { + if (OS.IsUnicode && (style & SWT.FLIP_TEXT_DIRECTION) != 0) { int bits = OS.GetWindowLong (parent.handle, OS.GWL_EXSTYLE); if ((bits & OS.WS_EX_LAYOUTRTL) != 0) { buffer = new TCHAR (parent.getCodePage (), LRE + text, false); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java index 2728b9f2dd..5488c58535 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java @@ -236,7 +236,7 @@ public FontData open () { /* Compute the result */ if (success) { - LOGFONT logFont = new LOGFONT (); + LOGFONT logFont = OS.IsUnicode ? (LOGFONT) new LOGFONTW () : new LOGFONTA (); OS.MoveMemory (logFont, lpLogFont, LOGFONT.sizeof); /* @@ -257,7 +257,7 @@ public FontData open () { */ long /*int*/ hFont = OS.CreateFontIndirect(logFont); long /*int*/ oldFont = OS.SelectObject(hDC, hFont); - TEXTMETRIC lptm = new TEXTMETRIC (); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics(hDC, lptm); OS.SelectObject(hDC, oldFont); OS.DeleteObject(hFont); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java index a337b61415..b9e8d92b28 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java @@ -172,7 +172,7 @@ protected void checkSubclass () { long /*int*/ hDC = OS.GetDC (handle); newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); if (newFont != 0) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); @@ -248,7 +248,7 @@ String fixText (boolean enabled) { long /*int*/ hDC = OS.GetDC (handle); newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); if (newFont != 0) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java index fbfe3348ea..d7ae2bf378 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java @@ -167,7 +167,7 @@ static int checkStyle (int style) { long /*int*/ oldFont = OS.SelectObject (hDC, newFont); int length = OS.GetWindowTextLength (handle); if (length == 0) { - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); height = Math.max (height, tm.tmHeight); } else { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java index 864648f903..dbe666d603 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java @@ -188,7 +188,7 @@ long /*int*/ callWindowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, lo width = rect.right - rect.left; height = rect.bottom; } else { - TEXTMETRIC lptm = new TEXTMETRIC (); + TEXTMETRIC lptm = OS.IsUnicode ? (TEXTMETRIC)new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, lptm); width = 0; height = lptm.tmHeight; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java index d2be79f253..036d56650c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java @@ -1852,6 +1852,22 @@ void setToolTipText (long /*int*/ hwnd, String text) { } } +void setToolTipText (NMTTDISPINFO lpnmtdi, byte [] buffer) { + /* + * Ensure that the current position of the mouse + * is inside the client area of the shell. This + * prevents tool tips from popping up over the + * shell trimmings. + */ + if (!hasCursor ()) return; + long /*int*/ hHeap = OS.GetProcessHeap (); + if (lpstrTip != 0) OS.HeapFree (hHeap, 0, lpstrTip); + int byteCount = buffer.length; + lpstrTip = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); + OS.MoveMemory (lpstrTip, buffer, byteCount); + lpnmtdi.lpszText = lpstrTip; +} + void setToolTipText (NMTTDISPINFO lpnmtdi, char [] buffer) { /* * Ensure that the current position of the mouse diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java index b55fac8859..a734b76537 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java @@ -298,7 +298,7 @@ long /*int*/ borderHandle () { long /*int*/ hDC = OS.GetDC (hwndText); newFont = OS.SendMessage (hwndText, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); height = tm.tmHeight; RECT rect = new RECT (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java index 3554e74ff8..f138eb7d8e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java @@ -4275,7 +4275,7 @@ void setCheckboxImageList (int width, int height, boolean fixScroll) { OS.FillRect (memDC, rect, hBrush); OS.DeleteObject (hBrush); long /*int*/ oldFont = OS.SelectObject (hDC, defaultFont ()); - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); OS.SelectObject (hDC, oldFont); int itemWidth = Math.min (tm.tmHeight, width); @@ -5718,7 +5718,8 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long / switch (hdr.code) { case OS.TTN_SHOW: case OS.TTN_POP: - case OS.TTN_GETDISPINFO: + case OS.TTN_GETDISPINFOA: + case OS.TTN_GETDISPINFOW: return OS.SendMessage (handle, msg, wParam, lParam); } break; @@ -6537,7 +6538,8 @@ LRESULT wmNotify (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { @Override LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { switch (hdr.code) { - case OS.LVN_ODFINDITEM: { + case OS.LVN_ODFINDITEMA: + case OS.LVN_ODFINDITEMW: { if ((style & SWT.VIRTUAL) != 0) return new LRESULT (-1); break; } @@ -6553,7 +6555,8 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.LVN_GETDISPINFO: { + case OS.LVN_GETDISPINFOA: + case OS.LVN_GETDISPINFOW: { // if (drawCount != 0 || !OS.IsWindowVisible (handle)) break; NMLVDISPINFO plvfi = new NMLVDISPINFO (); OS.MoveMemory (plvfi, lParam, NMLVDISPINFO.sizeof); @@ -6872,8 +6875,10 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { * both. */ switch (hdr.code) { - case OS.HDN_BEGINTRACK: - case OS.HDN_DIVIDERDBLCLICK: { + case OS.HDN_BEGINTRACKW: + case OS.HDN_BEGINTRACKA: + case OS.HDN_DIVIDERDBLCLICKW: + case OS.HDN_DIVIDERDBLCLICKA: { if (columnCount == 0) return LRESULT.ONE; NMHEADER phdn = new NMHEADER (); OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); @@ -6882,11 +6887,13 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { return LRESULT.ONE; } ignoreColumnMove = true; - if (hdr.code == OS.HDN_DIVIDERDBLCLICK) { - if (column != null && hooks (SWT.MeasureItem)) { - column.pack (); - return LRESULT.ONE; - } + switch (hdr.code) { + case OS.HDN_DIVIDERDBLCLICKW: + case OS.HDN_DIVIDERDBLCLICKA: + if (column != null && hooks (SWT.MeasureItem)) { + column.pack (); + return LRESULT.ONE; + } } break; } @@ -7093,7 +7100,8 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.HDN_ITEMCHANGED: { + case OS.HDN_ITEMCHANGEDW: + case OS.HDN_ITEMCHANGEDA: { /* * Bug in Windows. When a table has the LVS_EX_GRIDLINES extended * style and the user drags any column over the first column in the @@ -7149,7 +7157,8 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.HDN_ITEMDBLCLICK: { + case OS.HDN_ITEMDBLCLICKW: + case OS.HDN_ITEMDBLCLICKA: { NMHEADER phdn = new NMHEADER (); OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); TableColumn column = columns [phdn.iItem]; @@ -7173,7 +7182,8 @@ LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.TTN_GETDISPINFO: + case OS.TTN_GETDISPINFOA: + case OS.TTN_GETDISPINFOW: case OS.TTN_SHOW: { LRESULT result = super.wmNotify (hdr, wParam, lParam); if (result != null) return result; @@ -7215,11 +7225,21 @@ LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { int width = toolRect.right - toolRect.left, height = toolRect.bottom - toolRect.top; OS.SetWindowPos (hwndToolTip, 0, toolRect.left , toolRect.top, width, height, flags); } else { - NMTTDISPINFO lpnmtdi = new NMTTDISPINFO (); - OS.MoveMemory (lpnmtdi, lParam, NMTTDISPINFO.sizeof); - if (lpnmtdi.lpszText != 0) { - OS.MoveMemory (lpnmtdi.lpszText, new char [1], 2); - OS.MoveMemory (lParam, lpnmtdi, NMTTDISPINFO.sizeof); + NMTTDISPINFO lpnmtdi = null; + if (hdr.code == OS.TTN_GETDISPINFOA) { + lpnmtdi = new NMTTDISPINFOA (); + OS.MoveMemory ((NMTTDISPINFOA)lpnmtdi, lParam, NMTTDISPINFOA.sizeof); + if (lpnmtdi.lpszText != 0) { + OS.MoveMemory (lpnmtdi.lpszText, new byte [1], 1); + OS.MoveMemory (lParam, (NMTTDISPINFOA)lpnmtdi, NMTTDISPINFOA.sizeof); + } + } else { + lpnmtdi = new NMTTDISPINFOW (); + OS.MoveMemory ((NMTTDISPINFOW)lpnmtdi, lParam, NMTTDISPINFOW.sizeof); + if (lpnmtdi.lpszText != 0) { + OS.MoveMemory (lpnmtdi.lpszText, new char [1], 2); + OS.MoveMemory (lParam, (NMTTDISPINFOW)lpnmtdi, NMTTDISPINFOW.sizeof); + } } RECT cellRect = item.getBounds (pinfo.iItem, pinfo.iSubItem, true, true, true, true, hDC); RECT clientRect = new RECT (); @@ -7238,8 +7258,15 @@ LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { Shell shell = getShell (); char [] chars = new char [string.length () + 1]; string.getChars (0, string.length (), chars, 0); - shell.setToolTipText (lpnmtdi, chars); - OS.MoveMemory (lParam, lpnmtdi, NMTTDISPINFO.sizeof); + if (hdr.code == OS.TTN_GETDISPINFOA) { + byte [] bytes = new byte [chars.length * 2]; + OS.WideCharToMultiByte (getCodePage (), 0, chars, chars.length, bytes, bytes.length, null, null); + shell.setToolTipText (lpnmtdi, bytes); + OS.MoveMemory (lParam, (NMTTDISPINFOA)lpnmtdi, NMTTDISPINFOA.sizeof); + } else { + shell.setToolTipText (lpnmtdi, chars); + OS.MoveMemory (lParam, (NMTTDISPINFOW)lpnmtdi, NMTTDISPINFOW.sizeof); + } } } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskItem.java index 700b0e99e1..783f0c23d9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskItem.java @@ -520,10 +520,10 @@ void updateText () { TCHAR buffer = new TCHAR (shell.getCodePage (), overlayText, false); int length = buffer.length(); long /*int*/ hFont = 0, oldHFont = 0; - NONCLIENTMETRICS info = new NONCLIENTMETRICS (); + NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA (); info.cbSize = NONCLIENTMETRICS.sizeof; if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) { - LOGFONT logFont = info.lfMessageFont; + LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfMessageFont : ((NONCLIENTMETRICSA)info).lfMessageFont; logFont.lfHeight = -10; hFont = OS.CreateFontIndirect (logFont); oldHFont = OS.SelectObject (dstHdc, hFont); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java index 6b1cffd8fb..f9ed988480 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java @@ -641,7 +641,7 @@ public void clearSelection () { long /*int*/ hDC = OS.GetDC (handle); newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); int count = (style & SWT.SINGLE) != 0 ? 1 : (int)/*64*/OS.SendMessage (handle, OS.EM_GETLINECOUNT, 0, 0); height = count * tm.tmHeight; @@ -1128,7 +1128,7 @@ int getLineHeightInPixels () { long /*int*/ hDC = OS.GetDC (handle); newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); if (newFont != 0) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); @@ -1839,7 +1839,7 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags) { long /*int*/ hDC = OS.GetDC (handle); newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0); if (newFont != 0) oldFont = OS.SelectObject (hDC, newFont); - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); if (newFont != 0) OS.SelectObject (hDC, oldFont); OS.ReleaseDC (handle, hDC); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java index 26c6a3b046..6b58d8a2d2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java @@ -558,13 +558,24 @@ public void setVisible (boolean visible) { } if (item != null) { if (visible) { - NOTIFYICONDATA iconData = new NOTIFYICONDATA (); - char [] szInfoTitle = iconData.szInfoTitle; - int length1 = Math.min (szInfoTitle.length - 1, text.length ()); - text.getChars (0, length1, szInfoTitle, 0); - char [] szInfo = iconData.szInfo; - int length2 = Math.min (szInfo.length - 1, message.length ()); - message.getChars (0, length2, szInfo, 0); + NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA (); + TCHAR buffer1 = new TCHAR (0, text, true); + TCHAR buffer2 = new TCHAR (0, message, true); + if (OS.IsUnicode) { + char [] szInfoTitle = ((NOTIFYICONDATAW) iconData).szInfoTitle; + int length1 = Math.min (szInfoTitle.length - 1, buffer1.length ()); + System.arraycopy (buffer1.chars, 0, szInfoTitle, 0, length1); + char [] szInfo = ((NOTIFYICONDATAW) iconData).szInfo; + int length2 = Math.min (szInfo.length - 1, buffer2.length ()); + System.arraycopy (buffer2.chars, 0, szInfo, 0, length2); + } else { + byte [] szInfoTitle = ((NOTIFYICONDATAA) iconData).szInfoTitle; + int length = Math.min (szInfoTitle.length - 1, buffer1.length ()); + System.arraycopy (buffer1.bytes, 0, szInfoTitle, 0, length); + byte [] szInfo = ((NOTIFYICONDATAA) iconData).szInfo; + int length2 = Math.min (szInfo.length - 1, buffer2.length ()); + System.arraycopy (buffer2.bytes, 0, szInfo, 0, length2); + } Display display = item.getDisplay (); iconData.cbSize = NOTIFYICONDATA.sizeof; iconData.uID = item.id; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java index feb1d4a2ee..7083c8d11e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java @@ -150,7 +150,7 @@ protected void checkSubclass () { } void createUpdateWidget (boolean newIcon) { - NOTIFYICONDATA iconData = new NOTIFYICONDATA (); + NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA (); iconData.cbSize = NOTIFYICONDATA.sizeof; /* * As per MSDN article iconData.uID is unique for every TrayItem @@ -360,7 +360,7 @@ void releaseWidget () { image2 = null; highlightImage = null; toolTipText = null; - NOTIFYICONDATA iconData = new NOTIFYICONDATA (); + NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA (); iconData.cbSize = NOTIFYICONDATA.sizeof; iconData.uID = id; iconData.hWnd = display.hwndMessage; @@ -473,7 +473,7 @@ public void setImage (Image image) { break; } } - NOTIFYICONDATA iconData = new NOTIFYICONDATA (); + NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA (); iconData.cbSize = NOTIFYICONDATA.sizeof; iconData.uID = id; iconData.hWnd = display.hwndMessage; @@ -531,11 +531,20 @@ public void setToolTip (ToolTip toolTip) { public void setToolTipText (String string) { checkWidget (); toolTipText = string; - NOTIFYICONDATA iconData = new NOTIFYICONDATA (); - if (string != null) { - char [] szTip = iconData.szTip; - int length = Math.min (szTip.length - 1, string.length ()); - string.getChars (0, length, szTip, 0); + NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA (); + TCHAR buffer = new TCHAR (0, toolTipText == null ? "" : toolTipText, true); + /* + * Note that the size of the szTip field is different in version 5.0 of shell32.dll. + */ + int length = 128; + if (OS.IsUnicode) { + char [] szTip = ((NOTIFYICONDATAW) iconData).szTip; + length = Math.min (length - 1, buffer.length ()); + System.arraycopy (buffer.chars, 0, szTip, 0, length); + } else { + byte [] szTip = ((NOTIFYICONDATAA) iconData).szTip; + length = Math.min (length - 1, buffer.length ()); + System.arraycopy (buffer.bytes, 0, szTip, 0, length); } iconData.cbSize = NOTIFYICONDATA.sizeof; iconData.uID = id; @@ -568,7 +577,7 @@ public void setVisible (boolean visible) { if (isDisposed ()) return; } this.visible = visible; - NOTIFYICONDATA iconData = new NOTIFYICONDATA (); + NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA (); iconData.cbSize = NOTIFYICONDATA.sizeof; iconData.uID = id; iconData.hWnd = display.hwndMessage; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java index b92d9ad6cb..16a13846c5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java @@ -4605,7 +4605,7 @@ void setCheckboxImageList () { OS.FillRect (memDC, rect, hBrush); OS.DeleteObject (hBrush); long /*int*/ oldFont = OS.SelectObject (hDC, defaultFont ()); - TEXTMETRIC tm = new TEXTMETRIC (); + TEXTMETRIC tm = OS.IsUnicode ? (TEXTMETRIC) new TEXTMETRICW () : new TEXTMETRICA (); OS.GetTextMetrics (hDC, tm); OS.SelectObject (hDC, oldFont); int itemWidth = Math.min (tm.tmHeight, width); @@ -5757,7 +5757,8 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long / switch (hdr.code) { case OS.TTN_SHOW: case OS.TTN_POP: - case OS.TTN_GETDISPINFO: + case OS.TTN_GETDISPINFOA: + case OS.TTN_GETDISPINFOW: return OS.SendMessage (handle, msg, wParam, lParam); } break; @@ -7223,7 +7224,8 @@ LRESULT wmNotify (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { @Override LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { switch (hdr.code) { - case OS.TVN_GETDISPINFO: { + case OS.TVN_GETDISPINFOA: + case OS.TVN_GETDISPINFOW: { NMTVDISPINFO lptvdi = new NMTVDISPINFO (); OS.MoveMemory (lptvdi, lParam, NMTVDISPINFO.sizeof); if ((style & SWT.VIRTUAL) != 0) { @@ -7409,7 +7411,8 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { * changing on all but the item that is supposed to be * selected. */ - case OS.TVN_ITEMCHANGING: { + case OS.TVN_ITEMCHANGINGA: + case OS.TVN_ITEMCHANGINGW: { if ((style & SWT.MULTI) != 0) { if (hSelect != 0) { NMTVITEMCHANGE pnm = new NMTVITEMCHANGE (); @@ -7420,7 +7423,8 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.TVN_SELCHANGING: { + case OS.TVN_SELCHANGINGA: + case OS.TVN_SELCHANGINGW: { if ((style & SWT.MULTI) != 0) { if (lockSelection) { /* Save the old selection state for both items */ @@ -7438,7 +7442,8 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.TVN_SELCHANGED: { + case OS.TVN_SELCHANGEDA: + case OS.TVN_SELCHANGEDW: { NMTREEVIEW treeView = null; if ((style & SWT.MULTI) != 0) { if (lockSelection) { @@ -7481,7 +7486,8 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { updateScrollBar (); break; } - case OS.TVN_ITEMEXPANDING: { + case OS.TVN_ITEMEXPANDINGA: + case OS.TVN_ITEMEXPANDINGW: { if (itemToolTipHandle != 0) OS.ShowWindow (itemToolTipHandle, OS.SW_HIDE); boolean runExpanded = false; if ((style & SWT.VIRTUAL) != 0) style &= ~SWT.DOUBLE_BUFFERED; @@ -7547,7 +7553,8 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { if (!runExpanded) break; //FALL THROUGH } - case OS.TVN_ITEMEXPANDED: { + case OS.TVN_ITEMEXPANDEDA: + case OS.TVN_ITEMEXPANDEDW: { if ((style & SWT.VIRTUAL) != 0) style |= SWT.DOUBLE_BUFFERED; if (hooks (SWT.EraseItem) || hooks (SWT.PaintItem)) style |= SWT.DOUBLE_BUFFERED; if (findImageControl () != null && getDrawing () /*&& OS.IsWindowVisible (handle)*/) { @@ -7588,10 +7595,12 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { updateScrollBar (); break; } - case OS.TVN_BEGINDRAG: + case OS.TVN_BEGINDRAGA: + case OS.TVN_BEGINDRAGW: if (OS.GetKeyState (OS.VK_LBUTTON) >= 0) break; //FALL THROUGH - case OS.TVN_BEGINRDRAG: { + case OS.TVN_BEGINRDRAGA: + case OS.TVN_BEGINRDRAGW: { dragStarted = true; NMTREEVIEW treeView = new NMTREEVIEW (); OS.MoveMemory (treeView, lParam, NMTREEVIEW.sizeof); @@ -7625,8 +7634,10 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { * both. */ switch (hdr.code) { - case OS.HDN_BEGINTRACK: - case OS.HDN_DIVIDERDBLCLICK: { + case OS.HDN_BEGINTRACKW: + case OS.HDN_BEGINTRACKA: + case OS.HDN_DIVIDERDBLCLICKW: + case OS.HDN_DIVIDERDBLCLICKA: { NMHEADER phdn = new NMHEADER (); OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); TreeColumn column = columns [phdn.iItem]; @@ -7634,8 +7645,10 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { return LRESULT.ONE; } ignoreColumnMove = true; - if (hdr.code == OS.HDN_DIVIDERDBLCLICK) { - if (column != null) column.pack (); + switch (hdr.code) { + case OS.HDN_DIVIDERDBLCLICKW: + case OS.HDN_DIVIDERDBLCLICKA: + if (column != null) column.pack (); } break; } @@ -7841,7 +7854,8 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.HDN_ITEMCHANGING: { + case OS.HDN_ITEMCHANGINGW: + case OS.HDN_ITEMCHANGINGA: { NMHEADER phdn = new NMHEADER (); OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); if (phdn.pitem != 0) { @@ -7879,7 +7893,8 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.HDN_ITEMCHANGED: { + case OS.HDN_ITEMCHANGEDW: + case OS.HDN_ITEMCHANGEDA: { NMHEADER phdn = new NMHEADER (); OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); if (phdn.pitem != 0) { @@ -7914,7 +7929,8 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.HDN_ITEMCLICK: { + case OS.HDN_ITEMCLICKW: + case OS.HDN_ITEMCLICKA: { NMHEADER phdn = new NMHEADER (); OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); TreeColumn column = columns [phdn.iItem]; @@ -7923,7 +7939,8 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) { } break; } - case OS.HDN_ITEMDBLCLICK: { + case OS.HDN_ITEMDBLCLICKW: + case OS.HDN_ITEMDBLCLICKA: { NMHEADER phdn = new NMHEADER (); OS.MoveMemory (phdn, lParam, NMHEADER.sizeof); TreeColumn column = columns [phdn.iItem]; |