Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Nemkin2018-02-16 16:12:22 -0500
committerLars Vogel2018-03-28 11:22:36 -0400
commit84c9e305cb087110cb300a5e58f86583cf80914d (patch)
tree5666f707b70a6e756d3ba9e8e51470cbd95fd522 /bundles/org.eclipse.swt/Eclipse SWT/win32
parent4b0412b94e47be8f2c5480568a36ec71809a148f (diff)
downloadeclipse.platform.swt-84c9e305cb087110cb300a5e58f86583cf80914d.tar.gz
eclipse.platform.swt-84c9e305cb087110cb300a5e58f86583cf80914d.tar.xz
eclipse.platform.swt-84c9e305cb087110cb300a5e58f86583cf80914d.zip
Bug 531097 - [Win32] Remove support for Windows before Vista
Remove code paths specific to WinCE, Win9x, WinNT4, Win2k, WinXP. Remove uses of obsolete flag=no_wince JNI annotation. The following OS variables indicate dead code: * WIN32_VERSION is awlays >= 6.0 * COMCTL32_VERSION is always 6.10; * SHELL32_VERSION is always >= 6.0; * IsWinNT and IsUnicode are always true; * IsWin32s, IsWin95, IsWinCE, IsPPC, IsHPC, IsSP are always false. Change-Id: I4e700a89b22cd879e7c46f1493115a77e2ade1c9 Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java95
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Device.java71
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java568
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java384
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/BidiUtil.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java73
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java476
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java55
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Caret.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java36
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java207
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java322
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java285
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java70
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java68
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java415
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DirectoryDialog.java30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java640
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java69
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FontDialog.java38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Group.java57
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/IME.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Label.java127
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java135
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java430
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java418
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java128
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java134
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java125
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Shell.java320
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Spinner.java97
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Table.java754
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java237
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java312
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java138
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolTip.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TrayItem.java22
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java608
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java94
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java55
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java421
55 files changed, 2107 insertions, 6678 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
index 2e07eab309..fe49285f86 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Cursor.java
@@ -59,84 +59,6 @@ public final class Cursor extends Resource {
boolean isIcon;
- /**
- * data used to create a HAND cursor.
- */
- static final byte[] HAND_SOURCE = {
- (byte)0xf9,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0x3f,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0x07,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0x03,(byte)0xff,(byte)0xff,
- (byte)0xf0,(byte)0x00,(byte)0xff,(byte)0xff,
-
- (byte)0x10,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0x00,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0x80,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0xc0,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0xe0,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0xf0,(byte)0x00,(byte)0x7f,(byte)0xff,
- (byte)0xf8,(byte)0x00,(byte)0xff,(byte)0xff,
- (byte)0xfc,(byte)0x01,(byte)0xff,(byte)0xff,
-
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
-
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff,
- (byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff
- };
- static final byte[] HAND_MASK = {
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0xc0,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0xd8,(byte)0x00,(byte)0x00,
- (byte)0x06,(byte)0xd8,(byte)0x00,(byte)0x00,
-
- (byte)0x07,(byte)0xdb,(byte)0x00,(byte)0x00,
- (byte)0x67,(byte)0xfb,(byte)0x00,(byte)0x00,
- (byte)0x3f,(byte)0xff,(byte)0x00,(byte)0x00,
- (byte)0x1f,(byte)0xff,(byte)0x00,(byte)0x00,
- (byte)0x0f,(byte)0xff,(byte)0x00,(byte)0x00,
- (byte)0x07,(byte)0xff,(byte)0x00,(byte)0x00,
- (byte)0x03,(byte)0xfe,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
-
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
-
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,
- (byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00
- };
-
/**
* Prevents uninitialized instances from being created outside the package.
*/
@@ -220,20 +142,6 @@ public Cursor(Device device, int style) {
SWT.error(SWT.ERROR_INVALID_ARGUMENT);
}
handle = OS.LoadCursor(0, lpCursorName);
- /*
- * IDC_HAND is supported only on Windows 2000 and Windows 98.
- * Create a hand cursor if running in other Windows platforms.
- */
- if (handle == 0 && style == SWT.CURSOR_HAND) {
- int width = OS.GetSystemMetrics(OS.SM_CXCURSOR);
- int height = OS.GetSystemMetrics(OS.SM_CYCURSOR);
- if (width == 32 && height == 32) {
- long /*int*/ hInst = OS.GetModuleHandle(null);
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
- handle = OS.CreateCursor(hInst, 5, 0, 32, 32, HAND_SOURCE, HAND_MASK);
-
- }
- }
if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
init();
}
@@ -299,7 +207,6 @@ public Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int
/* Create the cursor */
long /*int*/ hInst = OS.GetModuleHandle(null);
- if (OS.IsWinCE) SWT.error (SWT.ERROR_NOT_IMPLEMENTED);
handle = OS.CreateCursor(hInst, hotspotX, hotspotY, source.width, source.height, sourceData, maskData);
if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
init();
@@ -437,7 +344,7 @@ void destroy () {
* destroy them all. If this causes problems in the future,
* put the flag back in.
*/
- if (!OS.IsWinCE) OS.DestroyCursor(handle);
+ OS.DestroyCursor(handle);
}
handle = 0;
}
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 47e2bfccda..d983509588 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
@@ -186,8 +186,7 @@ protected void checkDevice () {
void checkGDIP() {
if (gdipToken != null) return;
- int oldErrorMode = 0;
- if (!OS.IsWinCE) oldErrorMode = OS.SetErrorMode (OS.SEM_FAILCRITICALERRORS);
+ int oldErrorMode = OS.SetErrorMode (OS.SEM_FAILCRITICALERRORS);
try {
long /*int*/ [] token = new long /*int*/ [1];
GdiplusStartupInput input = new GdiplusStartupInput ();
@@ -211,7 +210,7 @@ void checkGDIP() {
} catch (Throwable t) {
SWT.error (SWT.ERROR_NO_GRAPHICS_LIBRARY, t, " [GDI+ is required]"); //$NON-NLS-1$
} finally {
- if (!OS.IsWinCE) OS.SetErrorMode (oldErrorMode);
+ OS.SetErrorMode (oldErrorMode);
}
}
@@ -535,11 +534,6 @@ public FontData [] getFontList (String faceName, boolean scalable) {
offset = nFonts;
for (int i=0; i<offset; i++) {
LOGFONT lf = logFonts [i];
- /**
- * Bug in Windows 98. When EnumFontFamiliesEx is called with a specified face name, it
- * should enumerate for each available style of that font. Instead, it only enumerates
- * once. The fix is to call EnumFontFamilies, which works as expected.
- */
if (OS.IsUnicode) {
OS.EnumFontFamiliesW (hDC, ((LOGFONTW)lf).lfFaceName, lpEnumFontFamProc, scalable ? 1 : 0);
} else {
@@ -549,11 +543,6 @@ public FontData [] getFontList (String faceName, boolean scalable) {
} else {
/* Use the character encoding for the default locale */
TCHAR lpFaceName = new TCHAR (0, faceName, true);
- /**
- * Bug in Windows 98. When EnumFontFamiliesEx is called with a specified face name, it
- * should enumerate for each available style of that font. Instead, it only enumerates
- * once. The fix is to call EnumFontFamilies, which works as expected.
- */
OS.EnumFontFamilies (hDC, lpFaceName, lpEnumFontFamProc, scalable ? 1 : 0);
}
int logPixelsY = OS.GetDeviceCaps(hDC, OS.LOGPIXELSY);
@@ -703,20 +692,18 @@ public boolean getWarnings () {
*/
protected void init () {
if (debug) {
- if (!OS.IsWinCE) OS.GdiSetBatchLimit(1);
+ OS.GdiSetBatchLimit(1);
}
/* Initialize the system font slot */
systemFont = getSystemFont();
/* Initialize scripts list */
- if (!OS.IsWinCE) {
- long /*int*/ [] ppSp = new long /*int*/ [1];
- int [] piNumScripts = new int [1];
- OS.ScriptGetProperties (ppSp, piNumScripts);
- scripts = new long /*int*/ [piNumScripts [0]];
- OS.MoveMemory (scripts, ppSp [0], scripts.length * C.PTR_SIZEOF);
- }
+ long /*int*/ [] ppSp = new long /*int*/ [1];
+ int [] piNumScripts = new int [1];
+ OS.ScriptGetProperties (ppSp, piNumScripts);
+ scripts = new long /*int*/ [piNumScripts [0]];
+ OS.MoveMemory (scripts, ppSp [0], scripts.length * C.PTR_SIZEOF);
/*
* If we're not on a device which supports palettes,
@@ -736,17 +723,6 @@ protected void init () {
int numReserved = OS.GetDeviceCaps (hDC, OS.NUMRESERVED);
int numEntries = OS.GetDeviceCaps (hDC, OS.SIZEPALETTE);
- if (OS.IsWinCE) {
- /*
- * Feature on WinCE. For some reason, certain 8 bit WinCE
- * devices return 0 for the number of reserved entries in
- * the system palette. Their system palette correctly contains
- * the usual 20 system colors. The workaround is to assume
- * there are 20 reserved system colors instead of 0.
- */
- if (numReserved == 0 && numEntries >= 20) numReserved = 20;
- }
-
/* Create the palette and reference counter */
colorRefCount = new int [numEntries];
@@ -852,26 +828,23 @@ public boolean isDisposed () {
public boolean loadFont (String path) {
checkDevice();
if (path == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (OS.IsWinNT && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- TCHAR lpszFilename = new TCHAR (0, path, true);
- boolean loaded = OS.AddFontResourceEx (lpszFilename, OS.FR_PRIVATE, 0) != 0;
- if (loaded) {
- if (gdipToken != null) {
- if (fontCollection == 0) {
- fontCollection = Gdip.PrivateFontCollection_new();
- if (fontCollection == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- }
- int length = path.length();
- char [] buffer = new char [length + 1];
- path.getChars(0, length, buffer, 0);
- Gdip.PrivateFontCollection_AddFontFile(fontCollection, buffer);
- } else {
- addFont(path);
+ TCHAR lpszFilename = new TCHAR (0, path, true);
+ boolean loaded = OS.AddFontResourceEx (lpszFilename, OS.FR_PRIVATE, 0) != 0;
+ if (loaded) {
+ if (gdipToken != null) {
+ if (fontCollection == 0) {
+ fontCollection = Gdip.PrivateFontCollection_new();
+ if (fontCollection == 0) SWT.error(SWT.ERROR_NO_HANDLES);
}
+ int length = path.length();
+ char [] buffer = new char [length + 1];
+ path.getChars(0, length, buffer, 0);
+ Gdip.PrivateFontCollection_AddFontFile(fontCollection, buffer);
+ } else {
+ addFont(path);
}
- return loaded;
}
- return false;
+ return loaded;
}
void new_Object (Object object) {
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 8d8ee8c794..f48eff78fe 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
@@ -382,7 +382,7 @@ void checkGC(int mask) {
* is to use ExtCreatePen() instead.
*/
long /*int*/ newPen;
- if (OS.IsWinCE || (width == 0 && lineStyle != OS.PS_USERSTYLE) || style == 0) {
+ if ((width == 0 && lineStyle != OS.PS_USERSTYLE) || style == 0) {
newPen = OS.CreatePen(style & OS.PS_STYLE_MASK, width, color);
} else {
LOGBRUSH logBrush = new LOGBRUSH();
@@ -513,10 +513,6 @@ public void copyArea (int srcX, int srcY, int width, int height, int destX, int
void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- /*
- * Feature in WinCE. The function WindowFromDC is not part of the
- * WinCE SDK. The fix is to remember the HWND.
- */
long /*int*/ hwnd = data.hwnd;
if (hwnd == 0) {
OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY);
@@ -531,36 +527,7 @@ void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int
RECT lprcScroll = new RECT();
OS.SetRect(lprcScroll, srcX, srcY, srcX + width, srcY + height);
int flags = paint ? OS.SW_INVALIDATE | OS.SW_ERASE : 0;
- int res = OS.ScrollWindowEx(hwnd, destX - srcX, destY - srcY, lprcScroll, lprcClip, 0, null, flags);
-
- /*
- * Feature in WinCE. ScrollWindowEx does not accept combined
- * vertical and horizontal scrolling. The fix is to do a
- * BitBlt and invalidate the appropriate source area.
- */
- if (res == 0 && OS.IsWinCE) {
- OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY);
- if (paint) {
- int deltaX = destX - srcX, deltaY = destY - srcY;
- boolean disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY);
- if (disjoint) {
- OS.InvalidateRect(hwnd, lprcScroll, true);
- } else {
- if (deltaX != 0) {
- int newX = destX - deltaX;
- if (deltaX < 0) newX = destX + width;
- OS.SetRect(lprcScroll, newX, srcY, newX + Math.abs(deltaX), srcY + height);
- OS.InvalidateRect(hwnd, lprcScroll, true);
- }
- if (deltaY != 0) {
- int newY = destY - deltaY;
- if (deltaY < 0) newY = destY + height;
- OS.SetRect(lprcScroll, srcX, newY, srcX + width, newY + Math.abs(deltaY));
- OS.InvalidateRect(hwnd, lprcScroll, true);
- }
- }
- }
- }
+ OS.ScrollWindowEx(hwnd, destX - srcX, destY - srcY, lprcScroll, lprcClip, 0, null, flags);
}
}
static long /*int*/ createGdipFont(long /*int*/ hDC, long /*int*/ hFont, long /*int*/ graphics, long /*int*/ fontCollection, long /*int*/ [] outFamily, long /*int*/[] outFont) {
@@ -784,51 +751,28 @@ void drawArcInPixels (int x, int y, int width, int height, int startAngle, int a
if ((data.style & SWT.MIRRORED) != 0) {
if (data.lineWidth != 0 && data.lineWidth % 2 == 0) x--;
}
- /*
- * Feature in WinCE. The function Arc is not present in the
- * WinCE SDK. The fix is to emulate arc drawing by using
- * Polyline.
- */
- if (OS.IsWinCE) {
- /* compute arc with a simple linear interpolation */
- if (arcAngle < 0) {
- startAngle += arcAngle;
- arcAngle = -arcAngle;
- }
- if (arcAngle > 360) arcAngle = 360;
- int[] points = new int[(arcAngle + 1) * 2];
- int cteX = 2 * x + width;
- int cteY = 2 * y + height;
- int index = 0;
- for (int i = 0; i <= arcAngle; i++) {
- points[index++] = (cos(startAngle + i, width) + cteX) >> 1;
- points[index++] = (cteY - sin(startAngle + i, height)) >> 1;
- }
- OS.Polyline(handle, points, points.length / 2);
+ int x1, y1, x2, y2,tmp;
+ boolean isNegative;
+ if (arcAngle >= 360 || arcAngle <= -360) {
+ x1 = x2 = x + width;
+ y1 = y2 = y + height / 2;
} else {
- int x1, y1, x2, y2,tmp;
- boolean isNegative;
- if (arcAngle >= 360 || arcAngle <= -360) {
- x1 = x2 = x + width;
- y1 = y2 = y + height / 2;
- } else {
- isNegative = arcAngle < 0;
-
- arcAngle = arcAngle + startAngle;
- if (isNegative) {
- // swap angles
- tmp = startAngle;
- startAngle = arcAngle;
- arcAngle = tmp;
- }
- x1 = cos(startAngle, width) + x + width/2;
- y1 = -1 * sin(startAngle, height) + y + height/2;
-
- x2 = cos(arcAngle, width) + x + width/2;
- y2 = -1 * sin(arcAngle, height) + y + height/2;
+ isNegative = arcAngle < 0;
+
+ arcAngle = arcAngle + startAngle;
+ if (isNegative) {
+ // swap angles
+ tmp = startAngle;
+ startAngle = arcAngle;
+ arcAngle = tmp;
}
- OS.Arc(handle, x, y, x + width + 1, y + height + 1, x1, y1, x2, y2);
+ x1 = cos(startAngle, width) + x + width/2;
+ y1 = -1 * sin(startAngle, height) + y + height/2;
+
+ x2 = cos(arcAngle, width) + x + width/2;
+ y2 = -1 * sin(arcAngle, height) + y + height/2;
}
+ OS.Arc(handle, x, y, x + width + 1, y + height + 1, x1, y1, x2, y2);
}
/**
@@ -1079,24 +1023,19 @@ void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, i
boolean drawIcon = true;
int flags = OS.DI_NORMAL;
int offsetX = 0, offsetY = 0;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(5, 1)) {
- if ((OS.GetLayout(handle) & OS.LAYOUT_RTL) != 0) {
- flags |= OS.DI_NOMIRROR;
- /*
- * Bug in Windows. For some reason, DrawIconEx() does not take
- * into account the window origin when the DI_NOMIRROR and
- * LAYOUT_RTL are set. The fix is to set the window origin to
- * (0, 0) and offset the drawing ourselves.
- */
- POINT pt = new POINT();
- OS.GetWindowOrgEx(handle, pt);
- offsetX = pt.x;
- offsetY = pt.y;
- }
- } else {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- drawIcon = (OS.GetLayout(handle) & OS.LAYOUT_RTL) == 0;
- }
+
+ if ((OS.GetLayout(handle) & OS.LAYOUT_RTL) != 0) {
+ flags |= OS.DI_NOMIRROR;
+ /*
+ * Bug in Windows. For some reason, DrawIconEx() does not take
+ * into account the window origin when the DI_NOMIRROR and
+ * LAYOUT_RTL are set. The fix is to set the window origin to
+ * (0, 0) and offset the drawing ourselves.
+ */
+ POINT pt = new POINT();
+ OS.GetWindowOrgEx(handle, pt);
+ offsetX = pt.x;
+ offsetY = pt.y;
}
/* Simple case: no stretching, entire icon */
@@ -1109,11 +1048,7 @@ void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, i
/* Get the icon info */
ICONINFO srcIconInfo = new ICONINFO();
- if (OS.IsWinCE) {
- Image.GetIconInfo(srcImage, srcIconInfo);
- } else {
- OS.GetIconInfo(srcImage.handle, srcIconInfo);
- }
+ OS.GetIconInfo(srcImage.handle, srcIconInfo);
/* Get the icon width and height */
long /*int*/ hBitmap = srcIconInfo.hbmColor;
@@ -1161,7 +1096,7 @@ void drawIcon(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, i
long /*int*/ oldDestBitmap = OS.SelectObject(dstHdc, newIconInfo.hbmColor);
boolean stretch = !simple && (srcWidth != destWidth || srcHeight != destHeight);
if (stretch) {
- if (!OS.IsWinCE) OS.SetStretchBltMode(dstHdc, OS.COLORONCOLOR);
+ OS.SetStretchBltMode(dstHdc, OS.COLORONCOLOR);
OS.StretchBlt(dstHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCCOPY);
} else {
OS.BitBlt(dstHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcColorY, OS.SRCCOPY);
@@ -1260,9 +1195,9 @@ void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHe
return;
}
- boolean alphaBlendSupport = OS.IsWinNT && OS.WIN32_VERSION >= OS.VERSION(4, 10);
+ boolean alphaBlendSupport = true;
boolean isPrinter = OS.GetDeviceCaps(handle, OS.TECHNOLOGY) == OS.DT_RASPRINTER;
- if (alphaBlendSupport && isPrinter) {
+ if (isPrinter) {
int caps = OS.GetDeviceCaps(handle, OS.SHADEBLENDCAPS);
if (caps != 0) {
if (srcImage.alpha != -1) {
@@ -1388,21 +1323,17 @@ void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHe
/* Scale the foreground pixels with alpha */
OS.MoveMemory(dibBM.bmBits, srcData, sizeInBytes);
/*
- * Bug in WinCE and Win98. StretchBlt does not correctly stretch when
+ * When drawing to a printer, StretchBlt does not correctly stretch if
* the source and destination HDCs are the same. The workaround is to
* stretch to a temporary HDC and blit back into the original HDC.
- * Note that on WinCE StretchBlt correctly compresses the image when the
- * source and destination HDCs are the same.
- *
- * Note that this also fails when drawing to a printer.
*/
- if ((OS.IsWinCE && (destWidth > srcWidth || destHeight > srcHeight)) || (!OS.IsWinNT && !OS.IsWinCE) || isPrinter) {
+ if (isPrinter) {
long /*int*/ tempHdc = OS.CreateCompatibleDC(handle);
long /*int*/ tempDib = Image.createDIB(destWidth, destHeight, 32);
if (tempDib == 0) SWT.error(SWT.ERROR_NO_HANDLES);
long /*int*/ oldTempBitmap = OS.SelectObject(tempHdc, tempDib);
if (!simple && (srcWidth != destWidth || srcHeight != destHeight)) {
- if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
+ OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
} else {
OS.BitBlt(tempHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, OS.SRCCOPY);
@@ -1413,7 +1344,7 @@ void drawBitmapAlpha(Image srcImage, int srcX, int srcY, int srcWidth, int srcHe
OS.DeleteDC(tempHdc);
} else {
if (!simple && (srcWidth != destWidth || srcHeight != destHeight)) {
- if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
+ OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
OS.StretchBlt(memHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
} else {
OS.BitBlt(memHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, OS.SRCCOPY);
@@ -1474,19 +1405,11 @@ void drawBitmapTransparentByClipping(long /*int*/ srcHdc, long /*int*/ maskHdc,
int result = OS.GetClipRgn(handle, clip);
if (result == 1) OS.CombineRgn(rgn, rgn, clip, OS.RGN_AND);
OS.SelectClipRgn(handle, rgn);
- int rop2 = 0;
- if (!OS.IsWinCE) {
- rop2 = OS.GetROP2(handle);
- } else {
- rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN);
- OS.SetROP2 (handle, rop2);
- }
- int dwRop = rop2 == OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY;
+ int dwRop = OS.GetROP2(handle) == OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY;
if (!simple && (srcWidth != destWidth || srcHeight != destHeight)) {
- int mode = 0;
- if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
+ int mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
OS.StretchBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, dwRop);
- if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
+ OS.SetStretchBltMode(handle, mode);
} else {
OS.BitBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, dwRop);
}
@@ -1519,14 +1442,13 @@ void drawBitmapMask(Image srcImage, long /*int*/ srcColor, long /*int*/ srcMask,
oldTextColor = OS.SetTextColor(handle, 0);
}
if (!simple && (srcWidth != destWidth || srcHeight != destHeight)) {
- int mode = 0;
- if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
+ int mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCINVERT);
OS.SelectObject(srcHdc, srcMask);
OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCAND);
OS.SelectObject(srcHdc, srcColor);
OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCINVERT);
- if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
+ OS.SetStretchBltMode(handle, mode);
} else {
OS.BitBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, OS.SRCINVERT);
OS.SetTextColor(destHdc, 0);
@@ -1562,46 +1484,30 @@ void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int
boolean fixPalette = false;
if (bm.bmBitsPixel <= 8) {
if (isDib) {
- /* Palette-based DIBSECTION */
- if (OS.IsWinCE) {
- byte[] pBits = new byte[1];
- OS.MoveMemory(pBits, bm.bmBits, 1);
- byte oldValue = pBits[0];
- int mask = (0xFF << (8 - bm.bmBitsPixel)) & 0x00FF;
- pBits[0] = (byte)((srcImage.transparentPixel << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask));
- OS.MoveMemory(bm.bmBits, pBits, 1);
- int color = OS.GetPixel(srcHdc, 0, 0);
- pBits[0] = oldValue;
- OS.MoveMemory(bm.bmBits, pBits, 1);
- transBlue = (color & 0xFF0000) >> 16;
- transGreen = (color & 0xFF00) >> 8;
- transRed = color & 0xFF;
- } else {
- int maxColors = 1 << bm.bmBitsPixel;
- byte[] oldColors = new byte[maxColors * 4];
- OS.GetDIBColorTable(srcHdc, 0, maxColors, oldColors);
- int offset = srcImage.transparentPixel * 4;
- for (int i = 0; i < oldColors.length; i += 4) {
- if (i != offset) {
- if (oldColors[offset] == oldColors[i] && oldColors[offset+1] == oldColors[i+1] && oldColors[offset+2] == oldColors[i+2]) {
- fixPalette = true;
- break;
- }
+ int maxColors = 1 << bm.bmBitsPixel;
+ byte[] oldColors = new byte[maxColors * 4];
+ OS.GetDIBColorTable(srcHdc, 0, maxColors, oldColors);
+ int offset = srcImage.transparentPixel * 4;
+ for (int i = 0; i < oldColors.length; i += 4) {
+ if (i != offset) {
+ if (oldColors[offset] == oldColors[i] && oldColors[offset+1] == oldColors[i+1] && oldColors[offset+2] == oldColors[i+2]) {
+ fixPalette = true;
+ break;
}
}
- if (fixPalette) {
- byte[] newColors = new byte[oldColors.length];
- transRed = transGreen = transBlue = 0xff;
- newColors[offset] = (byte)transBlue;
- newColors[offset+1] = (byte)transGreen;
- newColors[offset+2] = (byte)transRed;
- OS.SetDIBColorTable(srcHdc, 0, maxColors, newColors);
- originalColors = oldColors;
- } else {
- transBlue = oldColors[offset] & 0xFF;
- transGreen = oldColors[offset+1] & 0xFF;
- transRed = oldColors[offset+2] & 0xFF;
- }
+ }
+ if (fixPalette) {
+ byte[] newColors = new byte[oldColors.length];
+ transRed = transGreen = transBlue = 0xff;
+ newColors[offset] = (byte)transBlue;
+ newColors[offset+1] = (byte)transGreen;
+ newColors[offset+2] = (byte)transRed;
+ OS.SetDIBColorTable(srcHdc, 0, maxColors, newColors);
+ originalColors = oldColors;
+ } else {
+ transBlue = oldColors[offset] & 0xFF;
+ transGreen = oldColors[offset+1] & 0xFF;
+ transRed = oldColors[offset+2] & 0xFF;
}
} else {
/* Palette-based bitmap */
@@ -1613,7 +1519,6 @@ void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int
bmiHeader.biBitCount = bm.bmBitsPixel;
byte[] bmi = new byte[BITMAPINFOHEADER.sizeof + numColors * 4];
OS.MoveMemory(bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetDIBits(srcHdc, srcImage.handle, 0, 0, null, bmi, OS.DIB_RGB_COLORS);
int offset = BITMAPINFOHEADER.sizeof + 4 * srcImage.transparentPixel;
transRed = bmi[offset + 2] & 0xFF;
@@ -1645,14 +1550,7 @@ void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int
if (!fixPalette) srcImage.transparentColor = transparentColor;
}
- if (OS.IsWinCE) {
- /*
- * Note in WinCE. TransparentImage uses the first entry of a palette
- * based image when there are multiple entries that have the same
- * transparent color.
- */
- OS.TransparentImage(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, transparentColor);
- } else if (originalColors == null && OS.IsWinNT && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
+ if (originalColors == null) {
int mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
OS.TransparentBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, transparentColor);
OS.SetStretchBltMode(handle, mode);
@@ -1675,7 +1573,7 @@ void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int
long /*int*/ oldTempBitmap = OS.SelectObject(tempHdc, tempBitmap);
OS.BitBlt(tempHdc, 0, 0, destWidth, destHeight, handle, destX, destY, OS.SRCCOPY);
if (!simple && (srcWidth != destWidth || srcHeight != destHeight)) {
- if (!OS.IsWinCE) OS.SetStretchBltMode(tempHdc, OS.COLORONCOLOR);
+ OS.SetStretchBltMode(tempHdc, OS.COLORONCOLOR);
OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCINVERT);
OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, maskHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCAND);
OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCINVERT);
@@ -1701,19 +1599,11 @@ void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int
void drawBitmap(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, boolean simple, BITMAP bm, int imgWidth, int imgHeight) {
long /*int*/ srcHdc = OS.CreateCompatibleDC(handle);
long /*int*/ oldSrcBitmap = OS.SelectObject(srcHdc, srcImage.handle);
- int rop2 = 0;
- if (!OS.IsWinCE) {
- rop2 = OS.GetROP2(handle);
- } else {
- rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN);
- OS.SetROP2 (handle, rop2);
- }
- int dwRop = rop2 == OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY;
+ int dwRop = OS.GetROP2(handle) == OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY;
if (!simple && (srcWidth != destWidth || srcHeight != destHeight)) {
- int mode = 0;
- if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
+ int mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
OS.StretchBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, dwRop);
- if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
+ OS.SetStretchBltMode(handle, mode);
} else {
OS.BitBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, dwRop);
}
@@ -1758,13 +1648,8 @@ void drawLineInPixels (int x1, int y1, int x2, int y2) {
x2--;
}
}
- if (OS.IsWinCE) {
- int [] points = new int [] {x1, y1, x2, y2};
- OS.Polyline (handle, points, points.length / 2);
- } else {
- OS.MoveToEx (handle, x1, y1, 0);
- OS.LineTo (handle, x2, y2);
- }
+ OS.MoveToEx (handle, x1, y1, 0);
+ OS.LineTo (handle, x2, y2);
if (data.lineWidth <= 1) {
OS.SetPixel (handle, x2, y2, data.foreground);
}
@@ -2107,47 +1992,7 @@ void drawRoundRectangleInPixels (int x, int y, int width, int height, int arcWid
if ((data.style & SWT.MIRRORED) != 0) {
if (data.lineWidth != 0 && data.lineWidth % 2 == 0) x--;
}
- if (OS.IsWinCE) {
- /*
- * Bug in WinCE PPC. On certain devices, RoundRect does not draw
- * all the pixels. The workaround is to draw a round rectangle
- * using lines and arcs.
- */
- if (width == 0 || height == 0) return;
- if (arcWidth == 0 || arcHeight == 0) {
- drawRectangleInPixels(x, y, width, height);
- return;
- }
- if (width < 0) {
- x += width;
- width = -width;
- }
- if (height < 0) {
- y += height;
- height = -height;
- }
- if (arcWidth < 0) arcWidth = -arcWidth;
- if (arcHeight < 0) arcHeight = -arcHeight;
- if (arcWidth > width) arcWidth = width;
- if (arcHeight > height) arcHeight = height;
-
- if (arcWidth < width) {
- drawLineInPixels(x+arcWidth/2, y, x+width-arcWidth/2, y);
- drawLineInPixels(x+arcWidth/2, y+height, x+width-arcWidth/2, y+height);
- }
- if (arcHeight < height) {
- drawLineInPixels(x, y+arcHeight/2, x, y+height-arcHeight/2);
- drawLineInPixels(x+width, y+arcHeight/2, x+width, y+height-arcHeight/2);
- }
- if (arcWidth != 0 && arcHeight != 0) {
- drawArcInPixels(x, y, arcWidth, arcHeight, 90, 90);
- drawArcInPixels(x+width-arcWidth, y, arcWidth, arcHeight, 0, 90);
- drawArcInPixels(x+width-arcWidth, y+height-arcHeight, arcWidth, arcHeight, 0, -90);
- drawArcInPixels(x, y+height-arcHeight, arcWidth, arcHeight, 180, 90);
- }
- } else {
- OS.RoundRect(handle, x,y,x+width+1,y+height+1, arcWidth, arcHeight);
- }
+ OS.RoundRect(handle, x,y,x+width+1,y+height+1, arcWidth, arcHeight);
}
void drawRoundRectangleGdip (long /*int*/ gdipGraphics, long /*int*/ pen, int x, int y, int width, int height, int arcWidth, int arcHeight) {
@@ -2266,13 +2111,6 @@ void drawStringInPixels (String string, int x, int y, boolean isTransparent) {
drawText(gdipGraphics, string, x, y, isTransparent ? SWT.DRAW_TRANSPARENT : 0, null);
return;
}
- int rop2 = 0;
- if (OS.IsWinCE) {
- rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
- OS.SetROP2(handle, rop2);
- } else {
- rop2 = OS.GetROP2(handle);
- }
checkGC(FONT | FOREGROUND_TEXT | BACKGROUND_TEXT);
int oldBkMode = OS.SetBkMode(handle, isTransparent ? OS.TRANSPARENT : OS.OPAQUE);
RECT rect = null;
@@ -2291,7 +2129,7 @@ void drawStringInPixels (String string, int x, int y, boolean isTransparent) {
}
x--;
}
- if (rop2 != OS.R2_XORPEN) {
+ if (OS.GetROP2(handle) != OS.R2_XORPEN) {
OS.ExtTextOutW(handle, x, y, flags, rect, buffer, length, null);
} else {
int foreground = OS.GetTextColor(handle);
@@ -2438,18 +2276,7 @@ void drawTextInPixels (String string, int x, int y, int flags) {
int length = buffer.length();
if (length == 0) return;
RECT rect = new RECT();
- /*
- * Feature in Windows. For some reason DrawText(), the maximum
- * value for the bottom and right coordinates for the RECT that
- * is used to position the text is different on between Windows
- * versions. If this value is larger than the maximum, nothing
- * is drawn. On Windows 98, the limit is 0x7FFF. On Windows CE,
- * NT, and 2000 it is 0x6FFFFFF. And on XP, it is 0x7FFFFFFF.
- * The fix is to use the the smaller limit for Windows 98 and the
- * larger limit on the other Windows platforms.
- */
- int limit = OS.IsWin95 ? 0x7FFF : 0x6FFFFFF;
- OS.SetRect(rect, x, y, limit, limit);
+ OS.SetRect(rect, x, y, 0x6FFFFFF, 0x6FFFFFF);
int uFormat = OS.DT_LEFT;
if ((flags & SWT.DRAW_DELIMITER) == 0) uFormat |= OS.DT_SINGLELINE;
if ((flags & SWT.DRAW_TAB) != 0) uFormat |= OS.DT_EXPANDTABS;
@@ -2457,16 +2284,9 @@ void drawTextInPixels (String string, int x, int y, int flags) {
if ((flags & SWT.DRAW_MNEMONIC) != 0 && (data.uiState & OS.UISF_HIDEACCEL) != 0) {
uFormat |= OS.DT_HIDEPREFIX;
}
- int rop2 = 0;
- if (OS.IsWinCE) {
- rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
- OS.SetROP2(handle, rop2);
- } else {
- rop2 = OS.GetROP2(handle);
- }
checkGC(FONT | FOREGROUND_TEXT | BACKGROUND_TEXT);
int oldBkMode = OS.SetBkMode(handle, (flags & SWT.DRAW_TRANSPARENT) != 0 ? OS.TRANSPARENT : OS.OPAQUE);
- if (rop2 != OS.R2_XORPEN) {
+ if (OS.GetROP2(handle) != OS.R2_XORPEN) {
OS.DrawText(handle, buffer, length, rect, uFormat);
} else {
int foreground = OS.GetTextColor(handle);
@@ -2499,7 +2319,6 @@ void drawTextInPixels (String string, int x, int y, int flags) {
}
boolean useGDIP (long /*int*/ hdc, char[] buffer) {
- if (OS.IsWinCE || !OS.IsUnicode) return false;
short[] glyphs = new short[buffer.length];
OS.GetGlyphIndicesW(hdc, buffer, buffer.length, glyphs, OS.GGI_MARK_NONEXISTING_GLYPHS);
for (int i = 0; i < glyphs.length; i++) {
@@ -2854,58 +2673,28 @@ void fillArcInPixels (int x, int y, int width, int height, int startAngle, int a
}
if ((data.style & SWT.MIRRORED) != 0) x--;
- /*
- * Feature in WinCE. The function Pie is not present in the
- * WinCE SDK. The fix is to emulate it by using Polygon.
- */
- if (OS.IsWinCE) {
- /* compute arc with a simple linear interpolation */
- if (arcAngle < 0) {
- startAngle += arcAngle;
- arcAngle = -arcAngle;
- }
- boolean drawSegments = true;
- if (arcAngle >= 360) {
- arcAngle = 360;
- drawSegments = false;
- }
- int[] points = new int[(arcAngle + 1) * 2 + (drawSegments ? 4 : 0)];
- int cteX = 2 * x + width;
- int cteY = 2 * y + height;
- int index = (drawSegments ? 2 : 0);
- for (int i = 0; i <= arcAngle; i++) {
- points[index++] = (cos(startAngle + i, width) + cteX) >> 1;
- points[index++] = (cteY - sin(startAngle + i, height)) >> 1;
- }
- if (drawSegments) {
- points[0] = points[points.length - 2] = cteX >> 1;
- points[1] = points[points.length - 1] = cteY >> 1;
- }
- OS.Polygon(handle, points, points.length / 2);
+ int x1, y1, x2, y2,tmp;
+ boolean isNegative;
+ if (arcAngle >= 360 || arcAngle <= -360) {
+ x1 = x2 = x + width;
+ y1 = y2 = y + height / 2;
} else {
- int x1, y1, x2, y2,tmp;
- boolean isNegative;
- if (arcAngle >= 360 || arcAngle <= -360) {
- x1 = x2 = x + width;
- y1 = y2 = y + height / 2;
- } else {
- isNegative = arcAngle < 0;
-
- arcAngle = arcAngle + startAngle;
- if (isNegative) {
- // swap angles
- tmp = startAngle;
- startAngle = arcAngle;
- arcAngle = tmp;
- }
- x1 = cos(startAngle, width) + x + width/2;
- y1 = -1 * sin(startAngle, height) + y + height/2;
-
- x2 = cos(arcAngle, width) + x + width/2;
- y2 = -1 * sin(arcAngle, height) + y + height/2;
+ isNegative = arcAngle < 0;
+
+ arcAngle = arcAngle + startAngle;
+ if (isNegative) {
+ // swap angles
+ tmp = startAngle;
+ startAngle = arcAngle;
+ arcAngle = tmp;
}
- OS.Pie(handle, x, y, x + width + 1, y + height + 1, x1, y1, x2, y2);
+ x1 = cos(startAngle, width) + x + width/2;
+ y1 = -1 * sin(startAngle, height) + y + height/2;
+
+ x2 = cos(arcAngle, width) + x + width/2;
+ y2 = -1 * sin(arcAngle, height) + y + height/2;
}
+ OS.Pie(handle, x, y, x + width + 1, y + height + 1, x1, y1, x2, y2);
}
/**
@@ -2990,23 +2779,13 @@ void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean
Gdip.Color_delete(toGpColor);
return;
}
- /* Use GradientFill if supported, only on Windows 98, 2000 and newer. */
/*
* Bug in Windows: On Windows 2000 when the device is a printer,
* GradientFill swaps red and blue color components, causing the
- * gradient to be printed in the wrong color. On Windows 98 when
- * the device is a printer, GradientFill does not fill completely
- * to the right edge of the rectangle. The fix is not to use
+ * gradient to be printed in the wrong color. The fix is not to use
* GradientFill for printer devices.
*/
- int rop2 = 0;
- if (OS.IsWinCE) {
- rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
- OS.SetROP2(handle, rop2);
- } else {
- rop2 = OS.GetROP2(handle);
- }
- if (OS.IsWinNT && rop2 != OS.R2_XORPEN && OS.GetDeviceCaps(handle, OS.TECHNOLOGY) != OS.DT_RASPRINTER) {
+ if (OS.GetROP2(handle) != OS.R2_XORPEN && OS.GetDeviceCaps(handle, OS.TECHNOLOGY) != OS.DT_RASPRINTER) {
final long /*int*/ hHeap = OS.GetProcessHeap();
final long /*int*/ pMesh = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, GRADIENT_RECT.sizeof + TRIVERTEX.sizeof * 2);
if (pMesh == 0) SWT.error(SWT.ERROR_NO_HANDLES);
@@ -3198,14 +2977,7 @@ void fillRectangleInPixels (int x, int y, int width, int height) {
Gdip.Graphics_FillRectangle(data.gdipGraphics, data.gdipBrush, x, y, width, height);
return;
}
- int rop2 = 0;
- if (OS.IsWinCE) {
- rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
- OS.SetROP2(handle, rop2);
- } else {
- rop2 = OS.GetROP2(handle);
- }
- int dwRop = rop2 == OS.R2_XORPEN ? OS.PATINVERT : OS.PATCOPY;
+ int dwRop = OS.GetROP2(handle) == OS.R2_XORPEN ? OS.PATINVERT : OS.PATCOPY;
OS.PatBlt(handle, x, y, width, height, dwRop);
}
@@ -3349,18 +3121,8 @@ void flush () {
public int getAdvanceWidth(char ch) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
checkGC(FONT);
- if (OS.IsWinCE) {
- SIZE size = new SIZE();
- OS.GetTextExtentPoint32W(handle, new char[]{ch}, 1, size);
- return size.cx;
- }
- int tch = ch;
- if (ch > 0x7F) {
- TCHAR buffer = new TCHAR(getCodePage(), ch, false);
- tch = buffer.tcharAt(0);
- }
int[] width = new int[1];
- OS.GetCharWidth(handle, tch, tch, width);
+ OS.GetCharWidth(handle, ch, ch, width);
return width[0];
}
@@ -3496,16 +3258,9 @@ public int getCharWidth(char ch) {
checkGC(FONT);
/* GetCharABCWidths only succeeds on truetype fonts */
- if (!OS.IsWinCE) {
- int tch = ch;
- if (ch > 0x7F) {
- TCHAR buffer = new TCHAR(getCodePage(), ch, false);
- tch = buffer.tcharAt (0);
- }
- int[] width = new int[3];
- if (OS.GetCharABCWidths(handle, tch, tch, width)) {
- return width[1];
- }
+ int[] width = new int[3];
+ if (OS.GetCharABCWidths(handle, ch, ch, width)) {
+ return width[1];
}
/* It wasn't a truetype font */
@@ -3584,11 +3339,9 @@ public void getClipping (Region region) {
Gdip.Graphics_SetTransform(gdipGraphics, matrix);
Gdip.Matrix_delete(identity);
Gdip.Matrix_delete(matrix);
- if (!OS.IsWinCE) {
- POINT pt = new POINT ();
- OS.GetWindowOrgEx (handle, pt);
- OS.OffsetRgn (hRgn, pt.x, pt.y);
- }
+ POINT pt = new POINT ();
+ OS.GetWindowOrgEx (handle, pt);
+ OS.OffsetRgn (hRgn, pt.x, pt.y);
OS.CombineRgn(region.handle, hRgn, 0, OS.RGN_COPY);
OS.DeleteObject(hRgn);
}
@@ -3596,7 +3349,7 @@ public void getClipping (Region region) {
return;
}
POINT pt = new POINT ();
- if (!OS.IsWinCE) OS.GetWindowOrgEx (handle, pt);
+ OS.GetWindowOrgEx (handle, pt);
int result = OS.GetClipRgn (handle, region.handle);
if (result != 1) {
RECT rect = new RECT();
@@ -3605,44 +3358,34 @@ public void getClipping (Region region) {
} else {
OS.OffsetRgn (region.handle, pt.x, pt.y);
}
- if (!OS.IsWinCE) {
- long /*int*/ metaRgn = OS.CreateRectRgn (0, 0, 0, 0);
- if (OS.GetMetaRgn (handle, metaRgn) != 0) {
- OS.OffsetRgn (metaRgn, pt.x, pt.y);
- OS.CombineRgn (region.handle, metaRgn, region.handle, OS.RGN_AND);
- }
- OS.DeleteObject(metaRgn);
- long /*int*/ hwnd = data.hwnd;
- if (hwnd != 0 && data.ps != null) {
- long /*int*/ sysRgn = OS.CreateRectRgn (0, 0, 0, 0);
- if (OS.GetRandomRgn (handle, sysRgn, OS.SYSRGN) == 1) {
- if (OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- if ((OS.GetLayout(handle) & OS.LAYOUT_RTL) != 0) {
- int nBytes = OS.GetRegionData (sysRgn, 0, null);
- int [] lpRgnData = new int [nBytes / 4];
- OS.GetRegionData (sysRgn, nBytes, lpRgnData);
- long /*int*/ newSysRgn = OS.ExtCreateRegion(new float [] {-1, 0, 0, 1, 0, 0}, nBytes, lpRgnData);
- OS.DeleteObject(sysRgn);
- sysRgn = newSysRgn;
- }
- }
- if (OS.IsWinNT) {
- OS.MapWindowPoints(0, hwnd, pt, 1);
- OS.OffsetRgn(sysRgn, pt.x, pt.y);
- }
- OS.CombineRgn (region.handle, sysRgn, region.handle, OS.RGN_AND);
+ long /*int*/ metaRgn = OS.CreateRectRgn (0, 0, 0, 0);
+ if (OS.GetMetaRgn (handle, metaRgn) != 0) {
+ OS.OffsetRgn (metaRgn, pt.x, pt.y);
+ OS.CombineRgn (region.handle, metaRgn, region.handle, OS.RGN_AND);
+ }
+ OS.DeleteObject(metaRgn);
+ long /*int*/ hwnd = data.hwnd;
+ if (hwnd != 0 && data.ps != null) {
+ long /*int*/ sysRgn = OS.CreateRectRgn (0, 0, 0, 0);
+ if (OS.GetRandomRgn (handle, sysRgn, OS.SYSRGN) == 1) {
+ if ((OS.GetLayout(handle) & OS.LAYOUT_RTL) != 0) {
+ int nBytes = OS.GetRegionData (sysRgn, 0, null);
+ int [] lpRgnData = new int [nBytes / 4];
+ OS.GetRegionData (sysRgn, nBytes, lpRgnData);
+ long /*int*/ newSysRgn = OS.ExtCreateRegion(new float [] {-1, 0, 0, 1, 0, 0}, nBytes, lpRgnData);
+ OS.DeleteObject(sysRgn);
+ sysRgn = newSysRgn;
}
- OS.DeleteObject(sysRgn);
+ OS.MapWindowPoints (0, hwnd, pt, 1);
+ OS.OffsetRgn (sysRgn, pt.x, pt.y);
+ OS.CombineRgn (region.handle, sysRgn, region.handle, OS.RGN_AND);
}
+ OS.DeleteObject(sysRgn);
}
}
int getCodePage () {
- if (OS.IsUnicode) return OS.CP_ACP;
- int[] lpCs = new int[8];
- int cs = OS.GetTextCharset(handle);
- OS.TranslateCharsetInfo(cs, lpCs, OS.TCI_SRCCHARSET);
- return lpCs[1];
+ return OS.CP_ACP;
}
long /*int*/ getFgBrush() {
@@ -3663,7 +3406,6 @@ long /*int*/ getFgBrush() {
*/
public int getFillRule() {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (OS.IsWinCE) return SWT.FILL_EVEN_ODD;
return OS.GetPolyFillMode(handle) == OS.WINDING ? SWT.FILL_WINDING : SWT.FILL_EVEN_ODD;
}
@@ -4018,14 +3760,7 @@ public void getTransform(Transform transform) {
*/
public boolean getXORMode() {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- int rop2 = 0;
- if (OS.IsWinCE) {
- rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN);
- OS.SetROP2 (handle, rop2);
- } else {
- rop2 = OS.GetROP2(handle);
- }
- return rop2 == OS.R2_XORPEN;
+ return OS.GetROP2(handle) == OS.R2_XORPEN;
}
void initGdip() {
@@ -4041,11 +3776,9 @@ void initGdip() {
*/
long /*int*/ hRgn = OS.CreateRectRgn(0, 0, 0, 0);
int result = OS.GetClipRgn(handle, hRgn);
- if (!OS.IsWinCE) {
- POINT pt = new POINT ();
- OS.GetWindowOrgEx (handle, pt);
- OS.OffsetRgn (hRgn, pt.x, pt.y);
- }
+ POINT pt = new POINT ();
+ OS.GetWindowOrgEx (handle, pt);
+ OS.OffsetRgn (hRgn, pt.x, pt.y);
OS.SelectClipRgn(handle, 0);
/*
@@ -4096,7 +3829,7 @@ long /*int*/ identity() {
OS.GetObject(image.handle, BITMAP.sizeof, bm);
width = bm.bmWidth;
} else {
- long /*int*/ hwnd = OS.IsWinCE ? data.hwnd : OS.WindowFromDC(handle);
+ long /*int*/ hwnd = OS.WindowFromDC(handle);
if (hwnd != 0) {
RECT rect = new RECT();
OS.GetClientRect(hwnd, rect);
@@ -4110,7 +3843,7 @@ long /*int*/ identity() {
}
}
POINT pt = new POINT ();
- if (!OS.IsWinCE) OS.GetWindowOrgEx (handle, pt);
+ OS.GetWindowOrgEx (handle, pt);
return Gdip.Matrix_new(-1, 0, 0, 1, width + 2 * pt.x, 0);
}
return Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
@@ -4148,14 +3881,12 @@ void init(Drawable drawable, GCData data, long /*int*/ hDC) {
}
int layout = data.layout;
if (layout != -1) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- int flags = OS.GetLayout(hDC);
- if ((flags & OS.LAYOUT_RTL) != (layout & OS.LAYOUT_RTL)) {
- flags &= ~OS.LAYOUT_RTL;
- OS.SetLayout(hDC, flags | layout);
- }
- if ((data.style & SWT.RIGHT_TO_LEFT) != 0) data.style |= SWT.MIRRORED;
+ int flags = OS.GetLayout(hDC);
+ if ((flags & OS.LAYOUT_RTL) != (layout & OS.LAYOUT_RTL)) {
+ flags &= ~OS.LAYOUT_RTL;
+ OS.SetLayout(hDC, flags | layout);
}
+ if ((data.style & SWT.RIGHT_TO_LEFT) != 0) data.style |= SWT.MIRRORED;
}
this.drawable = drawable;
this.data = data;
@@ -4443,13 +4174,13 @@ void setClipping(long /*int*/ clipRgn) {
}
} else {
POINT pt = null;
- if (hRgn != 0 && !OS.IsWinCE) {
+ if (hRgn != 0) {
pt = new POINT();
OS.GetWindowOrgEx(handle, pt);
OS.OffsetRgn(hRgn, -pt.x, -pt.y);
}
OS.SelectClipRgn(handle, hRgn);
- if (hRgn != 0 && !OS.IsWinCE) {
+ if (hRgn != 0) {
OS.OffsetRgn(hRgn, pt.x, pt.y);
}
}
@@ -4586,7 +4317,6 @@ public void setClipping (Region region) {
*/
public void setFillRule(int rule) {
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (OS.IsWinCE) return;
int mode = OS.ALTERNATE;
switch (rule) {
case SWT.FILL_WINDING: mode = OS.WINDING; break;
@@ -5320,11 +5050,9 @@ public static GC win32_new(long /*int*/ hDC, GCData data) {
GC gc = new GC();
gc.device = data.device;
data.style |= SWT.LEFT_TO_RIGHT;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- int flags = OS.GetLayout (hDC);
- if ((flags & OS.LAYOUT_RTL) != 0) {
- data.style |= SWT.RIGHT_TO_LEFT | SWT.MIRRORED;
- }
+ int flags = OS.GetLayout (hDC);
+ if ((flags & OS.LAYOUT_RTL) != 0) {
+ data.style |= SWT.RIGHT_TO_LEFT | SWT.MIRRORED;
}
gc.init(null, data, hDC);
return gc;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
index 950a761148..c78ec94891 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
@@ -119,12 +119,6 @@ public final class Image extends Resource implements Drawable {
int alpha = -1;
/**
- * the image data used to create this image if it is a
- * icon. Used only in WinCE
- */
- ImageData data;
-
- /**
* ImageFileNameProvider to provide file names at various Zoom levels
*/
private ImageFileNameProvider imageFileNameProvider;
@@ -285,12 +279,8 @@ public Image(Device device, Image srcImage, int flag) {
}
break;
case SWT.ICON:
- if (OS.IsWinCE) {
- init(srcImage.data);
- } else {
- handle = OS.CopyImage(srcImage.handle, OS.IMAGE_ICON, rect.width, rect.height, 0);
- if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
- }
+ handle = OS.CopyImage(srcImage.handle, OS.IMAGE_ICON, rect.width, rect.height, 0);
+ if (handle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
break;
default:
SWT.error(SWT.ERROR_INVALID_IMAGE);
@@ -823,7 +813,7 @@ void initNative(String filename) {
* Windows 7 when the image has a position offset in the first frame.
* The fix is to not use GDI+ image loading in this case.
*/
- if ((!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(6, 1)) && filename.toLowerCase().endsWith(".gif")) gdip = false;
+ if (OS.WIN32_VERSION >= OS.VERSION(6, 1) && filename.toLowerCase().endsWith(".gif")) gdip = false;
if (gdip) {
int length = filename.length();
char[] chars = new char[length+1];
@@ -977,119 +967,6 @@ void initNative(String filename) {
}
}
-/**
- * Create a DIB from a DDB without using GetDIBits. Note that
- * the DDB should not be selected into a HDC.
- */
-long /*int*/ createDIBFromDDB(long /*int*/ hDC, long /*int*/ hBitmap, int width, int height) {
-
- /* Determine the DDB depth */
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
- int depth = bits * planes;
-
- /* Determine the DIB palette */
- boolean isDirect = depth > 8;
- RGB[] rgbs = null;
- if (!isDirect) {
- int numColors = 1 << depth;
- byte[] logPalette = new byte[4 * numColors];
- OS.GetPaletteEntries(device.hPalette, 0, numColors, logPalette);
- rgbs = new RGB[numColors];
- for (int i = 0; i < numColors; i++) {
- rgbs[i] = new RGB(logPalette[i] & 0xFF, logPalette[i + 1] & 0xFF, logPalette[i + 2] & 0xFF);
- }
- }
-
- boolean useBitfields = OS.IsWinCE && (depth == 16 || depth == 32);
- BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
- bmiHeader.biSize = BITMAPINFOHEADER.sizeof;
- bmiHeader.biWidth = width;
- bmiHeader.biHeight = -height;
- bmiHeader.biPlanes = 1;
- bmiHeader.biBitCount = (short)depth;
- if (useBitfields) bmiHeader.biCompression = OS.BI_BITFIELDS;
- else bmiHeader.biCompression = OS.BI_RGB;
- byte[] bmi;
- if (isDirect) bmi = new byte[BITMAPINFOHEADER.sizeof + (useBitfields ? 12 : 0)];
- else bmi = new byte[BITMAPINFOHEADER.sizeof + rgbs.length * 4];
- OS.MoveMemory(bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
-
- /* Set the rgb colors into the bitmap info */
- int offset = BITMAPINFOHEADER.sizeof;
- if (isDirect) {
- if (useBitfields) {
- int redMask = 0;
- int greenMask = 0;
- int blueMask = 0;
- switch (depth) {
- case 16:
- redMask = 0x7C00;
- greenMask = 0x3E0;
- blueMask = 0x1F;
- /* little endian */
- bmi[offset] = (byte)((redMask & 0xFF) >> 0);
- bmi[offset + 1] = (byte)((redMask & 0xFF00) >> 8);
- bmi[offset + 2] = (byte)((redMask & 0xFF0000) >> 16);
- bmi[offset + 3] = (byte)((redMask & 0xFF000000) >> 24);
- bmi[offset + 4] = (byte)((greenMask & 0xFF) >> 0);
- bmi[offset + 5] = (byte)((greenMask & 0xFF00) >> 8);
- bmi[offset + 6] = (byte)((greenMask & 0xFF0000) >> 16);
- bmi[offset + 7] = (byte)((greenMask & 0xFF000000) >> 24);
- bmi[offset + 8] = (byte)((blueMask & 0xFF) >> 0);
- bmi[offset + 9] = (byte)((blueMask & 0xFF00) >> 8);
- bmi[offset + 10] = (byte)((blueMask & 0xFF0000) >> 16);
- bmi[offset + 11] = (byte)((blueMask & 0xFF000000) >> 24);
- break;
- case 32:
- redMask = 0xFF00;
- greenMask = 0xFF0000;
- blueMask = 0xFF000000;
- /* big endian */
- bmi[offset] = (byte)((redMask & 0xFF000000) >> 24);
- bmi[offset + 1] = (byte)((redMask & 0xFF0000) >> 16);
- bmi[offset + 2] = (byte)((redMask & 0xFF00) >> 8);
- bmi[offset + 3] = (byte)((redMask & 0xFF) >> 0);
- bmi[offset + 4] = (byte)((greenMask & 0xFF000000) >> 24);
- bmi[offset + 5] = (byte)((greenMask & 0xFF0000) >> 16);
- bmi[offset + 6] = (byte)((greenMask & 0xFF00) >> 8);
- bmi[offset + 7] = (byte)((greenMask & 0xFF) >> 0);
- bmi[offset + 8] = (byte)((blueMask & 0xFF000000) >> 24);
- bmi[offset + 9] = (byte)((blueMask & 0xFF0000) >> 16);
- bmi[offset + 10] = (byte)((blueMask & 0xFF00) >> 8);
- bmi[offset + 11] = (byte)((blueMask & 0xFF) >> 0);
- break;
- default:
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- }
- } else {
- for (int j = 0; j < rgbs.length; j++) {
- bmi[offset] = (byte)rgbs[j].blue;
- bmi[offset + 1] = (byte)rgbs[j].green;
- bmi[offset + 2] = (byte)rgbs[j].red;
- bmi[offset + 3] = 0;
- offset += 4;
- }
- }
- long /*int*/[] pBits = new long /*int*/[1];
- long /*int*/ hDib = OS.CreateDIBSection(0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
- if (hDib == 0) SWT.error(SWT.ERROR_NO_HANDLES);
-
- /* Bitblt DDB into DIB */
- long /*int*/ hdcSource = OS.CreateCompatibleDC(hDC);
- long /*int*/ hdcDest = OS.CreateCompatibleDC(hDC);
- long /*int*/ hOldSrc = OS.SelectObject(hdcSource, hBitmap);
- long /*int*/ hOldDest = OS.SelectObject(hdcDest, hDib);
- OS.BitBlt(hdcDest, 0, 0, width, height, hdcSource, 0, 0, OS.SRCCOPY);
- OS.SelectObject(hdcSource, hOldSrc);
- OS.SelectObject(hdcDest, hOldDest);
- OS.DeleteDC(hdcSource);
- OS.DeleteDC(hdcDest);
-
- return hDib;
-}
-
long /*int*/ [] createGdipImage() {
switch (type) {
case SWT.BITMAP: {
@@ -1195,11 +1072,7 @@ long /*int*/ [] createGdipImage() {
* detect this and create a PixelFormat32bppARGB image instead.
*/
ICONINFO iconInfo = new ICONINFO();
- if (OS.IsWinCE) {
- GetIconInfo(this, iconInfo);
- } else {
- OS.GetIconInfo(handle, iconInfo);
- }
+ OS.GetIconInfo(handle, iconInfo);
long /*int*/ hBitmap = iconInfo.hbmColor;
if (hBitmap == 0) hBitmap = iconInfo.hbmMask;
BITMAP bm = new BITMAP();
@@ -1267,7 +1140,6 @@ long /*int*/ [] createGdipImage() {
void destroy () {
if (memGC != null) memGC.dispose();
if (type == SWT.ICON) {
- if (OS.IsWinCE) data = null;
OS.DestroyIcon (handle);
} else {
OS.DeleteObject (handle);
@@ -1333,26 +1205,11 @@ public Color getBackground() {
long /*int*/ hOldObject = OS.SelectObject(hdcMem, handle);
int red = 0, green = 0, blue = 0;
if (bm.bmBitsPixel <= 8) {
- if (OS.IsWinCE) {
- byte[] pBits = new byte[1];
- OS.MoveMemory(pBits, bm.bmBits, 1);
- byte oldValue = pBits[0];
- int mask = (0xFF << (8 - bm.bmBitsPixel)) & 0x00FF;
- pBits[0] = (byte)((transparentPixel << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask));
- OS.MoveMemory(bm.bmBits, pBits, 1);
- int color = OS.GetPixel(hdcMem, 0, 0);
- pBits[0] = oldValue;
- OS.MoveMemory(bm.bmBits, pBits, 1);
- blue = (color & 0xFF0000) >> 16;
- green = (color & 0xFF00) >> 8;
- red = color & 0xFF;
- } else {
- byte[] color = new byte[4];
- OS.GetDIBColorTable(hdcMem, transparentPixel, 1, color);
- blue = color[0] & 0xFF;
- green = color[1] & 0xFF;
- red = color[2] & 0xFF;
- }
+ byte[] color = new byte[4];
+ OS.GetDIBColorTable(hdcMem, transparentPixel, 1, color);
+ blue = color[0] & 0xFF;
+ green = color[1] & 0xFF;
+ red = color[2] & 0xFF;
} else {
switch (bm.bmBitsPixel) {
case 16:
@@ -1434,20 +1291,16 @@ public Rectangle getBoundsInPixels() {
OS.GetObject(handle, BITMAP.sizeof, bm);
return new Rectangle(0, 0, width = bm.bmWidth, height = bm.bmHeight);
case SWT.ICON:
- if (OS.IsWinCE) {
- return new Rectangle(0, 0, width = data.width, height = data.height);
- } else {
- ICONINFO info = new ICONINFO();
- OS.GetIconInfo(handle, info);
- long /*int*/ hBitmap = info.hbmColor;
- if (hBitmap == 0) hBitmap = info.hbmMask;
- bm = new BITMAP();
- OS.GetObject(hBitmap, BITMAP.sizeof, bm);
- if (hBitmap == info.hbmMask) bm.bmHeight /= 2;
- if (info.hbmColor != 0) OS.DeleteObject(info.hbmColor);
- if (info.hbmMask != 0) OS.DeleteObject(info.hbmMask);
- return new Rectangle(0, 0, width = bm.bmWidth, height = bm.bmHeight);
- }
+ ICONINFO info = new ICONINFO();
+ OS.GetIconInfo(handle, info);
+ long /*int*/ hBitmap = info.hbmColor;
+ if (hBitmap == 0) hBitmap = info.hbmMask;
+ bm = new BITMAP();
+ OS.GetObject(hBitmap, BITMAP.sizeof, bm);
+ if (hBitmap == info.hbmMask) bm.bmHeight /= 2;
+ if (info.hbmColor != 0) OS.DeleteObject(info.hbmColor);
+ if (info.hbmMask != 0) OS.DeleteObject(info.hbmMask);
+ return new Rectangle(0, 0, width = bm.bmWidth, height = bm.bmHeight);
default:
SWT.error(SWT.ERROR_INVALID_IMAGE);
return null;
@@ -1557,9 +1410,7 @@ public ImageData getImageDataAtCurrentZoom() {
int depth, width, height;
switch (type) {
case SWT.ICON: {
- if (OS.IsWinCE) return data;
ICONINFO info = new ICONINFO();
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetIconInfo(handle, info);
/* Get the basic BITMAP information */
long /*int*/ hBitmap = info.hbmColor;
@@ -1601,13 +1452,11 @@ public ImageData getImageDataAtCurrentZoom() {
/* Find the size of the image and allocate data */
int imageSize;
/* Call with null lpBits to get the image size */
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetDIBits(hBitmapDC, hBitmap, 0, height, null, bmi, OS.DIB_RGB_COLORS);
OS.MoveMemory(bmiHeader, bmi, BITMAPINFOHEADER.sizeof);
imageSize = bmiHeader.biSizeImage;
byte[] data = new byte[imageSize];
/* Get the bitmap data */
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetDIBits(hBitmapDC, hBitmap, 0, height, data, bmi, OS.DIB_RGB_COLORS);
/* Calculate the palette */
PaletteData palette = null;
@@ -1634,7 +1483,6 @@ public ImageData getImageDataAtCurrentZoom() {
if (info.hbmColor == 0) {
/* Do the bottom half of the mask */
maskData = new byte[imageSize];
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetDIBits(hBitmapDC, hBitmap, height, height, maskData, bmi, OS.DIB_RGB_COLORS);
} else {
/* Do the entire mask */
@@ -1655,12 +1503,10 @@ public ImageData getImageDataAtCurrentZoom() {
bmi[offset + 7] = 0;
OS.SelectObject(hBitmapDC, info.hbmMask);
/* Call with null lpBits to get the image size */
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetDIBits(hBitmapDC, info.hbmMask, 0, height, null, bmi, OS.DIB_RGB_COLORS);
OS.MoveMemory(bmiHeader, bmi, BITMAPINFOHEADER.sizeof);
imageSize = bmiHeader.biSizeImage;
maskData = new byte[imageSize];
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetDIBits(hBitmapDC, info.hbmMask, 0, height, maskData, bmi, OS.DIB_RGB_COLORS);
/* Loop to invert the mask */
for (int i = 0; i < maskData.length; i++) {
@@ -1705,33 +1551,6 @@ public ImageData getImageDataAtCurrentZoom() {
boolean isDib = (bm.bmBits != 0);
/* Get the HDC for the device */
long /*int*/ hDC = device.internal_new_GC(null);
-
- /*
- * Feature in WinCE. GetDIBits is not available in WinCE. The
- * workaround is to create a temporary DIB from the DDB and use
- * the bmBits field of DIBSECTION to retrieve the image data.
- */
- long /*int*/ handle = this.handle;
- if (OS.IsWinCE) {
- if (!isDib) {
- boolean mustRestore = false;
- if (memGC != null && !memGC.isDisposed()) {
- memGC.flush ();
- mustRestore = true;
- GCData data = memGC.data;
- if (data.hNullBitmap != 0) {
- OS.SelectObject(memGC.handle, data.hNullBitmap);
- data.hNullBitmap = 0;
- }
- }
- handle = createDIBFromDDB(hDC, this.handle, width, height);
- if (mustRestore) {
- long /*int*/ hOldBitmap = OS.SelectObject(memGC.handle, this.handle);
- memGC.data.hNullBitmap = hOldBitmap;
- }
- isDib = true;
- }
- }
DIBSECTION dib = null;
if (isDib) {
dib = new DIBSECTION();
@@ -1779,7 +1598,6 @@ public ImageData getImageDataAtCurrentZoom() {
imageSize = dib.biSizeImage;
} else {
/* Call with null lpBits to get the image size */
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetDIBits(hBitmapDC, handle, 0, height, null, bmi, OS.DIB_RGB_COLORS);
OS.MoveMemory(bmiHeader, bmi, BITMAPINFOHEADER.sizeof);
imageSize = bmiHeader.biSizeImage;
@@ -1787,14 +1605,8 @@ public ImageData getImageDataAtCurrentZoom() {
byte[] data = new byte[imageSize];
/* Get the bitmap data */
if (isDib) {
- if (OS.IsWinCE && this.handle != handle) {
- /* get image data from the temporary DIB */
- OS.MoveMemory(data, dib.bmBits, imageSize);
- } else {
- OS.MoveMemory(data, bm.bmBits, imageSize);
- }
+ OS.MoveMemory(data, bm.bmBits, imageSize);
} else {
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.GetDIBits(hBitmapDC, handle, 0, height, data, bmi, OS.DIB_RGB_COLORS);
}
/* Calculate the palette */
@@ -1802,37 +1614,12 @@ public ImageData getImageDataAtCurrentZoom() {
if (depth <= 8) {
RGB[] rgbs = new RGB[numColors];
if (isDib) {
- if (OS.IsWinCE) {
- /*
- * Feature on WinCE. GetDIBColorTable is not supported.
- * The workaround is to set a pixel to the desired
- * palette index and use getPixel to get the corresponding
- * RGB value.
- */
- int red = 0, green = 0, blue = 0;
- byte[] pBits = new byte[1];
- OS.MoveMemory(pBits, bm.bmBits, 1);
- byte oldValue = pBits[0];
- int mask = (0xFF << (8 - bm.bmBitsPixel)) & 0x00FF;
- for (int i = 0; i < numColors; i++) {
- pBits[0] = (byte)((i << (8 - bm.bmBitsPixel)) | (pBits[0] & ~mask));
- OS.MoveMemory(bm.bmBits, pBits, 1);
- int color = OS.GetPixel(hBitmapDC, 0, 0);
- blue = (color & 0xFF0000) >> 16;
- green = (color & 0xFF00) >> 8;
- red = color & 0xFF;
- rgbs[i] = new RGB(red, green, blue);
- }
- pBits[0] = oldValue;
- OS.MoveMemory(bm.bmBits, pBits, 1);
- } else {
- byte[] colors = new byte[numColors * 4];
- OS.GetDIBColorTable(hBitmapDC, 0, numColors, colors);
- int colorIndex = 0;
- for (int i = 0; i < rgbs.length; i++) {
- rgbs[i] = new RGB(colors[colorIndex + 2] & 0xFF, colors[colorIndex + 1] & 0xFF, colors[colorIndex] & 0xFF);
- colorIndex += 4;
- }
+ byte[] colors = new byte[numColors * 4];
+ OS.GetDIBColorTable(hBitmapDC, 0, numColors, colors);
+ int colorIndex = 0;
+ for (int i = 0; i < rgbs.length; i++) {
+ rgbs[i] = new RGB(colors[colorIndex + 2] & 0xFF, colors[colorIndex + 1] & 0xFF, colors[colorIndex] & 0xFF);
+ colorIndex += 4;
}
} else {
int srcIndex = BITMAPINFOHEADER.sizeof;
@@ -1857,12 +1644,6 @@ public ImageData getImageDataAtCurrentZoom() {
OS.SelectPalette(hBitmapDC, oldPalette, false);
OS.RealizePalette(hBitmapDC);
}
- if (OS.IsWinCE) {
- if (handle != this.handle) {
- /* free temporary DIB */
- OS.DeleteObject (handle);
- }
- }
OS.DeleteDC(hBitmapDC);
/* Release the HDC for the device */
@@ -1944,62 +1725,16 @@ static long /*int*/ createDIB(int width, int height, int depth) {
bmiHeader.biHeight = -height;
bmiHeader.biPlanes = 1;
bmiHeader.biBitCount = (short)depth;
- if (OS.IsWinCE) bmiHeader.biCompression = OS.BI_BITFIELDS;
- else bmiHeader.biCompression = OS.BI_RGB;
- byte[] bmi = new byte[BITMAPINFOHEADER.sizeof + (OS.IsWinCE ? 12 : 0)];
+ bmiHeader.biCompression = OS.BI_RGB;
+ byte[] bmi = new byte[BITMAPINFOHEADER.sizeof];
OS.MoveMemory(bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
- /* Set the rgb colors into the bitmap info */
- if (OS.IsWinCE) {
- int redMask = 0xFF00;
- int greenMask = 0xFF0000;
- int blueMask = 0xFF000000;
- /* big endian */
- int offset = BITMAPINFOHEADER.sizeof;
- bmi[offset] = (byte)((redMask & 0xFF000000) >> 24);
- bmi[offset + 1] = (byte)((redMask & 0xFF0000) >> 16);
- bmi[offset + 2] = (byte)((redMask & 0xFF00) >> 8);
- bmi[offset + 3] = (byte)((redMask & 0xFF) >> 0);
- bmi[offset + 4] = (byte)((greenMask & 0xFF000000) >> 24);
- bmi[offset + 5] = (byte)((greenMask & 0xFF0000) >> 16);
- bmi[offset + 6] = (byte)((greenMask & 0xFF00) >> 8);
- bmi[offset + 7] = (byte)((greenMask & 0xFF) >> 0);
- bmi[offset + 8] = (byte)((blueMask & 0xFF000000) >> 24);
- bmi[offset + 9] = (byte)((blueMask & 0xFF0000) >> 16);
- bmi[offset + 10] = (byte)((blueMask & 0xFF00) >> 8);
- bmi[offset + 11] = (byte)((blueMask & 0xFF) >> 0);
- }
-
long /*int*/[] pBits = new long /*int*/[1];
return OS.CreateDIBSection(0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
}
-/**
- * Feature in WinCE. GetIconInfo is not available in WinCE.
- * The workaround is to cache the object ImageData for images
- * of type SWT.ICON. The bitmaps hbmMask and hbmColor can then
- * be reconstructed by using our version of getIconInfo.
- * This function takes an ICONINFO object and sets the fields
- * hbmMask and hbmColor with the corresponding bitmaps it has
- * created.
- * Note. These bitmaps must be freed - as they would have to be
- * if the regular GetIconInfo had been used.
- */
-static void GetIconInfo(Image image, ICONINFO info) {
- long /*int*/ [] result = init(image.device, null, image.data);
- info.hbmColor = result[0];
- info.hbmMask = result[1];
-}
-
static long /*int*/ [] init(Device device, Image image, ImageData i) {
- /*
- * BUG in Windows 98:
- * A monochrome DIBSection will display as solid black
- * on Windows 98 machines, even though it contains the
- * correct data. The fix is to convert 1-bit ImageData
- * into 4-bit ImageData before creating the image.
- */
/* Windows does not support 2-bit images. Convert to 4-bit image. */
- if ((OS.IsWin95 && i.depth == 1 && i.getTransparencyType() != SWT.TRANSPARENCY_MASK) || i.depth == 2) {
+ if (i.depth == 2) {
ImageData img = new ImageData(i.width, i.height, 4, i.palette);
ImageData.blit(ImageData.BLIT_SRC,
i.data, i.depth, i.bytesPerLine, i.getByteOrder(), 0, 0, i.width, i.height, null, null, null,
@@ -2020,14 +1755,6 @@ static long /*int*/ [] init(Device device, Image image, ImageData i) {
* MSDN BITMAPINFOHEADER. Make sure the image is
* Windows-supported.
*/
- /*
- * Note on WinCE. CreateDIBSection requires the biCompression
- * field of the BITMAPINFOHEADER to be set to BI_BITFIELDS for
- * 16 and 32 bit direct images (see MSDN for CreateDIBSection).
- * In this case, the color mask can be set to any value. For
- * consistency, it is set to the same mask used by non WinCE
- * platforms in BI_RGB mode.
- */
if (i.palette.isDirect) {
final PaletteData palette = i.palette;
final int redMask = palette.redMask;
@@ -2081,63 +1808,23 @@ static long /*int*/ [] init(Device device, Image image, ImageData i) {
}
/* Construct bitmap info header by hand */
RGB[] rgbs = i.palette.getRGBs();
- boolean useBitfields = OS.IsWinCE && (i.depth == 16 || i.depth == 32);
BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
bmiHeader.biSize = BITMAPINFOHEADER.sizeof;
bmiHeader.biWidth = i.width;
bmiHeader.biHeight = -i.height;
bmiHeader.biPlanes = 1;
bmiHeader.biBitCount = (short)i.depth;
- if (useBitfields) bmiHeader.biCompression = OS.BI_BITFIELDS;
- else bmiHeader.biCompression = OS.BI_RGB;
+ bmiHeader.biCompression = OS.BI_RGB;
bmiHeader.biClrUsed = rgbs == null ? 0 : rgbs.length;
byte[] bmi;
if (i.palette.isDirect)
- bmi = new byte[BITMAPINFOHEADER.sizeof + (useBitfields ? 12 : 0)];
+ bmi = new byte[BITMAPINFOHEADER.sizeof];
else
bmi = new byte[BITMAPINFOHEADER.sizeof + rgbs.length * 4];
OS.MoveMemory(bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
/* Set the rgb colors into the bitmap info */
int offset = BITMAPINFOHEADER.sizeof;
- if (i.palette.isDirect) {
- if (useBitfields) {
- PaletteData palette = i.palette;
- int redMask = palette.redMask;
- int greenMask = palette.greenMask;
- int blueMask = palette.blueMask;
- /*
- * The color masks must be written based on the
- * endianness of the ImageData.
- */
- if (i.getByteOrder() == ImageData.LSB_FIRST) {
- bmi[offset] = (byte)((redMask & 0xFF) >> 0);
- bmi[offset + 1] = (byte)((redMask & 0xFF00) >> 8);
- bmi[offset + 2] = (byte)((redMask & 0xFF0000) >> 16);
- bmi[offset + 3] = (byte)((redMask & 0xFF000000) >> 24);
- bmi[offset + 4] = (byte)((greenMask & 0xFF) >> 0);
- bmi[offset + 5] = (byte)((greenMask & 0xFF00) >> 8);
- bmi[offset + 6] = (byte)((greenMask & 0xFF0000) >> 16);
- bmi[offset + 7] = (byte)((greenMask & 0xFF000000) >> 24);
- bmi[offset + 8] = (byte)((blueMask & 0xFF) >> 0);
- bmi[offset + 9] = (byte)((blueMask & 0xFF00) >> 8);
- bmi[offset + 10] = (byte)((blueMask & 0xFF0000) >> 16);
- bmi[offset + 11] = (byte)((blueMask & 0xFF000000) >> 24);
- } else {
- bmi[offset] = (byte)((redMask & 0xFF000000) >> 24);
- bmi[offset + 1] = (byte)((redMask & 0xFF0000) >> 16);
- bmi[offset + 2] = (byte)((redMask & 0xFF00) >> 8);
- bmi[offset + 3] = (byte)((redMask & 0xFF) >> 0);
- bmi[offset + 4] = (byte)((greenMask & 0xFF000000) >> 24);
- bmi[offset + 5] = (byte)((greenMask & 0xFF0000) >> 16);
- bmi[offset + 6] = (byte)((greenMask & 0xFF00) >> 8);
- bmi[offset + 7] = (byte)((greenMask & 0xFF) >> 0);
- bmi[offset + 8] = (byte)((blueMask & 0xFF000000) >> 24);
- bmi[offset + 9] = (byte)((blueMask & 0xFF0000) >> 16);
- bmi[offset + 10] = (byte)((blueMask & 0xFF00) >> 8);
- bmi[offset + 11] = (byte)((blueMask & 0xFF) >> 0);
- }
- }
- } else {
+ if (!i.palette.isDirect) {
for (int j = 0; j < rgbs.length; j++) {
bmi[offset] = (byte)rgbs[j].blue;
bmi[offset + 1] = (byte)rgbs[j].green;
@@ -2197,7 +1884,6 @@ static long /*int*/ [] init(Device device, Image image, ImageData i) {
OS.DeleteObject(hMask);
image.handle = hIcon;
image.type = SWT.ICON;
- if (OS.IsWinCE) image.data = i;
}
} else {
if (image == null) {
@@ -2414,10 +2100,6 @@ public boolean isDisposed() {
* </ul>
*/
public void setBackground(Color color) {
- /*
- * Note. Not implemented on WinCE.
- */
- if (OS.IsWinCE) return;
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
if (color == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
@@ -2434,13 +2116,11 @@ public void setBackground(Color color) {
OS.SelectObject(hdcMem, handle);
int maxColors = 1 << bm.bmBitsPixel;
byte[] colors = new byte[maxColors * 4];
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
int numColors = OS.GetDIBColorTable(hdcMem, 0, maxColors, colors);
int offset = transparentPixel * 4;
colors[offset] = (byte)color.getBlue();
colors[offset + 1] = (byte)color.getGreen();
colors[offset + 2] = (byte)color.getRed();
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
OS.SetDIBColorTable(hdcMem, 0, numColors, colors);
OS.DeleteDC(hdcMem);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java
index d7cfba8ee3..81deb04863 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Region.java
@@ -120,7 +120,6 @@ public void add (int[] pointArray) {
}
void addInPixels (int[] pointArray) {
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
long /*int*/ polyRgn = OS.CreatePolygonRgn(pointArray, pointArray.length / 2, OS.ALTERNATE);
OS.CombineRgn (handle, handle, polyRgn, OS.RGN_OR);
OS.DeleteObject (polyRgn);
@@ -491,7 +490,6 @@ public void subtract (int[] pointArray) {
}
void subtractInPixels (int[] pointArray) {
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
long /*int*/ polyRgn = OS.CreatePolygonRgn(pointArray, pointArray.length / 2, OS.ALTERNATE);
OS.CombineRgn (handle, handle, polyRgn, OS.RGN_DIFF);
OS.DeleteObject (polyRgn);
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 5ca282f7ff..0a5ddee0a0 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
@@ -711,7 +711,7 @@ void drawInPixels (GC gc, int x, int y, int selectionStart, int selectionEnd, Co
if (extents) {
int width;
if ((flags & SWT.FULL_SELECTION) != 0) {
- width = OS.IsWin95 ? 0x7FFF : 0x6FFFFFF;
+ width = 0x6FFFFFF;
} else {
width = lineHeight / 3;
}
@@ -2697,9 +2697,7 @@ StyleItem[] itemize () {
*
* Note: This code is intentionally commented because it causes bug#377472.
*/
-// if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
-// scriptControl.fReserved = 0x1;
-// }
+// scriptControl.fReserved = 0x1;
OS.ScriptApplyDigitSubstitution(null, scriptControl, scriptState);
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 f1da175294..582a7ec1bc 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
@@ -141,13 +141,10 @@ static long /*int*/ EnumSystemLanguageGroupsProc(long /*int*/ lpLangGrpId, long
*/
public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, int y) {
int length = renderDx.length;
-
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- if (OS.GetLayout (gc.handle) != 0) {
- reverse(renderDx);
- renderDx[length-1]--; //fixes bug 40006
- reverse(renderBuffer);
- }
+ if (OS.GetLayout (gc.handle) != 0) {
+ reverse(renderDx);
+ renderDx[length-1]--; //fixes bug 40006
+ reverse(renderBuffer);
}
// render transparently to avoid overlapping segments. fixes bug 40006
int oldBkMode = OS.SetBkMode(gc.handle, OS.TRANSPARENT);
@@ -176,12 +173,7 @@ public static char[] getRenderInfo(GC gc, String text, int[] order, byte[] class
int fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle);
long /*int*/ hHeap = OS.GetProcessHeap();
int[] lpCs = new int[8];
- int cs = OS.GetTextCharset(gc.handle);
- boolean isRightOriented = false;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- isRightOriented = OS.GetLayout(gc.handle) != 0;
- }
- OS.TranslateCharsetInfo(cs, lpCs, OS.TCI_SRCCHARSET);
+ boolean isRightOriented = OS.GetLayout(gc.handle) != 0;
TCHAR textBuffer = new TCHAR(lpCs[1], text, false);
int byteCount = textBuffer.length();
boolean linkBefore = (flags & LINKBEFORE) == LINKBEFORE;
@@ -309,14 +301,9 @@ public static void getOrderInfo(GC gc, String text, int[] order, byte[] classBuf
int fontLanguageInfo = OS.GetFontLanguageInfo(gc.handle);
long /*int*/ hHeap = OS.GetProcessHeap();
int[] lpCs = new int[8];
- int cs = OS.GetTextCharset(gc.handle);
- OS.TranslateCharsetInfo(cs, lpCs, OS.TCI_SRCCHARSET);
TCHAR textBuffer = new TCHAR(lpCs[1], text, false);
int byteCount = textBuffer.length();
- boolean isRightOriented = false;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- isRightOriented = OS.GetLayout(gc.handle) != 0;
- }
+ boolean isRightOriented = OS.GetLayout(gc.handle) != 0;
GCP_RESULTS result = new GCP_RESULTS();
result.lStructSize = GCP_RESULTS.sizeof;
@@ -439,7 +426,6 @@ static boolean isBidiLang(long /*int*/ lang) {
* false on Windows CE.
*/
public static boolean isBidiPlatform() {
- if (OS.IsWinCE) return false;
if (isBidiPlatform != -1) return isBidiPlatform == 1; // already set
isBidiPlatform = 0;
@@ -593,8 +579,6 @@ public static void setKeyboardLanguage(int language) {
* could not be changed
*/
public static boolean setOrientation (long /*int*/ hwnd, int orientation) {
- if (OS.IsWinCE) return false;
- if (OS.WIN32_VERSION < OS.VERSION(4, 10)) return false;
int bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
if ((orientation & SWT.RIGHT_TO_LEFT) != 0) {
bits |= OS.WS_EX_LAYOUTRTL;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
index b8f941d0fe..e5c7374c8f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
@@ -26,28 +26,7 @@ public ImageList (int style) {
public ImageList (int style, int width, int height) {
this.style = style;
- int flags = OS.ILC_MASK;
- if (OS.IsWinCE) {
- flags |= OS.ILC_COLOR;
- } else {
- if (OS.COMCTL32_MAJOR >= 6) {
- flags |= OS.ILC_COLOR32;
- } else {
- long /*int*/ hDC = OS.GetDC (0);
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
- OS.ReleaseDC (0, hDC);
- int depth = bits * planes;
- switch (depth) {
- case 4: flags |= OS.ILC_COLOR4; break;
- case 8: flags |= OS.ILC_COLOR8; break;
- case 16: flags |= OS.ILC_COLOR16; break;
- case 24: flags |= OS.ILC_COLOR24; break;
- case 32: flags |= OS.ILC_COLOR32; break;
- default: flags |= OS.ILC_COLOR; break;
- }
- }
- }
+ int flags = OS.ILC_MASK | OS.ILC_COLOR32;
if ((style & SWT.RIGHT_TO_LEFT) != 0) flags |= OS.ILC_MIRROR;
handle = OS.ImageList_Create (width, height, flags, 16, 16);
images = new Image [4];
@@ -99,37 +78,16 @@ long /*int*/ copyBitmap (long /*int*/ hImage, int width, int height) {
* it to 24-bit depth.
*/
long /*int*/ hBitmap;
- if (bm.bmBitsPixel == 32 && OS.COMCTL32_MAJOR >= 6) {
+ if (bm.bmBitsPixel == 32) {
BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
bmiHeader.biSize = BITMAPINFOHEADER.sizeof;
bmiHeader.biWidth = width;
bmiHeader.biHeight = -height;
bmiHeader.biPlanes = 1;
bmiHeader.biBitCount = (short)24;
- if (OS.IsWinCE) bmiHeader.biCompression = OS.BI_BITFIELDS;
- else bmiHeader.biCompression = OS.BI_RGB;
- byte[] bmi = new byte[BITMAPINFOHEADER.sizeof + (OS.IsWinCE ? 12 : 0)];
+ bmiHeader.biCompression = OS.BI_RGB;
+ byte[] bmi = new byte[BITMAPINFOHEADER.sizeof];
OS.MoveMemory(bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
- /* Set the rgb colors into the bitmap info */
- if (OS.IsWinCE) {
- int redMask = 0xFF00;
- int greenMask = 0xFF0000;
- int blueMask = 0xFF000000;
- /* big endian */
- int offset = BITMAPINFOHEADER.sizeof;
- bmi[offset] = (byte)((redMask & 0xFF000000) >> 24);
- bmi[offset + 1] = (byte)((redMask & 0xFF0000) >> 16);
- bmi[offset + 2] = (byte)((redMask & 0xFF00) >> 8);
- bmi[offset + 3] = (byte)((redMask & 0xFF) >> 0);
- bmi[offset + 4] = (byte)((greenMask & 0xFF000000) >> 24);
- bmi[offset + 5] = (byte)((greenMask & 0xFF0000) >> 16);
- bmi[offset + 6] = (byte)((greenMask & 0xFF00) >> 8);
- bmi[offset + 7] = (byte)((greenMask & 0xFF) >> 0);
- bmi[offset + 8] = (byte)((blueMask & 0xFF000000) >> 24);
- bmi[offset + 9] = (byte)((blueMask & 0xFF0000) >> 16);
- bmi[offset + 10] = (byte)((blueMask & 0xFF00) >> 8);
- bmi[offset + 11] = (byte)((blueMask & 0xFF) >> 0);
- }
long /*int*/[] pBits = new long /*int*/[1];
hBitmap = OS.CreateDIBSection(0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
} else {
@@ -137,7 +95,7 @@ long /*int*/ copyBitmap (long /*int*/ hImage, int width, int height) {
}
OS.SelectObject (hdc2, hBitmap);
if (width != bm.bmWidth || height != bm.bmHeight) {
- if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
+ OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
OS.StretchBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, OS.SRCCOPY);
} else {
OS.BitBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, OS.SRCCOPY);
@@ -149,7 +107,6 @@ long /*int*/ copyBitmap (long /*int*/ hImage, int width, int height) {
}
long /*int*/ copyIcon (long /*int*/ hImage, int width, int height) {
- if (OS.IsWinCE) SWT.error(SWT.ERROR_NOT_IMPLEMENTED);
long /*int*/ hIcon = OS.CopyImage (hImage, OS.IMAGE_ICON, width, height, 0);
return hIcon != 0 ? hIcon : hImage;
}
@@ -230,7 +187,7 @@ long /*int*/ copyWithAlpha (long /*int*/ hBitmap, int background, byte[] alphaDa
long /*int*/ memDib2 = OS.CreateDIBSection (0, bmi2, OS.DIB_RGB_COLORS, pBits2, 0, 0);
long /*int*/ memHdc2 = OS.CreateCompatibleDC (hdc);
long /*int*/ oldMemBitmap2 = OS.SelectObject (memHdc2, memDib2);
- if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc2, OS.COLORONCOLOR);
+ OS.SetStretchBltMode(memHdc2, OS.COLORONCOLOR);
OS.StretchBlt (memHdc2, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
OS.SelectObject (memHdc2, oldMemBitmap2);
OS.DeleteDC (memHdc2);
@@ -268,7 +225,7 @@ long /*int*/ createMaskFromAlpha (ImageData data, int destWidth, int destHeight)
long /*int*/ hdc2 = OS.CreateCompatibleDC (hdc);
long /*int*/ hMask2 = OS.CreateBitmap (destWidth, destHeight, 1, 1, null);
OS.SelectObject (hdc2, hMask2);
- if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
+ OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
OS.StretchBlt (hdc2, 0, 0, destWidth, destHeight, hdc1, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
OS.DeleteDC (hdc1);
OS.DeleteDC (hdc2);
@@ -300,7 +257,7 @@ long /*int*/ createMask (long /*int*/ hBitmap, int destWidth, int destHeight, in
*/
boolean isDib = bm.bmBits != 0;
byte[] originalColors = null;
- if (!OS.IsWinCE && transparentPixel != -1 && isDib && bm.bmBitsPixel <= 8) {
+ if (transparentPixel != -1 && isDib && bm.bmBitsPixel <= 8) {
int maxColors = 1 << bm.bmBitsPixel;
byte[] oldColors = new byte[maxColors * 4];
OS.GetDIBColorTable(hdc1, 0, maxColors, oldColors);
@@ -319,7 +276,7 @@ long /*int*/ createMask (long /*int*/ hBitmap, int destWidth, int destHeight, in
long /*int*/ hdc2 = OS.CreateCompatibleDC (hDC);
OS.SelectObject (hdc2, hMask);
if (destWidth != srcWidth || destHeight != srcHeight) {
- if (!OS.IsWinCE) OS.SetStretchBltMode (hdc2, OS.COLORONCOLOR);
+ OS.SetStretchBltMode (hdc2, OS.COLORONCOLOR);
OS.StretchBlt (hdc2, 0, 0, destWidth, destHeight, hdc1, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
} else {
OS.BitBlt (hdc2, 0, 0, destWidth, destHeight, hdc1, 0, 0, OS.SRCCOPY);
@@ -425,7 +382,7 @@ void set (int index, Image image, int count) {
}
}
}
- if (OS.COMCTL32_MAJOR >= 6 && !fullyTransparent) {
+ if (!fullyTransparent) {
hBitmap = copyWithAlpha (hImage, -1, data.alphaData, cx [0], cy [0]);
} else {
hBitmap = copyBitmap (hImage, cx [0], cy [0]);
@@ -456,13 +413,9 @@ void set (int index, Image image, int count) {
break;
}
case SWT.ICON: {
- if (OS.IsWinCE) {
- OS.ImageList_ReplaceIcon (handle, index == count ? -1 : index, hImage);
- } else {
- long /*int*/ hIcon = copyIcon (hImage, cx [0], cy [0]);
- OS.ImageList_ReplaceIcon (handle, index == count ? -1 : index, hIcon);
- OS.DestroyIcon (hIcon);
- }
+ long /*int*/ hIcon = copyIcon (hImage, cx [0], cy [0]);
+ OS.ImageList_ReplaceIcon (handle, index == count ? -1 : index, hIcon);
+ OS.DestroyIcon (hIcon);
break;
}
}
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 9b9db7148a..513a96ea0e 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
@@ -62,8 +62,8 @@ public class Button extends Control {
static {
long /*int*/ hBitmap = OS.LoadBitmap (0, OS.OBM_CHECKBOXES);
if (hBitmap == 0) {
- CHECK_WIDTH = OS.GetSystemMetrics (OS.IsWinCE ? OS.SM_CXSMICON : OS.SM_CXVSCROLL);
- CHECK_HEIGHT = OS.GetSystemMetrics (OS.IsWinCE ? OS.SM_CYSMICON : OS.SM_CYVSCROLL);
+ CHECK_WIDTH = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
+ CHECK_HEIGHT = OS.GetSystemMetrics (OS.SM_CYVSCROLL);
} else {
BITMAP bitmap = new BITMAP ();
OS.GetObject (hBitmap, BITMAP.sizeof, bitmap);
@@ -120,170 +120,72 @@ public Button (Composite parent, int style) {
void _setImage (Image image) {
if ((style & SWT.COMMAND) != 0) return;
- if (OS.COMCTL32_MAJOR >= 6) {
- if (imageList != null) imageList.dispose ();
- imageList = null;
- if (image != null) {
- imageList = new ImageList (style & SWT.RIGHT_TO_LEFT);
- if (OS.IsWindowEnabled (handle)) {
- imageList.add (image);
- } else {
- if (disabledImage != null) disabledImage.dispose ();
- disabledImage = new Image (display, image, SWT.IMAGE_DISABLE);
- imageList.add (disabledImage);
- }
- BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
- buttonImageList.himl = imageList.getHandle ();
- int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE), newBits = oldBits;
- newBits &= ~(OS.BS_LEFT | OS.BS_CENTER | OS.BS_RIGHT);
- if ((style & SWT.LEFT) != 0) newBits |= OS.BS_LEFT;
- if ((style & SWT.CENTER) != 0) newBits |= OS.BS_CENTER;
- if ((style & SWT.RIGHT) != 0) newBits |= OS.BS_RIGHT;
- if (text.length () == 0) {
- if ((style & SWT.LEFT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
- if ((style & SWT.CENTER) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_CENTER;
- if ((style & SWT.RIGHT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_RIGHT;
- } else {
- buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
- buttonImageList.margin_left = computeLeftMargin ();
- buttonImageList.margin_right = MARGIN;
- newBits &= ~(OS.BS_CENTER | OS.BS_RIGHT);
- newBits |= OS.BS_LEFT;
- }
- if (newBits != oldBits) {
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- OS.InvalidateRect (handle, null, true);
- }
- OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
+ if (imageList != null) imageList.dispose ();
+ imageList = null;
+ if (image != null) {
+ imageList = new ImageList (style & SWT.RIGHT_TO_LEFT);
+ if (OS.IsWindowEnabled (handle)) {
+ imageList.add (image);
} else {
- OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, 0);
+ if (disabledImage != null) disabledImage.dispose ();
+ disabledImage = new Image (display, image, SWT.IMAGE_DISABLE);
+ imageList.add (disabledImage);
}
- /*
- * Bug in Windows. Under certain cirumstances yet to be
- * isolated, BCM_SETIMAGELIST does not redraw the control
- * when a new image is set. The fix is to force a redraw.
- */
- OS.InvalidateRect (handle, null, true);
- } else {
- if (image2 != null) image2.dispose ();
- image2 = null;
- long /*int*/ hImage = 0;
- int imageBits = 0, fImageType = 0;
- if (image != null) {
- switch (image.type) {
- case SWT.BITMAP: {
- Rectangle rect = image.getBounds ();
- ImageData data = image.getImageData ();
- switch (data.getTransparencyType ()) {
- case SWT.TRANSPARENCY_PIXEL:
- if (rect.width <= ICON_WIDTH && rect.height <= ICON_HEIGHT) {
- image2 = new Image (display, data, data.getTransparencyMask ());
- hImage = image2.handle;
- imageBits = OS.BS_ICON;
- fImageType = OS.IMAGE_ICON;
- break;
- }
- //$FALL-THROUGH$
- case SWT.TRANSPARENCY_ALPHA:
- image2 = new Image (display, rect.width, rect.height);
- GC gc = new GC (image2);
- gc.setBackground (getBackground ());
- gc.fillRectangle (rect);
- gc.drawImage (image, 0, 0);
- gc.dispose ();
- hImage = image2.handle;
- imageBits = OS.BS_BITMAP;
- fImageType = OS.IMAGE_BITMAP;
- break;
- case SWT.TRANSPARENCY_NONE:
- hImage = image.handle;
- imageBits = OS.BS_BITMAP;
- fImageType = OS.IMAGE_BITMAP;
- break;
- }
- break;
- }
- case SWT.ICON: {
- hImage = image.handle;
- imageBits = OS.BS_ICON;
- fImageType = OS.IMAGE_ICON;
- break;
- }
- }
- /*
- * Feature in Windows. The button control mirrors its image when the
- * flag WS_EX_LAYOUTRTL is set. This behaviour is not desirable in SWT.
- * The fix is to set a mirrored version of real image in the button.
- */
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- Rectangle rect = image.getBoundsInPixels ();
- long /*int*/ hDC = OS.GetDC (handle);
- long /*int*/ dstHdc = OS.CreateCompatibleDC (hDC);
- long /*int*/ hBitmap = OS.CreateCompatibleBitmap (hDC, rect.width, rect.height);
- long /*int*/ oldBitmap = OS.SelectObject (dstHdc, hBitmap);
- OS.SetLayout (dstHdc, OS.LAYOUT_RTL);
- if (fImageType == OS.IMAGE_BITMAP) {
- long /*int*/ srcHdc = OS.CreateCompatibleDC (hDC);
- long /*int*/ oldSrcBitmap = OS.SelectObject (srcHdc, hImage);
- OS.SetLayout (dstHdc, 0);
- OS.BitBlt (dstHdc, 0, 0, rect.width, rect.height, srcHdc, 0, 0, OS.SRCCOPY);
- OS.SelectObject (srcHdc, oldSrcBitmap);
- OS.DeleteDC (srcHdc);
- } else {
- Control control = findBackgroundControl ();
- if (control == null) control = this;
- long /*int*/ newBrush = OS.CreateSolidBrush (control.getBackgroundPixel ());
- long /*int*/ oldBrush = OS.SelectObject (dstHdc, newBrush);
- OS.PatBlt (dstHdc, 0, 0, rect.width, rect.height, OS.PATCOPY);
- OS.DrawIconEx (dstHdc, 0, 0, hImage, 0, 0, 0, 0, OS.DI_NORMAL);
- OS.SelectObject (dstHdc, oldBrush);
- OS.DeleteObject (newBrush);
- }
- OS.SelectObject (dstHdc, oldBitmap);
- OS.DeleteDC (dstHdc);
- OS.ReleaseDC (handle, hDC);
- if (image2 != null) image2.dispose ();
- image2 = Image.win32_new (display, SWT.BITMAP, hBitmap);
- imageBits = OS.BS_BITMAP;
- fImageType = OS.IMAGE_BITMAP;
- hImage = hBitmap;
- }
- }
+ BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
+ buttonImageList.himl = imageList.getHandle ();
+ int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE), newBits = oldBits;
+ newBits &= ~(OS.BS_LEFT | OS.BS_CENTER | OS.BS_RIGHT);
+ if ((style & SWT.LEFT) != 0) newBits |= OS.BS_LEFT;
+ if ((style & SWT.CENTER) != 0) newBits |= OS.BS_CENTER;
+ if ((style & SWT.RIGHT) != 0) newBits |= OS.BS_RIGHT;
+ if (text.length () == 0) {
+ if ((style & SWT.LEFT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
+ if ((style & SWT.CENTER) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_CENTER;
+ if ((style & SWT.RIGHT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_RIGHT;
+ } else {
+ buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
+ buttonImageList.margin_left = computeLeftMargin ();
+ buttonImageList.margin_right = MARGIN;
+ newBits &= ~(OS.BS_CENTER | OS.BS_RIGHT);
+ newBits |= OS.BS_LEFT;
+ }
+ if (newBits != oldBits) {
+ OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
+ OS.InvalidateRect (handle, null, true);
}
- int newBits = OS.GetWindowLong (handle, OS.GWL_STYLE), oldBits = newBits;
- newBits &= ~(OS.BS_BITMAP | OS.BS_ICON);
- newBits |= imageBits;
- if (newBits != oldBits) OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- OS.SendMessage (handle, OS.BM_SETIMAGE, fImageType, hImage);
+ OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
+ } else {
+ OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, 0);
}
+ /*
+ * Bug in Windows. Under certain cirumstances yet to be
+ * isolated, BCM_SETIMAGELIST does not redraw the control
+ * when a new image is set. The fix is to force a redraw.
+ */
+ OS.InvalidateRect (handle, null, true);
}
void _setText (String text) {
int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE), newBits = oldBits;
- if (OS.COMCTL32_MAJOR >= 6) {
- newBits &= ~(OS.BS_LEFT | OS.BS_CENTER | OS.BS_RIGHT);
- if ((style & SWT.LEFT) != 0) newBits |= OS.BS_LEFT;
- if ((style & SWT.CENTER) != 0) newBits |= OS.BS_CENTER;
- if ((style & SWT.RIGHT) != 0) newBits |= OS.BS_RIGHT;
- if (imageList != null) {
- BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
- buttonImageList.himl = imageList.getHandle ();
- if (text.length () == 0) {
- if ((style & SWT.LEFT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
- if ((style & SWT.CENTER) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_CENTER;
- if ((style & SWT.RIGHT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_RIGHT;
- } else {
- buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
- buttonImageList.margin_left = computeLeftMargin ();
- buttonImageList.margin_right = MARGIN;
- newBits &= ~(OS.BS_CENTER | OS.BS_RIGHT);
- newBits |= OS.BS_LEFT;
- }
- OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
+ newBits &= ~(OS.BS_LEFT | OS.BS_CENTER | OS.BS_RIGHT);
+ if ((style & SWT.LEFT) != 0) newBits |= OS.BS_LEFT;
+ if ((style & SWT.CENTER) != 0) newBits |= OS.BS_CENTER;
+ if ((style & SWT.RIGHT) != 0) newBits |= OS.BS_RIGHT;
+ if (imageList != null) {
+ BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
+ buttonImageList.himl = imageList.getHandle ();
+ if (text.length () == 0) {
+ if ((style & SWT.LEFT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
+ if ((style & SWT.CENTER) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_CENTER;
+ if ((style & SWT.RIGHT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_RIGHT;
+ } else {
+ buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
+ buttonImageList.margin_left = computeLeftMargin ();
+ buttonImageList.margin_right = MARGIN;
+ newBits &= ~(OS.BS_CENTER | OS.BS_RIGHT);
+ newBits |= OS.BS_LEFT;
}
- } else {
- newBits &= ~(OS.BS_BITMAP | OS.BS_ICON);
+ OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
}
if (newBits != oldBits) {
OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
@@ -295,7 +197,7 @@ void _setText (String text) {
* is to append a space to the text.
*/
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
+ if (!OS.IsAppThemed ()) {
text = OS.IsWindowEnabled (handle) ? text : text + " ";
}
}
@@ -379,7 +281,6 @@ void click () {
// TODO: this method ignores the style LEFT, CENTER or RIGHT
int computeLeftMargin () {
- if (OS.COMCTL32_MAJOR < 6) return MARGIN;
if ((style & (SWT.PUSH | SWT.TOGGLE)) == 0) return MARGIN;
int margin = 0;
if (image != null && text.length () != 0) {
@@ -435,13 +336,6 @@ int computeLeftMargin () {
} else {
int extra = 0;
boolean hasImage = image != null, hasText = true;
- if (OS.COMCTL32_MAJOR < 6) {
- if ((style & SWT.PUSH) == 0) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- hasImage = (bits & (OS.BS_BITMAP | OS.BS_ICON)) != 0;
- if (hasImage) hasText = false;
- }
- }
if (hasImage) {
if (image != null) {
Rectangle rect = image.getBoundsInPixels ();
@@ -476,7 +370,7 @@ int computeLeftMargin () {
} else {
rect.right -= 6;
}
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
+ if (!OS.IsAppThemed ()) {
rect.right -= 2;
if (isRadioOrCheck()) {
rect.right -= 2;
@@ -521,53 +415,32 @@ void createHandle () {
super.createHandle ();
parent.state &= ~IGNORE_WM_CHANGEUISTATE;
- /* Set the theme background */
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
- /*
+ if (OS.IsAppThemed ()) {
+ /* Set the theme background.
+ *
* NOTE: On Vista this causes problems when the tab
* key is pressed for push buttons so disable the
* theme background drawing for these widgets for
* now.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 0)) {
+ if ((style & (SWT.PUSH | SWT.TOGGLE)) == 0) {
state |= THEME_BACKGROUND;
- } else {
- if ((style & (SWT.PUSH | SWT.TOGGLE)) == 0) {
- state |= THEME_BACKGROUND;
- }
}
- }
- /*
- * Bug in Windows. For some reason, the HBRUSH that
- * is returned from WM_CTRLCOLOR is misaligned when
- * the button uses it to draw. If the brush is a solid
- * color, this does not matter. However, if the brush
- * contains an image, the image is misaligned. The
- * fix is to draw the background in WM_CTRLCOLOR.
- *
- * NOTE: For comctl32.dll 6.0 with themes disabled,
- * drawing in WM_ERASEBKGND will draw on top of the
- * text of the control.
- */
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
- if ((style & SWT.RADIO) != 0) state |= DRAW_BACKGROUND;
- }
-
- /*
- * Feature in Windows. Push buttons draw border around
- * the button using the default background color instead
- * of using the color provided by WM_CTRLCOLOR. The fix
- * is to draw the background in WM_CTRLCOLOR.
- *
- * NOTE: On Vista this causes problems when the tab key
- * is pressed for push buttons so disable the fix for now.
- */
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 0)) {
- if ((style & (SWT.PUSH | SWT.TOGGLE)) != 0) {
- state |= DRAW_BACKGROUND;
- }
+ /*
+ * Bug in Windows. For some reason, the HBRUSH that
+ * is returned from WM_CTRLCOLOR is misaligned when
+ * the button uses it to draw. If the brush is a solid
+ * color, this does not matter. However, if the brush
+ * contains an image, the image is misaligned. The
+ * fix is to draw the background in WM_CTRLCOLOR.
+ *
+ * NOTE: For comctl32.dll 6.0 with themes disabled,
+ * drawing in WM_ERASEBKGND will draw on top of the
+ * text of the control.
+ */
+ if ((style & SWT.RADIO) != 0) {
+ state |= DRAW_BACKGROUND;
}
}
}
@@ -606,7 +479,7 @@ void enableWidget (boolean enabled) {
* is to append a space to the text.
*/
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
+ if (!OS.IsAppThemed ()) {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
boolean hasImage = (bits & (OS.BS_BITMAP | OS.BS_ICON)) != 0;
if (!hasImage) {
@@ -914,23 +787,21 @@ public void setAlignment (int alignment) {
if ((style & SWT.LEFT) != 0) newBits |= OS.BS_LEFT;
if ((style & SWT.CENTER) != 0) newBits |= OS.BS_CENTER;
if ((style & SWT.RIGHT) != 0) newBits |= OS.BS_RIGHT;
- if (OS.COMCTL32_MAJOR >= 6) {
- if (imageList != null) {
- BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
- buttonImageList.himl = imageList.getHandle ();
- if (text.length () == 0) {
- if ((style & SWT.LEFT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
- if ((style & SWT.CENTER) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_CENTER;
- if ((style & SWT.RIGHT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_RIGHT;
- } else {
- buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
- buttonImageList.margin_left = computeLeftMargin ();
- buttonImageList.margin_right = MARGIN;
- newBits &= ~(OS.BS_CENTER | OS.BS_RIGHT);
- newBits |= OS.BS_LEFT;
- }
- OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
+ if (imageList != null) {
+ BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
+ buttonImageList.himl = imageList.getHandle ();
+ if (text.length () == 0) {
+ if ((style & SWT.LEFT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
+ if ((style & SWT.CENTER) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_CENTER;
+ if ((style & SWT.RIGHT) != 0) buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_RIGHT;
+ } else {
+ buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
+ buttonImageList.margin_left = computeLeftMargin ();
+ buttonImageList.margin_right = MARGIN;
+ newBits &= ~(OS.BS_CENTER | OS.BS_RIGHT);
+ newBits |= OS.BS_LEFT;
}
+ OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
}
if (newBits != oldBits) {
OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
@@ -1089,13 +960,11 @@ public void setGrayed (boolean grayed) {
checkWidget ();
if (message == null) error (SWT.ERROR_NULL_ARGUMENT);
this.message = message;
- if (OS.COMCTL32_VERSION >= OS.VERSION (6, 1)) {
- if ((style & SWT.COMMAND) != 0) {
- int length = message.length ();
- char [] chars = new char [length + 1];
- message.getChars(0, length, chars, 0);
- OS.SendMessage (handle, OS.BCM_SETNOTE, 0, chars);
- }
+ if ((style & SWT.COMMAND) != 0) {
+ int length = message.length ();
+ char [] chars = new char [length + 1];
+ message.getChars(0, length, chars, 0);
+ OS.SendMessage (handle, OS.BCM_SETNOTE, 0, chars);
}
}
@@ -1220,28 +1089,26 @@ boolean updateTextDirection(int textDirection) {
}
void updateImageList () {
- if (OS.COMCTL32_MAJOR >= 6) {
- if (imageList != null) {
- BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
- OS.SendMessage (handle, OS.BCM_GETIMAGELIST, 0, buttonImageList);
- if (imageList != null) imageList.dispose ();
- imageList = new ImageList (style & SWT.RIGHT_TO_LEFT);
- if (OS.IsWindowEnabled (handle)) {
- imageList.add (image);
- } else {
- if (disabledImage != null) disabledImage.dispose ();
- disabledImage = new Image (display, image, SWT.IMAGE_DISABLE);
- imageList.add (disabledImage);
- }
- buttonImageList.himl = imageList.getHandle ();
- OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
- /*
- * Bug in Windows. Under certain cirumstances yet to be
- * isolated, BCM_SETIMAGELIST does not redraw the control
- * when an image is set. The fix is to force a redraw.
- */
- OS.InvalidateRect (handle, null, true);
+ if (imageList != null) {
+ BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
+ OS.SendMessage (handle, OS.BCM_GETIMAGELIST, 0, buttonImageList);
+ if (imageList != null) imageList.dispose ();
+ imageList = new ImageList (style & SWT.RIGHT_TO_LEFT);
+ if (OS.IsWindowEnabled (handle)) {
+ imageList.add (image);
+ } else {
+ if (disabledImage != null) disabledImage.dispose ();
+ disabledImage = new Image (display, image, SWT.IMAGE_DISABLE);
+ imageList.add (disabledImage);
}
+ buttonImageList.himl = imageList.getHandle ();
+ OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
+ /*
+ * Bug in Windows. Under certain cirumstances yet to be
+ * isolated, BCM_SETIMAGELIST does not redraw the control
+ * when an image is set. The fix is to force a redraw.
+ */
+ OS.InvalidateRect (handle, null, true);
}
}
@@ -1307,30 +1174,6 @@ long /*int*/ windowProc () {
return ButtonProc;
}
-
-@Override
-LRESULT WM_ERASEBKGND (long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
- if (result != null) return result;
- /*
- * Bug in Windows. For some reason, the HBRUSH that
- * is returned from WM_CTRLCOLOR is misaligned when
- * the button uses it to draw. If the brush is a solid
- * color, this does not matter. However, if the brush
- * contains an image, the image is misaligned. The
- * fix is to draw the background in WM_ERASEBKGND.
- */
- if (OS.COMCTL32_MAJOR < 6) {
- if (isRadioOrCheck()) {
- if (findImageControl () != null) {
- drawBackground (wParam);
- return LRESULT.ONE;
- }
- }
- }
- return result;
-}
-
@Override
LRESULT WM_GETDLGCODE (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
@@ -1401,16 +1244,14 @@ LRESULT WM_SETFOCUS (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_SIZE (wParam, lParam);
if (result != null) return result;
- if (OS.COMCTL32_MAJOR >= 6) {
- if ((style & (SWT.PUSH | SWT.TOGGLE)) != 0) {
- if (imageList != null && text.length () != 0) {
- BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
- OS.SendMessage (handle, OS.BCM_GETIMAGELIST, 0, buttonImageList);
- buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
- buttonImageList.margin_left = computeLeftMargin ();
- buttonImageList.margin_right = MARGIN;
- OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
- }
+ if ((style & (SWT.PUSH | SWT.TOGGLE)) != 0) {
+ if (imageList != null && text.length () != 0) {
+ BUTTON_IMAGELIST buttonImageList = new BUTTON_IMAGELIST ();
+ OS.SendMessage (handle, OS.BCM_GETIMAGELIST, 0, buttonImageList);
+ buttonImageList.uAlign = OS.BUTTON_IMAGELIST_ALIGN_LEFT;
+ buttonImageList.margin_left = computeLeftMargin ();
+ buttonImageList.margin_right = MARGIN;
+ OS.SendMessage (handle, OS.BCM_SETIMAGELIST, 0, buttonImageList);
}
}
return result;
@@ -1439,22 +1280,20 @@ LRESULT WM_UPDATEUISTATE (long /*int*/ wParam, long /*int*/ lParam) {
* NOTE: This only happens for radio, check and toggle
* buttons.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if ((style & (SWT.RADIO | SWT.CHECK | SWT.TOGGLE)) != 0) {
- boolean redraw = findImageControl () != null;
- if (!redraw) {
- if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
- redraw = findThemeControl () != null;
- }
+ if ((style & (SWT.RADIO | SWT.CHECK | SWT.TOGGLE)) != 0) {
+ boolean redraw = findImageControl () != null;
+ if (!redraw) {
+ if ((state & THEME_BACKGROUND) != 0) {
+ if (OS.IsAppThemed ()) {
+ redraw = findThemeControl () != null;
}
- if (!redraw) redraw = findBackgroundControl () != null;
- }
- if (redraw) {
- OS.InvalidateRect (handle, null, false);
- long /*int*/ code = OS.DefWindowProc (handle, OS.WM_UPDATEUISTATE, wParam, lParam);
- return new LRESULT (code);
}
+ if (!redraw) redraw = findBackgroundControl () != null;
+ }
+ if (redraw) {
+ OS.InvalidateRect (handle, null, false);
+ long /*int*/ code = OS.DefWindowProc (handle, OS.WM_UPDATEUISTATE, wParam, lParam);
+ return new LRESULT (code);
}
}
/*
@@ -1495,35 +1334,11 @@ LRESULT wmCommandChild (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT wmColorChild (long /*int*/ wParam, long /*int*/ lParam) {
- /*
- * Bug in Windows. For some reason, the HBRUSH that
- * is returned from WM_CTRLCOLOR is misaligned when
- * the button uses it to draw. If the brush is a solid
- * color, this does not matter. However, if the brush
- * contains an image, the image is misaligned. The
- * fix is to draw the background in WM_ERASEBKGND.
- */
- LRESULT result = super.wmColorChild (wParam, lParam);
- if (OS.COMCTL32_MAJOR < 6) {
- if (isRadioOrCheck()) {
- if (findImageControl () != null) {
- OS.SetBkMode (wParam, OS.TRANSPARENT);
- return new LRESULT (OS.GetStockObject (OS.NULL_BRUSH));
- }
- }
- }
- return result;
-}
-
-@Override
LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
switch (hdr.code) {
case OS.NM_CUSTOMDRAW:
// this message will not appear for owner-draw buttons (currently the ARROW button).
- if (OS.COMCTL32_MAJOR < 6) break;
-
NMCUSTOMDRAW nmcd = new NMCUSTOMDRAW ();
OS.MoveMemory (nmcd, lParam, NMCUSTOMDRAW.sizeof);
@@ -1645,7 +1460,7 @@ LRESULT wmDrawChild (long /*int*/ wParam, long /*int*/ lParam) {
OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof);
RECT rect = new RECT ();
OS.SetRect (rect, struct.left, struct.top, struct.right, struct.bottom);
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
int iStateId = OS.ABS_LEFTNORMAL;
switch (style & (SWT.UP | SWT.DOWN | SWT.LEFT | SWT.RIGHT)) {
case SWT.UP: iStateId = OS.ABS_UPNORMAL; break;
@@ -1654,15 +1469,12 @@ LRESULT wmDrawChild (long /*int*/ wParam, long /*int*/ lParam) {
case SWT.RIGHT: iStateId = OS.ABS_RIGHTNORMAL; break;
}
/*
- * Feature in Windows. On Vista only, DrawThemeBackground()
- * does not mirror the drawing. The fix is switch left to right
- * and right to left.
+ * Feature in Windows. DrawThemeBackground() does not mirror the drawing.
+ * The fix is switch left to right and right to left.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if ((style & SWT.MIRRORED) != 0) {
- if ((style & (SWT.LEFT | SWT.RIGHT)) != 0) {
- iStateId = iStateId == OS.ABS_RIGHTNORMAL ? OS.ABS_LEFTNORMAL : OS.ABS_RIGHTNORMAL;
- }
+ if ((style & SWT.MIRRORED) != 0) {
+ if ((style & (SWT.LEFT | SWT.RIGHT)) != 0) {
+ iStateId = iStateId == OS.ABS_RIGHTNORMAL ? OS.ABS_LEFTNORMAL : OS.ABS_RIGHTNORMAL;
}
}
/*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
index c283f29f40..bdd736ed45 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Canvas.java
@@ -220,30 +220,16 @@ void scrollInPixels (int destX, int destY, int x, int y, int width, int height,
RECT clientRect = new RECT ();
OS.GetClientRect (handle, clientRect);
if (OS.IntersectRect (clientRect, sourceRect, clientRect)) {
- if (OS.IsWinCE) {
- OS.UpdateWindow (handle);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
int deltaX = destX - x, deltaY = destY - y;
if (findImageControl () != null) {
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, sourceRect, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
- if (all) flags |= OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, sourceRect, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
+ if (all) flags |= OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, sourceRect, 0, flags);
OS.OffsetRect (sourceRect, deltaX, deltaY);
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, sourceRect, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
- if (all) flags |= OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, sourceRect, 0, flags);
- }
+ OS.RedrawWindow (handle, sourceRect, 0, flags);
} else {
int flags = OS.SW_INVALIDATE | OS.SW_ERASE;
/*
@@ -388,35 +374,6 @@ LRESULT WM_IME_COMPOSITION (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = ime.WM_IME_COMPOSITION (wParam, lParam);
if (result != null) return result;
}
-
- /*
- * Bug in Windows. On Korean Windows XP, the IME window
- * for the Korean Input System (MS-IME 2002) always opens
- * in the top left corner of the screen, despite the fact
- * that ImmSetCompositionWindow() was called to position
- * the IME when focus is gained. The fix is to position
- * the IME on every WM_IME_COMPOSITION message.
- */
- if (!OS.IsWinCE && OS.WIN32_VERSION == OS.VERSION (5, 1)) {
- if (OS.IsDBLocale) {
- short langID = OS.GetSystemDefaultUILanguage ();
- short primaryLang = OS.PRIMARYLANGID (langID);
- if (primaryLang == OS.LANG_KOREAN) {
- if (caret != null && caret.isFocusCaret ()) {
- POINT ptCurrentPos = new POINT ();
- if (OS.GetCaretPos (ptCurrentPos)) {
- COMPOSITIONFORM lpCompForm = new COMPOSITIONFORM ();
- lpCompForm.dwStyle = OS.CFS_POINT;
- lpCompForm.x = ptCurrentPos.x;
- lpCompForm.y = ptCurrentPos.y;
- long /*int*/ hIMC = OS.ImmGetContext (handle);
- OS.ImmSetCompositionWindow (hIMC, lpCompForm);
- OS.ImmReleaseContext (handle, hIMC);
- }
- }
- }
- }
- }
return super.WM_IME_COMPOSITION (wParam, lParam);
}
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 0023de9111..0b447dec79 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
@@ -118,12 +118,11 @@ Rectangle getBoundsInPixels () {
if (image != null) {
Rectangle rect = image.getBoundsInPixels ();
return new Rectangle (x, y, rect.width, rect.height);
- } else {
- if (!OS.IsWinCE && width == 0) {
- int [] buffer = new int [1];
- if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
- return new Rectangle (x, y, buffer [0], height);
- }
+ }
+ if (width == 0) {
+ int [] buffer = new int [1];
+ if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
+ return new Rectangle (x, y, buffer [0], height);
}
}
return new Rectangle (x, y, width, height);
@@ -217,12 +216,11 @@ Point getSizeInPixels () {
if (image != null) {
Rectangle rect = image.getBoundsInPixels ();
return new Point (rect.width, rect.height);
- } else {
- if (!OS.IsWinCE && width == 0) {
- int [] buffer = new int [1];
- if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
- return new Point (buffer [0], height);
- }
+ }
+ if (width == 0) {
+ int [] buffer = new int [1];
+ if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
+ return new Point (buffer [0], height);
}
}
return new Point (width, height);
@@ -340,7 +338,7 @@ void resize () {
OS.DestroyCaret ();
long /*int*/ hBitmap = image != null ? image.handle : 0;
int width = this.width;
- if (!OS.IsWinCE && image == null && width == 0) {
+ if (image == null && width == 0) {
int [] buffer = new int [1];
if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
width = buffer [0];
@@ -427,7 +425,7 @@ void setFocus () {
long /*int*/ hBitmap = 0;
if (image != null) hBitmap = image.handle;
int width = this.width;
- if (!OS.IsWinCE && image == null && width == 0) {
+ if (image == null && width == 0) {
int [] buffer = new int [1];
if (OS.SystemParametersInfo (OS.SPI_GETCARETWIDTH, 0, buffer, 0)) {
width = buffer [0];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java
index 63bba8cfda..db2983ff87 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java
@@ -177,25 +177,23 @@ public RGB open () {
* parent for the dialog to inherit.
*/
boolean enabled = false;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- int dialogOrientation = style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
- int parentOrientation = parent.style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
- if (dialogOrientation != parentOrientation) {
- int exStyle = OS.WS_EX_NOINHERITLAYOUT;
- if (dialogOrientation == SWT.RIGHT_TO_LEFT) exStyle |= OS.WS_EX_LAYOUTRTL;
- hwndOwner = OS.CreateWindowEx (
- exStyle,
- Shell.DialogClass,
- null,
- 0,
- OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
- hwndParent,
- 0,
- OS.GetModuleHandle (null),
- null);
- enabled = OS.IsWindowEnabled (hwndParent);
- if (enabled) OS.EnableWindow (hwndParent, false);
- }
+ int dialogOrientation = style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+ int parentOrientation = parent.style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+ if (dialogOrientation != parentOrientation) {
+ int exStyle = OS.WS_EX_NOINHERITLAYOUT;
+ if (dialogOrientation == SWT.RIGHT_TO_LEFT) exStyle |= OS.WS_EX_LAYOUTRTL;
+ hwndOwner = OS.CreateWindowEx (
+ exStyle,
+ Shell.DialogClass,
+ null,
+ 0,
+ OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
+ hwndParent,
+ 0,
+ OS.GetModuleHandle (null),
+ null);
+ enabled = OS.IsWindowEnabled (hwndParent);
+ if (enabled) OS.EnableWindow (hwndParent, false);
}
/* Create the CCHookProc */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
index 4664cadf3f..28760c92de 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java
@@ -81,7 +81,7 @@ public class Combo extends Composite {
* to stop the compiler from inlining.
*/
static {
- LIMIT = OS.IsWinNT ? 0x7FFFFFFF : 0x7FFF;
+ LIMIT = 0x7FFFFFFF;
}
/*
@@ -385,10 +385,6 @@ void applyEditSegments () {
/* Get the current selection */
int [] start = new int [1], end = new int [1];
OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = mbcsToWcsPos (start [0]);
- end [0] = mbcsToWcsPos (end [0]);
- }
boolean oldIgnoreCharacter = ignoreCharacter, oldIgnoreModify = ignoreModify;
ignoreCharacter = ignoreModify = true;
/*
@@ -403,10 +399,6 @@ void applyEditSegments () {
/* Restore selection */
start [0] = translateOffset (start [0]);
end [0] = translateOffset (end [0]);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = wcsToMbcsPos (start [0]);
- end [0] = wcsToMbcsPos (end [0]);
- }
if (segmentsChars != null && segmentsChars.length > 0) {
/*
* In addition to enforcing the required direction by prepending a UCC (LRE
@@ -575,10 +567,6 @@ void clearSegments (boolean applyText) {
/* Get the current selection */
int [] start = new int [1], end = new int [1];
OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = mbcsToWcsPos (start[0]);
- end [0]= mbcsToWcsPos (end [0]);
- }
start [0] = untranslateOffset (start [0]);
end [0] = untranslateOffset (end[0]);
@@ -590,11 +578,6 @@ void clearSegments (boolean applyText) {
OS.SendMessage (hwndText, OS.EM_SETSEL, 0, -1);
long /*int*/ undo = OS.SendMessage (hwndText, OS.EM_CANUNDO, 0, 0);
OS.SendMessage (hwndText, OS.EM_REPLACESEL, undo, buffer);
- /* Restore selection */
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = wcsToMbcsPos (start [0]);
- end [0] = wcsToMbcsPos (end [0]);
- }
OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);
ignoreCharacter = oldIgnoreCharacter;
ignoreModify = oldIgnoreModify;
@@ -681,7 +664,7 @@ public void clearSelection () {
}
COMBOBOXINFO pcbi = new COMBOBOXINFO ();
pcbi.cbSize = COMBOBOXINFO.sizeof;
- if (((style & SWT.SIMPLE) == 0) && !OS.IsWinCE && OS.GetComboBoxInfo (handle, pcbi)) {
+ if (((style & SWT.SIMPLE) == 0) && OS.GetComboBoxInfo (handle, pcbi)) {
width += pcbi.itemLeft + (pcbi.buttonRight - pcbi.buttonLeft);
height = (pcbi.buttonBottom - pcbi.buttonTop) + pcbi.buttonTop * 2;
} else {
@@ -730,7 +713,7 @@ void createHandle () {
* the combo box gets focus. The fix is use the CBT hook to clear
* the ES_NOHIDESEL style bit when the text control is created.
*/
- if (OS.IsWinCE || (style & (SWT.READ_ONLY | SWT.SIMPLE)) != 0) {
+ if ((style & (SWT.READ_ONLY | SWT.SIMPLE)) != 0) {
super.createHandle ();
} else {
int threadId = OS.GetCurrentThreadId ();
@@ -763,8 +746,8 @@ void createHandle () {
*/
if ((style & SWT.SIMPLE) != 0) {
int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- SetWindowPos (handle, 0, 0, 0, 0x3FFF, 0x3FFF, flags);
- SetWindowPos (handle, 0, 0, 0, 0, 0, flags);
+ OS.SetWindowPos (handle, 0, 0, 0, 0x3FFF, 0x3FFF, flags);
+ OS.SetWindowPos (handle, 0, 0, 0, 0, 0, flags);
}
}
@@ -776,17 +759,11 @@ void createWidget() {
int itemHeight = (int)/*64*/OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, 0, 0);
if (itemHeight != OS.CB_ERR && itemHeight != 0) {
int maxHeight = 0;
- if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- RECT rect = new RECT ();
- OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
- maxHeight = (rect.bottom - rect.top) / 3;
- } else {
- long /*int*/ hmonitor = OS.MonitorFromWindow (handle, OS.MONITOR_DEFAULTTONEAREST);
- MONITORINFO lpmi = new MONITORINFO ();
- lpmi.cbSize = MONITORINFO.sizeof;
- OS.GetMonitorInfo (hmonitor, lpmi);
- maxHeight = (lpmi.rcWork_bottom - lpmi.rcWork_top) / 3;
- }
+ long /*int*/ hmonitor = OS.MonitorFromWindow (handle, OS.MONITOR_DEFAULTTONEAREST);
+ MONITORINFO lpmi = new MONITORINFO ();
+ lpmi.cbSize = MONITORINFO.sizeof;
+ OS.GetMonitorInfo (hmonitor, lpmi);
+ maxHeight = (lpmi.rcWork_bottom - lpmi.rcWork_top) / 3;
visibleCount = Math.max(visibleCount, maxHeight / itemHeight);
}
}
@@ -825,13 +802,8 @@ TCHAR deprocessText (TCHAR text, int start, int end, boolean terminate) {
if (nSegments == 0) return text;
char [] chars;
if (start < 0) start = 0;
- if (OS.IsUnicode) {
- chars = text.chars;
- if (text.chars [length - 1] == 0) length--;
- } else {
- chars = new char [length];
- length = OS.MultiByteToWideChar (getCodePage (), OS.MB_PRECOMPOSED, text.bytes, length, chars, length);
- }
+ chars = text.chars;
+ if (text.chars [length - 1] == 0) length--;
if (end == -1) end = length;
if (end > segments [0] && start <= segments [nSegments - 1]) {
int nLeadSegments = 0;
@@ -1032,31 +1004,26 @@ public int getCaretPosition () {
*/
int caret = start [0];
if (start [0] != end [0]) {
- if (!OS.IsWinCE) {
- int idThread = OS.GetWindowThreadProcessId (hwndText, null);
- GUITHREADINFO lpgui = new GUITHREADINFO ();
- lpgui.cbSize = GUITHREADINFO.sizeof;
- if (OS.GetGUIThreadInfo (idThread, lpgui)) {
- if (lpgui.hwndCaret == hwndText || lpgui.hwndCaret == 0) {
- POINT ptCurrentPos = new POINT ();
- if (OS.GetCaretPos (ptCurrentPos)) {
- long /*int*/ endPos = OS.SendMessage (hwndText, OS.EM_POSFROMCHAR, end [0], 0);
- if (endPos == -1) {
- long /*int*/ startPos = OS.SendMessage (hwndText, OS.EM_POSFROMCHAR, start [0], 0);
- int startX = OS.GET_X_LPARAM (startPos);
- if (ptCurrentPos.x > startX) caret = end [0];
- } else {
- int endX = OS.GET_X_LPARAM (endPos);
- if (ptCurrentPos.x >= endX) caret = end [0];
- }
+ int idThread = OS.GetWindowThreadProcessId (hwndText, null);
+ GUITHREADINFO lpgui = new GUITHREADINFO ();
+ lpgui.cbSize = GUITHREADINFO.sizeof;
+ if (OS.GetGUIThreadInfo (idThread, lpgui)) {
+ if (lpgui.hwndCaret == hwndText || lpgui.hwndCaret == 0) {
+ POINT ptCurrentPos = new POINT ();
+ if (OS.GetCaretPos (ptCurrentPos)) {
+ long /*int*/ endPos = OS.SendMessage (hwndText, OS.EM_POSFROMCHAR, end [0], 0);
+ if (endPos == -1) {
+ long /*int*/ startPos = OS.SendMessage (hwndText, OS.EM_POSFROMCHAR, start [0], 0);
+ int startX = OS.GET_X_LPARAM (startPos);
+ if (ptCurrentPos.x > startX) caret = end [0];
+ } else {
+ int endX = OS.GET_X_LPARAM (endPos);
+ if (ptCurrentPos.x >= endX) caret = end [0];
}
}
}
}
}
- if (!OS.IsUnicode && OS.IsDBLocale) {
- caret = mbcsToWcsPos (caret);
- }
return untranslateOffset (caret);
}
@@ -1329,10 +1296,6 @@ public Point getSelection () {
}
int [] start = new int [1], end = new int [1];
OS.SendMessage (handle, OS.CB_GETEDITSEL, start, end);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = mbcsToWcsPos (start [0]);
- end [0] = mbcsToWcsPos (end [0]);
- }
return new Point (untranslateOffset (start [0]), untranslateOffset (end [0]));
}
@@ -1397,7 +1360,7 @@ public int getTextHeight () {
int getTextHeightInPixels () {
COMBOBOXINFO pcbi = new COMBOBOXINFO ();
pcbi.cbSize = COMBOBOXINFO.sizeof;
- if (((style & SWT.SIMPLE) == 0) && !OS.IsWinCE && OS.GetComboBoxInfo (handle, pcbi)) {
+ if (((style & SWT.SIMPLE) == 0) && OS.GetComboBoxInfo (handle, pcbi)) {
return (pcbi.buttonBottom - pcbi.buttonTop) + pcbi.buttonTop * 2;
}
int result = (int)/*64*/OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, -1, 0);
@@ -1533,19 +1496,6 @@ public int indexOf (String string, int start) {
return index;
}
-int mbcsToWcsPos (int mbcsPos) {
- if (mbcsPos <= 0) return 0;
- if (OS.IsUnicode) return mbcsPos;
- long /*int*/ hwndText = OS.GetDlgItem (handle, CBID_EDIT);
- if (hwndText == 0) return mbcsPos;
- int mbcsSize = OS.GetWindowTextLengthA (hwndText);
- if (mbcsSize == 0) return 0;
- if (mbcsPos >= mbcsSize) return mbcsSize;
- byte [] buffer = new byte [mbcsSize + 1];
- OS.GetWindowTextA (hwndText, buffer, mbcsSize + 1);
- return OS.MultiByteToWideChar (getCodePage (), OS.MB_PRECOMPOSED, buffer, mbcsPos, null, 0);
-}
-
/**
* Pastes text from clipboard.
* <p>
@@ -1906,12 +1856,6 @@ boolean sendKeyEvent (int type, int msg, long /*int*/ wParam, long /*int*/ lPara
if (start [0] == end [0]) {
if (start [0] == 0) return true;
start [0] = start [0] - 1;
- if (!OS.IsUnicode && OS.IsDBLocale) {
- int [] newStart = new int [1], newEnd = new int [1];
- OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (hwndText, OS.EM_GETSEL, newStart, newEnd);
- if (start [0] != newStart [0]) start [0] = start [0] - 1;
- }
start [0] = Math.max (start [0], 0);
}
break;
@@ -1920,12 +1864,6 @@ boolean sendKeyEvent (int type, int msg, long /*int*/ wParam, long /*int*/ lPara
int length = OS.GetWindowTextLength (hwndText);
if (start [0] == length) return true;
end [0] = end [0] + 1;
- if (!OS.IsUnicode && OS.IsDBLocale) {
- int [] newStart = new int [1], newEnd = new int [1];
- OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (hwndText, OS.EM_GETSEL, newStart, newEnd);
- if (end [0] != newEnd [0]) end [0] = end [0] + 1;
- }
end [0] = Math.min (end [0], length);
}
break;
@@ -1963,7 +1901,7 @@ public void select (int index) {
if (0 <= index && index < count) {
int selection = (int)/*64*/OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
//corner case for single elements combo boxes for Bug 222752
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 2) && getListVisible() && (style & SWT.READ_ONLY) != 0 && count==1 && selection == OS.CB_ERR) {
+ if (OS.WIN32_VERSION < OS.VERSION (6, 2) && getListVisible() && (style & SWT.READ_ONLY) != 0 && count==1 && selection == OS.CB_ERR) {
OS.SendMessage (handle, OS.WM_KEYDOWN, OS.VK_DOWN, 0);
sendEvent (SWT.Modify);
return;
@@ -1971,7 +1909,7 @@ public void select (int index) {
int code = (int)/*64*/OS.SendMessage (handle, OS.CB_SETCURSEL, index, 0);
if (code != OS.CB_ERR && code != selection) {
//Workaround for Bug 222752
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 2) && getListVisible() && (style & SWT.READ_ONLY) != 0) {
+ if (OS.WIN32_VERSION < OS.VERSION (6, 2) && getListVisible() && (style & SWT.READ_ONLY) != 0) {
int firstKey = OS.VK_UP;
int secondKey = OS.VK_DOWN;
if (index == 0) {
@@ -2048,7 +1986,7 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags) {
if (oldWidth == width && oldHeight == height) flags |= OS.SWP_NOSIZE;
}
}
- SetWindowPos (handle, 0, x, y, width, height, flags);
+ OS.SetWindowPos (handle, 0, x, y, width, height, flags);
} else {
super.setBoundsInPixels (x, y, width, height, flags);
}
@@ -2216,18 +2154,11 @@ void setScrollWidth (int scrollWidth) {
boolean scroll = false;
int count = (int)/*64*/OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
if (count > 3) {
- int maxWidth = 0;
- if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- RECT rect = new RECT ();
- OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
- maxWidth = (rect.right - rect.left) / 4;
- } else {
- long /*int*/ hmonitor = OS.MonitorFromWindow (handle, OS.MONITOR_DEFAULTTONEAREST);
- MONITORINFO lpmi = new MONITORINFO ();
- lpmi.cbSize = MONITORINFO.sizeof;
- OS.GetMonitorInfo (hmonitor, lpmi);
- maxWidth = (lpmi.rcWork_right - lpmi.rcWork_left) / 4;
- }
+ long /*int*/ hmonitor = OS.MonitorFromWindow (handle, OS.MONITOR_DEFAULTTONEAREST);
+ MONITORINFO lpmi = new MONITORINFO ();
+ lpmi.cbSize = MONITORINFO.sizeof;
+ OS.GetMonitorInfo (hmonitor, lpmi);
+ int maxWidth = (lpmi.rcWork_right - lpmi.rcWork_left) / 4;
scroll = scrollWidth > maxWidth;
}
/*
@@ -2295,10 +2226,6 @@ public void setSelection (Point selection) {
checkWidget ();
if (selection == null) error (SWT.ERROR_NULL_ARGUMENT);
int start = translateOffset (selection.x), end = translateOffset (selection.y);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start = wcsToMbcsPos (start);
- end = wcsToMbcsPos (end);
- }
long /*int*/ bits = OS.MAKELPARAM (start, end);
OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits);
}
@@ -2517,7 +2444,7 @@ void updateDropDownHeight () {
forceResize ();
OS.GetWindowRect (handle, rect);
int flags = OS.SWP_NOMOVE | OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- SetWindowPos (handle, 0, 0, 0, rect.right - rect.left, height, flags);
+ OS.SetWindowPos (handle, 0, 0, 0, rect.right - rect.left, height, flags);
}
}
}
@@ -2525,13 +2452,6 @@ void updateDropDownHeight () {
@Override
boolean updateTextDirection(int textDirection) {
if (super.updateTextDirection(textDirection)) {
- if (textDirection == AUTO_TEXT_DIRECTION) {
- /* To support auto direction we use UCC that are not available in ANSI CP */
- if (!OS.IsUnicode) {
- state &= ~HAS_AUTO_DIRECTION;
- return false;
- }
- }
clearSegments (true);
applyEditSegments ();
applyListSegments ();
@@ -2582,10 +2502,10 @@ void updateOrientation () {
OS.GetWindowRect (handle, rect);
int widthCombo = rect.right - rect.left, heightCombo = rect.bottom - rect.top;
int uFlags = OS.SWP_NOMOVE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE;
- SetWindowPos (hwndText, 0, 0, 0, width - 1, height - 1, uFlags);
- SetWindowPos (handle, 0, 0, 0, widthCombo - 1, heightCombo - 1, uFlags);
- SetWindowPos (hwndText, 0, 0, 0, width, height, uFlags);
- SetWindowPos (handle, 0, 0, 0, widthCombo, heightCombo, uFlags);
+ OS.SetWindowPos (hwndText, 0, 0, 0, width - 1, height - 1, uFlags);
+ OS.SetWindowPos (handle, 0, 0, 0, widthCombo - 1, heightCombo - 1, uFlags);
+ OS.SetWindowPos (hwndText, 0, 0, 0, width, height, uFlags);
+ OS.SetWindowPos (handle, 0, 0, 0, widthCombo, heightCombo, uFlags);
OS.InvalidateRect (handle, null, true);
}
if (hwndList != 0) {
@@ -2609,10 +2529,6 @@ String verifyText (String string, int start, int end, Event keyEvent) {
event.keyCode = keyEvent.keyCode;
event.stateMask = keyEvent.stateMask;
}
- if (!OS.IsUnicode && OS.IsDBLocale) {
- event.start = mbcsToWcsPos (start);
- event.end = mbcsToWcsPos (end);
- }
event.start = untranslateOffset (event.start);
event.end = untranslateOffset (event.end);
/*
@@ -2626,24 +2542,6 @@ String verifyText (String string, int start, int end, Event keyEvent) {
return event.text;
}
-int wcsToMbcsPos (int wcsPos) {
- if (wcsPos <= 0) return 0;
- if (OS.IsUnicode) return wcsPos;
- long /*int*/ hwndText = OS.GetDlgItem (handle, CBID_EDIT);
- if (hwndText == 0) return wcsPos;
- int mbcsSize = OS.GetWindowTextLengthA (hwndText);
- if (mbcsSize == 0) return 0;
- byte [] buffer = new byte [mbcsSize + 1];
- OS.GetWindowTextA (hwndText, buffer, mbcsSize + 1);
- int mbcsPos = 0, wcsCount = 0;
- while (mbcsPos < mbcsSize) {
- if (wcsPos == wcsCount) break;
- if (OS.IsDBCSLeadByte (buffer [mbcsPos++])) mbcsPos++;
- wcsCount++;
- }
- return mbcsPos;
-}
-
@Override
int widgetExtStyle () {
return super.widgetExtStyle () & ~OS.WS_EX_NOINHERITLAYOUT;
@@ -2806,7 +2704,7 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /
case OS.CB_FINDSTRINGEXACT:
if (lParam != 0 && (hooks (SWT.Segments) || filters (SWT.Segments) || ((state & HAS_AUTO_DIRECTION) != 0))) {
long /*int*/ code = OS.CB_ERR;
- int length = OS.IsUnicode ? OS.wcslen (lParam) : C.strlen (lParam);
+ int length = OS.wcslen (lParam);
TCHAR buffer = new TCHAR (getCodePage (), length);
OS.MoveMemory (buffer, lParam, buffer.length () * TCHAR.sizeof);
String string = buffer.toString (0, length);
@@ -2954,15 +2852,8 @@ LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
if ((style & SWT.SIMPLE) != 0) {
LRESULT result = super.WM_SIZE (wParam, lParam);
if (OS.IsWindowVisible (handle)) {
- if (OS.IsWinCE) {
- long /*int*/ hwndText = OS.GetDlgItem (handle, CBID_EDIT);
- if (hwndText != 0) OS.InvalidateRect (hwndText, null, true);
- long /*int*/ hwndList = OS.GetDlgItem (handle, CBID_LIST);
- if (hwndList != 0) OS.InvalidateRect (hwndList, null, true);
- } else {
- int uFlags = OS.RDW_ERASE | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, uFlags);
- }
+ int uFlags = OS.RDW_ERASE | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, uFlags);
}
return result;
}
@@ -3012,7 +2903,6 @@ LRESULT WM_WINDOWPOSCHANGING (long /*int*/ wParam, long /*int*/ lParam) {
* text field and the area in the parent where the
* combo box used to be.
*/
- if (OS.IsWinCE) return result;
if (!getDrawing ()) return result;
if (!OS.IsWindowVisible (handle)) return result;
if (ignoreResize) {
@@ -3095,12 +2985,7 @@ LRESULT wmChar (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
*/
case SWT.DEL:
if (OS.GetKeyState (OS.VK_CONTROL) < 0) {
- /*
- * 'Ctrl + BackSpace' functionality uses 'EM_REPLACESEL' native
- * API which is supported from Windows Vista. Adding OS version
- * check to avoid crash on WinXP, see more details on bug 496939
- */
- if (OS.WIN32_VERSION < OS.VERSION (6, 0) || (style & SWT.READ_ONLY) != 0) return LRESULT.ZERO;
+ if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO;
Point selection = getSelection ();
long /*int*/ hwndText = OS.GetDlgItem (handle, CBID_EDIT);
int x = selection.x;
@@ -3169,7 +3054,7 @@ LRESULT wmClipboard (long /*int*/ hwndText, int msg, long /*int*/ wParam, long /
case OS.WM_SETTEXT:
if (lockText) return null;
end [0] = OS.GetWindowTextLength (hwndText);
- int length = OS.IsUnicode ? OS.wcslen (lParam) : C.strlen (lParam);
+ int length = OS.wcslen (lParam);
TCHAR buffer = new TCHAR (getCodePage (), length);
int byteCount = buffer.length () * TCHAR.sizeof;
OS.MoveMemory (buffer, lParam, byteCount);
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 5e87758487..126fcde2b8 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
@@ -164,7 +164,7 @@ public void changed (Control[] changed) {
@Override
void checkBuffered () {
- if (OS.IsWinCE || (state & CANVAS) == 0) {
+ if ((state & CANVAS) == 0) {
super.checkBuffered ();
}
}
@@ -997,10 +997,10 @@ boolean resizeChildren (boolean defer, WINDOWPOS [] pwp) {
// if ((bits & OS.WS_CLIPSIBLINGS) == 0) wp.flags |= OS.SWP_NOCOPYBITS;
// }
if (defer) {
- hdwp = DeferWindowPos (hdwp, wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
+ hdwp = OS.DeferWindowPos (hdwp, wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
if (hdwp == 0) return false;
} else {
- SetWindowPos (wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
+ OS.SetWindowPos (wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
}
}
}
@@ -1015,13 +1015,11 @@ void resizeEmbeddedHandle(long /*int*/ embeddedHandle, int width, int height) {
if (threadId != OS.GetCurrentThreadId ()) {
if (processID [0] == OS.GetCurrentProcessId ()) {
if (display.msgHook == 0) {
- if (!OS.IsWinCE) {
- display.getMsgCallback = new Callback (display, "getMsgProc", 3);
- display.getMsgProc = display.getMsgCallback.getAddress ();
- if (display.getMsgProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- display.msgHook = OS.SetWindowsHookEx (OS.WH_GETMESSAGE, display.getMsgProc, OS.GetLibraryHandle(), threadId);
- OS.PostThreadMessage (threadId, OS.WM_NULL, 0, 0);
- }
+ display.getMsgCallback = new Callback (display, "getMsgProc", 3);
+ display.getMsgProc = display.getMsgCallback.getAddress ();
+ if (display.getMsgProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+ display.msgHook = OS.SetWindowsHookEx (OS.WH_GETMESSAGE, display.getMsgProc, OS.GetLibraryHandle(), threadId);
+ OS.PostThreadMessage (threadId, OS.WM_NULL, 0, 0);
}
}
int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE | OS.SWP_ASYNCWINDOWPOS;
@@ -1253,10 +1251,8 @@ String toolTipText (NMTTDISPINFO hdr) {
* Bug in Windows. On Windows 7, tool tips hang when displaying large
* unwrapped strings. The fix is to wrap the string ourselves.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (string.length () > TOOLTIP_LIMIT / 4) {
- string = display.wrapText (string, handle, toolTip.getWidth ());
- }
+ if (string.length () > TOOLTIP_LIMIT / 4) {
+ string = display.wrapText (string, handle, toolTip.getWidth ());
}
}
return string;
@@ -1390,7 +1386,7 @@ void updateOrientation () {
RECT rect = rects [i];
control.setOrientation (orientation);
int flags = OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE;
- SetWindowPos (control.topHandle (), 0, rect.left, rect.top, 0, 0, flags);
+ OS.SetWindowPos (control.topHandle (), 0, rect.left, rect.top, 0, 0, flags);
}
}
@@ -1476,7 +1472,7 @@ LRESULT WM_NCHITTEST (long /*int*/ wParam, long /*int*/ lParam) {
* and the point is not in the client area, and redraw
* the trim, which somehow fixes the next WM_NCHITTEST.
*/
- if (!OS.IsWinCE && OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if ((state & CANVAS)!= 0) {
long /*int*/ code = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
if (code == OS.HTCLIENT) {
@@ -1517,12 +1513,9 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
}
/* Set the clipping bits */
- int oldBits = 0, newBits = 0;
- if (!OS.IsWinCE) {
- oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- newBits = oldBits | OS.WS_CLIPSIBLINGS | OS.WS_CLIPCHILDREN;
- if (newBits != oldBits) OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- }
+ int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
+ int newBits = oldBits | OS.WS_CLIPSIBLINGS | OS.WS_CLIPCHILDREN;
+ if (newBits != oldBits) OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
/* Paint the control and the background */
PAINTSTRUCT ps = new PAINTSTRUCT ();
@@ -1531,10 +1524,8 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
/* Use the buffered paint when possible */
boolean bufferedPaint = false;
if ((style & SWT.DOUBLE_BUFFERED) != 0) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if ((style & (SWT.NO_MERGE_PAINTS | SWT.RIGHT_TO_LEFT)) == 0) {
- if ((style & SWT.TRANSPARENT) == 0) bufferedPaint = true;
- }
+ if ((style & (SWT.NO_MERGE_PAINTS | SWT.RIGHT_TO_LEFT | SWT.TRANSPARENT)) == 0) {
+ bufferedPaint = true;
}
}
if (bufferedPaint) {
@@ -1586,21 +1577,17 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
if ((style & (SWT.DOUBLE_BUFFERED | SWT.TRANSPARENT)) != 0 || (style & SWT.NO_MERGE_PAINTS) != 0) {
sysRgn = OS.CreateRectRgn (0, 0, 0, 0);
if (OS.GetRandomRgn (gc.handle, sysRgn, OS.SYSRGN) == 1) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- if ((OS.GetLayout (gc.handle) & OS.LAYOUT_RTL) != 0) {
- int nBytes = OS.GetRegionData (sysRgn, 0, null);
- int [] lpRgnData = new int [nBytes / 4];
- OS.GetRegionData (sysRgn, nBytes, lpRgnData);
- long /*int*/ newSysRgn = OS.ExtCreateRegion (new float [] {-1, 0, 0, 1, 0, 0}, nBytes, lpRgnData);
- OS.DeleteObject (sysRgn);
- sysRgn = newSysRgn;
- }
- }
- if (OS.IsWinNT) {
- POINT pt = new POINT();
- OS.MapWindowPoints (0, handle, pt, 1);
- OS.OffsetRgn (sysRgn, pt.x, pt.y);
+ if ((OS.GetLayout (gc.handle) & OS.LAYOUT_RTL) != 0) {
+ int nBytes = OS.GetRegionData (sysRgn, 0, null);
+ int [] lpRgnData = new int [nBytes / 4];
+ OS.GetRegionData (sysRgn, nBytes, lpRgnData);
+ long /*int*/ newSysRgn = OS.ExtCreateRegion (new float [] {-1, 0, 0, 1, 0, 0}, nBytes, lpRgnData);
+ OS.DeleteObject (sysRgn);
+ sysRgn = newSysRgn;
}
+ POINT pt = new POINT();
+ OS.MapWindowPoints (0, handle, pt, 1);
+ OS.OffsetRgn (sysRgn, pt.x, pt.y);
}
}
@@ -1694,7 +1681,7 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
}
/* Restore the clipping bits */
- if (!OS.IsWinCE && !isDisposed ()) {
+ if (!isDisposed ()) {
if (newBits != oldBits) {
/*
* It is possible (but unlikely), that application
@@ -1787,7 +1774,7 @@ LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
}
}
}
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (findThemeControl () != null) redrawChildren ();
}
}
@@ -1831,23 +1818,22 @@ LRESULT WM_SYSCOMMAND (long /*int*/ wParam, long /*int*/ lParam) {
* does not redraw properly. The fix is to detect this case and
* redraw the non-client area.
*/
- if (!OS.IsWinCE) {
- int cmd = (int)/*64*/wParam & 0xFFF0;
- switch (cmd) {
- case OS.SC_HSCROLL:
- case OS.SC_VSCROLL:
- boolean showHBar = horizontalBar != null && horizontalBar.getVisible ();
- boolean showVBar = verticalBar != null && verticalBar.getVisible ();
- long /*int*/ code = callWindowProc (handle, OS.WM_SYSCOMMAND, wParam, lParam);
- if ((showHBar != (horizontalBar != null && horizontalBar.getVisible ())) ||
- (showVBar != (verticalBar != null && verticalBar.getVisible ()))) {
- int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_UPDATENOW;
- OS.RedrawWindow (handle, null, 0, flags);
- }
- if (code == 0) return LRESULT.ZERO;
- return new LRESULT (code);
- }
+ int cmd = (int)/*64*/wParam & 0xFFF0;
+ switch (cmd) {
+ case OS.SC_HSCROLL:
+ case OS.SC_VSCROLL:
+ boolean showHBar = horizontalBar != null && horizontalBar.getVisible ();
+ boolean showVBar = verticalBar != null && verticalBar.getVisible ();
+ long /*int*/ code = callWindowProc (handle, OS.WM_SYSCOMMAND, wParam, lParam);
+ if ((showHBar != (horizontalBar != null && horizontalBar.getVisible ())) ||
+ (showVBar != (verticalBar != null && verticalBar.getVisible ()))) {
+ int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_UPDATENOW;
+ OS.RedrawWindow (handle, null, 0, flags);
+ }
+ if (code == 0) return LRESULT.ZERO;
+ return new LRESULT (code);
}
+
/* Return the result */
return result;
}
@@ -1868,7 +1854,7 @@ LRESULT wmNCPaint (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam)
if (result != null) return result;
long /*int*/ borderHandle = borderHandle ();
if ((state & CANVAS) != 0 || (hwnd == borderHandle && handle != borderHandle)) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
int bits1 = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
if ((bits1 & OS.WS_EX_CLIENTEDGE) != 0) {
long /*int*/ code = 0;
@@ -1895,137 +1881,121 @@ LRESULT wmNCPaint (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam)
@Override
LRESULT wmNotify (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
- if (!OS.IsWinCE) {
- switch (hdr.code) {
+ switch (hdr.code) {
+ /*
+ * Feature in Windows. When the tool tip control is
+ * created, the parent of the tool tip is the shell.
+ * If SetParent () is used to reparent the tool bar
+ * into a new shell, the tool tip is not reparented
+ * and pops up underneath the new shell. The fix is
+ * to make sure the tool tip is a topmost window.
+ */
+ case OS.TTN_SHOW:
+ case OS.TTN_POP: {
/*
- * Feature in Windows. When the tool tip control is
- * created, the parent of the tool tip is the shell.
- * If SetParent () is used to reparent the tool bar
- * into a new shell, the tool tip is not reparented
- * and pops up underneath the new shell. The fix is
- * to make sure the tool tip is a topmost window.
+ * Bug in Windows 98 and NT. Setting the tool tip to be the
+ * top most window using HWND_TOPMOST can result in a parent
+ * dialog shell being moved behind its parent if the dialog
+ * has a sibling that is currently on top. The fix is to
+ * lock the z-order of the active window.
+ *
+ * Feature in Windows. Using SetWindowPos() with HWND_NOTOPMOST
+ * to clear the topmost state of a window whose parent is already
+ * topmost clears the topmost state of the parent. The fix is to
+ * check if the parent is already on top and neither set or clear
+ * the topmost status of the tool tip.
*/
- case OS.TTN_SHOW:
- case OS.TTN_POP: {
+ long /*int*/ hwndParent = hdr.hwndFrom;
+ do {
+ hwndParent = OS.GetParent (hwndParent);
+ if (hwndParent == 0) break;
+ int bits = OS.GetWindowLong (hwndParent, OS.GWL_EXSTYLE);
+ if ((bits & OS.WS_EX_TOPMOST) != 0) break;
+ } while (true);
+ if (hwndParent != 0) break;
+ /*
+ * Bug in Windows. TTN_SHOW is sent for inactive shells. When
+ * SetWindowPos is called as a reaction, inactive shells can
+ * wrongly end up on top. The fix is to swallow such requests.
+ *
+ * A visible effect is that spurious tool tips can show up and
+ * disappear in a split second. This is a mostly harmless
+ * feature that can also be observed in the Windows Explorer.
+ * See bug 491627 for more details.
+ */
+ if (display.getActiveShell () == null) return LRESULT.ONE;
+
+ display.lockActiveWindow = true;
+ int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOSIZE;
+ long /*int*/ hwndInsertAfter = hdr.code == OS.TTN_SHOW ? OS.HWND_TOPMOST : OS.HWND_NOTOPMOST;
+ OS.SetWindowPos (hdr.hwndFrom, hwndInsertAfter, 0, 0, 0, 0, flags);
+ display.lockActiveWindow = false;
+ break;
+ }
+ 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 ();
+ string = Display.withCrLf (string);
/*
- * Bug in Windows 98 and NT. Setting the tool tip to be the
- * top most window using HWND_TOPMOST can result in a parent
- * dialog shell being moved behind its parent if the dialog
- * has a sibling that is currently on top. The fix is to
- * lock the z-order of the active window.
- *
- * Feature in Windows. Using SetWindowPos() with HWND_NOTOPMOST
- * to clear the topmost state of a window whose parent is already
- * topmost clears the topmost state of the parent. The fix is to
- * check if the parent is already on top and neither set or clear
- * the topmost status of the tool tip.
+ * Bug in Windows. On Windows 7, tool tips hang when displaying large
+ * strings. The fix is to limit the tool tip string to 4Kb.
*/
- long /*int*/ hwndParent = hdr.hwndFrom;
- do {
- hwndParent = OS.GetParent (hwndParent);
- if (hwndParent == 0) break;
- int bits = OS.GetWindowLong (hwndParent, OS.GWL_EXSTYLE);
- if ((bits & OS.WS_EX_TOPMOST) != 0) break;
- } while (true);
- if (hwndParent != 0) break;
+ if (string.length() > TOOLTIP_LIMIT) {
+ string = string.substring(0, TOOLTIP_LIMIT);
+ }
/*
- * Bug in Windows. TTN_SHOW is sent for inactive shells. When
- * SetWindowPos is called as a reaction, inactive shells can
- * wrongly end up on top. The fix is to swallow such requests.
- *
- * A visible effect is that spurious tool tips can show up and
- * disappear in a split second. This is a mostly harmless
- * feature that can also be observed in the Windows Explorer.
- * See bug 491627 for more details.
+ * Bug 475858: In Japanese like languages where mnemonics are not taken from the
+ * source label text but appended in parentheses like "(&M)" at end. In order to
+ * allow the reuse of such label text as a tool-tip text as well, "(&M)" like
+ * character sequence has to be removed from the end of CJK-style mnemonics.
*/
- if (display.getActiveShell () == null) return LRESULT.ONE;
+ char [] chars = fixMnemonic (string, false, true);
- display.lockActiveWindow = true;
- int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOSIZE;
- long /*int*/ hwndInsertAfter = hdr.code == OS.TTN_SHOW ? OS.HWND_TOPMOST : OS.HWND_NOTOPMOST;
- SetWindowPos (hdr.hwndFrom, hwndInsertAfter, 0, 0, 0, 0, flags);
- display.lockActiveWindow = false;
- break;
- }
- /*
- * Bug in Windows 98. For some reason, the tool bar control
- * sends both TTN_GETDISPINFOW and TTN_GETDISPINFOA to get
- * the tool tip text and the tab folder control sends only
- * TTN_GETDISPINFOW. The fix is to handle only TTN_GETDISPINFOW,
- * even though it should never be sent on Windows 98.
- *
- * NOTE: Because the size of NMTTDISPINFO differs between
- * Windows 98 and NT, guard against the case where the wrong
- * kind of message occurs by inlining the memory moves and
- * the UNICODE conversion code.
- */
- 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);
+ /*
+ * Ensure that the orientation of the tool tip matches
+ * the orientation of the control.
+ */
+ Widget widget = null;
+ long /*int*/ hwnd = hdr.idFrom;
+ if ((lpnmtdi.uFlags & OS.TTF_IDISHWND) != 0) {
+ widget = display.getControl (hwnd);
} else {
- lpnmtdi = new NMTTDISPINFOW ();
- OS.MoveMemory ((NMTTDISPINFOW)lpnmtdi, lParam, NMTTDISPINFOW.sizeof);
- }
- String string = toolTipText (lpnmtdi);
- if (string != null) {
- Shell shell = getShell ();
- string = Display.withCrLf (string);
- /*
- * Bug in Windows. On Windows 7, tool tips hang when displaying large
- * strings. The fix is to limit the tool tip string to 4Kb.
- */
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (string.length() > TOOLTIP_LIMIT) {
- string = string.substring(0, TOOLTIP_LIMIT);
- }
+ if (hdr.hwndFrom == shell.toolTipHandle || hdr.hwndFrom == shell.balloonTipHandle) {
+ widget = shell.findToolTip ((int)/*64*/hdr.idFrom);
}
- /*
- * Bug 475858: In Japanese like languages where mnemonics are not taken from the
- * source label text but appended in parentheses like "(&M)" at end. In order to
- * allow the reuse of such label text as a tool-tip text as well, "(&M)" like
- * character sequence has to be removed from the end of CJK-style mnemonics.
- */
- char [] chars = fixMnemonic (string, false, true);
-
- /*
- * Ensure that the orientation of the tool tip matches
- * the orientation of the control.
- */
- Widget widget = null;
- long /*int*/ hwnd = hdr.idFrom;
- if ((lpnmtdi.uFlags & OS.TTF_IDISHWND) != 0) {
- widget = display.getControl (hwnd);
+ }
+ if (widget != null) {
+ int style = widget.getStyle();
+ int flags = SWT.RIGHT_TO_LEFT | SWT.FLIP_TEXT_DIRECTION;
+ if ((style & flags) != 0 && (style & flags) != flags) {
+ lpnmtdi.uFlags |= OS.TTF_RTLREADING;
} else {
- if (hdr.hwndFrom == shell.toolTipHandle || hdr.hwndFrom == shell.balloonTipHandle) {
- widget = shell.findToolTip ((int)/*64*/hdr.idFrom);
- }
- }
- if (widget != null) {
- int style = widget.getStyle();
- int flags = SWT.RIGHT_TO_LEFT | SWT.FLIP_TEXT_DIRECTION;
- if ((style & flags) != 0 && (style & flags) != flags) {
- lpnmtdi.uFlags |= OS.TTF_RTLREADING;
- } else {
- lpnmtdi.uFlags &= ~OS.TTF_RTLREADING;
- }
+ lpnmtdi.uFlags &= ~OS.TTF_RTLREADING;
}
+ }
- 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;
+ 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);
}
- break;
+ return LRESULT.ZERO;
}
+ break;
}
}
return super.wmNotify (hdr, wParam, lParam);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index f50c3d0209..e20ac85c44 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
@@ -729,7 +729,7 @@ void createHandle () {
}
void checkGesture () {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
int value = OS.GetSystemMetrics (OS.SM_DIGITIZER);
if ((value & (OS.NID_READY | OS.NID_MULTI_INPUT)) != 0) {
/*
@@ -771,7 +771,6 @@ void createWidget () {
}
int defaultBackground () {
- if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_WINDOW);
return OS.GetSysColor (OS.COLOR_BTNFACE);
}
@@ -947,7 +946,7 @@ void drawBackground (long /*int*/ hDC, RECT rect, int pixel, int tx, int ty) {
}
if (pixel == -1) {
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
control = findThemeControl ();
if (control != null) {
fillThemeBackground (hDC, control, rect);
@@ -1134,7 +1133,7 @@ void forceResize () {
// int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
// if ((bits & OS.WS_CLIPSIBLINGS) == 0) wp.flags |= OS.SWP_NOCOPYBITS;
// }
- SetWindowPos (wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
+ OS.SetWindowPos (wp.hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
lpwp [i] = null;
return;
}
@@ -1272,22 +1271,13 @@ Rectangle getBoundsInPixels () {
}
int getCodePage () {
- if (OS.IsUnicode) return OS.CP_ACP;
- long /*int*/ hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
- LOGFONT logFont = OS.IsUnicode ? (LOGFONT) new LOGFONTW () : new LOGFONTA ();
- OS.GetObject (hFont, LOGFONT.sizeof, logFont);
- int cs = logFont.lfCharSet & 0xFF;
- int [] lpCs = new int [8];
- if (OS.TranslateCharsetInfo (cs, lpCs, OS.TCI_SRCCHARSET)) {
- return lpCs [1];
- }
- return OS.GetACP ();
+ return OS.CP_ACP;
}
String getClipboardText () {
String string = "";
if (OS.OpenClipboard (0)) {
- long /*int*/ hMem = OS.GetClipboardData (OS.IsUnicode ? OS.CF_UNICODETEXT : OS.CF_TEXT);
+ long /*int*/ hMem = OS.GetClipboardData (OS.CF_UNICODETEXT);
if (hMem != 0) {
/* Ensure byteCount is a multiple of 2 bytes on UNICODE platforms */
int byteCount = OS.GlobalSize (hMem) / TCHAR.sizeof * TCHAR.sizeof;
@@ -1482,9 +1472,6 @@ public Menu getMenu () {
*/
public Monitor getMonitor () {
checkWidget ();
- if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- return display.getPrimaryMonitor ();
- }
long /*int*/ hmonitor = OS.MonitorFromWindow (handle, OS.MONITOR_DEFAULTTONEAREST);
MONITORINFO lpmi = new MONITORINFO ();
lpmi.cbSize = MONITORINFO.sizeof;
@@ -1818,20 +1805,16 @@ public long /*int*/ internal_new_GC (GCData data) {
}
if (hDC == 0) error(SWT.ERROR_NO_HANDLES);
if (data != null) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- if ((data.style & mask) != 0) {
- data.layout = (data.style & SWT.RIGHT_TO_LEFT) != 0 ? OS.LAYOUT_RTL : 0;
+ int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
+ if ((data.style & mask) != 0) {
+ data.layout = (data.style & SWT.RIGHT_TO_LEFT) != 0 ? OS.LAYOUT_RTL : 0;
+ } else {
+ int flags = OS.GetLayout (hDC);
+ if ((flags & OS.LAYOUT_RTL) != 0) {
+ data.style |= SWT.RIGHT_TO_LEFT | SWT.MIRRORED;
} else {
- int flags = OS.GetLayout (hDC);
- if ((flags & OS.LAYOUT_RTL) != 0) {
- data.style |= SWT.RIGHT_TO_LEFT | SWT.MIRRORED;
- } else {
- data.style |= SWT.LEFT_TO_RIGHT;
- }
+ data.style |= SWT.LEFT_TO_RIGHT;
}
- } else {
- data.style |= SWT.LEFT_TO_RIGHT;
}
data.device = display;
int foreground = getForegroundPixel ();
@@ -2118,7 +2101,7 @@ public void moveAbove (Control control) {
}
}
int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- SetWindowPos (topHandle, hwndAbove, 0, 0, 0, 0, flags);
+ OS.SetWindowPos (topHandle, hwndAbove, 0, 0, 0, 0, flags);
}
/**
@@ -2178,7 +2161,7 @@ public void moveBelow (Control control) {
}
if (hwndAbove == 0 || hwndAbove == topHandle) return;
int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- SetWindowPos (topHandle, hwndAbove, 0, 0, 0, 0, flags);
+ OS.SetWindowPos (topHandle, hwndAbove, 0, 0, 0, 0, flags);
}
Accessible new_Accessible (Control control) {
@@ -2258,56 +2241,49 @@ public boolean print (GC gc) {
checkWidget ();
if (gc == null) error (SWT.ERROR_NULL_ARGUMENT);
if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- long /*int*/ topHandle = topHandle ();
- long /*int*/ hdc = gc.handle;
- int state = 0;
- long /*int*/ gdipGraphics = gc.getGCData().gdipGraphics;
- if (gdipGraphics != 0) {
- long /*int*/ clipRgn = 0;
- Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeNone);
- long /*int*/ rgn = Gdip.Region_new();
- if (rgn == 0) error(SWT.ERROR_NO_HANDLES);
- Gdip.Graphics_GetClip(gdipGraphics, rgn);
- if (!Gdip.Region_IsInfinite(rgn, gdipGraphics)) {
- clipRgn = Gdip.Region_GetHRGN(rgn, gdipGraphics);
- }
- Gdip.Region_delete(rgn);
- Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeHalf);
- float[] lpXform = null;
- long /*int*/ matrix = Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
- if (matrix == 0) error(SWT.ERROR_NO_HANDLES);
- Gdip.Graphics_GetTransform(gdipGraphics, matrix);
- if (!Gdip.Matrix_IsIdentity(matrix)) {
- lpXform = new float[6];
- Gdip.Matrix_GetElements(matrix, lpXform);
- }
- Gdip.Matrix_delete(matrix);
- hdc = Gdip.Graphics_GetHDC(gdipGraphics);
- state = OS.SaveDC(hdc);
- if (lpXform != null) {
- OS.SetGraphicsMode(hdc, OS.GM_ADVANCED);
- OS.SetWorldTransform(hdc, lpXform);
- }
- if (clipRgn != 0) {
- OS.SelectClipRgn(hdc, clipRgn);
- OS.DeleteObject(clipRgn);
- }
+ long /*int*/ topHandle = topHandle ();
+ long /*int*/ hdc = gc.handle;
+ int state = 0;
+ long /*int*/ gdipGraphics = gc.getGCData().gdipGraphics;
+ if (gdipGraphics != 0) {
+ long /*int*/ clipRgn = 0;
+ Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeNone);
+ long /*int*/ rgn = Gdip.Region_new();
+ if (rgn == 0) error(SWT.ERROR_NO_HANDLES);
+ Gdip.Graphics_GetClip(gdipGraphics, rgn);
+ if (!Gdip.Region_IsInfinite(rgn, gdipGraphics)) {
+ clipRgn = Gdip.Region_GetHRGN(rgn, gdipGraphics);
}
- if (OS.IsWinCE) {
- OS.UpdateWindow (topHandle);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (topHandle, null, 0, flags);
+ Gdip.Region_delete(rgn);
+ Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeHalf);
+ float[] lpXform = null;
+ long /*int*/ matrix = Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
+ if (matrix == 0) error(SWT.ERROR_NO_HANDLES);
+ Gdip.Graphics_GetTransform(gdipGraphics, matrix);
+ if (!Gdip.Matrix_IsIdentity(matrix)) {
+ lpXform = new float[6];
+ Gdip.Matrix_GetElements(matrix, lpXform);
}
- printWidget (topHandle, hdc, gc);
- if (gdipGraphics != 0) {
- OS.RestoreDC(hdc, state);
- Gdip.Graphics_ReleaseHDC(gdipGraphics, hdc);
+ Gdip.Matrix_delete(matrix);
+ hdc = Gdip.Graphics_GetHDC(gdipGraphics);
+ state = OS.SaveDC(hdc);
+ if (lpXform != null) {
+ OS.SetGraphicsMode(hdc, OS.GM_ADVANCED);
+ OS.SetWorldTransform(hdc, lpXform);
+ }
+ if (clipRgn != 0) {
+ OS.SelectClipRgn(hdc, clipRgn);
+ OS.DeleteObject(clipRgn);
}
- return true;
}
- return false;
+ int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (topHandle, null, 0, flags);
+ printWidget (topHandle, hdc, gc);
+ if (gdipGraphics != 0) {
+ OS.RestoreDC(hdc, state);
+ Gdip.Graphics_ReleaseHDC(gdipGraphics, hdc);
+ }
+ return true;
}
void printWidget (long /*int*/ hwnd, long /*int*/ hdc, GC gc) {
@@ -2380,11 +2356,9 @@ void printWidget (long /*int*/ hwnd, long /*int*/ hdc, GC gc) {
if ((bits1 & OS.WS_VISIBLE) != 0) {
OS.DefWindowProc (hwnd, OS.WM_SETREDRAW, 0, 0);
}
- SetWindowPos (hwnd, 0, x + width, y + height, 0, 0, flags);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.SetWindowLong (hwnd, OS.GWL_STYLE, (bits1 & ~OS.WS_CHILD) | OS.WS_POPUP);
- OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits2 | OS.WS_EX_TOOLWINDOW);
- }
+ OS.SetWindowPos (hwnd, 0, x + width, y + height, 0, 0, flags);
+ OS.SetWindowLong (hwnd, OS.GWL_STYLE, (bits1 & ~OS.WS_CHILD) | OS.WS_POPUP);
+ OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits2 | OS.WS_EX_TOOLWINDOW);
Shell shell = getShell ();
Control savedFocus = shell.savedFocus;
OS.SetParent (hwnd, 0);
@@ -2404,14 +2378,12 @@ void printWidget (long /*int*/ hwnd, long /*int*/ hdc, GC gc) {
if ((bits1 & OS.WS_VISIBLE) != 0) {
OS.DefWindowProc (hwnd, OS.WM_SETREDRAW, 0, 0);
}
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.SetWindowLong (hwnd, OS.GWL_STYLE, bits1);
- OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits2);
- }
+ OS.SetWindowLong (hwnd, OS.GWL_STYLE, bits1);
+ OS.SetWindowLong (hwnd, OS.GWL_EXSTYLE, bits2);
OS.SetParent (hwnd, hwndParent);
OS.MapWindowPoints (0, hwndParent, rect1, 2);
int flags = OS.SWP_NOSIZE | OS.SWP_NOACTIVATE | OS.SWP_DRAWFRAME;
- SetWindowPos (hwnd, hwndInsertAfter, rect1.left, rect1.top, rect1.right - rect1.left, rect1.bottom - rect1.top, flags);
+ OS.SetWindowPos (hwnd, hwndInsertAfter, rect1.left, rect1.top, rect1.right - rect1.left, rect1.bottom - rect1.top, flags);
if ((bits1 & OS.WS_VISIBLE) != 0) {
OS.DefWindowProc (hwnd, OS.WM_SETREDRAW, 1, 0);
}
@@ -2484,13 +2456,9 @@ public void redraw () {
void redraw (boolean all) {
// checkWidget ();
if (!OS.IsWindowVisible (handle)) return;
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
- if (all) flags |= OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
+ if (all) flags |= OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
/**
* Causes the rectangular area of the receiver specified by
@@ -2543,13 +2511,9 @@ void redrawInPixels (int x, int y, int width, int height, boolean all) {
if (!OS.IsWindowVisible (handle)) return;
RECT rect = new RECT ();
OS.SetRect (rect, x, y, x + width, y + height);
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, rect, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
- if (all) flags |= OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, rect, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
+ if (all) flags |= OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, rect, 0, flags);
}
boolean redrawChildren () {
@@ -2557,7 +2521,7 @@ boolean redrawChildren () {
Control control = findBackgroundControl ();
if (control == null) {
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
OS.InvalidateRect (handle, null, true);
return true;
}
@@ -3224,21 +3188,13 @@ public void setBackgroundImage (Image image) {
}
void setBackgroundImage (long /*int*/ hBitmap) {
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
+ OS.RedrawWindow (handle, null, 0, flags);
}
void setBackgroundPixel (int pixel) {
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
+ OS.RedrawWindow (handle, null, 0, flags);
}
/**
@@ -3292,7 +3248,7 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags, boolean
if (backgroundImage == null) flags |= OS.SWP_NOCOPYBITS;
} else {
if (OS.GetWindow (handle, OS.GW_CHILD) == 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (findThemeControl () != null) flags |= OS.SWP_NOCOPYBITS;
}
}
@@ -3323,7 +3279,7 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags, boolean
return;
}
}
- SetWindowPos (topHandle, 0, x, y, width, height, flags);
+ OS.SetWindowPos (topHandle, 0, x, y, width, height, flags);
}
/**
@@ -3411,11 +3367,6 @@ public void setCursor (Cursor cursor) {
checkWidget ();
if (cursor != null && cursor.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
this.cursor = cursor;
- if (OS.IsWinCE) {
- long /*int*/ hCursor = cursor != null ? cursor.handle : 0;
- OS.SetCursor (hCursor);
- return;
- }
long /*int*/ hwndCursor = OS.GetCapture ();
if (hwndCursor == 0) {
POINT pt = new POINT ();
@@ -3612,14 +3563,7 @@ public void setLocation (int x, int y) {
}
void setLocationInPixels (int x, int y) {
- int flags = OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE;
- /*
- * Feature in WinCE. The SWP_DRAWFRAME flag for SetWindowPos()
- * causes a WM_SIZE message to be sent even when the SWP_NOSIZE
- * flag is specified. The fix is to set SWP_DRAWFRAME only when
- * not running on WinCE.
- */
- if (!OS.IsWinCE) flags |= OS.SWP_DRAWFRAME;
+ int flags = OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE | OS.SWP_DRAWFRAME;
setBoundsInPixels (x, y, 0, 0, flags);
}
@@ -3699,8 +3643,6 @@ public void setMenu (Menu menu) {
*/
public void setOrientation (int orientation) {
checkWidget ();
- if (OS.IsWinCE) return;
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return;
int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
if ((orientation & flags) == 0 || (orientation & flags) == flags) return;
style &= ~SWT.MIRRORED;
@@ -3767,13 +3709,8 @@ public void setRedraw (boolean redraw) {
OS.ShowWindow (topHandle, OS.SW_HIDE);
if (handle != topHandle) OS.ShowWindow (handle, OS.SW_HIDE);
} else {
- if (OS.IsWinCE) {
- OS.InvalidateRect (topHandle, null, true);
- if (handle != topHandle) OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (topHandle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (topHandle, null, 0, flags);
}
}
} else {
@@ -3916,8 +3853,6 @@ boolean setTabItemFocus () {
*/
public void setTextDirection(int textDirection) {
checkWidget ();
- if (OS.IsWinCE) return;
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return;
textDirection &= (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT);
updateTextDirection (textDirection);
if (textDirection == AUTO_TEXT_DIRECTION) {
@@ -4288,14 +4223,6 @@ boolean translateTraversal (MSG msg) {
case OS.VK_LEFT:
case OS.VK_DOWN:
case OS.VK_RIGHT: {
- /*
- * On WinCE SP there is no tab key. Focus is assigned
- * using the VK_UP and VK_DOWN keys, not with VK_LEFT
- * or VK_RIGHT.
- */
- if (OS.IsSP) {
- if (key == OS.VK_LEFT || key == OS.VK_RIGHT) return false;
- }
lastVirtual = true;
long /*int*/ code = OS.SendMessage (hwnd, OS.WM_GETDLGCODE, 0, 0);
if ((code & (OS.DLGC_WANTARROWS /*| OS.DLGC_WANTALLKEYS*/)) != 0) doit = false;
@@ -4680,13 +4607,9 @@ public void update () {
void update (boolean all) {
// checkWidget ();
- if (OS.IsWinCE) {
- OS.UpdateWindow (handle);
- } else {
- int flags = OS.RDW_UPDATENOW;
- if (all) flags |= OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_UPDATENOW;
+ if (all) flags |= OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
void updateBackgroundColor () {
@@ -4713,10 +4636,6 @@ void updateFont (Font oldFont, Font newFont) {
if (getFont ().equals (oldFont)) setFont (newFont);
}
-void updateImages () {
- /* Do nothing */
-}
-
void updateLayout (boolean resize, boolean all) {
/* Do nothing */
}
@@ -4771,20 +4690,10 @@ CREATESTRUCT widgetCreateStruct () {
int widgetExtStyle () {
int bits = 0;
- if (!OS.IsPPC) {
- if ((style & SWT.BORDER) != 0) bits |= OS.WS_EX_CLIENTEDGE;
- }
+ if ((style & SWT.BORDER) != 0) bits |= OS.WS_EX_CLIENTEDGE;
// if ((style & SWT.BORDER) != 0) {
// if ((style & SWT.FLAT) == 0) bits |= OS.WS_EX_CLIENTEDGE;
// }
- /*
- * Feature in Windows NT. When CreateWindowEx() is called with
- * WS_EX_LAYOUTRTL or WS_EX_NOINHERITLAYOUT, CreateWindowEx()
- * fails to create the HWND. The fix is to not use these bits.
- */
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- return bits;
- }
bits |= OS.WS_EX_NOINHERITLAYOUT;
if ((style & SWT.RIGHT_TO_LEFT) != 0) bits |= OS.WS_EX_LAYOUTRTL;
if ((style & SWT.FLIP_TEXT_DIRECTION) != 0) bits |= OS.WS_EX_RTLREADING;
@@ -4801,9 +4710,6 @@ int widgetStyle () {
// if ((style & SWT.BORDER) != 0) {
// if ((style & SWT.FLAT) != 0) bits |= OS.WS_BORDER;
// }
- if (OS.IsPPC) {
- if ((style & SWT.BORDER) != 0) bits |= OS.WS_BORDER;
- }
return bits;
/*
@@ -4851,7 +4757,7 @@ public boolean setParent (Composite parent) {
if (OS.SetParent (topHandle, parent.handle) == 0) return false;
this.parent = parent;
int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- SetWindowPos (topHandle, OS.HWND_BOTTOM, 0, 0, 0, 0, flags);
+ OS.SetWindowPos (topHandle, OS.HWND_BOTTOM, 0, 0, 0, 0, flags);
reskin (SWT.ALL);
return true;
}
@@ -5068,7 +4974,7 @@ LRESULT WM_ERASEBKGND (long /*int*/ wParam, long /*int*/ lParam) {
if (findImageControl () != null) return LRESULT.ONE;
}
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (findThemeControl () != null) return LRESULT.ONE;
}
}
@@ -5114,7 +5020,6 @@ LRESULT WM_HOTKEY (long /*int*/ wParam, long /*int*/ lParam) {
}
LRESULT WM_HELP (long /*int*/ wParam, long /*int*/ lParam) {
- if (OS.IsWinCE) return null;
HELPINFO lphi = new HELPINFO ();
OS.MoveMemory (lphi, lParam, HELPINFO.sizeof);
Decorations shell = menuShell ();
@@ -5388,7 +5293,7 @@ LRESULT WM_MOUSEHOVER (long /*int*/ wParam, long /*int*/ lParam) {
}
LRESULT WM_MOUSELEAVE (long /*int*/ wParam, long /*int*/ lParam) {
- if (OS.COMCTL32_MAJOR >= 6) getShell ().fixToolTip ();
+ getShell ().fixToolTip ();
return wmMouseLeave (handle, wParam, lParam);
}
@@ -5410,7 +5315,7 @@ LRESULT WM_MOVE (long /*int*/ wParam, long /*int*/ lParam) {
if (this != getShell ()) redrawChildren ();
} else {
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (OS.IsWindowVisible (handle)) {
if (findThemeControl () != null) redrawChildren ();
}
@@ -5615,7 +5520,7 @@ LRESULT WM_SYSCOMMAND (long /*int*/ wParam, long /*int*/ lParam) {
Decorations shell = menuShell ();
Menu menu = shell.getMenuBar ();
if (menu != null) {
- char key = Display.mbcsToWcs ((int)/*64*/lParam);
+ char key = (char) lParam;
if (key != 0) {
key = Character.toUpperCase (key);
MenuItem [] items = menu.getItems ();
@@ -5794,17 +5699,13 @@ LRESULT WM_WINDOWPOSCHANGING (long /*int*/ wParam, long /*int*/ lParam) {
if (width != 0 && height != 0) {
long /*int*/ hwndParent = parent == null ? 0 : parent.handle;
OS.MapWindowPoints (0, hwndParent, rect, 2);
- if (OS.IsWinCE) {
- OS.InvalidateRect (hwndParent, rect, true);
- } else {
- long /*int*/ rgn1 = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
- long /*int*/ rgn2 = OS.CreateRectRgn (lpwp.x, lpwp.y, lpwp.x + lpwp.cx, lpwp.y + lpwp.cy);
- OS.CombineRgn (rgn1, rgn1, rgn2, OS.RGN_DIFF);
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (hwndParent, null, rgn1, flags);
- OS.DeleteObject (rgn1);
- OS.DeleteObject (rgn2);
- }
+ long /*int*/ rgn1 = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
+ long /*int*/ rgn2 = OS.CreateRectRgn (lpwp.x, lpwp.y, lpwp.x + lpwp.cx, lpwp.y + lpwp.cy);
+ OS.CombineRgn (rgn1, rgn1, rgn2, OS.RGN_DIFF);
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (hwndParent, null, rgn1, flags);
+ OS.DeleteObject (rgn1);
+ OS.DeleteObject (rgn2);
}
}
}
@@ -5828,7 +5729,7 @@ LRESULT wmColorChild (long /*int*/ wParam, long /*int*/ lParam) {
Control control = findBackgroundControl ();
if (control == null) {
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
control = findThemeControl ();
if (control != null) {
RECT rect = new RECT ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
index 71f50c22d0..f7c35d60b8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolBar.java
@@ -151,28 +151,20 @@ protected void checkSubclass () {
ignoreResize = true;
boolean redraw = false;
if (OS.IsWindowVisible (handle)) {
- if (OS.COMCTL32_MAJOR >= 6) {
- redraw = true;
- OS.UpdateWindow (handle);
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
- } else {
- redraw = getDrawing();
- if (redraw) {
- OS.UpdateWindow (handle);
- OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- }
- }
+ redraw = true;
+ OS.UpdateWindow (handle);
+ OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
}
RECT oldRect = new RECT ();
OS.GetWindowRect (handle, oldRect);
int oldWidth = oldRect.right - oldRect.left;
int oldHeight = oldRect.bottom - oldRect.top;
int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOREDRAW | OS.SWP_NOZORDER;
- SetWindowPos (handle, 0, 0, 0, newWidth, newHeight, flags);
+ OS.SetWindowPos (handle, 0, 0, 0, newWidth, newHeight, flags);
RECT rect = new RECT ();
OS.SendMessage (handle, OS.RB_GETRECT, count - 1, rect);
height = Math.max (height, rect.bottom);
- SetWindowPos (handle, 0, 0, 0, oldWidth, oldHeight, flags);
+ OS.SetWindowPos (handle, 0, 0, 0, oldWidth, oldHeight, flags);
REBARBANDINFO rbBand = new REBARBANDINFO ();
rbBand.cbSize = REBARBANDINFO.sizeof;
rbBand.fMask = OS.RBBIM_IDEALSIZE | OS.RBBIM_STYLE;
@@ -187,11 +179,7 @@ protected void checkSubclass () {
}
width = Math.max(width, rowWidth);
if (redraw) {
- if (OS.COMCTL32_MAJOR >= 6) {
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
- } else {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- }
+ OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
}
ignoreResize = false;
}
@@ -373,7 +361,7 @@ void destroyItem (CoolItem item) {
@Override
void drawThemeBackground (long /*int*/ hDC, long /*int*/ hwnd, RECT rect) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (background == -1 && (style & SWT.FLAT) != 0) {
Control control = findBackgroundControl ();
if (control != null && control.backgroundImage != null) {
@@ -399,11 +387,9 @@ Control findThemeControl () {
int getMargin (int index) {
int margin = 0;
- if (OS.COMCTL32_MAJOR >= 6) {
- MARGINS margins = new MARGINS ();
- OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, margins);
- margin += margins.cxLeftWidth + margins.cxRightWidth;
- }
+ MARGINS margins = new MARGINS ();
+ OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, margins);
+ margin += margins.cxLeftWidth + margins.cxRightWidth;
RECT rect = new RECT ();
OS.SendMessage (handle, OS.RB_GETBANDBORDERS, index, rect);
if ((style & SWT.FLAT) != 0) {
@@ -581,11 +567,9 @@ Point [] getItemSizesInPixels () {
RECT rect = new RECT ();
OS.SendMessage (handle, OS.RB_GETRECT, i, rect);
OS.SendMessage (handle, OS.RB_GETBANDINFO, i, rbBand);
- if (OS.COMCTL32_MAJOR >= 6) {
- OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, margins);
- rect.left -= margins.cxLeftWidth;
- rect.right += margins.cxRightWidth;
- }
+ OS.SendMessage (handle, OS.RB_GETBANDMARGINS, 0, margins);
+ rect.left -= margins.cxLeftWidth;
+ rect.right += margins.cxRightWidth;
if (!isLastItemOfRow(i)) rect.right += separator;
if ((style & SWT.VERTICAL) != 0) {
sizes [i] = new Point (rbBand.cyChild, rect.right - rect.left);
@@ -767,12 +751,8 @@ void setBackgroundPixel (int pixel) {
* to invalidate the coolbar area.
*/
if (!OS.IsWindowVisible (handle)) return;
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
@Override
@@ -1069,7 +1049,7 @@ LRESULT WM_ERASEBKGND (long /*int*/ wParam, long /*int*/ lParam) {
* the cool bar window proc after the background has
* been erased.
*/
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
+ if (!OS.IsAppThemed ()) {
drawBackground (wParam);
return null;
}
@@ -1124,14 +1104,7 @@ LRESULT WM_SETREDRAW (long /*int*/ wParam, long /*int*/ lParam) {
* not running the default window proc or the rebar window
* proc.
*/
- if (OS.COMCTL32_MAJOR >= 6) return LRESULT.ZERO;
- Rectangle rect = getBoundsInPixels ();
- long /*int*/ code = callWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam);
- OS.DefWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam);
- if (!rect.equals (getBoundsInPixels ())) {
- parent.redrawInPixels (rect.x, rect.y, rect.width, rect.height, true);
- }
- return new LRESULT (code);
+ return LRESULT.ZERO;
}
@Override
@@ -1142,7 +1115,7 @@ LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
return new LRESULT (code);
}
//TEMPORARY CODE
-// if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+// if (OS.IsAppThemed ()) {
// if (background == -1 && (style & SWT.FLAT) == 0) {
// OS.InvalidateRect (handle, null, true);
// }
@@ -1215,13 +1188,6 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
break;
}
case OS.NM_CUSTOMDRAW: {
- /*
- * Bug in Windows. On versions of Windows prior to XP,
- * drawing the background color in NM_CUSTOMDRAW erases
- * the separators. The fix is to draw the background
- * in WM_ERASEBKGND.
- */
- if (OS.COMCTL32_MAJOR < 6) break;
if (findBackgroundControl () != null || (style & SWT.FLAT) != 0) {
NMCUSTOMDRAW nmcd = new NMCUSTOMDRAW ();
OS.MoveMemory (nmcd, lParam, NMCUSTOMDRAW.sizeof);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
index 1931910066..ae700a5683 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/CoolItem.java
@@ -232,12 +232,10 @@ Rectangle getBoundsInPixels () {
long /*int*/ hwnd = parent.handle;
RECT rect = new RECT ();
OS.SendMessage (hwnd, OS.RB_GETRECT, index, rect);
- if (OS.COMCTL32_MAJOR >= 6) {
- MARGINS margins = new MARGINS ();
- OS.SendMessage (hwnd, OS.RB_GETBANDMARGINS, 0, margins);
- rect.left -= margins.cxLeftWidth;
- rect.right += margins.cxRightWidth;
- }
+ MARGINS margins = new MARGINS ();
+ OS.SendMessage (hwnd, OS.RB_GETBANDMARGINS, 0, margins);
+ rect.left -= margins.cxLeftWidth;
+ rect.right += margins.cxRightWidth;
if (!parent.isLastItemOfRow (index)) {
rect.right += (parent.style & SWT.FLAT) == 0 ? CoolBar.SEPARATOR_WIDTH : 0;
}
@@ -367,7 +365,7 @@ public void setControl (Control control) {
if (showOld) oldControl.setVisible (true);
if (hwndAbove != 0 && hwndAbove != hwndChild) {
int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- SetWindowPos (hwndChild, hwndAbove, 0, 0, 0, 0, flags);
+ OS.SetWindowPos (hwndChild, hwndAbove, 0, 0, 0, 0, flags);
}
}
@@ -493,12 +491,10 @@ Point getSizeInPixels() {
long /*int*/ hwnd = parent.handle;
RECT rect = new RECT ();
OS.SendMessage (hwnd, OS.RB_GETRECT, index, rect);
- if (OS.COMCTL32_MAJOR >= 6) {
- MARGINS margins = new MARGINS ();
- OS.SendMessage (hwnd, OS.RB_GETBANDMARGINS, 0, margins);
- rect.left -= margins.cxLeftWidth;
- rect.right += margins.cxRightWidth;
- }
+ MARGINS margins = new MARGINS ();
+ OS.SendMessage (hwnd, OS.RB_GETBANDMARGINS, 0, margins);
+ rect.left -= margins.cxLeftWidth;
+ rect.right += margins.cxRightWidth;
if (!parent.isLastItemOfRow (index)) {
rect.right += (parent.style & SWT.FLAT) == 0 ? CoolBar.SEPARATOR_WIDTH : 0;
}
@@ -563,11 +559,9 @@ void setSizeInPixels (int width, int height) {
* Do not set the size for the last item on the row.
*/
if (!parent.isLastItemOfRow (index)) {
- if (OS.COMCTL32_MAJOR >= 6) {
- MARGINS margins = new MARGINS ();
- OS.SendMessage (hwnd, OS.RB_GETBANDMARGINS, 0, margins);
- cx -= margins.cxLeftWidth + margins.cxRightWidth;
- }
+ MARGINS margins = new MARGINS ();
+ OS.SendMessage (hwnd, OS.RB_GETBANDMARGINS, 0, margins);
+ cx -= margins.cxLeftWidth + margins.cxRightWidth;
int separator = (parent.style & SWT.FLAT) == 0 ? CoolBar.SEPARATOR_WIDTH : 0;
rbBand.cx = cx - separator;
rbBand.fMask |= OS.RBBIM_SIZE;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java
index e30d1a8e79..6d53fd8f0b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java
@@ -126,15 +126,6 @@ public class DateTime extends Composite {
OS.RegisterClass (lpWndClass);
OS.HeapFree (hHeap, 0, lpszClassName);
}
- static final int MARGIN = 4;
- static final int MAX_DIGIT = 9;
- static final int MAX_DAY = 31;
- static final int MAX_12HOUR = 12;
- static final int MAX_24HOUR = 24;
- static final int MAX_MINUTE = 60;
- static final int MONTH_DAY_YEAR = 0;
- static final int DAY_MONTH_YEAR = 1;
- static final int YEAR_MONTH_DAY = 2;
static final char SINGLE_QUOTE = '\''; //$NON-NLS-1$ short date format may include quoted text
static final char DAY_FORMAT_CONSTANT = 'd'; //$NON-NLS-1$ 1-4 lowercase 'd's represent day
static final char MONTH_FORMAT_CONSTANT = 'M'; //$NON-NLS-1$ 1-4 uppercase 'M's represent month
@@ -143,7 +134,6 @@ public class DateTime extends Composite {
static final char MINUTES_FORMAT_CONSTANT = 'm'; //$NON-NLS-1$ 1-2 lowercase 'm's represent minutes
static final char SECONDS_FORMAT_CONSTANT = 's'; //$NON-NLS-1$ 1-2 lowercase 's's represent seconds
static final char AMPM_FORMAT_CONSTANT = 't'; //$NON-NLS-1$ 1-2 lowercase 't's represent am/pm
- static final int[] MONTH_NAMES = new int[] {OS.LOCALE_SMONTHNAME1, OS.LOCALE_SMONTHNAME2, OS.LOCALE_SMONTHNAME3, OS.LOCALE_SMONTHNAME4, OS.LOCALE_SMONTHNAME5, OS.LOCALE_SMONTHNAME6, OS.LOCALE_SMONTHNAME7, OS.LOCALE_SMONTHNAME8, OS.LOCALE_SMONTHNAME9, OS.LOCALE_SMONTHNAME10, OS.LOCALE_SMONTHNAME11, OS.LOCALE_SMONTHNAME12};
/**
@@ -257,58 +247,12 @@ protected void checkSubclass () {
width = rect.right;
height = rect.bottom;
} else {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- /* Vista and later: use DTM_GETIDEALSIZE. */
- SIZE size = new SIZE ();
- OS.SendMessage(handle, OS.DTM_GETIDEALSIZE, 0, size);
- width = size.cx;
- height = size.cy;
- } else {
- long /*int*/ newFont, oldFont = 0;
- long /*int*/ 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 ();
- if ((style & SWT.DATE) != 0) {
- int dwFlags = 0;
- TCHAR lpFormat = null;
- if ((style & SWT.SHORT) != 0) {
- lpFormat = new TCHAR (0, getCustomShortDateFormat(), true);
- } else {
- dwFlags = (style & SWT.MEDIUM) != 0 ? OS.DATE_SHORTDATE : OS.DATE_LONGDATE;
- }
- int size = OS.GetDateFormat(OS.LOCALE_USER_DEFAULT, dwFlags, null, lpFormat, null, 0);
- if (size > 0) {
- TCHAR buffer = new TCHAR (getCodePage (), size);
- OS.GetDateFormat(OS.LOCALE_USER_DEFAULT, dwFlags, null, lpFormat, buffer, buffer.length ());
- OS.DrawText (hDC, buffer, size, rect, OS.DT_CALCRECT | OS.DT_EDITCONTROL);
- }
- } else if ((style & SWT.TIME) != 0) {
- int dwFlags = 0;
- TCHAR lpFormat = null;
- if ((style & SWT.SHORT) != 0) {
- dwFlags = OS.TIME_NOSECONDS;
- lpFormat = new TCHAR (0, getCustomShortTimeFormat(), true);
- }
- int size = OS.GetTimeFormat(OS.LOCALE_USER_DEFAULT, dwFlags, null, lpFormat, null, 0);
- if (size > 0) {
- TCHAR buffer = new TCHAR (getCodePage (), size);
- OS.GetTimeFormat(OS.LOCALE_USER_DEFAULT, dwFlags, null, lpFormat, buffer, buffer.length ());
- OS.DrawText (hDC, buffer, size, rect, OS.DT_CALCRECT | OS.DT_EDITCONTROL);
- }
- }
- width = rect.right - rect.left;
- height = rect.bottom - rect.top;
- if (newFont != 0) OS.SelectObject (hDC, oldFont);
- OS.ReleaseDC (handle, hDC);
- int upDownWidth = OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- width += upDownWidth + MARGIN;
- }
- int upDownHeight = OS.GetSystemMetrics (OS.SM_CYVSCROLL);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- // TODO: Can maybe use DTM_GETDATETIMEPICKERINFO for this
- upDownHeight += 7;
- }
+ SIZE size = new SIZE ();
+ OS.SendMessage(handle, OS.DTM_GETIDEALSIZE, 0, size);
+ width = size.cx;
+ height = size.cy;
+ // TODO: Can maybe use DTM_GETDATETIMEPICKERINFO for this
+ int upDownHeight = OS.GetSystemMetrics (OS.SM_CYVSCROLL) + 7;
height = Math.max (height, upDownHeight);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
index c292f6acb2..d93927cb2d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
@@ -160,37 +160,13 @@ public Decorations (Composite parent, int style) {
void _setMaximized (boolean maximized) {
swFlags = maximized ? OS.SW_SHOWMAXIMIZED : OS.SW_RESTORE;
- if (OS.IsWinCE) {
- /*
- * Note: WinCE does not support SW_SHOWMAXIMIZED and SW_RESTORE. The
- * workaround is to resize the window to fit the parent client area.
- */
- if (maximized) {
- RECT rect = new RECT ();
- OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
- int width = rect.right - rect.left, height = rect.bottom - rect.top;
- if (OS.IsPPC) {
- /* Leave space for the menu bar */
- if (menuBar != null) {
- long /*int*/ hwndCB = menuBar.hwndCB;
- RECT rectCB = new RECT ();
- OS.GetWindowRect (hwndCB, rectCB);
- height -= rectCB.bottom - rectCB.top;
- }
- }
- int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- SetWindowPos (handle, 0, rect.left, rect.top, width, height, flags);
- }
- } else {
- if (!OS.IsWindowVisible (handle)) return;
- if (maximized == OS.IsZoomed (handle)) return;
- OS.ShowWindow (handle, swFlags);
- OS.UpdateWindow (handle);
- }
+ if (!OS.IsWindowVisible (handle)) return;
+ if (maximized == OS.IsZoomed (handle)) return;
+ OS.ShowWindow (handle, swFlags);
+ OS.UpdateWindow (handle);
}
void _setMinimized (boolean minimized) {
- if (OS.IsWinCE) return;
swFlags = minimized ? OS.SW_SHOWMINNOACTIVE : OS.SW_RESTORE;
if (!OS.IsWindowVisible (handle)) return;
if (minimized == OS.IsIconic (handle)) return;
@@ -240,17 +216,6 @@ static int checkStyle (int style) {
} else if ((style & SWT.NO_MOVE) != 0) {
style |= SWT.TITLE;
}
- if (OS.IsWinCE) {
- /*
- * Feature in WinCE PPC. WS_MINIMIZEBOX or WS_MAXIMIZEBOX
- * are not supposed to be used. If they are, the result
- * is a button which does not repaint correctly. The fix
- * is to remove this style.
- */
- if ((style & SWT.MIN) != 0) style &= ~SWT.MIN;
- if ((style & SWT.MAX) != 0) style &= ~SWT.MAX;
- return style;
- }
if ((style & (SWT.MENU | SWT.MIN | SWT.MAX | SWT.CLOSE)) != 0) {
style |= SWT.TITLE;
}
@@ -326,10 +291,8 @@ int compare (ImageData data1, ImageData data2, int width, int height, int depth)
if (data1.depth == data2.depth) return 0;
return data1.depth > data2.depth && data1.depth <= depth ? -1 : 1;
}
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- if (transparent1 == SWT.TRANSPARENCY_ALPHA) return -1;
- if (transparent2 == SWT.TRANSPARENCY_ALPHA) return 1;
- }
+ if (transparent1 == SWT.TRANSPARENCY_ALPHA) return -1;
+ if (transparent2 == SWT.TRANSPARENCY_ALPHA) return 1;
if (transparent1 == SWT.TRANSPARENCY_MASK) return -1;
if (transparent2 == SWT.TRANSPARENCY_MASK) return 1;
if (transparent1 == SWT.TRANSPARENCY_PIXEL) return -1;
@@ -357,7 +320,7 @@ Control computeTabRoot () {
OS.SetRect (rect, x, y, x + width, y + height);
int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
int bits2 = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
- boolean hasMenu = OS.IsWinCE ? false : OS.GetMenu (handle) != 0;
+ boolean hasMenu = OS.GetMenu (handle) != 0;
OS.AdjustWindowRectEx (rect, bits1, hasMenu, bits2);
/* Get the size of the scroll bars */
@@ -381,47 +344,29 @@ Control computeTabRoot () {
void createAccelerators () {
hAccel = nAccel = 0;
- int maxAccel = 0;
MenuItem [] items = display.items;
if (menuBar == null || items == null) {
- if (!OS.IsPPC) return;
- maxAccel = 1;
- } else {
- maxAccel = OS.IsPPC ? items.length + 1 : items.length;
+ return;
}
ACCEL accel = new ACCEL ();
byte [] buffer1 = new byte [ACCEL.sizeof];
- byte [] buffer2 = new byte [maxAccel * ACCEL.sizeof];
- if (menuBar != null && items != null) {
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if (item != null && item.accelerator != 0) {
- Menu menu = item.parent;
- if (menu.parent == this) {
- while (menu != null && menu != menuBar) {
- menu = menu.getParentMenu ();
- }
- if (menu == menuBar && item.fillAccel (accel)) {
- OS.MoveMemory (buffer1, accel, ACCEL.sizeof);
- System.arraycopy (buffer1, 0, buffer2, nAccel * ACCEL.sizeof, ACCEL.sizeof);
- nAccel++;
- }
+ byte [] buffer2 = new byte [items.length * ACCEL.sizeof];
+ for (int i=0; i<items.length; i++) {
+ MenuItem item = items [i];
+ if (item != null && item.accelerator != 0) {
+ Menu menu = item.parent;
+ if (menu.parent == this) {
+ while (menu != null && menu != menuBar) {
+ menu = menu.getParentMenu ();
+ }
+ if (menu == menuBar && item.fillAccel (accel)) {
+ OS.MoveMemory (buffer1, accel, ACCEL.sizeof);
+ System.arraycopy (buffer1, 0, buffer2, nAccel * ACCEL.sizeof, ACCEL.sizeof);
+ nAccel++;
}
}
}
}
- if (OS.IsPPC) {
- /*
- * Note on WinCE PPC. Close the shell when user taps CTRL-Q.
- * IDOK represents the "Done Button" which also closes the shell.
- */
- accel.fVirt = (byte) (OS.FVIRTKEY | OS.FCONTROL);
- accel.key = (short) 'Q';
- accel.cmd = (short) OS.IDOK;
- OS.MoveMemory (buffer1, accel, ACCEL.sizeof);
- System.arraycopy (buffer1, 0, buffer2, nAccel * ACCEL.sizeof, ACCEL.sizeof);
- nAccel++;
- }
if (nAccel != 0) hAccel = OS.CreateAcceleratorTable (buffer2, nAccel);
}
@@ -437,7 +382,7 @@ void createHandle () {
@Override
void createWidget () {
super.createWidget ();
- swFlags = OS.IsWinCE ? OS.SW_SHOWMAXIMIZED : OS.SW_SHOWNOACTIVATE;
+ swFlags = OS.SW_SHOWNOACTIVATE;
hAccel = -1;
}
@@ -493,73 +438,54 @@ void fixDecorations (Decorations newDecorations, Control control, Menu [] menus)
@Override Rectangle getBoundsInPixels () {
checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
- int width = maxRect.right - maxRect.left;
- int height = maxRect.bottom - maxRect.top;
- return new Rectangle (maxRect.left, maxRect.top, width, height);
- }
- int width = lpwndpl.right - lpwndpl.left;
- int height = lpwndpl.bottom - lpwndpl.top;
- return new Rectangle (lpwndpl.left, lpwndpl.top, width, height);
+ if (OS.IsIconic (handle)) {
+ WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
+ lpwndpl.length = WINDOWPLACEMENT.sizeof;
+ OS.GetWindowPlacement (handle, lpwndpl);
+ if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
+ int width = maxRect.right - maxRect.left;
+ int height = maxRect.bottom - maxRect.top;
+ return new Rectangle (maxRect.left, maxRect.top, width, height);
}
+ int width = lpwndpl.right - lpwndpl.left;
+ int height = lpwndpl.bottom - lpwndpl.top;
+ return new Rectangle (lpwndpl.left, lpwndpl.top, width, height);
}
return super.getBoundsInPixels ();
}
@Override Rectangle getClientAreaInPixels () {
checkWidget ();
- /*
- * Note: The CommandBar is part of the client area,
- * not the trim. Applications don't expect this so
- * subtract the height of the CommandBar.
- */
- if (OS.IsHPC) {
- Rectangle rect = super.getClientAreaInPixels ();
- if (menuBar != null) {
- long /*int*/ hwndCB = menuBar.hwndCB;
- int height = OS.CommandBar_Height (hwndCB);
- rect.y += height;
- rect.height = Math.max (0, rect.height - height);
- }
- return rect;
- }
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
- return new Rectangle (0, 0, oldWidth, oldHeight);
- }
- int width = lpwndpl.right - lpwndpl.left;
- int height = lpwndpl.bottom - lpwndpl.top;
- /*
- * Feature in Windows. For some reason WM_NCCALCSIZE does
- * not compute the client area when the window is minimized.
- * The fix is to compute it using AdjustWindowRectEx() and
- * GetSystemMetrics().
- *
- * NOTE: This code fails to compute the correct client area
- * for a minimized window where the menu bar would wrap were
- * the window restored. There is no fix for this problem at
- * this time.
- */
- if (horizontalBar != null) width -= OS.GetSystemMetrics (OS.SM_CYHSCROLL);
- if (verticalBar != null) height -= OS.GetSystemMetrics (OS.SM_CXVSCROLL);
- RECT rect = new RECT ();
- int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
- int bits2 = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
- boolean hasMenu = OS.IsWinCE ? false : OS.GetMenu (handle) != 0;
- OS.AdjustWindowRectEx (rect, bits1, hasMenu, bits2);
- width = Math.max (0, width - (rect.right - rect.left));
- height = Math.max (0, height - (rect.bottom - rect.top));
- return new Rectangle (0, 0, width, height);
+ if (OS.IsIconic (handle)) {
+ WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
+ lpwndpl.length = WINDOWPLACEMENT.sizeof;
+ OS.GetWindowPlacement (handle, lpwndpl);
+ if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
+ return new Rectangle (0, 0, oldWidth, oldHeight);
}
+ int width = lpwndpl.right - lpwndpl.left;
+ int height = lpwndpl.bottom - lpwndpl.top;
+ /*
+ * Feature in Windows. For some reason WM_NCCALCSIZE does
+ * not compute the client area when the window is minimized.
+ * The fix is to compute it using AdjustWindowRectEx() and
+ * GetSystemMetrics().
+ *
+ * NOTE: This code fails to compute the correct client area
+ * for a minimized window where the menu bar would wrap were
+ * the window restored. There is no fix for this problem at
+ * this time.
+ */
+ if (horizontalBar != null) width -= OS.GetSystemMetrics (OS.SM_CYHSCROLL);
+ if (verticalBar != null) height -= OS.GetSystemMetrics (OS.SM_CXVSCROLL);
+ RECT rect = new RECT ();
+ int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
+ int bits2 = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
+ boolean hasMenu = OS.GetMenu (handle) != 0;
+ OS.AdjustWindowRectEx (rect, bits1, hasMenu, bits2);
+ width = Math.max (0, width - (rect.right - rect.left));
+ height = Math.max (0, height - (rect.bottom - rect.top));
+ return new Rectangle (0, 0, width, height);
}
return super.getClientAreaInPixels ();
}
@@ -646,16 +572,14 @@ public Image [] getImages () {
@Override Point getLocationInPixels () {
checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
- return new Point (maxRect.left, maxRect.top);
- }
- return new Point (lpwndpl.left, lpwndpl.top);
+ if (OS.IsIconic (handle)) {
+ WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
+ lpwndpl.length = WINDOWPLACEMENT.sizeof;
+ OS.GetWindowPlacement (handle, lpwndpl);
+ if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
+ return new Point (maxRect.left, maxRect.top);
}
+ return new Point (lpwndpl.left, lpwndpl.top);
}
return super.getLocationInPixels ();
}
@@ -676,7 +600,6 @@ public Image [] getImages () {
*/
public boolean getMaximized () {
checkWidget ();
- if (OS.IsWinCE) return swFlags == OS.SW_SHOWMAXIMIZED;
if (OS.IsWindowVisible (handle)) return OS.IsZoomed (handle);
return swFlags == OS.SW_SHOWMAXIMIZED;
}
@@ -713,7 +636,6 @@ public Menu getMenuBar () {
*/
public boolean getMinimized () {
checkWidget ();
- if (OS.IsWinCE) return false;
if (OS.IsWindowVisible (handle)) return OS.IsIconic (handle);
return swFlags == OS.SW_SHOWMINNOACTIVE;
}
@@ -725,20 +647,18 @@ String getNameText () {
@Override Point getSizeInPixels () {
checkWidget ();
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
- lpwndpl.length = WINDOWPLACEMENT.sizeof;
- OS.GetWindowPlacement (handle, lpwndpl);
- if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
- int width = maxRect.right - maxRect.left;
- int height = maxRect.bottom - maxRect.top;
- return new Point (width, height);
- }
- int width = lpwndpl.right - lpwndpl.left;
- int height = lpwndpl.bottom - lpwndpl.top;
+ if (OS.IsIconic (handle)) {
+ WINDOWPLACEMENT lpwndpl = new WINDOWPLACEMENT ();
+ lpwndpl.length = WINDOWPLACEMENT.sizeof;
+ OS.GetWindowPlacement (handle, lpwndpl);
+ if ((lpwndpl.flags & OS.WPF_RESTORETOMAXIMIZED) != 0) {
+ int width = maxRect.right - maxRect.left;
+ int height = maxRect.bottom - maxRect.top;
return new Point (width, height);
}
+ int width = lpwndpl.right - lpwndpl.left;
+ int height = lpwndpl.bottom - lpwndpl.top;
+ return new Point (width, height);
}
return super.getSizeInPixels ();
}
@@ -869,13 +789,9 @@ void saveFocus () {
@Override
void setBoundsInPixels (int x, int y, int width, int height, int flags, boolean defer) {
swFlags = OS.SW_SHOWNOACTIVATE;
- if (OS.IsWinCE) {
- swFlags = OS.SW_RESTORE;
- } else {
- if (OS.IsIconic (handle)) {
- setPlacement (x, y, width, height, flags);
- return;
- }
+ if (OS.IsIconic (handle)) {
+ setPlacement (x, y, width, height, flags);
+ return;
}
forceResize ();
RECT rect = new RECT ();
@@ -890,13 +806,11 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags, boolean
sameExtent = rect.right - rect.left == width && rect.bottom - rect.top == height;
if (!sameExtent) resized = true;
}
- if (!OS.IsWinCE) {
- if (OS.IsZoomed (handle)) {
- if (sameOrigin && sameExtent) return;
- setPlacement (x, y, width, height, flags);
- _setMaximized (false);
- return;
- }
+ if (OS.IsZoomed (handle)) {
+ if (sameOrigin && sameExtent) return;
+ setPlacement (x, y, width, height, flags);
+ _setMaximized (false);
+ return;
}
super.setBoundsInPixels (x, y, width, height, flags, defer);
}
@@ -984,16 +898,6 @@ public void setImage (Image image) {
}
void setImages (Image image, Image [] images) {
- /*
- * Feature in WinCE. WM_SETICON and WM_GETICON set the icon
- * for the window class, not the window instance. This means
- * that it is possible to set an icon into a window and then
- * later free the icon, thus freeing the icon for every window.
- * The fix is to avoid the API.
- *
- * On WinCE PPC, icons in windows are not displayed.
- */
- if (OS.IsWinCE) return;
if (smallImage != null) smallImage.dispose ();
if (largeImage != null) largeImage.dispose ();
smallImage = largeImage = null;
@@ -1054,11 +958,9 @@ void setImages (Image image, Image [] images) {
* trimmings do not redraw to hide the previous icon.
* The fix is to force a redraw.
*/
- if (!OS.IsWinCE) {
- if (hSmallIcon == 0 && hLargeIcon == 0 && (style & SWT.BORDER) != 0) {
- int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ if (hSmallIcon == 0 && hLargeIcon == 0 && (style & SWT.BORDER) != 0) {
+ int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE;
+ OS.RedrawWindow (handle, null, 0, flags);
}
}
@@ -1148,45 +1050,10 @@ public void setMenuBar (Menu menu) {
if ((menu.style & SWT.BAR) == 0) error (SWT.ERROR_MENU_NOT_BAR);
if (menu.parent != this) error (SWT.ERROR_INVALID_PARENT);
}
- if (OS.IsWinCE) {
- if (OS.IsHPC) {
- boolean resize = menuBar != menu;
- if (menuBar != null) OS.CommandBar_Show (menuBar.hwndCB, false);
- menuBar = menu;
- if (menuBar != null) OS.CommandBar_Show (menuBar.hwndCB, true);
- if (resize) {
- sendEvent (SWT.Resize);
- if (isDisposed ()) return;
- if (layout != null) {
- markLayout (false, false);
- updateLayout (true, false);
- }
- }
- } else {
- if (OS.IsPPC) {
- /*
- * Note in WinCE PPC. The menu bar is a separate popup window.
- * If the shell is full screen, resize its window to leave
- * space for the menu bar.
- */
- boolean resize = getMaximized () && menuBar != menu;
- if (menuBar != null) OS.ShowWindow (menuBar.hwndCB, OS.SW_HIDE);
- menuBar = menu;
- if (menuBar != null) OS.ShowWindow (menuBar.hwndCB, OS.SW_SHOW);
- if (resize) _setMaximized (true);
- }
- if (OS.IsSP) {
- if (menuBar != null) OS.ShowWindow (menuBar.hwndCB, OS.SW_HIDE);
- menuBar = menu;
- if (menuBar != null) OS.ShowWindow (menuBar.hwndCB, OS.SW_SHOW);
- }
- }
- } else {
- if (menu != null) display.removeBar (menu);
- menuBar = menu;
- long /*int*/ hMenu = menuBar != null ? menuBar.handle: 0;
- OS.SetMenu (handle, hMenu);
- }
+ if (menu != null) display.removeBar (menu);
+ menuBar = menu;
+ long /*int*/ hMenu = menuBar != null ? menuBar.handle: 0;
+ OS.SetMenu (handle, hMenu);
destroyAccelerators ();
}
@@ -1252,7 +1119,7 @@ void setParent () {
OS.SetWindowLong (handle, OS.GWL_STYLE, bits | OS.WS_POPUP);
OS.SetWindowLongPtr (handle, OS.GWLP_ID, 0);
int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- SetWindowPos (handle, OS.HWND_BOTTOM, 0, 0, 0, 0, flags);
+ OS.SetWindowPos (handle, OS.HWND_BOTTOM, 0, 0, 0, 0, flags);
display.lockActiveWindow = false;
}
@@ -1312,7 +1179,6 @@ void setSavedFocus (Control control) {
}
void setSystemMenu () {
- if (OS.IsWinCE) return;
long /*int*/ hMenu = OS.GetSystemMenu (handle, false);
if (hMenu == 0) return;
int oldCount = OS.GetMenuItemCount (hMenu);
@@ -1406,28 +1272,18 @@ public void setVisible (boolean visible) {
*/
sendEvent (SWT.Show);
if (isDisposed ()) return;
- if (OS.IsHPC) {
- if (menuBar != null) {
- long /*int*/ hwndCB = menuBar.hwndCB;
- OS.CommandBar_DrawMenuBar (hwndCB, 0);
- }
- }
if (!getDrawing()) {
state &= ~HIDDEN;
} else {
- if (OS.IsWinCE) {
- OS.ShowWindow (handle, OS.SW_SHOW);
+ if (menuBar != null) {
+ display.removeBar (menuBar);
+ OS.DrawMenuBar (handle);
+ }
+ STARTUPINFO lpStartUpInfo = Display.lpStartupInfo;
+ if (lpStartUpInfo != null && (lpStartUpInfo.dwFlags & OS.STARTF_USESHOWWINDOW) != 0) {
+ OS.ShowWindow (handle, lpStartUpInfo.wShowWindow);
} else {
- if (menuBar != null) {
- display.removeBar (menuBar);
- OS.DrawMenuBar (handle);
- }
- STARTUPINFO lpStartUpInfo = Display.lpStartupInfo;
- if (lpStartUpInfo != null && (lpStartUpInfo.dwFlags & OS.STARTF_USESHOWWINDOW) != 0) {
- OS.ShowWindow (handle, lpStartUpInfo.wShowWindow);
- } else {
- OS.ShowWindow (handle, swFlags);
- }
+ OS.ShowWindow (handle, swFlags);
}
if (isDisposed ()) return;
opened = true;
@@ -1450,22 +1306,18 @@ public void setVisible (boolean visible) {
* This causes pixel corruption. The fix is to avoid calling
* update on hung windows.
*/
- boolean update = true;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0) && !OS.IsAppThemed ()) {
- update = !OS.IsHungAppWindow (handle);
+ if (OS.IsAppThemed () || !OS.IsHungAppWindow (handle)) {
+ OS.UpdateWindow (handle);
}
- if (update) OS.UpdateWindow (handle);
}
} else {
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- swFlags = OS.SW_SHOWMINNOACTIVE;
+ if (OS.IsIconic (handle)) {
+ swFlags = OS.SW_SHOWMINNOACTIVE;
+ } else {
+ if (OS.IsZoomed (handle)) {
+ swFlags = OS.SW_SHOWMAXIMIZED;
} else {
- if (OS.IsZoomed (handle)) {
- swFlags = OS.SW_SHOWMAXIMIZED;
- } else {
- swFlags = OS.SW_SHOWNOACTIVATE;
- }
+ swFlags = OS.SW_SHOWNOACTIVATE;
}
}
if (!getDrawing()) {
@@ -1589,9 +1441,6 @@ int widgetExtStyle () {
int bits = super.widgetExtStyle () | OS.WS_EX_MDICHILD;
bits &= ~OS.WS_EX_CLIENTEDGE;
if ((style & SWT.NO_TRIM) != 0) return bits;
- if (OS.IsPPC) {
- if ((style & SWT.CLOSE) != 0) bits |= OS.WS_EX_CAPTIONOKBTN;
- }
if ((style & SWT.RESIZE) != 0) return bits;
if ((style & SWT.BORDER) != 0) bits |= OS.WS_EX_DLGMODALFRAME;
return bits;
@@ -1628,20 +1477,13 @@ int widgetStyle () {
/* Set the resize, dialog border or border bits */
if ((style & SWT.RESIZE) != 0) {
- /*
- * Note on WinCE PPC. SWT.RESIZE is used to resize
- * the Shell according to the state of the IME.
- * It does not set the WS_THICKFRAME style.
- */
- if (!OS.IsPPC) bits |= OS.WS_THICKFRAME;
- } else {
- if ((style & SWT.BORDER) == 0) bits |= OS.WS_BORDER;
+ bits |= OS.WS_THICKFRAME;
+ } else if ((style & SWT.BORDER) == 0) {
+ bits |= OS.WS_BORDER;
}
/* Set the system menu and close box bits */
- if (!OS.IsPPC && !OS.IsSP) {
- if ((style & SWT.CLOSE) != 0) bits |= OS.WS_SYSMENU;
- }
+ if ((style & SWT.CLOSE) != 0) bits |= OS.WS_SYSMENU;
return bits;
}
@@ -1731,33 +1573,6 @@ LRESULT WM_CLOSE (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT WM_HOTKEY (long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.WM_HOTKEY (wParam, lParam);
- if (result != null) return result;
- if (OS.IsSP) {
- /*
- * Feature on WinCE SP. The Back key is either used to close
- * the foreground Dialog or used as a regular Back key in an EDIT
- * control. The article 'Back Key' in MSDN for Smartphone
- * describes how an application should handle it. The
- * workaround is to override the Back key when creating
- * the menubar and handle it based on the style of the Shell.
- * If the Shell has the SWT.CLOSE style, close the Shell.
- * Otherwise, send the Back key to the window with focus.
- */
- if (OS.HIWORD (lParam) == OS.VK_ESCAPE) {
- if ((style & SWT.CLOSE) != 0) {
- OS.PostMessage (handle, OS.WM_CLOSE, 0, 0);
- } else {
- OS.SHSendBackToFocusWindow (OS.WM_HOTKEY, wParam, lParam);
- }
- return LRESULT.ZERO;
- }
- }
- return result;
-}
-
-@Override
LRESULT WM_KILLFOCUS (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_KILLFOCUS (wParam, lParam);
saveFocus ();
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 f5295c7f31..edcae234b4 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
@@ -40,15 +40,11 @@ public class DirectoryDialog extends Dialog {
static final byte[] IID_IFileOpenDialog = new byte[16];
static final byte[] IID_IShellItem = new byte[16];
static {
- if (OS.IsWinVista) {
- //Common Item/File Dialog
- OS.IIDFromString("{DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7}\0".toCharArray(), CLSID_FileOpenDialog); //$NON-NLS-1$
- OS.IIDFromString("{d57c7288-d4ad-4768-be02-9d969532d960}\0".toCharArray(), IID_IFileOpenDialog); //$NON-NLS-1$
- OS.IIDFromString("{43826d1e-e718-42ee-bc55-a1e261c37bfe}\0".toCharArray(), IID_IShellItem); //$NON-NLS-1$
- }
+ OS.IIDFromString("{DC1C5A9C-E88A-4dde-A5A1-60F82A20AEF7}\0".toCharArray(), CLSID_FileOpenDialog); //$NON-NLS-1$
+ OS.IIDFromString("{d57c7288-d4ad-4768-be02-9d969532d960}\0".toCharArray(), IID_IFileOpenDialog); //$NON-NLS-1$
+ OS.IIDFromString("{43826d1e-e718-42ee-bc55-a1e261c37bfe}\0".toCharArray(), IID_IShellItem); //$NON-NLS-1$
}
-
String message = "", filterPath = ""; //$NON-NLS-1$//$NON-NLS-2$
String directoryPath;
@@ -115,7 +111,7 @@ long /*int*/ BrowseCallbackProc (long /*int*/ hwnd, long /*int*/ uMsg, long /*in
case OS.BFFM_VALIDATEFAILEDA:
case OS.BFFM_VALIDATEFAILEDW:
/* Use the character encoding for the default locale */
- int length = OS.IsUnicode ? OS.wcslen (lParam) : C.strlen (lParam);
+ int length = OS.wcslen (lParam);
TCHAR buffer = new TCHAR (0, length);
int byteCount = buffer.length () * TCHAR.sizeof;
OS.MoveMemory (buffer, lParam, byteCount);
@@ -161,15 +157,13 @@ public String getMessage () {
* </ul>
*/
public String open() {
- if (OS.IsWinVista) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
return openCommonItemDialog();
}
return openCommonFileDialog();
}
private String openCommonFileDialog () {
- if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
-
long /*int*/ hHeap = OS.GetProcessHeap ();
/* Get the owner HWND for the dialog */
@@ -237,21 +231,7 @@ private String openCommonFileDialog () {
int oldErrorMode = OS.SetErrorMode (OS.SEM_FAILCRITICALERRORS);
display.sendPreExternalEventDispatchEvent ();
- /*
- * Bug in Windows. When a WH_MSGFILTER hook is used to run code
- * during the message loop for SHBrowseForFolder(), running code
- * in the hook can cause a GP. Specifically, SetWindowText()
- * for static controls seemed to make the problem happen.
- * The fix is to disable async messages while the directory
- * dialog is open.
- *
- * NOTE: This only happens in versions of the comctl32.dll
- * earlier than 6.0.
- */
- boolean oldRunMessages = display.runMessages;
- if (OS.COMCTL32_MAJOR < 6) display.runMessages = false;
long /*int*/ lpItemIdList = OS.SHBrowseForFolder (lpbi);
- if (OS.COMCTL32_MAJOR < 6) display.runMessages = oldRunMessages;
display.sendPostExternalEventDispatchEvent ();
OS.SetErrorMode (oldErrorMode);
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 0ef8749b54..fc7698f4fa 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
@@ -136,24 +136,14 @@ public class Display extends Device {
long /*int*/ lastHwnd, lastGetHwnd;
Control [] controlTable;
static final int GROW_SIZE = 1024;
- static final int SWT_OBJECT_INDEX;
- static final boolean USE_PROPERTY = !OS.IsWinCE;
- static {
- if (USE_PROPERTY) {
- SWT_OBJECT_INDEX = OS.GlobalAddAtom (new TCHAR (0, "SWT_OBJECT_INDEX", true)); //$NON-NLS-1$
- } else {
- SWT_OBJECT_INDEX = 0;
- }
- }
+ static final int SWT_OBJECT_INDEX = OS.GlobalAddAtom (new TCHAR (0, "SWT_OBJECT_INDEX", true)); //$NON-NLS-1$
/* Startup info */
static STARTUPINFO lpStartupInfo;
static {
- if (!OS.IsWinCE) {
- lpStartupInfo = new STARTUPINFO ();
- lpStartupInfo.cb = STARTUPINFO.sizeof;
- OS.GetStartupInfo (lpStartupInfo);
- }
+ lpStartupInfo = new STARTUPINFO ();
+ lpStartupInfo.cb = STARTUPINFO.sizeof;
+ OS.GetStartupInfo (lpStartupInfo);
}
/* XP Themes */
@@ -206,7 +196,7 @@ public class Display extends Device {
Synchronizer synchronizer = new Synchronizer (this);
Consumer<RuntimeException> runtimeExceptionHandler = DefaultExceptionHandler.RUNTIME_EXCEPTION_HANDLER;
Consumer<Error> errorHandler = DefaultExceptionHandler.RUNTIME_ERROR_HANDLER;
- boolean runMessages = true, runMessagesInIdle = false, runMessagesInMessageProc = true;
+ boolean runMessagesInIdle = false, runMessagesInMessageProc = true;
static final String RUN_MESSAGES_IN_IDLE_KEY = "org.eclipse.swt.internal.win32.runMessagesInIdle"; //$NON-NLS-1$
static final String RUN_MESSAGES_IN_MESSAGE_PROC_KEY = "org.eclipse.swt.internal.win32.runMessagesInMessageProc"; //$NON-NLS-1$
static final String USE_OWNDC_KEY = "org.eclipse.swt.internal.win32.useOwnDC"; //$NON-NLS-1$
@@ -237,7 +227,6 @@ public class Display extends Device {
/* Settings */
static final long /*int*/ SETTINGS_ID = 100;
static final int SETTINGS_DELAY = 2000;
- boolean lastHighContrast, sendSettings;
/* Keyboard and Mouse */
RECT clickRect;
@@ -284,9 +273,6 @@ public class Display extends Device {
/* Custom Colors for ChooseColor */
long /*int*/ lpCustColors;
- /* Sort Indicators */
- Image upArrow, downArrow;
-
/* Table */
char [] tableBuffer;
NMHDR hdr = new NMHDR ();
@@ -527,11 +513,7 @@ void addControl (long /*int*/ handle, Control control) {
indexTable = newIndexTable;
controlTable = newControlTable;
}
- if (USE_PROPERTY) {
- OS.SetProp (handle, SWT_OBJECT_INDEX, freeSlot + 1);
- } else {
- OS.SetWindowLongPtr (handle, OS.GWLP_USERDATA, freeSlot + 1);
- }
+ OS.SetProp (handle, SWT_OBJECT_INDEX, freeSlot + 1);
int oldSlot = freeSlot;
freeSlot = indexTable [oldSlot];
indexTable [oldSlot] = -2;
@@ -667,20 +649,13 @@ void addPopup (Menu menu) {
}
int asciiKey (int key) {
- if (OS.IsWinCE) return 0;
-
/* Get the current keyboard. */
for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
if (!OS.GetKeyboardState (keyboard)) return 0;
/* Translate the key to ASCII or UNICODE using the virtual keyboard */
- if (OS.IsUnicode) {
- char [] result = new char [1];
- if (OS.ToUnicode (key, key, keyboard, result, 1, 0) == 1) return result [0];
- } else {
- short [] result = new short [1];
- if (OS.ToAscii (key, key, keyboard, result, 0) == 1) return result [0];
- }
+ char [] result = new char [1];
+ if (OS.ToUnicode (key, key, keyboard, result, 1, 0) == 1) return result [0];
return 0;
}
@@ -1097,27 +1072,10 @@ static Image createIcon (Image image) {
long /*int*/ hMask, hBitmap;
long /*int*/ hDC = device.internal_new_GC (null);
long /*int*/ dstHdc = OS.CreateCompatibleDC (hDC), oldDstBitmap;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- hBitmap = Display.create32bitDIB (image.handle, data.alpha, data.alphaData, data.transparentPixel);
- hMask = OS.CreateBitmap (width, height, 1, 1, null);
- oldDstBitmap = OS.SelectObject (dstHdc, hMask);
- OS.PatBlt (dstHdc, 0, 0, width, height, OS.BLACKNESS);
- } else {
- hMask = Display.createMaskFromAlpha (data, width, height);
- /* Icons need black pixels where the mask is transparent */
- hBitmap = OS.CreateCompatibleBitmap (hDC, width, height);
- oldDstBitmap = OS.SelectObject (dstHdc, hBitmap);
- long /*int*/ srcHdc = OS.CreateCompatibleDC (hDC);
- long /*int*/ oldSrcBitmap = OS.SelectObject (srcHdc, image.handle);
- OS.PatBlt (dstHdc, 0, 0, width, height, OS.BLACKNESS);
- OS.BitBlt (dstHdc, 0, 0, width, height, srcHdc, 0, 0, OS.SRCINVERT);
- OS.SelectObject (srcHdc, hMask);
- OS.BitBlt (dstHdc, 0, 0, width, height, srcHdc, 0, 0, OS.SRCAND);
- OS.SelectObject (srcHdc, image.handle);
- OS.BitBlt (dstHdc, 0, 0, width, height, srcHdc, 0, 0, OS.SRCINVERT);
- OS.SelectObject (srcHdc, oldSrcBitmap);
- OS.DeleteDC (srcHdc);
- }
+ hBitmap = Display.create32bitDIB (image.handle, data.alpha, data.alphaData, data.transparentPixel);
+ hMask = OS.CreateBitmap (width, height, 1, 1, null);
+ oldDstBitmap = OS.SelectObject (dstHdc, hMask);
+ OS.PatBlt (dstHdc, 0, 0, width, height, OS.BLACKNESS);
OS.SelectObject (dstHdc, oldDstBitmap);
OS.DeleteDC (dstHdc);
device.internal_dispose_GC (hDC, null);
@@ -1132,37 +1090,6 @@ static Image createIcon (Image image) {
return Image.win32_new (device, SWT.ICON, hIcon);
}
-static long /*int*/ createMaskFromAlpha (ImageData data, int destWidth, int destHeight) {
- int srcWidth = data.width;
- int srcHeight = data.height;
- ImageData mask = ImageData.internal_new (srcWidth, srcHeight, 1,
- new PaletteData(new RGB [] {new RGB (0, 0, 0), new RGB (0xff, 0xff, 0xff)}),
- 2, null, 1, null, null, -1, -1, -1, 0, 0, 0, 0);
- int ap = 0;
- for (int y = 0; y < mask.height; y++) {
- for (int x = 0; x < mask.width; x++) {
- mask.setPixel (x, y, (data.alphaData [ap++] & 0xff) <= 127 ? 1 : 0);
- }
- }
- long /*int*/ hMask = OS.CreateBitmap (srcWidth, srcHeight, 1, 1, mask.data);
- if (srcWidth != destWidth || srcHeight != destHeight) {
- long /*int*/ hdc = OS.GetDC (0);
- long /*int*/ hdc1 = OS.CreateCompatibleDC (hdc);
- OS.SelectObject (hdc1, hMask);
- long /*int*/ hdc2 = OS.CreateCompatibleDC (hdc);
- long /*int*/ hMask2 = OS.CreateBitmap (destWidth, destHeight, 1, 1, null);
- OS.SelectObject (hdc2, hMask2);
- if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
- OS.StretchBlt (hdc2, 0, 0, destWidth, destHeight, hdc1, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
- OS.DeleteDC (hdc1);
- OS.DeleteDC (hdc2);
- OS.ReleaseDC (0, hdc);
- OS.DeleteObject(hMask);
- hMask = hMask2;
- }
- return hMask;
-}
-
static void deregister (Display display) {
synchronized (Device.class) {
for (int i=0; i<Displays.length; i++) {
@@ -1392,7 +1319,7 @@ public Widget findWidget (Widget widget, long /*int*/ id) {
long /*int*/ foregroundIdleProc (long /*int*/ code, long /*int*/ wParam, long /*int*/ lParam) {
if (code >= 0) {
- if (runMessages && getMessageCount () != 0) {
+ if (getMessageCount () != 0) {
sendPostExternalEventDispatchEvent ();
if (runMessagesInIdle) {
if (runMessagesInMessageProc) {
@@ -1615,12 +1542,7 @@ Control getControl (long /*int*/ handle) {
if (lastGetControl != null && lastGetHwnd == handle) {
return lastGetControl;
}
- int index;
- if (USE_PROPERTY) {
- index = (int)/*64*/OS.GetProp (handle, SWT_OBJECT_INDEX) - 1;
- } else {
- index = (int)/*64*/OS.GetWindowLongPtr (handle, OS.GWLP_USERDATA) - 1;
- }
+ int index = (int)/*64*/OS.GetProp (handle, SWT_OBJECT_INDEX) - 1;
if (0 <= index && index < controlTable.length) {
Control control = controlTable [index];
/*
@@ -1891,7 +1813,6 @@ String getFontName (LOGFONT logFont) {
*/
public boolean getHighContrast () {
checkDevice ();
- if (OS.IsWinCE) return false;
HIGHCONTRAST pvParam = new HIGHCONTRAST ();
pvParam.cbSize = HIGHCONTRAST.sizeof;
OS.SystemParametersInfo (OS.SPI_GETHIGHCONTRAST, 0, pvParam, 0);
@@ -1913,9 +1834,7 @@ public boolean getHighContrast () {
*/
public int getIconDepth () {
checkDevice ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- if (getDepth () >= 24) return 32;
- }
+ if (getDepth () >= 24) return 32;
/* Use the character encoding for the default locale */
TCHAR buffer1 = new TCHAR (0, "Control Panel\\Desktop\\WindowMetrics", true); //$NON-NLS-1$
@@ -2085,7 +2004,7 @@ ImageList getImageListToolBarHot (int style, int width, int height) {
}
int getLastEventTime () {
- return OS.IsWinCE ? OS.GetTickCount () : OS.GetMessageTime ();
+ return OS.GetMessageTime ();
}
MenuItem getMenuItem (int id) {
@@ -2123,9 +2042,6 @@ Dialog getModalDialog () {
*/
public Monitor [] getMonitors () {
checkDevice ();
- if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- return new Monitor [] {getPrimaryMonitor ()};
- }
monitors = new Monitor [4];
Callback callback = new Callback (this, "monitorEnumProc", 4); //$NON-NLS-1$
long /*int*/ lpfnEnum = callback.getAddress ();
@@ -2198,20 +2114,6 @@ long /*int*/ getMsgProc (long /*int*/ code, long /*int*/ wParam, long /*int*/ lP
*/
public Monitor getPrimaryMonitor () {
checkDevice ();
- if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- Monitor monitor = new Monitor();
- int width = OS.GetSystemMetrics (OS.SM_CXSCREEN);
- int height = OS.GetSystemMetrics (OS.SM_CYSCREEN);
- Rectangle bounds = new Rectangle (0, 0, width, height);
- bounds = DPIUtil.autoScaleDown (bounds);
- monitor.setBounds (bounds);
- RECT rect = new RECT ();
- OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
- Rectangle clientArea = new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
- clientArea = DPIUtil.autoScaleDown (clientArea);
- monitor.setClientArea( clientArea);
- return monitor;
- }
monitors = new Monitor [4];
Callback callback = new Callback (this, "monitorEnumProc", 4); //$NON-NLS-1$
long /*int*/ lpfnEnum = callback.getAddress ();
@@ -2273,54 +2175,6 @@ public Shell [] getShells () {
return newResult;
}
-Image getSortImage (int direction) {
- switch (direction) {
- case SWT.UP: {
- if (upArrow != null) return upArrow;
- Color c1 = getSystemColor (SWT.COLOR_WIDGET_NORMAL_SHADOW);
- Color c2 = getSystemColor (SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- Color c3 = getSystemColor (SWT.COLOR_WIDGET_BACKGROUND);
- PaletteData palette = new PaletteData(new RGB [] {c1.getRGB (), c2.getRGB (), c3.getRGB ()});
- ImageData imageData = new ImageData (8, 8, 4, palette);
- imageData.transparentPixel = 2;
- upArrow = new Image (this, imageData);
- GC gc = new GC (upArrow);
- gc.setBackground (c3);
- gc.fillRectangle (0, 0, 8, 8);
- gc.setForeground (c1);
- int [] line1 = new int [] {0,6, 1,6, 1,4, 2,4, 2,2, 3,2, 3,1};
- gc.drawPolyline (line1);
- gc.setForeground (c2);
- int [] line2 = new int [] {0,7, 7,7, 7,6, 6,6, 6,4, 5,4, 5,2, 4,2, 4,1};
- gc.drawPolyline (line2);
- gc.dispose ();
- return upArrow;
- }
- case SWT.DOWN: {
- if (downArrow != null) return downArrow;
- Color c1 = getSystemColor (SWT.COLOR_WIDGET_NORMAL_SHADOW);
- Color c2 = getSystemColor (SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- Color c3 = getSystemColor (SWT.COLOR_WIDGET_BACKGROUND);
- PaletteData palette = new PaletteData (new RGB [] {c1.getRGB (), c2.getRGB (), c3.getRGB ()});
- ImageData imageData = new ImageData (8, 8, 4, palette);
- imageData.transparentPixel = 2;
- downArrow = new Image (this, imageData);
- GC gc = new GC (downArrow);
- gc.setBackground (c3);
- gc.fillRectangle (0, 0, 8, 8);
- gc.setForeground (c1);
- int [] line1 = new int [] {7,0, 0,0, 0,1, 1,1, 1,3, 2,3, 2,5, 3,5, 3,6};
- gc.drawPolyline (line1);
- gc.setForeground (c2);
- int [] line2 = new int [] {4,6, 4,5, 5,5, 5,3, 6,3, 6,1, 7,1};
- gc.drawPolyline (line2);
- gc.dispose ();
- return downArrow;
- }
- }
- return null;
-}
-
/**
* Gets the synchronizer used by the display.
*
@@ -2493,14 +2347,12 @@ public Font getSystemFont () {
checkDevice ();
if (systemFont != null) return systemFont;
long /*int*/ hFont = 0;
- if (!OS.IsWinCE) {
- NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();
- info.cbSize = NONCLIENTMETRICS.sizeof;
- if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
- LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfMessageFont : ((NONCLIENTMETRICSA)info).lfMessageFont;
- hFont = OS.CreateFontIndirect (logFont);
- lfSystemFont = hFont != 0 ? logFont : null;
- }
+ NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();
+ info.cbSize = NONCLIENTMETRICS.sizeof;
+ if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
+ LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfMessageFont : ((NONCLIENTMETRICSA)info).lfMessageFont;
+ hFont = OS.CreateFontIndirect (logFont);
+ lfSystemFont = hFont != 0 ? logFont : null;
}
if (hFont == 0) hFont = OS.GetStockObject (OS.DEFAULT_GUI_FONT);
if (hFont == 0) hFont = OS.GetStockObject (OS.SYSTEM_FONT);
@@ -2594,7 +2446,7 @@ public Menu getSystemMenu () {
public TaskBar getSystemTaskBar () {
checkDevice ();
if (taskBar != null) return taskBar;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
taskBar = new TaskBar (this, SWT.NONE);
}
return taskBar;
@@ -2614,8 +2466,7 @@ public TaskBar getSystemTaskBar () {
*/
public Tray getSystemTray () {
checkDevice ();
- if (tray != null) return tray;
- if (!OS.IsWinCE) tray = new Tray (this, SWT.NONE);
+ if (tray == null) tray = new Tray (this, SWT.NONE);
return tray;
}
@@ -2736,7 +2587,7 @@ protected void init () {
/* Set the application user model ID, if APP_NAME is non Default */
char [] appName = null;
if (APP_NAME != null && !"SWT".equalsIgnoreCase (APP_NAME)) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
int length = APP_NAME.length ();
appName = new char [length + 1];
APP_NAME.getChars (0, length, appName, 0);
@@ -2768,26 +2619,9 @@ protected void init () {
WNDCLASS lpWndClass = new WNDCLASS ();
lpWndClass.hInstance = hInstance;
lpWndClass.lpfnWndProc = windowProc;
- lpWndClass.style = OS.CS_BYTEALIGNWINDOW | OS.CS_DBLCLKS;
+ lpWndClass.style = OS.CS_DBLCLKS;
lpWndClass.hCursor = OS.LoadCursor (0, OS.IDC_ARROW);
- /*
- * Set the default icon for the window class to IDI_APPLICATION.
- * This is not necessary for native Windows applications but
- * versions of Java starting at JDK 1.6 set the icon in the
- * executable instead of leaving the default.
- */
- if (!OS.IsWinCE) {
- TCHAR lpszFile = new TCHAR (0, OS.MAX_PATH);
- while (OS.GetModuleFileName (0, lpszFile, lpszFile.length ()) == lpszFile.length ()) {
- lpszFile = new TCHAR (0, lpszFile.length () + OS.MAX_PATH);
- }
- if (OS.ExtractIconEx (lpszFile, -1, null, null, 1) != 0) {
- String fileName = lpszFile.toString (0, lpszFile.strlen ());
- if (fileName.endsWith ("java.exe") || fileName.endsWith ("javaw.exe")) { //$NON-NLS-1$ //$NON-NLS-2$
- lpWndClass.hIcon = OS.LoadIcon (0, OS.IDI_APPLICATION);
- }
- }
- }
+ lpWndClass.hIcon = OS.LoadIcon (0, OS.IDI_APPLICATION);
int byteCount = windowClass.length () * TCHAR.sizeof;
lpWndClass.lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory (lpWndClass.lpszClassName, windowClass, byteCount);
@@ -2795,9 +2629,7 @@ protected void init () {
OS.HeapFree (hHeap, 0, lpWndClass.lpszClassName);
/* Register the SWT drop shadow window class */
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- lpWndClass.style |= OS.CS_DROPSHADOW;
- }
+ lpWndClass.style |= OS.CS_DROPSHADOW;
byteCount = windowShadowClass.length () * TCHAR.sizeof;
lpWndClass.lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory (lpWndClass.lpszClassName, windowShadowClass, byteCount);
@@ -2805,9 +2637,7 @@ protected void init () {
OS.HeapFree (hHeap, 0, lpWndClass.lpszClassName);
/* Register the CS_OWNDC window class */
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- lpWndClass.style |= OS.CS_OWNDC;
- }
+ lpWndClass.style |= OS.CS_OWNDC;
byteCount = windowOwnDCClass.length () * TCHAR.sizeof;
lpWndClass.lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory (lpWndClass.lpszClassName, windowOwnDCClass, byteCount);
@@ -2832,20 +2662,16 @@ protected void init () {
OS.SetWindowLongPtr (hwndMessage, OS.GWLP_WNDPROC, messageProc);
/* Create the filter hook */
- if (!OS.IsWinCE) {
- msgFilterCallback = new Callback (this, "msgFilterProc", 3); //$NON-NLS-1$
- msgFilterProc = msgFilterCallback.getAddress ();
- if (msgFilterProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- filterHook = OS.SetWindowsHookEx (OS.WH_MSGFILTER, msgFilterProc, 0, threadId);
- }
+ msgFilterCallback = new Callback (this, "msgFilterProc", 3); //$NON-NLS-1$
+ msgFilterProc = msgFilterCallback.getAddress ();
+ if (msgFilterProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+ filterHook = OS.SetWindowsHookEx (OS.WH_MSGFILTER, msgFilterProc, 0, threadId);
/* Create the idle hook */
- if (!OS.IsWinCE) {
- foregroundIdleCallback = new Callback (this, "foregroundIdleProc", 3); //$NON-NLS-1$
- foregroundIdleProc = foregroundIdleCallback.getAddress ();
- if (foregroundIdleProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
- idleHook = OS.SetWindowsHookEx (OS.WH_FOREGROUNDIDLE, foregroundIdleProc, 0, threadId);
- }
+ foregroundIdleCallback = new Callback (this, "foregroundIdleProc", 3); //$NON-NLS-1$
+ foregroundIdleProc = foregroundIdleCallback.getAddress ();
+ if (foregroundIdleProc == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
+ idleHook = OS.SetWindowsHookEx (OS.WH_FOREGROUNDIDLE, foregroundIdleProc, 0, threadId);
/* Register window messages */
TASKBARCREATED = OS.RegisterWindowMessage (new TCHAR (0, "TaskbarCreated", true)); //$NON-NLS-1$
@@ -2855,7 +2681,7 @@ protected void init () {
SWT_OPENDOC = OS.RegisterWindowMessage(new TCHAR (0, "SWT_OPENDOC", true)); //$NON-NLS-1$
/* Initialize OLE */
- if (!OS.IsWinCE) OS.OleInitialize (0);
+ OS.OleInitialize (0);
if (appName != null) {
/* Delete any old jump list set for the ID */
@@ -2870,18 +2696,13 @@ protected void init () {
}
/* Initialize buffered painting */
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)){
- OS.BufferedPaintInit ();
- }
+ OS.BufferedPaintInit ();
/* Initialize the Widget Table */
indexTable = new int [GROW_SIZE];
controlTable = new Control [GROW_SIZE];
for (int i=0; i<GROW_SIZE-1; i++) indexTable [i] = i + 1;
indexTable [GROW_SIZE - 1] = -1;
-
- /* Remember the last high contrast state */
- lastHighContrast = getHighContrast ();
}
/**
@@ -3138,47 +2959,6 @@ Rectangle mapInPixels (Control from, Control to, int x, int y, int width, int he
return new Rectangle (rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
}
-/*
- * Returns a single character, converted from the default
- * multi-byte character set (MBCS) used by the operating
- * system widgets to a wide character set (WCS) used by Java.
- *
- * @param ch the MBCS character
- * @return the WCS character
- */
-static char mbcsToWcs (int ch) {
- return mbcsToWcs (ch, 0);
-}
-
-/*
- * Returns a single character, converted from the specified
- * multi-byte character set (MBCS) used by the operating
- * system widgets to a wide character set (WCS) used by Java.
- *
- * @param ch the MBCS character
- * @param codePage the code page used to convert the character
- * @return the WCS character
- */
-static char mbcsToWcs (int ch, int codePage) {
- if (OS.IsUnicode) return (char) ch;
- int key = ch & 0xFFFF;
- if (key <= 0x7F) return (char) ch;
- byte [] buffer;
- if (key <= 0xFF) {
- buffer = new byte [1];
- buffer [0] = (byte) key;
- } else {
- buffer = new byte [2];
- buffer [0] = (byte) ((key >> 8) & 0xFF);
- buffer [1] = (byte) (key & 0xFF);
- }
- char [] unicode = new char [1];
- int cp = codePage != 0 ? codePage : OS.CP_ACP;
- int count = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, buffer.length, unicode, 1);
- if (count == 0) return 0;
- return unicode [0];
-}
-
long /*int*/ messageProc (long /*int*/ hwnd, long /*int*/ msg, long /*int*/ wParam, long /*int*/ lParam) {
switch ((int)/*64*/msg) {
case SWT_RUNASYNC: {
@@ -3204,41 +2984,34 @@ long /*int*/ messageProc (long /*int*/ hwnd, long /*int*/ msg, long /*int*/ wPar
switch (keyMsg.message) {
case OS.WM_KEYDOWN:
case OS.WM_SYSKEYDOWN: {
- if (!OS.IsWinCE) {
- switch ((int)/*64*/keyMsg.wParam) {
- case OS.VK_SHIFT:
- case OS.VK_MENU:
- case OS.VK_CONTROL:
- case OS.VK_CAPITAL:
- case OS.VK_NUMLOCK:
- case OS.VK_SCROLL:
- break;
- default: {
- /*
- * Bug in Windows. The high bit in the result of MapVirtualKey() on
- * Windows NT is bit 32 while the high bit on Windows 95 is bit 16.
- * They should both be bit 32. The fix is to test the right bit.
- */
- int mapKey = OS.MapVirtualKey ((int)/*64*/keyMsg.wParam, 2);
- if (mapKey != 0) {
- accentKey = (mapKey & (OS.IsWinNT ? 0x80000000 : 0x8000)) != 0;
- if (!accentKey) {
- for (int i=0; i<ACCENTS.length; i++) {
- int value = OS.VkKeyScan (ACCENTS [i]);
- if (value != -1 && (value & 0xFF) == keyMsg.wParam) {
- int state = value >> 8;
- if ((OS.GetKeyState (OS.VK_SHIFT) < 0) == ((state & 0x1) != 0) &&
- (OS.GetKeyState (OS.VK_CONTROL) < 0) == ((state & 0x2) != 0) &&
- (OS.GetKeyState (OS.VK_MENU) < 0) == ((state & 0x4) != 0)) {
- if ((state & 0x7) != 0) accentKey = true;
- break;
- }
+ switch ((int)/*64*/keyMsg.wParam) {
+ case OS.VK_SHIFT:
+ case OS.VK_MENU:
+ case OS.VK_CONTROL:
+ case OS.VK_CAPITAL:
+ case OS.VK_NUMLOCK:
+ case OS.VK_SCROLL:
+ break;
+ default: {
+ int mapKey = OS.MapVirtualKey ((int)/*64*/keyMsg.wParam, 2);
+ if (mapKey != 0) {
+ accentKey = (mapKey & 0x80000000) != 0;
+ if (!accentKey) {
+ for (int i=0; i<ACCENTS.length; i++) {
+ int value = OS.VkKeyScan (ACCENTS [i]);
+ if (value != -1 && (value & 0xFF) == keyMsg.wParam) {
+ int state = value >> 8;
+ if ((OS.GetKeyState (OS.VK_SHIFT) < 0) == ((state & 0x1) != 0) &&
+ (OS.GetKeyState (OS.VK_CONTROL) < 0) == ((state & 0x2) != 0) &&
+ (OS.GetKeyState (OS.VK_MENU) < 0) == ((state & 0x4) != 0)) {
+ if ((state & 0x7) != 0) accentKey = true;
+ break;
}
}
}
}
- break;
}
+ break;
}
}
break;
@@ -3365,54 +3138,23 @@ long /*int*/ messageProc (long /*int*/ hwnd, long /*int*/ msg, long /*int*/ wPar
if (!event.doit) return 0;
break;
}
- case OS.WM_DWMCOLORIZATIONCOLORCHANGED: {
- sendSettings = true;
- //FALL THROUGH
- }
+ case OS.WM_DWMCOLORIZATIONCOLORCHANGED:
case OS.WM_SETTINGCHANGE: {
- /*
- * Bug in Windows. When high contrast is cleared using
- * the key sequence, Alt + Left Shift + Print Screen, the
- * system parameter is set to false, but WM_SETTINGCHANGE
- * is not sent with SPI_SETHIGHCONTRAST. The fix is to
- * detect the change when any WM_SETTINGCHANGE message
- * is sent.
- */
- if (lastHighContrast != getHighContrast ()) {
- sendSettings = true;
- lastHighContrast = getHighContrast ();
- }
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- sendSettings = true;
- }
- switch ((int)/*64*/wParam) {
- case 0:
- case 1:
- case OS.SPI_SETHIGHCONTRAST: {
- sendSettings = true;
- lastHighContrast = getHighContrast ();
- }
- }
/* Set the initial timer or push the time out period forward */
- if (sendSettings) {
- OS.SetTimer (hwndMessage, SETTINGS_ID, SETTINGS_DELAY, 0);
- }
+ OS.SetTimer (hwndMessage, SETTINGS_ID, SETTINGS_DELAY, 0);
break;
}
case OS.WM_THEMECHANGED: {
- if (OS.COMCTL32_MAJOR >= 6) {
- if (hButtonTheme != 0) OS.CloseThemeData (hButtonTheme);
- if (hEditTheme != 0) OS.CloseThemeData (hEditTheme);
- if (hExplorerBarTheme != 0) OS.CloseThemeData (hExplorerBarTheme);
- if (hScrollBarTheme != 0) OS.CloseThemeData (hScrollBarTheme);
- if (hTabTheme != 0) OS.CloseThemeData (hTabTheme);
- hButtonTheme = hEditTheme = hExplorerBarTheme = hScrollBarTheme = hTabTheme = 0;
- }
+ if (hButtonTheme != 0) OS.CloseThemeData (hButtonTheme);
+ if (hEditTheme != 0) OS.CloseThemeData (hEditTheme);
+ if (hExplorerBarTheme != 0) OS.CloseThemeData (hExplorerBarTheme);
+ if (hScrollBarTheme != 0) OS.CloseThemeData (hScrollBarTheme);
+ if (hTabTheme != 0) OS.CloseThemeData (hTabTheme);
+ hButtonTheme = hEditTheme = hExplorerBarTheme = hScrollBarTheme = hTabTheme = 0;
break;
}
case OS.WM_TIMER: {
if (wParam == SETTINGS_ID) {
- sendSettings = false;
OS.KillTimer (hwndMessage, SETTINGS_ID);
runSettings ();
} else {
@@ -3459,7 +3201,6 @@ long /*int*/ messageProc (long /*int*/ hwnd, long /*int*/ msg, long /*int*/ wPar
}
String getSharedData(int pid, int handle) {
- if (OS.IsWinCE) return null;
long /*int*/ [] mapHandle = new long /*int*/ [1];
if (pid == OS.GetCurrentProcessId()) {
mapHandle[0] = handle;
@@ -3472,7 +3213,7 @@ String getSharedData(int pid, int handle) {
long /*int*/ sharedData = OS.MapViewOfFile(mapHandle[0], OS.FILE_MAP_READ, 0, 0, 0);
if (sharedData == 0) return null;
- int length = OS.IsUnicode ? OS.wcslen (sharedData) : C.strlen (sharedData);
+ int length = OS.wcslen (sharedData);
TCHAR buffer = new TCHAR (0, length);
int byteCount = buffer.length () * TCHAR.sizeof;
OS.MoveMemory (buffer, sharedData, byteCount);
@@ -3530,14 +3271,12 @@ long /*int*/ msgFilterProc (long /*int*/ code, long /*int*/ wParam, long /*int*/
case OS.MSGF_NEXTWINDOW:
case OS.MSGF_SCROLLBAR:
case OS.MSGF_SIZE: {
- if (runMessages) {
- OS.MoveMemory (hookMsg, lParam, MSG.sizeof);
- if (hookMsg.message == OS.WM_NULL) {
- MSG msg = new MSG ();
- int flags = OS.PM_NOREMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
- if (!OS.PeekMessage (msg, 0, 0, 0, flags)) {
- if (runAsyncMessages (false)) wakeThread ();
- }
+ OS.MoveMemory (hookMsg, lParam, MSG.sizeof);
+ if (hookMsg.message == OS.WM_NULL) {
+ MSG msg = new MSG ();
+ int flags = OS.PM_NOREMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
+ if (!OS.PeekMessage (msg, 0, 0, 0, flags)) {
+ if (runAsyncMessages (false)) wakeThread ();
}
}
break;
@@ -3653,13 +3392,9 @@ public boolean post (Event event) {
// case SWT.LF: inputs.wVk = (short) OS.VK_RETURN; break;
case SWT.LF: return false;
default: {
- if (OS.IsWinCE) {
- inputs.wVk = (short)/*64*/OS.CharUpper ((short) key);
- } else {
- inputs.wVk = OS.VkKeyScan ((short) wcsToMbcs (key, 0));
- if (inputs.wVk == -1) return false;
- inputs.wVk &= 0xFF;
- }
+ inputs.wVk = OS.VkKeyScan ((short) key);
+ if (inputs.wVk == -1) return false;
+ inputs.wVk &= 0xFF;
}
}
}
@@ -3696,24 +3431,16 @@ public boolean post (Event event) {
case SWT.MouseWheel: {
MOUSEINPUT inputs = new MOUSEINPUT ();
if (type == SWT.MouseMove){
- inputs.dwFlags = OS.MOUSEEVENTF_MOVE | OS.MOUSEEVENTF_ABSOLUTE;
- int x= 0, y = 0, width = 0, height = 0;
- if (OS.WIN32_VERSION >= OS.VERSION (5, 0)) {
- inputs.dwFlags |= OS.MOUSEEVENTF_VIRTUALDESK;
- x = OS.GetSystemMetrics (OS.SM_XVIRTUALSCREEN);
- y = OS.GetSystemMetrics (OS.SM_YVIRTUALSCREEN);
- width = OS.GetSystemMetrics (OS.SM_CXVIRTUALSCREEN);
- height = OS.GetSystemMetrics (OS.SM_CYVIRTUALSCREEN);
- } else {
- width = OS.GetSystemMetrics (OS.SM_CXSCREEN);
- height = OS.GetSystemMetrics (OS.SM_CYSCREEN);
- }
+ inputs.dwFlags = OS.MOUSEEVENTF_MOVE | OS.MOUSEEVENTF_ABSOLUTE | OS.MOUSEEVENTF_VIRTUALDESK;
+ int x = OS.GetSystemMetrics (OS.SM_XVIRTUALSCREEN);
+ int y = OS.GetSystemMetrics (OS.SM_YVIRTUALSCREEN);
+ int width = OS.GetSystemMetrics (OS.SM_CXVIRTUALSCREEN);
+ int height = OS.GetSystemMetrics (OS.SM_CYVIRTUALSCREEN);
Point loc = event.getLocationInPixels();
inputs.dx = ((loc.x - x) * 65535 + width - 2) / (width - 1);
inputs.dy = ((loc.y - y) * 65535 + height - 2) / (height - 1);
} else {
if (type == SWT.MouseWheel) {
- if (OS.WIN32_VERSION < OS.VERSION (5, 0)) return false;
inputs.dwFlags = OS.MOUSEEVENTF_WHEEL;
switch (event.detail) {
case SWT.SCROLL_PAGE:
@@ -3732,13 +3459,11 @@ public boolean post (Event event) {
case 2: inputs.dwFlags = type == SWT.MouseDown ? OS.MOUSEEVENTF_MIDDLEDOWN : OS.MOUSEEVENTF_MIDDLEUP; break;
case 3: inputs.dwFlags = type == SWT.MouseDown ? OS.MOUSEEVENTF_RIGHTDOWN : OS.MOUSEEVENTF_RIGHTUP; break;
case 4: {
- if (OS.WIN32_VERSION < OS.VERSION (5, 0)) return false;
inputs.dwFlags = type == SWT.MouseDown ? OS.MOUSEEVENTF_XDOWN : OS.MOUSEEVENTF_XUP;
inputs.mouseData = OS.XBUTTON1;
break;
}
case 5: {
- if (OS.WIN32_VERSION < OS.VERSION (5, 0)) return false;
inputs.dwFlags = type == SWT.MouseDown ? OS.MOUSEEVENTF_XDOWN : OS.MOUSEEVENTF_XUP;
inputs.mouseData = OS.XBUTTON2;
break;
@@ -3822,7 +3547,7 @@ public boolean readAndDispatch () {
runDeferredEvents ();
return true;
}
- return isDisposed () || (runMessages && runAsyncMessages (false));
+ return isDisposed () || runAsyncMessages (false);
}
static void register (Display display) {
@@ -3904,38 +3629,30 @@ void releaseDisplay () {
}
/* Release XP Themes */
- if (OS.COMCTL32_MAJOR >= 6) {
- if (hButtonTheme != 0) OS.CloseThemeData (hButtonTheme);
- if (hEditTheme != 0) OS.CloseThemeData (hEditTheme);
- if (hExplorerBarTheme != 0) OS.CloseThemeData (hExplorerBarTheme);
- if (hScrollBarTheme != 0) OS.CloseThemeData (hScrollBarTheme);
- if (hTabTheme != 0) OS.CloseThemeData (hTabTheme);
- hButtonTheme = hEditTheme = hExplorerBarTheme = hScrollBarTheme = hTabTheme = 0;
- }
+ if (hButtonTheme != 0) OS.CloseThemeData (hButtonTheme);
+ if (hEditTheme != 0) OS.CloseThemeData (hEditTheme);
+ if (hExplorerBarTheme != 0) OS.CloseThemeData (hExplorerBarTheme);
+ if (hScrollBarTheme != 0) OS.CloseThemeData (hScrollBarTheme);
+ if (hTabTheme != 0) OS.CloseThemeData (hTabTheme);
+ hButtonTheme = hEditTheme = hExplorerBarTheme = hScrollBarTheme = hTabTheme = 0;
/* Unhook the message hook */
- if (!OS.IsWinCE) {
- if (msgHook != 0) OS.UnhookWindowsHookEx (msgHook);
- msgHook = 0;
- }
+ if (msgHook != 0) OS.UnhookWindowsHookEx (msgHook);
+ msgHook = 0;
/* Unhook the filter hook */
- if (!OS.IsWinCE) {
- if (filterHook != 0) OS.UnhookWindowsHookEx (filterHook);
- filterHook = 0;
- msgFilterCallback.dispose ();
- msgFilterCallback = null;
- msgFilterProc = 0;
- }
+ if (filterHook != 0) OS.UnhookWindowsHookEx (filterHook);
+ filterHook = 0;
+ msgFilterCallback.dispose ();
+ msgFilterCallback = null;
+ msgFilterProc = 0;
/* Unhook the idle hook */
- if (!OS.IsWinCE) {
- if (idleHook != 0) OS.UnhookWindowsHookEx (idleHook);
- idleHook = 0;
- foregroundIdleCallback.dispose ();
- foregroundIdleCallback = null;
- foregroundIdleProc = 0;
- }
+ if (idleHook != 0) OS.UnhookWindowsHookEx (idleHook);
+ idleHook = 0;
+ foregroundIdleCallback.dispose ();
+ foregroundIdleCallback = null;
+ foregroundIdleProc = 0;
/* Stop the settings timer */
OS.KillTimer (hwndMessage, SETTINGS_ID);
@@ -3972,11 +3689,6 @@ void releaseDisplay () {
if (warningIcon != null) warningIcon.dispose ();
errorImage = infoImage = questionImage = warningIcon = null;
- /* Release Sort Indicators */
- if (upArrow != null) upArrow.dispose ();
- if (downArrow != null) downArrow.dispose ();
- upArrow = downArrow = null;
-
/* Release the System Cursors */
for (int i = 0; i < cursors.length; i++) {
if (cursors [i] != null) cursors [i].dispose ();
@@ -3996,12 +3708,10 @@ void releaseDisplay () {
lpCustColors = 0;
/* Uninitialize OLE */
- if (!OS.IsWinCE) OS.OleUninitialize ();
+ OS.OleUninitialize ();
/* Uninitialize buffered painting */
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.BufferedPaintUnInit ();
- }
+ OS.BufferedPaintUnInit ();
/* Release references */
thread = null;
@@ -4183,13 +3893,7 @@ Control removeControl (long /*int*/ handle) {
if (handle == 0) return null;
lastControl = lastGetControl = null;
Control control = null;
- int index;
- if (USE_PROPERTY) {
- index = (int)/*64*/OS.RemoveProp (handle, SWT_OBJECT_INDEX) - 1;
- } else {
- index = (int)/*64*/OS.GetWindowLongPtr (handle, OS.GWLP_USERDATA) - 1;
- OS.SetWindowLongPtr (handle, OS.GWLP_USERDATA, 0);
- }
+ int index = (int)/*64*/OS.RemoveProp (handle, SWT_OBJECT_INDEX) - 1;
if (0 <= index && index < controlTable.length) {
control = controlTable [index];
controlTable [index] = null;
@@ -4291,7 +3995,6 @@ boolean runPopups () {
void runSettings () {
Font oldFont = getSystemFont ();
saveResources ();
- updateImages ();
sendEvent (SWT.Settings, null);
Font newFont = getSystemFont ();
boolean sameFont = oldFont.equals (newFont);
@@ -4369,31 +4072,29 @@ void saveResources () {
resources = newResources;
}
if (systemFont != null) {
- if (!OS.IsWinCE) {
- NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();
- info.cbSize = NONCLIENTMETRICS.sizeof;
- if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
- LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfMessageFont : ((NONCLIENTMETRICSA)info).lfMessageFont;
- if (lfSystemFont == null ||
- logFont.lfCharSet != lfSystemFont.lfCharSet ||
- logFont.lfHeight != lfSystemFont.lfHeight ||
- logFont.lfWidth != lfSystemFont.lfWidth ||
- logFont.lfEscapement != lfSystemFont.lfEscapement ||
- logFont.lfOrientation != lfSystemFont.lfOrientation ||
- logFont.lfWeight != lfSystemFont.lfWeight ||
- logFont.lfItalic != lfSystemFont.lfItalic ||
- logFont.lfUnderline != lfSystemFont.lfUnderline ||
- logFont.lfStrikeOut != lfSystemFont.lfStrikeOut ||
- logFont.lfCharSet != lfSystemFont.lfCharSet ||
- logFont.lfOutPrecision != lfSystemFont.lfOutPrecision ||
- logFont.lfClipPrecision != lfSystemFont.lfClipPrecision ||
- logFont.lfQuality != lfSystemFont.lfQuality ||
- logFont.lfPitchAndFamily != lfSystemFont.lfPitchAndFamily ||
- !getFontName (logFont).equals (getFontName (lfSystemFont))) {
- resources [resourceCount++] = systemFont;
- lfSystemFont = logFont;
- systemFont = null;
- }
+ NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();
+ info.cbSize = NONCLIENTMETRICS.sizeof;
+ if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
+ LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfMessageFont : ((NONCLIENTMETRICSA)info).lfMessageFont;
+ if (lfSystemFont == null ||
+ logFont.lfCharSet != lfSystemFont.lfCharSet ||
+ logFont.lfHeight != lfSystemFont.lfHeight ||
+ logFont.lfWidth != lfSystemFont.lfWidth ||
+ logFont.lfEscapement != lfSystemFont.lfEscapement ||
+ logFont.lfOrientation != lfSystemFont.lfOrientation ||
+ logFont.lfWeight != lfSystemFont.lfWeight ||
+ logFont.lfItalic != lfSystemFont.lfItalic ||
+ logFont.lfUnderline != lfSystemFont.lfUnderline ||
+ logFont.lfStrikeOut != lfSystemFont.lfStrikeOut ||
+ logFont.lfCharSet != lfSystemFont.lfCharSet ||
+ logFont.lfOutPrecision != lfSystemFont.lfOutPrecision ||
+ logFont.lfClipPrecision != lfSystemFont.lfClipPrecision ||
+ logFont.lfQuality != lfSystemFont.lfQuality ||
+ logFont.lfPitchAndFamily != lfSystemFont.lfPitchAndFamily ||
+ !getFontName (logFont).equals (getFontName (lfSystemFont))) {
+ resources [resourceCount++] = systemFont;
+ lfSystemFont = logFont;
+ systemFont = null;
}
}
}
@@ -4818,20 +4519,13 @@ public final Consumer<Error> getErrorHandler () {
}
int shiftedKey (int key) {
- if (OS.IsWinCE) return 0;
-
/* Clear the virtual keyboard and press the shift key */
for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
keyboard [OS.VK_SHIFT] |= 0x80;
/* Translate the key to ASCII or UNICODE using the virtual keyboard */
- if (OS.IsUnicode) {
- char [] result = new char [1];
- if (OS.ToUnicode (key, key, keyboard, result, 1, 0) == 1) return result [0];
- } else {
- short [] result = new short [1];
- if (OS.ToAscii (key, key, keyboard, result, 0) == 1) return result [0];
- }
+ char [] result = new char [1];
+ if (OS.ToUnicode (key, key, keyboard, result, 1, 0) == 1) return result [0];
return 0;
}
@@ -4851,13 +4545,8 @@ int shiftedKey (int key) {
*/
public boolean sleep () {
checkDevice ();
- if (runMessages && getMessageCount () != 0) return true;
+ if (getMessageCount () != 0) return true;
sendPreExternalEventDispatchEvent ();
- if (OS.IsWinCE) {
- OS.MsgWaitForMultipleObjectsEx (0, 0, OS.INFINITE, OS.QS_ALLINPUT, OS.MWMO_INPUTAVAILABLE);
- sendPostExternalEventDispatchEvent ();
- return true;
- }
boolean result = OS.WaitMessage ();
sendPostExternalEventDispatchEvent ();
return result;
@@ -5044,12 +4733,10 @@ public void update() {
* NOTE: This allows other cross thread messages to be delivered,
* most notably WM_ACTIVATE.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- if (OS.IsHungAppWindow (hwndMessage)) {
- MSG msg = new MSG ();
- int flags = OS.PM_REMOVE | OS.PM_NOYIELD;
- OS.PeekMessage (msg, hwndMessage, SWT_NULL, SWT_NULL, flags);
- }
+ if (OS.IsHungAppWindow (hwndMessage)) {
+ MSG msg = new MSG ();
+ int flags = OS.PM_REMOVE | OS.PM_NOYIELD;
+ OS.PeekMessage (msg, hwndMessage, SWT_NULL, SWT_NULL, flags);
}
Shell[] shells = getShells ();
for (int i=0; i<shells.length; i++) {
@@ -5058,16 +4745,6 @@ public void update() {
}
}
-void updateImages () {
- if (upArrow != null) upArrow.dispose ();
- if (downArrow != null) downArrow.dispose ();
- upArrow = downArrow = null;
- for (int i=0; i<controlTable.length; i++) {
- Control control = controlTable [i];
- if (control != null) control.updateImages ();
- }
-}
-
/**
* If the receiver's user-interface thread was <code>sleep</code>ing,
* causes it to be awakened and start running again. Note that this
@@ -5088,41 +4765,7 @@ public void wake () {
}
void wakeThread () {
- if (OS.IsWinCE) {
- OS.PostMessage (hwndMessage, OS.WM_NULL, 0, 0);
- } else {
- OS.PostThreadMessage (threadId, OS.WM_NULL, 0, 0);
- }
-}
-
-/*
- * Returns a single character, converted from the wide
- * character set (WCS) used by Java to the specified
- * multi-byte character set used by the operating system
- * widgets.
- *
- * @param ch the WCS character
- * @param codePage the code page used to convert the character
- * @return the MBCS character
- */
-static int wcsToMbcs (char ch, int codePage) {
- if (OS.IsUnicode) return ch;
- if (ch <= 0x7F) return ch;
- TCHAR buffer = new TCHAR (codePage, ch, false);
- return buffer.tcharAt (0);
-}
-
-/*
- * Returns a single character, converted from the wide
- * character set (WCS) used by Java to the default
- * multi-byte character set used by the operating system
- * widgets.
- *
- * @param ch the WCS character
- * @return the MBCS character
- */
-static int wcsToMbcs (char ch) {
- return wcsToMbcs (ch, 0);
+ OS.PostThreadMessage (threadId, OS.WM_NULL, 0, 0);
}
long /*int*/ windowProc (long /*int*/ hwnd, long /*int*/ msg, long /*int*/ wParam, long /*int*/ lParam) {
@@ -5182,12 +4825,7 @@ long /*int*/ windowProc (long /*int*/ hwnd, long /*int*/ msg, long /*int*/ wPara
if (lastControl != null && lastHwnd == hwnd) {
return lastControl.windowProc (hwnd, (int)/*64*/msg, wParam, lParam);
}
- int index;
- if (USE_PROPERTY) {
- index = (int)/*64*/OS.GetProp (hwnd, SWT_OBJECT_INDEX) - 1;
- } else {
- index = (int)/*64*/OS.GetWindowLongPtr (hwnd, OS.GWLP_USERDATA) - 1;
- }
+ int index = (int)/*64*/OS.GetProp (hwnd, SWT_OBJECT_INDEX) - 1;
if (0 <= index && index < controlTable.length) {
Control control = controlTable [index];
if (control != null) {
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 10dc4e1b8a..8abd30a83d 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
@@ -142,13 +142,11 @@ static int checkStyle (int style) {
if (hFont != 0) {
hCurrentFont = hFont;
} else {
- if (!OS.IsWinCE) {
- NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();
- info.cbSize = NONCLIENTMETRICS.sizeof;
- if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
- LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont;
- hCurrentFont = OS.CreateFontIndirect (logFont);
- }
+ NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();
+ info.cbSize = NONCLIENTMETRICS.sizeof;
+ if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
+ LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont;
+ hCurrentFont = OS.CreateFontIndirect (logFont);
}
}
if (hCurrentFont != 0) {
@@ -272,13 +270,11 @@ void drawWidget (GC gc, RECT clipRect) {
if (hFont != 0) {
hCurrentFont = hFont;
} else {
- if (!OS.IsWinCE) {
- NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();
- info.cbSize = NONCLIENTMETRICS.sizeof;
- if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
- LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont;
- hCurrentFont = OS.CreateFontIndirect (logFont);
- }
+ NONCLIENTMETRICS info = OS.IsUnicode ? (NONCLIENTMETRICS) new NONCLIENTMETRICSW () : new NONCLIENTMETRICSA ();
+ info.cbSize = NONCLIENTMETRICS.sizeof;
+ if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, info, 0)) {
+ LOGFONT logFont = OS.IsUnicode ? (LOGFONT) ((NONCLIENTMETRICSW)info).lfCaptionFont : ((NONCLIENTMETRICSA)info).lfCaptionFont;
+ hCurrentFont = OS.CreateFontIndirect (logFont);
}
}
if (hCurrentFont != 0) {
@@ -431,7 +427,7 @@ boolean isAppThemed () {
if (background != -1) return false;
if (foreground != -1) return false;
if (hFont != 0) return false;
- return OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ();
+ return OS.IsAppThemed ();
}
void layoutItems (int index, boolean setScrollbar) {
@@ -506,10 +502,8 @@ void reskinChildren (int flags) {
@Override
void setBackgroundPixel (int pixel) {
super.setBackgroundPixel (pixel);
- if (!OS.IsWinCE) {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
@Override
@@ -522,10 +516,8 @@ public void setFont (Font font) {
@Override
void setForegroundPixel (int pixel) {
super.setForegroundPixel (pixel);
- if (!OS.IsWinCE) {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
void setScrollbar () {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java
index 193399e60f..1b01dbb5b7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/FileDialog.java
@@ -54,9 +54,7 @@ public class FileDialog extends Dialog {
* is to only use OFN_ENABLEHOOK when the buffer has
* overrun.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- USE_HOOK = false;
- }
+ USE_HOOK = false;
}
/**
@@ -250,25 +248,23 @@ public String open () {
* parent for the dialog to inherit.
*/
boolean enabled = false;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- int dialogOrientation = style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
- int parentOrientation = parent.style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
- if (dialogOrientation != parentOrientation) {
- int exStyle = OS.WS_EX_NOINHERITLAYOUT;
- if (dialogOrientation == SWT.RIGHT_TO_LEFT) exStyle |= OS.WS_EX_LAYOUTRTL;
- hwndOwner = OS.CreateWindowEx (
- exStyle,
- Shell.DialogClass,
- null,
- 0,
- OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
- hwndParent,
- 0,
- OS.GetModuleHandle (null),
- null);
- enabled = OS.IsWindowEnabled (hwndParent);
- if (enabled) OS.EnableWindow (hwndParent, false);
- }
+ int dialogOrientation = style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+ int parentOrientation = parent.style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+ if (dialogOrientation != parentOrientation) {
+ int exStyle = OS.WS_EX_NOINHERITLAYOUT;
+ if (dialogOrientation == SWT.RIGHT_TO_LEFT) exStyle |= OS.WS_EX_LAYOUTRTL;
+ hwndOwner = OS.CreateWindowEx (
+ exStyle,
+ Shell.DialogClass,
+ null,
+ 0,
+ OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
+ hwndParent,
+ 0,
+ OS.GetModuleHandle (null),
+ null);
+ enabled = OS.IsWindowEnabled (hwndParent);
+ if (enabled) OS.EnableWindow (hwndParent, false);
}
/* Convert the title and copy it into lpstrTitle */
@@ -334,7 +330,7 @@ public String open () {
Callback callback = null;
if ((style & SWT.MULTI) != 0) {
struct.Flags |= OS.OFN_ALLOWMULTISELECT | OS.OFN_EXPLORER | OS.OFN_ENABLESIZING;
- if (!OS.IsWinCE && USE_HOOK) {
+ if (USE_HOOK) {
callback = new Callback (this, "OFNHookProc", 4); //$NON-NLS-1$
long /*int*/ lpfnHook = callback.getAddress ();
if (lpfnHook == 0) error (SWT.ERROR_NO_MORE_CALLBACKS);
@@ -375,15 +371,9 @@ public String open () {
* does not run for GetSaveFileName() or GetOpenFileName(). The
* fix is to allow async messages to run in the WH_FOREGROUNDIDLE
* hook instead.
- *
- * Bug in Windows 98. For some reason, when certain operating
- * system calls such as Shell_NotifyIcon(), GetOpenFileName()
- * and GetSaveFileName() are made during the WH_FOREGROUNDIDLE
- * hook, Windows hangs. The fix is to disallow async messages
- * during WH_FOREGROUNDIDLE.
*/
boolean oldRunMessagesInIdle = display.runMessagesInIdle;
- display.runMessagesInIdle = !OS.IsWin95;
+ display.runMessagesInIdle = true;
display.sendPreExternalEventDispatchEvent ();
/*
* Open the dialog. If the open fails due to an invalid
@@ -422,26 +412,7 @@ public String open () {
TCHAR buffer = new TCHAR (0, struct.nMaxFile);
int byteCount1 = buffer.length () * TCHAR.sizeof;
OS.MoveMemory (buffer, lpstrFile, byteCount1);
-
- /*
- * Bug in WinCE. For some reason, nFileOffset and nFileExtension
- * are always zero on WinCE HPC. nFileOffset is always zero on
- * WinCE PPC when using GetSaveFileName(). nFileOffset is correctly
- * set on WinCE PPC when using OpenFileName(). The fix is to parse
- * lpstrFile to calculate nFileOffset.
- *
- * Note: WinCE does not support multi-select file dialogs.
- */
int nFileOffset = struct.nFileOffset;
- if (OS.IsWinCE && nFileOffset == 0) {
- int index = 0;
- while (index < buffer.length ()) {
- int ch = buffer.tcharAt (index);
- if (ch == 0) break;
- if (ch == '\\') nFileOffset = index + 1;
- index++;
- }
- }
if (nFileOffset > 0) {
/* Use the character encoding for the default locale */
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 8fc005833a..defe0b6fae 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
@@ -153,8 +153,6 @@ public RGB getRGB () {
* </ul>
*/
public FontData open () {
- if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
-
/* Get the owner HWND for the dialog */
long /*int*/ hwndOwner = parent.handle;
long /*int*/ hwndParent = parent.handle;
@@ -166,25 +164,23 @@ public FontData open () {
* parent for the dialog to inherit.
*/
boolean enabled = false;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- int dialogOrientation = style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
- int parentOrientation = parent.style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
- if (dialogOrientation != parentOrientation) {
- int exStyle = OS.WS_EX_NOINHERITLAYOUT;
- if (dialogOrientation == SWT.RIGHT_TO_LEFT) exStyle |= OS.WS_EX_LAYOUTRTL;
- hwndOwner = OS.CreateWindowEx (
- exStyle,
- Shell.DialogClass,
- null,
- 0,
- OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
- hwndParent,
- 0,
- OS.GetModuleHandle (null),
- null);
- enabled = OS.IsWindowEnabled (hwndParent);
- if (enabled) OS.EnableWindow (hwndParent, false);
- }
+ int dialogOrientation = style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+ int parentOrientation = parent.style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+ if (dialogOrientation != parentOrientation) {
+ int exStyle = OS.WS_EX_NOINHERITLAYOUT;
+ if (dialogOrientation == SWT.RIGHT_TO_LEFT) exStyle |= OS.WS_EX_LAYOUTRTL;
+ hwndOwner = OS.CreateWindowEx (
+ exStyle,
+ Shell.DialogClass,
+ null,
+ 0,
+ OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
+ hwndParent,
+ 0,
+ OS.GetModuleHandle (null),
+ null);
+ enabled = OS.IsWindowEnabled (hwndParent);
+ if (enabled) OS.EnableWindow (hwndParent, false);
}
/* Open the dialog */
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 d75df30f00..b5a3643f30 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
@@ -44,7 +44,7 @@ public class Group extends Composite {
String text = "";
static final int CLIENT_INSET = 3;
static final long /*int*/ GroupProc;
- static final TCHAR GroupClass = new TCHAR (0, OS.IsWinCE ? "BUTTON" : "SWT_GROUP", true);
+ static final TCHAR GroupClass = new TCHAR (0, "SWT_GROUP", true);
static {
/*
* Feature in Windows. The group box window class
@@ -53,32 +53,22 @@ public class Group extends Composite {
* when resized. This causes flashing. The fix is to
* register a new window class without these bits and
* implement special code that damages only the control.
- *
- * Feature in WinCE. On certain devices, defining
- * a new window class which looks like BUTTON causes
- * CreateWindowEx() to crash. The workaround is to use
- * the class Button directly.
*/
WNDCLASS lpWndClass = new WNDCLASS ();
- if (OS.IsWinCE) {
- OS.GetClassInfo (0, GroupClass, lpWndClass);
- GroupProc = lpWndClass.lpfnWndProc;
- } else {
- TCHAR WC_BUTTON = new TCHAR (0, "BUTTON", true);
- OS.GetClassInfo (0, WC_BUTTON, lpWndClass);
- GroupProc = lpWndClass.lpfnWndProc;
- long /*int*/ hInstance = OS.GetModuleHandle (null);
- if (!OS.GetClassInfo (hInstance, GroupClass, lpWndClass)) {
- long /*int*/ hHeap = OS.GetProcessHeap ();
- lpWndClass.hInstance = hInstance;
- lpWndClass.style &= ~(OS.CS_HREDRAW | OS.CS_VREDRAW);
- int byteCount = GroupClass.length () * TCHAR.sizeof;
- long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (lpszClassName, GroupClass, byteCount);
- lpWndClass.lpszClassName = lpszClassName;
- OS.RegisterClass (lpWndClass);
- OS.HeapFree (hHeap, 0, lpszClassName);
- }
+ TCHAR WC_BUTTON = new TCHAR (0, "BUTTON", true);
+ OS.GetClassInfo (0, WC_BUTTON, lpWndClass);
+ GroupProc = lpWndClass.lpfnWndProc;
+ long /*int*/ hInstance = OS.GetModuleHandle (null);
+ if (!OS.GetClassInfo (hInstance, GroupClass, lpWndClass)) {
+ long /*int*/ hHeap = OS.GetProcessHeap ();
+ lpWndClass.hInstance = hInstance;
+ lpWndClass.style &= ~(OS.CS_HREDRAW | OS.CS_VREDRAW);
+ int byteCount = GroupClass.length () * TCHAR.sizeof;
+ long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+ OS.MoveMemory (lpszClassName, GroupClass, byteCount);
+ lpWndClass.lpszClassName = lpszClassName;
+ OS.RegisterClass (lpWndClass);
+ OS.HeapFree (hHeap, 0, lpszClassName);
}
}
@@ -172,7 +162,7 @@ protected void checkSubclass () {
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;
+ int offsetY = OS.IsAppThemed () ? 0 : 1;
size.x = Math.max (size.x, rect.right - rect.left + CLIENT_INSET * 6 + offsetY);
}
return size;
@@ -189,7 +179,7 @@ protected void checkSubclass () {
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 offsetY = OS.IsAppThemed () ? 0 : 1;
trim.x -= CLIENT_INSET;
trim.y -= tm.tmHeight + offsetY;
trim.width += CLIENT_INSET * 2;
@@ -242,11 +232,11 @@ String fixText (boolean enabled) {
if (text.length() == 0) return null;
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
String string = null;
- if (!enabled && (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ())) {
+ if (!enabled && !OS.IsAppThemed ()) {
string = " " + text + " ";
}
- return !OS.IsUnicode || (style & SWT.FLIP_TEXT_DIRECTION) == 0 ? string : string != null ? LRE + string : LRE + text;
- } else if (OS.IsUnicode && (style & SWT.FLIP_TEXT_DIRECTION) != 0) {
+ return (style & SWT.FLIP_TEXT_DIRECTION) == 0 ? string : string != null ? LRE + string : LRE + text;
+ } else if ((style & SWT.FLIP_TEXT_DIRECTION) != 0) {
return RLE + text;
}
return null;
@@ -265,7 +255,7 @@ String fixText (boolean enabled) {
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 offsetY = 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);
@@ -557,7 +547,7 @@ LRESULT WM_PRINTCLIENT (long /*int*/ wParam, long /*int*/ lParam) {
* BS_GROUP, there is no problem. The fix is to save
* and restore the current font.
*/
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
int nSavedDC = OS.SaveDC (wParam);
long /*int*/ code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam);
OS.RestoreDC (wParam, nSavedDC);
@@ -581,7 +571,7 @@ LRESULT WM_UPDATEUISTATE (long /*int*/ wParam, long /*int*/ lParam) {
boolean redraw = findImageControl () != null;
if (!redraw) {
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
redraw = findThemeControl () != null;
}
}
@@ -605,7 +595,6 @@ LRESULT WM_WINDOWPOSCHANGING (long /*int*/ wParam, long /*int*/ lParam) {
* group from inside WM_SIZE causes pixel corruption for
* radio button children.
*/
- if (OS.IsWinCE) return result;
if (!OS.IsWindowVisible (handle)) return result;
WINDOWPOS lpwp = new WINDOWPOS ();
OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/IME.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/IME.java
index 764143ac59..012891c0bb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/IME.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/IME.java
@@ -316,7 +316,6 @@ public boolean getWideCaret() {
}
boolean isInlineEnabled () {
- if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (5, 1)) return false;
return OS.IsDBLocale && hooks (SWT.ImeComposition);
}
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 fa1826b167..98d89a6bfd 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
@@ -111,7 +111,7 @@ long /*int*/ callWindowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, lo
* clipboard. This is unwanted. The fix is to avoid
* calling the label window proc.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(6, 1)) {
+ if (OS.WIN32_VERSION >= OS.VERSION(6, 1)) {
switch (msg) {
case OS.WM_LBUTTONDBLCLK: return OS.DefWindowProc (hwnd, msg, wParam, lParam);
}
@@ -187,13 +187,6 @@ static int checkStyle (int style) {
if (hHint != SWT.DEFAULT) height = hHint;
width += border * 2;
height += border * 2;
- /*
- * Feature in WinCE PPC. Text labels have a trim
- * of one pixel wide on the right and left side.
- * The fix is to increase the width to include
- * this trim.
- */
- if (OS.IsWinCE && !drawImage) width += 2;
return new Point (width, height);
}
@@ -430,17 +423,6 @@ public void setText (String string) {
if ((state & HAS_AUTO_DIRECTION) != 0) {
updateTextDirection (AUTO_TEXT_DIRECTION);
}
- /*
- * Bug in Windows. For some reason, the HBRUSH that
- * is returned from WM_CTRLCOLOR is misaligned when
- * the label uses it to draw. If the brush is a solid
- * color, this does not matter. However, if the brush
- * contains an image, the image is misaligned. The
- * fix is to draw the background in WM_ERASEBKGND.
- */
- if (OS.COMCTL32_MAJOR < 6) {
- if (findImageControl () != null) OS.InvalidateRect (handle, null, true);
- }
}
@Override
@@ -454,9 +436,7 @@ int widgetExtStyle () {
int widgetStyle () {
int bits = super.widgetStyle () | OS.SS_NOTIFY;
if ((style & SWT.SEPARATOR) != 0) return bits | OS.SS_OWNERDRAW;
- if (OS.WIN32_VERSION >= OS.VERSION (5, 0)) {
- if ((style & SWT.WRAP) != 0) bits |= OS.SS_EDITCONTROL;
- }
+ if ((style & SWT.WRAP) != 0) bits |= OS.SS_EDITCONTROL;
if ((style & SWT.CENTER) != 0) return bits | OS.SS_CENTER;
if ((style & SWT.RIGHT) != 0) return bits | OS.SS_RIGHT;
if ((style & SWT.WRAP) != 0) return bits | OS.SS_LEFT;
@@ -481,20 +461,6 @@ LRESULT WM_ERASEBKGND (long /*int*/ wParam, long /*int*/ lParam) {
if ((bits & OS.SS_OWNERDRAW) == OS.SS_OWNERDRAW) {
return LRESULT.ONE;
}
- /*
- * Bug in Windows. For some reason, the HBRUSH that
- * is returned from WM_CTRLCOLOR is misaligned when
- * the label uses it to draw. If the brush is a solid
- * color, this does not matter. However, if the brush
- * contains an image, the image is misaligned. The
- * fix is to draw the background in WM_ERASEBKGND.
- */
- if (OS.COMCTL32_MAJOR < 6) {
- if (findImageControl () != null) {
- drawBackground (wParam);
- return LRESULT.ONE;
- }
- }
return result;
}
@@ -540,7 +506,7 @@ LRESULT WM_UPDATEUISTATE (long /*int*/ wParam, long /*int*/ lParam) {
boolean redraw = findImageControl () != null;
if (!redraw) {
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
redraw = findThemeControl () != null;
}
}
@@ -554,93 +520,6 @@ LRESULT WM_UPDATEUISTATE (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT wmColorChild (long /*int*/ wParam, long /*int*/ lParam) {
- /*
- * Bug in Windows. For some reason, the HBRUSH that
- * is returned from WM_CTRLCOLOR is misaligned when
- * the label uses it to draw. If the brush is a solid
- * color, this does not matter. However, if the brush
- * contains an image, the image is misaligned. The
- * fix is to draw the background in WM_ERASEBKGND.
- */
- LRESULT result = super.wmColorChild (wParam, lParam);
- if (OS.COMCTL32_MAJOR < 6) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.SS_OWNERDRAW) != OS.SS_OWNERDRAW) {
- if (findImageControl () != null) {
- OS.SetBkMode (wParam, OS.TRANSPARENT);
- return new LRESULT (OS.GetStockObject (OS.NULL_BRUSH));
- }
- }
- }
- return result;
-}
-
-@Override
-LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
- if ((state & DISPOSE_SENT) != 0) return LRESULT.ZERO;
-
- if (OS.IsWinCE) {
- boolean drawImage = image != null;
- boolean drawSeparator = (style & SWT.SEPARATOR) != 0 && (style & SWT.SHADOW_NONE) == 0;
- if (drawImage || drawSeparator) {
- LRESULT result = null;
- PAINTSTRUCT ps = new PAINTSTRUCT ();
- GCData data = new GCData ();
- data.ps = ps;
- data.hwnd = handle;
- GC gc = new_GC (data);
- if (gc != null) {
- drawBackground (gc.handle);
- RECT clientRect = new RECT();
- OS.GetClientRect (handle, clientRect);
- if (drawSeparator) {
- RECT rect = new RECT ();
- int lineWidth = OS.GetSystemMetrics (OS.SM_CXBORDER);
- int flags = (style & SWT.SHADOW_IN) != 0 ? OS.EDGE_SUNKEN : OS.EDGE_ETCHED;
- if ((style & SWT.HORIZONTAL) != 0) {
- int bottom = clientRect.top + Math.max (lineWidth * 2, (clientRect.bottom - clientRect.top) / 2);
- OS.SetRect (rect, clientRect.left, clientRect.top, clientRect.right, bottom);
- OS.DrawEdge (gc.handle, rect, flags, OS.BF_BOTTOM);
- } else {
- int right = clientRect.left + Math.max (lineWidth * 2, (clientRect.right - clientRect.left) / 2);
- OS.SetRect (rect, clientRect.left, clientRect.top, right, clientRect.bottom);
- OS.DrawEdge (gc.handle, rect, flags, OS.BF_RIGHT);
- }
- result = LRESULT.ONE;
- }
- if (drawImage) {
- Rectangle imageBounds = image.getBoundsInPixels ();
- int x = 0;
- if ((style & SWT.CENTER) != 0) {
- x = Math.max (0, (clientRect.right - imageBounds.width) / 2);
- } else {
- if ((style & SWT.RIGHT) != 0) {
- x = Math.max (0, (clientRect.right - imageBounds.width));
- }
- }
- gc.drawImage (image, DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(Math.max (0, (clientRect.bottom - imageBounds.height) / 2)));
- result = LRESULT.ONE;
- }
- int width = ps.right - ps.left;
- int height = ps.bottom - ps.top;
- if (width != 0 && height != 0) {
- Event event = new Event ();
- event.gc = gc;
- event.setBoundsInPixels(new Rectangle(ps.left, ps.top, width, height));
- sendEvent (SWT.Paint, event);
- // widget could be disposed at this point
- event.gc = null;
- }
- gc.dispose ();
- }
- return result;
- }
- }
- return super.WM_PAINT(wParam, lParam);
-}
-
-@Override
LRESULT wmDrawChild (long /*int*/ wParam, long /*int*/ lParam) {
DRAWITEMSTRUCT struct = new DRAWITEMSTRUCT ();
OS.MoveMemory (struct, lParam, DRAWITEMSTRUCT.sizeof);
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 552af12d49..215a624b31 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
@@ -55,41 +55,37 @@ public class Link extends Control {
static final long /*int*/ LinkProc;
static final TCHAR LinkClass = new TCHAR (0, OS.WC_LINK, true);
static {
- if (isCommonControlAvailable()) {
- WNDCLASS lpWndClass = new WNDCLASS ();
- OS.GetClassInfo (0, LinkClass, lpWndClass);
- LinkProc = lpWndClass.lpfnWndProc;
- /*
- * Feature in Windows. The SysLink window class
- * does not include CS_DBLCLKS. This means that these
- * controls will not get double click messages such as
- * WM_LBUTTONDBLCLK. The fix is to register a new
- * window class with CS_DBLCLKS.
- *
- * NOTE: Screen readers look for the exact class name
- * of the control in order to provide the correct kind
- * of assistance. Therefore, it is critical that the
- * new window class have the same name. It is possible
- * to register a local window class with the same name
- * as a global class. Since bits that affect the class
- * are being changed, it is possible that other native
- * code, other than SWT, could create a control with
- * this class name, and fail unexpectedly.
- */
- long /*int*/ hInstance = OS.GetModuleHandle (null);
- long /*int*/ hHeap = OS.GetProcessHeap ();
- lpWndClass.hInstance = hInstance;
- lpWndClass.style &= ~OS.CS_GLOBALCLASS;
- lpWndClass.style |= OS.CS_DBLCLKS;
- int byteCount = LinkClass.length () * TCHAR.sizeof;
- long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (lpszClassName, LinkClass, byteCount);
- lpWndClass.lpszClassName = lpszClassName;
- OS.RegisterClass (lpWndClass);
- OS.HeapFree (hHeap, 0, lpszClassName);
- } else {
- LinkProc = 0;
- }
+ WNDCLASS lpWndClass = new WNDCLASS ();
+ OS.GetClassInfo (0, LinkClass, lpWndClass);
+ LinkProc = lpWndClass.lpfnWndProc;
+ /*
+ * Feature in Windows. The SysLink window class
+ * does not include CS_DBLCLKS. This means that these
+ * controls will not get double click messages such as
+ * WM_LBUTTONDBLCLK. The fix is to register a new
+ * window class with CS_DBLCLKS.
+ *
+ * NOTE: Screen readers look for the exact class name
+ * of the control in order to provide the correct kind
+ * of assistance. Therefore, it is critical that the
+ * new window class have the same name. It is possible
+ * to register a local window class with the same name
+ * as a global class. Since bits that affect the class
+ * are being changed, it is possible that other native
+ * code, other than SWT, could create a control with
+ * this class name, and fail unexpectedly.
+ */
+ long /*int*/ hInstance = OS.GetModuleHandle (null);
+ long /*int*/ hHeap = OS.GetProcessHeap ();
+ lpWndClass.hInstance = hInstance;
+ lpWndClass.style &= ~OS.CS_GLOBALCLASS;
+ lpWndClass.style |= OS.CS_DBLCLKS;
+ int byteCount = LinkClass.length () * TCHAR.sizeof;
+ long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+ OS.MoveMemory (lpszClassName, LinkClass, byteCount);
+ lpWndClass.lpszClassName = lpszClassName;
+ OS.RegisterClass (lpWndClass);
+ OS.HeapFree (hHeap, 0, lpszClassName);
}
/**
@@ -158,24 +154,21 @@ public void addSelectionListener (SelectionListener listener) {
@Override
long /*int*/ callWindowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /*int*/ lParam) {
if (handle == 0) return 0;
- if (LinkProc != 0) {
- /*
- * Feature in Windows. By convention, native Windows controls
- * check for a non-NULL wParam, assume that it is an HDC and
- * paint using that device. The SysLink control does not.
- * The fix is to check for an HDC and use WM_PRINTCLIENT.
- */
- switch (msg) {
- case OS.WM_PAINT:
- if (wParam != 0) {
- OS.SendMessage (hwnd, OS.WM_PRINTCLIENT, wParam, 0);
- return 0;
- }
- break;
- }
- return OS.CallWindowProc (LinkProc, hwnd, msg, wParam, lParam);
+ /*
+ * Feature in Windows. By convention, native Windows controls
+ * check for a non-NULL wParam, assume that it is an HDC and
+ * paint using that device. The SysLink control does not.
+ * The fix is to check for an HDC and use WM_PRINTCLIENT.
+ */
+ switch (msg) {
+ case OS.WM_PAINT:
+ if (wParam != 0) {
+ OS.SendMessage (hwnd, OS.WM_PRINTCLIENT, wParam, 0);
+ return 0;
+ }
+ break;
}
- return OS.DefWindowProc (hwnd, msg, wParam, lParam);
+ return OS.CallWindowProc (LinkProc, hwnd, msg, wParam, lParam);
}
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
@@ -381,13 +374,7 @@ Color internalGetLinkForeground() {
if (linkForeground != -1) {
return Color.win32_new (display, linkForeground);
}
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- return Color.win32_new (display, OS.GetSysColor (OS.COLOR_HOTLIGHT));
- }
- // Create and cache the linkForeground Color native handle for re-use.
- Color color = new Color (display, LAST_FALLBACK_LINK_FOREGROUND);
- linkForeground = color.handle;
- return color;
+ return Color.win32_new (display, OS.GetSysColor (OS.COLOR_HOTLIGHT));
}
@Override
@@ -763,17 +750,15 @@ public void setText (String string) {
boolean enabled = OS.IsWindowEnabled (handle);
String parsedText = parse (text);
- if (isCommonControlAvailable()) {
- /*
- * Bug in Windows. For some reason, when SetWindowText()
- * is used to set the text of a link control to the empty
- * string, the old text remains. The fix is to set the
- * text to a space instead.
- */
- if (string.length () == 0) string = " "; //$NON-NLS-1$
- TCHAR buffer = new TCHAR (getCodePage (), string, true);
- OS.SetWindowText (handle, buffer);
- }
+ /*
+ * Bug in Windows. For some reason, when SetWindowText()
+ * is used to set the text of a link control to the empty
+ * string, the old text remains. The fix is to set the
+ * text to a space instead.
+ */
+ if (string.length () == 0) string = " "; //$NON-NLS-1$
+ TCHAR buffer = new TCHAR (getCodePage (), string, true);
+ OS.SetWindowText (handle, buffer);
layout.setText (parsedText);
focusIndex = offsets.length > 0 ? 0 : -1;
@@ -835,11 +820,7 @@ boolean useCommonControl() {
}
boolean useCommonControl(boolean enabled) {
- return linkForeground == -1 && !enabled && isCommonControlAvailable();
-}
-
-static boolean isCommonControlAvailable() {
- return OS.COMCTL32_MAJOR >= 6;
+ return linkForeground == -1 && !enabled;
}
@Override
@@ -850,12 +831,12 @@ int widgetStyle () {
@Override
TCHAR windowClass () {
- return isCommonControlAvailable() ? LinkClass : display.windowClass;
+ return LinkClass;
}
@Override
long /*int*/ windowProc () {
- return LinkProc != 0 ? LinkProc : display.windowProc;
+ return LinkProc;
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
index ea156e4eb3..8b60d062ca 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/List.java
@@ -1566,13 +1566,8 @@ void updateMenuLocation (Event event) {
@Override
boolean updateTextDirection (int textDirection) {
if (textDirection == AUTO_TEXT_DIRECTION) {
- /*
- * To apply auto direction we use UCC that are not available in ANSI CP
- * and - most important - will not be supported by TCHAR - even though
- * they could be supported natively through "wide" (Unicode) versions of
- * win32 API. Also, if auto is already in effect, there's nothing to do.
- */
- if (!OS.IsUnicode || (state & HAS_AUTO_DIRECTION) != 0) return false;
+ /* If auto is already in effect, there's nothing to do. */
+ if ((state & HAS_AUTO_DIRECTION) != 0) return false;
state |= HAS_AUTO_DIRECTION;
} else {
state &= ~HAS_AUTO_DIRECTION;
@@ -1631,7 +1626,7 @@ long /*int*/ windowProc () {
@Override
long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /*int*/ lParam) {
/* Below code is to support auto text direction. */
- if (OS.IsUnicode && handle != 0 && lParam != 0 && (state & HAS_AUTO_DIRECTION) != 0) {
+ if (handle != 0 && lParam != 0 && (state & HAS_AUTO_DIRECTION) != 0) {
switch (msg) {
case OS.LB_ADDSTRING:
case OS.LB_INSERTSTRING:
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
index 62848b4476..b9f66aa052 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
@@ -55,27 +55,15 @@ public class Menu extends Widget {
public long /*int*/ handle;
int x, y;
- long /*int*/ hBrush, hwndCB;
+ long /*int*/ hBrush;
int id0, id1;
int foreground = -1, background = -1;
Image backgroundImage;
boolean hasLocation;
MenuItem cascade;
Decorations parent;
- ImageList imageList;
MenuItem selectedMenuItem;
- /* Resource ID for SHMENUBARINFO */
- static final int ID_PPC = 100;
-
- /* SmartPhone SoftKeyBar resource ids */
- static final int ID_SPMM = 102;
- static final int ID_SPBM = 103;
- static final int ID_SPMB = 104;
- static final int ID_SPBB = 105;
- static final int ID_SPSOFTKEY0 = 106;
- static final int ID_SPSOFTKEY1 = 107;
-
/* Timer ID for MenuItem ToolTip */
static final int ID_TOOLTIP_TIMER = 110;
@@ -262,7 +250,7 @@ void _setVisible (boolean visible) {
boolean success = OS.TrackPopupMenu (handle, flags, nX, nY, 0, hwndParent, null);
// widget could be disposed at this point
display.sendPostExternalEventDispatchEvent ();
- if (!success && GetMenuItemCount (handle) == 0) {
+ if (!success && OS.GetMenuItemCount (handle) == 0) {
OS.SendMessage (hwndParent, OS.WM_MENUSELECT, OS.MAKEWPARAM (0, 0xFFFF), 0);
}
} else {
@@ -354,180 +342,41 @@ static int checkStyle (int style) {
void createHandle () {
if (handle != 0) return;
if ((style & SWT.BAR) != 0) {
- if (OS.IsPPC) {
- long /*int*/ hwndShell = parent.handle;
- SHMENUBARINFO mbi = new SHMENUBARINFO ();
- mbi.cbSize = SHMENUBARINFO.sizeof;
- mbi.hwndParent = hwndShell;
- mbi.dwFlags = OS.SHCMBF_HIDDEN;
- mbi.nToolBarId = ID_PPC;
- mbi.hInstRes = OS.GetLibraryHandle ();
- boolean success = OS.SHCreateMenuBar (mbi);
- hwndCB = mbi.hwndMB;
- if (!success) error (SWT.ERROR_NO_HANDLES);
- /* Remove the item from the resource file */
- OS.SendMessage (hwndCB, OS.TB_DELETEBUTTON, 0, 0);
- return;
- }
- /*
- * Note in WinCE SmartPhone. The SoftBar contains only 2 items.
- * An item can either be a menu or a button.
- * SWT.BAR: creates a SoftBar with 2 menus
- * SWT.BAR | SWT.BUTTON1: creates a SoftBar with 1 button
- * for button1, and a menu for button2
- * SWT.BAR | SWT.BUTTON1 | SWT.BUTTON2: creates a SoftBar with
- * 2 buttons
- */
- if (OS.IsSP) {
- /* Determine type of menubar */
- int nToolBarId;
- if ((style & SWT.BUTTON1) != 0) {
- nToolBarId = ((style & SWT.BUTTON2) != 0) ? ID_SPBB : ID_SPBM;
- } else {
- nToolBarId = ((style & SWT.BUTTON2) != 0) ? ID_SPMB : ID_SPMM;
- }
-
- /* Create SHMENUBAR */
- SHMENUBARINFO mbi = new SHMENUBARINFO ();
- mbi.cbSize = SHMENUBARINFO.sizeof;
- mbi.hwndParent = parent.handle;
- mbi.dwFlags = OS.SHCMBF_HIDDEN;
- mbi.nToolBarId = nToolBarId; /* as defined in .rc file */
- mbi.hInstRes = OS.GetLibraryHandle ();
- if (!OS.SHCreateMenuBar (mbi)) error (SWT.ERROR_NO_HANDLES);
- hwndCB = mbi.hwndMB;
-
- /*
- * Feature on WinCE SmartPhone. The SHCMBF_HIDDEN flag causes the
- * SHMENUBAR to not be drawn. However the keyboard events still go
- * through it. The workaround is to also hide the SHMENUBAR with
- * ShowWindow ().
- */
- OS.ShowWindow (hwndCB, OS.SW_HIDE);
-
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_COMMAND;
- MenuItem item;
-
- /* Set first item */
- if (nToolBarId == ID_SPMM || nToolBarId == ID_SPMB) {
- long /*int*/ hMenu = OS.SendMessage (hwndCB, OS.SHCMBM_GETSUBMENU, 0, ID_SPSOFTKEY0);
- /* Remove the item from the resource file */
- OS.RemoveMenu (hMenu, 0, OS.MF_BYPOSITION);
- Menu menu = new Menu (parent, SWT.DROP_DOWN, hMenu);
- item = new MenuItem (this, menu, SWT.CASCADE, 0);
- } else {
- item = new MenuItem (this, null, SWT.PUSH, 0);
- }
- info.idCommand = id0 = item.id;
- OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, ID_SPSOFTKEY0, info);
-
- /* Set second item */
- if (nToolBarId == ID_SPMM || nToolBarId == ID_SPBM) {
- long /*int*/ hMenu = OS.SendMessage (hwndCB, OS.SHCMBM_GETSUBMENU, 0, ID_SPSOFTKEY1);
- OS.RemoveMenu (hMenu, 0, OS.MF_BYPOSITION);
- Menu menu = new Menu (parent, SWT.DROP_DOWN, hMenu);
- item = new MenuItem (this, menu, SWT.CASCADE, 1);
- } else {
- item = new MenuItem (this, null, SWT.PUSH, 1);
- }
- info.idCommand = id1 = item.id;
- OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, ID_SPSOFTKEY1, info);
-
- /*
- * Override the Back key. For some reason, the owner of the menubar
- * must be a Dialog or it won't receive the WM_HOTKEY message. As
- * a result, Shell on WinCE SP must use the class Dialog.
- */
- int dwMask = OS.SHMBOF_NODEFAULT | OS.SHMBOF_NOTIFY;
- long /*int*/ lParam = OS.MAKELPARAM (dwMask, dwMask);
- OS.SendMessage (hwndCB, OS.SHCMBM_OVERRIDEKEY, OS.VK_ESCAPE, lParam);
- return;
- }
handle = OS.CreateMenu ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
- if (OS.IsHPC) {
- long /*int*/ hwndShell = parent.handle;
- hwndCB = OS.CommandBar_Create (OS.GetModuleHandle (null), hwndShell, 1);
- if (hwndCB == 0) error (SWT.ERROR_NO_HANDLES);
- OS.CommandBar_Show (hwndCB, false);
- OS.CommandBar_InsertMenubarEx (hwndCB, 0, handle, 0);
- /*
- * The command bar hosts the 'close' button when the window does not
- * have a caption.
- */
- if ((parent.style & SWT.CLOSE) != 0 && (parent.style & SWT.TITLE) == 0) {
- OS.CommandBar_AddAdornments (hwndCB, 0, 0);
- }
- }
} else {
handle = OS.CreatePopupMenu ();
- if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
void createItem (MenuItem item, int index) {
- int count = GetMenuItemCount (handle);
+ int count = OS.GetMenuItemCount (handle);
if (!(0 <= index && index <= count)) error (SWT.ERROR_INVALID_RANGE);
display.addMenuItem (item);
- boolean success = false;
- if ((OS.IsPPC || OS.IsSP) && hwndCB != 0) {
- if (OS.IsSP) return;
- TBBUTTON lpButton = new TBBUTTON ();
- lpButton.idCommand = item.id;
- lpButton.fsStyle = (byte) OS.TBSTYLE_AUTOSIZE;
- if ((item.style & SWT.CASCADE) != 0) lpButton.fsStyle |= OS.TBSTYLE_DROPDOWN | 0x80;
- if ((item.style & SWT.SEPARATOR) != 0) lpButton.fsStyle = (byte) OS.BTNS_SEP;
- lpButton.fsState = (byte) OS.TBSTATE_ENABLED;
- lpButton.iBitmap = OS.I_IMAGENONE;
- success = OS.SendMessage (hwndCB, OS.TB_INSERTBUTTON, index, lpButton) != 0;
- } else {
- if (OS.IsWinCE) {
- int uFlags = OS.MF_BYPOSITION;
- TCHAR lpNewItem = null;
- if ((item.style & SWT.SEPARATOR) != 0) {
- uFlags |= OS.MF_SEPARATOR;
- } else {
- lpNewItem = new TCHAR (0, " ", true);
- }
- success = OS.InsertMenu (handle, index, uFlags, item.id, lpNewItem);
- if (success) {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- info.dwItemData = item.id;
- success = OS.SetMenuItemInfo (handle, index, true, info);
- }
- } else {
- /*
- * Bug in Windows. For some reason, when InsertMenuItem()
- * is used to insert an item without text, it is not possible
- * to use SetMenuItemInfo() to set the text at a later time.
- * The fix is to insert the item with some text.
- *
- * Feature in Windows. When an empty string is used instead
- * of a space and InsertMenuItem() is used to set a submenu
- * before setting text to a non-empty string, the menu item
- * becomes unexpectedly disabled. The fix is to insert a
- * space.
- */
- long /*int*/ hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (0, " ", true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- long /*int*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_DATA;
- info.wID = item.id;
- info.dwItemData = item.id;
- info.fType = item.widgetStyle ();
- info.dwTypeData = pszText;
- success = OS.InsertMenuItem (handle, index, true, info);
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- }
- }
+ /*
+ * Bug in Windows. For some reason, when InsertMenuItem()
+ * is used to insert an item without text, it is not possible
+ * to use SetMenuItemInfo() to set the text at a later time.
+ * The fix is to insert the item with some text.
+ *
+ * Feature in Windows. When an empty string is used instead
+ * of a space and InsertMenuItem() is used to set a submenu
+ * before setting text to a non-empty string, the menu item
+ * becomes unexpectedly disabled. The fix is to insert a
+ * space.
+ */
+ long /*int*/ hHeap = OS.GetProcessHeap ();
+ long /*int*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, 4);
+ OS.MoveMemory (pszText, new char [] {' ', '\0'}, 4);
+ MENUITEMINFO info = new MENUITEMINFO ();
+ info.cbSize = MENUITEMINFO.sizeof;
+ info.fMask = OS.MIIM_ID | OS.MIIM_TYPE | OS.MIIM_DATA;
+ info.wID = item.id;
+ info.dwItemData = item.id;
+ info.fType = item.widgetStyle ();
+ info.dwTypeData = pszText;
+ boolean success = OS.InsertMenuItem (handle, index, true, info);
+ if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
if (!success) {
display.removeMenuItem (item);
error (SWT.ERROR_ITEM_NOT_ADDED);
@@ -568,44 +417,8 @@ void destroyAccelerators () {
}
void destroyItem (MenuItem item) {
- if (OS.IsWinCE) {
- if ((OS.IsPPC || OS.IsSP) && hwndCB != 0) {
- if (OS.IsSP) {
- redraw();
- return;
- }
- int index = (int)/*64*/OS.SendMessage (hwndCB, OS.TB_COMMANDTOINDEX, item.id, 0);
- if (OS.SendMessage (hwndCB, OS.TB_DELETEBUTTON, index, 0) == 0) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- int count = (int)/*64*/OS.SendMessage (hwndCB, OS.TB_BUTTONCOUNT, 0, 0);
- if (count == 0) {
- if (imageList != null) {
- OS.SendMessage (handle, OS.TB_SETIMAGELIST, 0, 0);
- display.releaseImageList (imageList);
- imageList = null;
- }
- }
- } else {
- int index = 0;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- while (OS.GetMenuItemInfo (handle, index, true, info)) {
- if (info.dwItemData == item.id) break;
- index++;
- }
- if (info.dwItemData != item.id) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- if (!OS.DeleteMenu (handle, index, OS.MF_BYPOSITION)) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
- }
- } else {
- if (!OS.DeleteMenu (handle, item.id, OS.MF_BYCOMMAND)) {
- error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
+ if (!OS.DeleteMenu (handle, item.id, OS.MF_BYCOMMAND)) {
+ error (SWT.ERROR_ITEM_NOT_REMOVED);
}
redraw ();
}
@@ -613,16 +426,12 @@ void destroyItem (MenuItem item) {
@Override
void destroyWidget () {
MenuItem cascade = this.cascade;
- long /*int*/ hMenu = handle, hCB = hwndCB;
+ long /*int*/ hMenu = handle;
releaseHandle ();
- if (OS.IsWinCE && hCB != 0) {
- OS.CommandBar_Destroy (hCB);
+ if (cascade != null) {
+ cascade.setMenu (null, true);
} else {
- if (cascade != null) {
- if (!OS.IsSP) cascade.setMenu (null, true);
- } else {
- if (hMenu != 0) OS.DestroyMenu (hMenu);
- }
+ if (hMenu != 0) OS.DestroyMenu (hMenu);
}
}
@@ -695,7 +504,6 @@ void fixMenus (Decorations newParent) {
*/
/*public*/ Rectangle getBounds () {
checkWidget ();
- if (OS.IsWinCE) return new Rectangle (0, 0, 0, 0);
if ((style & SWT.BAR) != 0) {
if (parent.menuBar != this) {
return new Rectangle (0, 0, 0, 0);
@@ -709,7 +517,7 @@ void fixMenus (Decorations newParent) {
return new Rectangle (info.left, info.top, width, height);
}
} else {
- int count = GetMenuItemCount (handle);
+ int count = OS.GetMenuItemCount (handle);
if (count != 0) {
RECT rect1 = new RECT ();
if (OS.GetMenuItemRect (0, handle, 0, rect1)) {
@@ -740,7 +548,6 @@ void fixMenus (Decorations newParent) {
*/
public MenuItem getDefaultItem () {
checkWidget ();
- if (OS.IsWinCE) return null;
int id = OS.GetMenuDefaultItem (handle, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
if (id == -1) return null;
MENUITEMINFO info = new MENUITEMINFO ();
@@ -805,26 +612,13 @@ public boolean getEnabled () {
public MenuItem getItem (int index) {
checkWidget ();
int id = 0;
- if ((OS.IsPPC || OS.IsSP) && hwndCB != 0) {
- if (OS.IsPPC) {
- TBBUTTON lpButton = new TBBUTTON ();
- long /*int*/ result = OS.SendMessage (hwndCB, OS.TB_GETBUTTON, index, lpButton);
- if (result == 0) error (SWT.ERROR_CANNOT_GET_ITEM);
- id = lpButton.idCommand;
- }
- if (OS.IsSP) {
- if (!(0 <= index && index <= 1)) error (SWT.ERROR_CANNOT_GET_ITEM);
- id = index == 0 ? id0 : id1;
- }
- } else {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- if (!OS.GetMenuItemInfo (handle, index, true, info)) {
- error (SWT.ERROR_INVALID_RANGE);
- }
- id = (int)/*64*/info.dwItemData;
+ MENUITEMINFO info = new MENUITEMINFO ();
+ info.cbSize = MENUITEMINFO.sizeof;
+ info.fMask = OS.MIIM_DATA;
+ if (!OS.GetMenuItemInfo (handle, index, true, info)) {
+ error (SWT.ERROR_INVALID_RANGE);
}
+ id = (int)/*64*/info.dwItemData;
return display.getMenuItem (id);
}
@@ -840,7 +634,7 @@ public MenuItem getItem (int index) {
*/
public int getItemCount () {
checkWidget ();
- return GetMenuItemCount (handle);
+ return OS.GetMenuItemCount (handle);
}
/**
@@ -861,24 +655,8 @@ public int getItemCount () {
*/
public MenuItem [] getItems () {
checkWidget ();
- if ((OS.IsPPC || OS.IsSP) && hwndCB != 0) {
- if (OS.IsSP) {
- MenuItem [] result = new MenuItem [2];
- result[0] = display.getMenuItem (id0);
- result[1] = display.getMenuItem (id1);
- return result;
- }
- int count = (int)/*64*/OS.SendMessage (hwndCB, OS.TB_BUTTONCOUNT, 0, 0);
- TBBUTTON lpButton = new TBBUTTON ();
- MenuItem [] result = new MenuItem [count];
- for (int i=0; i<count; i++) {
- OS.SendMessage (hwndCB, OS.TB_GETBUTTON, i, lpButton);
- result [i] = display.getMenuItem (lpButton.idCommand);
- }
- return result;
- }
int index = 0, count = 0;
- int length = OS.IsWinCE ? 4 : OS.GetMenuItemCount (handle);
+ int length = OS.GetMenuItemCount (handle);
if (length < 0) {
int error = OS.GetLastError();
SWT.error(SWT.ERROR_CANNOT_GET_COUNT, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
@@ -903,20 +681,6 @@ public MenuItem [] getItems () {
return result;
}
-int GetMenuItemCount (long /*int*/ handle) {
- if (OS.IsWinCE) {
- if ((OS.IsPPC || OS.IsSP) && hwndCB != 0) {
- return OS.IsSP ? 2 : (int)/*64*/OS.SendMessage (hwndCB, OS.TB_BUTTONCOUNT, 0, 0);
- }
- int count = 0;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- while (OS.GetMenuItemInfo (handle, count, true, info)) count++;
- return count;
- }
- return OS.GetMenuItemCount (handle);
-}
-
@Override
String getNameText () {
String result = "";
@@ -1063,25 +827,6 @@ void hideCurrentToolTip () {
}
}
-int imageIndex (Image image) {
- if (hwndCB == 0 || image == null) return OS.I_IMAGENONE;
- if (imageList == null) {
- Rectangle bounds = image.getBoundsInPixels ();
- imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height);
- int index = imageList.add (image);
- long /*int*/ hImageList = imageList.getHandle ();
- OS.SendMessage (hwndCB, OS.TB_SETIMAGELIST, 0, hImageList);
- return index;
- }
- int index = imageList.indexOf (image);
- if (index == -1) {
- index = imageList.add (image);
- } else {
- imageList.put (index, image);
- }
- return index;
-}
-
/**
* Searches the receiver's list starting at the first item
* (index 0) until an item is found that is equal to the
@@ -1104,16 +849,6 @@ public int indexOf (MenuItem item) {
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
if (item.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
if (item.parent != this) return -1;
- if ((OS.IsPPC || OS.IsSP) && hwndCB != 0) {
- if (OS.IsPPC) {
- return (int)/*64*/OS.SendMessage (hwndCB, OS.TB_COMMANDTOINDEX, item.id, 0);
- }
- if (OS.IsSP) {
- if (item.id == id0) return 0;
- if (item.id == id1) return 1;
- return -1;
- }
- }
int index = 0;
MENUITEMINFO info = new MENUITEMINFO ();
info.cbSize = MENUITEMINFO.sizeof;
@@ -1180,7 +915,7 @@ void redraw () {
@Override
void releaseHandle () {
super.releaseHandle ();
- handle = hwndCB = 0;
+ handle = 0;
cascade = null;
}
@@ -1190,11 +925,7 @@ void releaseChildren (boolean destroy) {
for (int i=0; i<items.length; i++) {
MenuItem item = items [i];
if (item != null && !item.isDisposed ()) {
- if (OS.IsPPC && hwndCB != 0) {
- item.dispose ();
- } else {
- item.release (false);
- }
+ item.release (false);
}
}
super.releaseChildren (destroy);
@@ -1221,13 +952,6 @@ void releaseWidget () {
backgroundImage = null;
if (hBrush != 0) OS.DeleteObject (hBrush);
hBrush = 0;
- if (OS.IsPPC && hwndCB != 0) {
- if (imageList != null) {
- OS.SendMessage (hwndCB, OS.TB_SETIMAGELIST, 0, 0);
- display.releaseToolImageList (imageList);
- imageList = null;
- }
- }
if (parent != null) parent.removeMenu (this);
parent = null;
}
@@ -1401,7 +1125,6 @@ public void setDefaultItem (MenuItem item) {
if (item.parent != this) return;
newID = item.id;
}
- if (OS.IsWinCE) return;
int oldID = OS.GetMenuDefaultItem (handle, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
if (newID == oldID) return;
OS.SetMenuDefaultItem (handle, newID, OS.MF_BYCOMMAND);
@@ -1513,8 +1236,6 @@ public void setOrientation (int orientation) {
}
void _setOrientation (int orientation) {
- if (OS.IsWinCE) return;
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return;
int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
if ((orientation & flags) == 0 || (orientation & flags) == flags) return;
style &= ~flags;
@@ -1554,34 +1275,10 @@ public void setVisible (boolean visible) {
}
void update () {
- if (OS.IsPPC || OS.IsSP) return;
- if (OS.IsHPC) {
- /*
- * Each time a menu has been modified, the command menu bar
- * must be redrawn or it won't update properly. For example,
- * a submenu will not drop down.
- */
- Menu menuBar = parent.menuBar;
- if (menuBar != null) {
- Menu menu = this;
- while (menu != null && menu != menuBar) {
- menu = menu.getParentMenu ();
- }
- if (menu == menuBar) {
- OS.CommandBar_DrawMenuBar (menuBar.hwndCB, 0);
- OS.CommandBar_Show (menuBar.hwndCB, true);
- }
- }
- return;
- }
- if (OS.IsWinCE) return;
if ((style & SWT.BAR) != 0) {
if (this == parent.menuBar) OS.DrawMenuBar (parent.handle);
return;
}
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- return;
- }
boolean hasCheck = false, hasImage = false;
MenuItem [] items = getItems ();
for (int i=0; i<items.length; i++) {
@@ -1594,42 +1291,6 @@ void update () {
}
}
- /*
- * Bug in Windows. If a menu contains items that have
- * images and can be checked, Windows does not include
- * the width of the image and the width of the check when
- * computing the width of the menu. When the longest item
- * does not have an image, the label and the accelerator
- * text can overlap. The fix is to use SetMenuItemInfo()
- * to indicate that all items have a bitmap and then include
- * the width of the widest bitmap in WM_MEASURECHILD.
- *
- * NOTE: This work around causes problems on Windows 98.
- * Under certain circumstances that have yet to be isolated,
- * some menus can become huge and blank. For now, do not
- * run the code on Windows 98.
- *
- * NOTE: This work around doesn't run on Vista because
- * WM_MEASURECHILD and WM_DRAWITEM cause Vista to lose
- * the menu theme.
- */
- if (!OS.IsWin95) {
- if (OS.WIN32_VERSION < OS.VERSION (6, 0)) {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_BITMAP;
- for (int i=0; i<items.length; i++) {
- MenuItem item = items [i];
- if ((style & SWT.SEPARATOR) == 0) {
- if (item.image == null || foreground != -1) {
- info.hbmpItem = hasImage || foreground != -1 ? OS.HBMMENU_CALLBACK : 0;
- OS.SetMenuItemInfo (handle, item.id, false, info);
- }
- }
- }
- }
- }
-
/* Update the menu to hide or show the space for bitmaps */
MENUINFO lpcmi = new MENUINFO ();
lpcmi.cbSize = MENUINFO.sizeof;
@@ -1659,7 +1320,6 @@ void updateBackground () {
}
void updateForeground () {
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return;
MENUITEMINFO info = new MENUITEMINFO ();
info.cbSize = MENUITEMINFO.sizeof;
int index = 0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
index c14bd5cab9..1d1d6f84ca 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
@@ -41,16 +41,9 @@ public class MenuItem extends Item {
long /*int*/ hBitmap;
int id, accelerator, userId, index;
ToolTip itemToolTip;
- /*
- * Feature in Windows. On Windows 98, it is necessary
- * to add 4 pixels to the width of the image or the image
- * and text are too close. On other Windows platforms,
- * this causes the text of the longest item to touch the
- * accelerator text. The fix is to use smaller margins
- * everywhere but on Windows 98.
- */
- final static int MARGIN_WIDTH = OS.IsWin95 ? 2 : 1;
- final static int MARGIN_HEIGHT = OS.IsWin95 ? 2 : 1;
+ /* Image margin. */
+ final static int MARGIN_WIDTH = 1;
+ final static int MARGIN_HEIGHT = 1;
/**
* Constructs a new instance of this class given its parent
@@ -268,19 +261,14 @@ boolean fillAccel (ACCEL accel) {
case 27: key = OS.VK_ESCAPE; break;
case 127: key = OS.VK_DELETE; break;
default: {
- key = Display.wcsToMbcs ((char) key);
if (key == 0) return false;
- if (OS.IsWinCE) {
- key = (int)/*64*/OS.CharUpper ((short) key);
- } else {
- vKey = OS.VkKeyScan ((short) key);
- if (vKey == -1) {
- if (key != (int)/*64*/OS.CharUpper ((short) key)) {
- fVirt = 0;
- }
- } else {
- key = vKey & 0xFF;
+ vKey = OS.VkKeyScan ((short) key);
+ if (vKey == -1) {
+ if (key != (int)/*64*/OS.CharUpper ((short) key)) {
+ fVirt = 0;
}
+ } else {
+ key = vKey & 0xFF;
}
}
}
@@ -333,7 +321,6 @@ public int getAccelerator () {
*/
/*public*/ Rectangle getBounds () {
checkWidget ();
- if (OS.IsWinCE) return new Rectangle (0, 0, 0, 0);
int index = parent.indexOf (this);
if (index == -1) return new Rectangle (0, 0, 0, 0);
if ((parent.style & SWT.BAR) != 0) {
@@ -392,14 +379,6 @@ public int getAccelerator () {
*/
public boolean getEnabled () {
checkWidget ();
- if ((OS.IsPPC || OS.IsSP) && parent.hwndCB != 0) {
- long /*int*/ hwndCB = parent.hwndCB;
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_STATE;
- OS.SendMessage (hwndCB, OS.TB_GETBUTTONINFO, id, info);
- return (info.fsState & OS.TBSTATE_ENABLED) != 0;
- }
/*
* Feature in Windows. For some reason, when the menu item
* is a separator, GetMenuItemInfo() always indicates that
@@ -413,14 +392,7 @@ public boolean getEnabled () {
MENUITEMINFO info = new MENUITEMINFO ();
info.cbSize = MENUITEMINFO.sizeof;
info.fMask = OS.MIIM_STATE;
- boolean success;
- if (OS.IsWinCE) {
- int index = parent.indexOf (this);
- if (index == -1) error (SWT.ERROR_CANNOT_GET_ENABLED);
- success = OS.GetMenuItemInfo (hMenu, index, true, info);
- } else {
- success = OS.GetMenuItemInfo (hMenu, id, false, info);
- }
+ boolean success = OS.GetMenuItemInfo (hMenu, id, false, info);
if (!success) error (SWT.ERROR_CANNOT_GET_ENABLED);
return (info.fState & (OS.MFS_DISABLED | OS.MFS_GRAYED)) == 0;
}
@@ -500,7 +472,6 @@ public Menu getParent () {
public boolean getSelection () {
checkWidget ();
if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return false;
- if ((OS.IsPPC || OS.IsSP) && parent.hwndCB != 0) return false;
long /*int*/ hMenu = parent.handle;
MENUITEMINFO info = new MENUITEMINFO ();
info.cbSize = MENUITEMINFO.sizeof;
@@ -715,70 +686,50 @@ public void setAccelerator (int accelerator) {
*/
public void setEnabled (boolean enabled) {
checkWidget ();
- if ((OS.IsPPC || OS.IsSP) && parent.hwndCB != 0) {
- long /*int*/ hwndCB = parent.hwndCB;
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_STATE;
- OS.SendMessage (hwndCB, OS.TB_GETBUTTONINFO, id, info);
- info.fsState &= ~OS.TBSTATE_ENABLED;
- if (enabled) info.fsState |= OS.TBSTATE_ENABLED;
- OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, id, info);
+ /*
+ * Feature in Windows. For some reason, when the menu item
+ * is a separator, GetMenuItemInfo() always indicates that
+ * the item is not enabled. The fix is to track the enabled
+ * state for separators.
+ */
+ if ((style & SWT.SEPARATOR) != 0) {
+ if (enabled) {
+ state &= ~DISABLED;
+ } else {
+ state |= DISABLED;
+ }
+ }
+ long /*int*/ hMenu = parent.handle;
+ MENUITEMINFO info = new MENUITEMINFO ();
+ info.cbSize = MENUITEMINFO.sizeof;
+ info.fMask = OS.MIIM_STATE;
+ boolean success = OS.GetMenuItemInfo (hMenu, id, false, info);
+ if (!success) {
+ int error = OS.GetLastError();
+ SWT.error (SWT.ERROR_CANNOT_SET_ENABLED, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
+ }
+ int bits = OS.MFS_DISABLED | OS.MFS_GRAYED;
+ if (enabled) {
+ if ((info.fState & bits) == 0) return;
+ info.fState &= ~bits;
} else {
+ if ((info.fState & bits) == bits) return;
+ info.fState |= bits;
+ }
+ success = OS.SetMenuItemInfo (hMenu, id, false, info);
+ if (!success) {
/*
- * Feature in Windows. For some reason, when the menu item
- * is a separator, GetMenuItemInfo() always indicates that
- * the item is not enabled. The fix is to track the enabled
- * state for separators.
+ * Bug in Windows. For some reason SetMenuItemInfo(),
+ * returns a fail code when setting the enabled or
+ * selected state of a default item, but sets the
+ * state anyway. The fix is to ignore the error.
+ *
+ * NOTE: This only happens on Vista.
*/
- if ((style & SWT.SEPARATOR) != 0) {
- if (enabled) {
- state &= ~DISABLED;
- } else {
- state |= DISABLED;
- }
- }
- long /*int*/ hMenu = parent.handle;
- if (OS.IsWinCE) {
- int index = parent.indexOf (this);
- if (index == -1) return;
- int uEnable = OS.MF_BYPOSITION | (enabled ? OS.MF_ENABLED : OS.MF_GRAYED);
- OS.EnableMenuItem (hMenu, index, uEnable);
- } else {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_STATE;
- boolean success = OS.GetMenuItemInfo (hMenu, id, false, info);
- if (!success) {
- int error = OS.GetLastError();
- SWT.error (SWT.ERROR_CANNOT_SET_ENABLED, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
- }
- int bits = OS.MFS_DISABLED | OS.MFS_GRAYED;
- if (enabled) {
- if ((info.fState & bits) == 0) return;
- info.fState &= ~bits;
- } else {
- if ((info.fState & bits) == bits) return;
- info.fState |= bits;
- }
- success = OS.SetMenuItemInfo (hMenu, id, false, info);
- if (!success) {
- /*
- * Bug in Windows. For some reason SetMenuItemInfo(),
- * returns a fail code when setting the enabled or
- * selected state of a default item, but sets the
- * state anyway. The fix is to ignore the error.
- *
- * NOTE: This only happens on Vista.
- */
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- success = id == OS.GetMenuDefaultItem (hMenu, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
- }
- if (!success) {
- int error = OS.GetLastError();
- SWT.error (SWT.ERROR_CANNOT_SET_ENABLED, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
- }
- }
+ success = id == OS.GetMenuDefaultItem (hMenu, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
+ if (!success) {
+ int error = OS.GetLastError();
+ SWT.error (SWT.ERROR_CANNOT_SET_ENABLED, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
}
}
parent.destroyAccelerators ();
@@ -828,25 +779,13 @@ public void setImage (Image image) {
checkWidget ();
if ((style & SWT.SEPARATOR) != 0) return;
super.setImage (image);
- if (OS.IsWinCE) {
- if ((OS.IsPPC || OS.IsSP) && parent.hwndCB != 0) {
- long /*int*/ hwndCB = parent.hwndCB;
- TBBUTTONINFO info = new TBBUTTONINFO ();
- info.cbSize = TBBUTTONINFO.sizeof;
- info.dwMask = OS.TBIF_IMAGE;
- info.iImage = parent.imageIndex (image);
- OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, id, info);
- }
- return;
- }
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return;
MENUITEMINFO info = new MENUITEMINFO ();
info.cbSize = MENUITEMINFO.sizeof;
info.fMask = OS.MIIM_BITMAP;
if (parent.foreground != -1) {
info.hbmpItem = OS.HBMMENU_CALLBACK;
} else {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0) && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (hBitmap != 0) OS.DeleteObject (hBitmap);
info.hbmpItem = hBitmap = image != null ? Display.create32bitDIB (image) : 0;
} else {
@@ -910,98 +849,55 @@ void setMenu (Menu menu, boolean dispose) {
if (oldMenu != null) oldMenu.cascade = null;
this.menu = menu;
- /* Assign the new menu in the OS */
- if ((OS.IsPPC || OS.IsSP) && parent.hwndCB != 0) {
- if (OS.IsPPC) {
- long /*int*/ hwndCB = parent.hwndCB;
- long /*int*/ hMenu = menu == null ? 0 : menu.handle;
- OS.SendMessage (hwndCB, OS.SHCMBM_SETSUBMENU, id, hMenu);
- }
- if (OS.IsSP) error (SWT.ERROR_CANNOT_SET_MENU);
+ long /*int*/ hMenu = parent.handle;
+ MENUITEMINFO info = new MENUITEMINFO ();
+ info.cbSize = MENUITEMINFO.sizeof;
+ info.fMask = OS.MIIM_DATA;
+ int index = 0;
+ while (OS.GetMenuItemInfo (hMenu, index, true, info)) {
+ if (info.dwItemData == id) break;
+ index++;
+ }
+ if (info.dwItemData != id) return;
+ int cch = 128;
+ long /*int*/ hHeap = OS.GetProcessHeap ();
+ int byteCount = cch * 2;
+ long /*int*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+ info.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_DATA;
+ /*
+ * Bug in Windows. When GetMenuItemInfo() is used to get the text,
+ * for an item that has a bitmap set using MIIM_BITMAP, the text is
+ * not returned. This means that when SetMenuItemInfo() is used to
+ * set the submenu and the current menu state, the text is lost.
+ * The fix is use MIIM_BITMAP and MIIM_STRING.
+ */
+ info.fMask |= OS.MIIM_BITMAP | OS.MIIM_STRING;
+ info.dwTypeData = pszText;
+ info.cch = cch;
+ boolean success = OS.GetMenuItemInfo (hMenu, index, true, info);
+ if (menu != null) {
+ menu.cascade = this;
+ info.fMask |= OS.MIIM_SUBMENU;
+ info.hSubMenu = menu.handle;
+ }
+ if (dispose || oldMenu == null) {
+ success = OS.SetMenuItemInfo (hMenu, index, true, info);
} else {
- long /*int*/ hMenu = parent.handle;
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_DATA;
- int index = 0;
- while (OS.GetMenuItemInfo (hMenu, index, true, info)) {
- if (info.dwItemData == id) break;
- index++;
- }
- if (info.dwItemData != id) return;
- int cch = 128;
- long /*int*/ hHeap = OS.GetProcessHeap ();
- int byteCount = cch * TCHAR.sizeof;
- long /*int*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- info.fMask = OS.MIIM_STATE | OS.MIIM_ID | OS.MIIM_DATA;
/*
- * Bug in Windows. When GetMenuItemInfo() is used to get the text,
- * for an item that has a bitmap set using MIIM_BITMAP, the text is
- * not returned. This means that when SetMenuItemInfo() is used to
- * set the submenu and the current menu state, the text is lost.
- * The fix is use MIIM_BITMAP and MIIM_STRING.
+ * Feature in Windows. When SetMenuItemInfo () is used to
+ * set a submenu and the menu item already has a submenu,
+ * Windows destroys the previous menu. This is undocumented
+ * and unexpected but not necessarily wrong. The fix is to
+ * remove the item with RemoveMenu () which does not destroy
+ * the submenu and then insert the item with InsertMenuItem ().
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- info.fMask |= OS.MIIM_BITMAP | OS.MIIM_STRING;
- } else {
- info.fMask |= OS.MIIM_TYPE;
- }
- info.dwTypeData = pszText;
- info.cch = cch;
- boolean success = OS.GetMenuItemInfo (hMenu, index, true, info);
- if (menu != null) {
- menu.cascade = this;
- info.fMask |= OS.MIIM_SUBMENU;
- info.hSubMenu = menu.handle;
- }
- if (OS.IsWinCE) {
- OS.RemoveMenu (hMenu, index, OS.MF_BYPOSITION);
- /*
- * On WinCE, InsertMenuItem() is not available. The fix is to
- * use SetMenuItemInfo() but this call does not set the menu item
- * state and submenu. The fix is to use InsertMenu() to insert
- * the item, SetMenuItemInfo() to set the string and EnableMenuItem()
- * and CheckMenuItem() to set the state.
- */
- long /*int*/ uIDNewItem = id;
- int uFlags = OS.MF_BYPOSITION;
- if (menu != null) {
- uFlags |= OS.MF_POPUP;
- uIDNewItem = menu.handle;
- }
- TCHAR lpNewItem = new TCHAR (0, " ", true);
- success = OS.InsertMenu (hMenu, index, uFlags, uIDNewItem, lpNewItem);
- if (success) {
- info.fMask = OS.MIIM_DATA | OS.MIIM_TYPE;
- success = OS.SetMenuItemInfo (hMenu, index, true, info);
- if ((info.fState & (OS.MFS_DISABLED | OS.MFS_GRAYED)) != 0) {
- OS.EnableMenuItem (hMenu, index, OS.MF_BYPOSITION | OS.MF_GRAYED);
- }
- if ((info.fState & OS.MFS_CHECKED) != 0) {
- OS.CheckMenuItem (hMenu, index, OS.MF_BYPOSITION | OS.MF_CHECKED);
- }
- }
- } else {
- if (dispose || oldMenu == null) {
- success = OS.SetMenuItemInfo (hMenu, index, true, info);
- } else {
- /*
- * Feature in Windows. When SetMenuItemInfo () is used to
- * set a submenu and the menu item already has a submenu,
- * Windows destroys the previous menu. This is undocumented
- * and unexpected but not necessarily wrong. The fix is to
- * remove the item with RemoveMenu () which does not destroy
- * the submenu and then insert the item with InsertMenuItem ().
- */
- OS.RemoveMenu (hMenu, index, OS.MF_BYPOSITION);
- success = OS.InsertMenuItem (hMenu, index, true, info);
- }
- }
- if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- if (!success) {
- int error = OS.GetLastError();
- SWT.error (SWT.ERROR_CANNOT_SET_MENU, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
- }
+ OS.RemoveMenu (hMenu, index, OS.MF_BYPOSITION);
+ success = OS.InsertMenuItem (hMenu, index, true, info);
+ }
+ if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
+ if (!success) {
+ int error = OS.GetLastError();
+ SWT.error (SWT.ERROR_CANNOT_SET_MENU, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
}
parent.destroyAccelerators ();
}
@@ -1041,38 +937,28 @@ void setOrientation (int orientation) {
public void setSelection (boolean selected) {
checkWidget ();
if ((style & (SWT.CHECK | SWT.RADIO)) == 0) return;
- if ((OS.IsPPC || OS.IsSP) && parent.hwndCB != 0) return;
long /*int*/ hMenu = parent.handle;
- if (OS.IsWinCE) {
- int index = parent.indexOf (this);
- if (index == -1) return;
- int uCheck = OS.MF_BYPOSITION | (selected ? OS.MF_CHECKED : OS.MF_UNCHECKED);
- OS.CheckMenuItem (hMenu, index, uCheck);
- } else {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- info.fMask = OS.MIIM_STATE;
- boolean success = OS.GetMenuItemInfo (hMenu, id, false, info);
- if (!success) error (SWT.ERROR_CANNOT_SET_SELECTION);
- info.fState &= ~OS.MFS_CHECKED;
- if (selected) info.fState |= OS.MFS_CHECKED;
- success = OS.SetMenuItemInfo (hMenu, id, false, info);
+ MENUITEMINFO info = new MENUITEMINFO ();
+ info.cbSize = MENUITEMINFO.sizeof;
+ info.fMask = OS.MIIM_STATE;
+ boolean success = OS.GetMenuItemInfo (hMenu, id, false, info);
+ if (!success) error (SWT.ERROR_CANNOT_SET_SELECTION);
+ info.fState &= ~OS.MFS_CHECKED;
+ if (selected) info.fState |= OS.MFS_CHECKED;
+ success = OS.SetMenuItemInfo (hMenu, id, false, info);
+ if (!success) {
+ /*
+ * Bug in Windows. For some reason SetMenuItemInfo(),
+ * returns a fail code when setting the enabled or
+ * selected state of a default item, but sets the
+ * state anyway. The fix is to ignore the error.
+ *
+ * NOTE: This only happens on Vista.
+ */
+ success = id == OS.GetMenuDefaultItem (hMenu, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
if (!success) {
- /*
- * Bug in Windows. For some reason SetMenuItemInfo(),
- * returns a fail code when setting the enabled or
- * selected state of a default item, but sets the
- * state anyway. The fix is to ignore the error.
- *
- * NOTE: This only happens on Vista.
- */
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- success = id == OS.GetMenuDefaultItem (hMenu, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
- }
- if (!success) {
- int error = OS.GetLastError();
- SWT.error (SWT.ERROR_CANNOT_SET_SELECTION, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
- }
+ int error = OS.GetLastError();
+ SWT.error (SWT.ERROR_CANNOT_SET_SELECTION, null, " [GetLastError=0x" + Integer.toHexString(error) + "]");//$NON-NLS-1$ $NON-NLS-2$
}
}
parent.redraw ();
@@ -1123,59 +1009,23 @@ public void setText (String string) {
super.setText (string);
long /*int*/ hHeap = OS.GetProcessHeap ();
long /*int*/ pszText = 0;
- boolean success = false;
- if ((OS.IsPPC || OS.IsSP) && parent.hwndCB != 0) {
- /*
- * Bug in WinCE PPC. Tool items on the menubar don't resize
- * correctly when the character '&' is used (even when it
- * is a sequence '&&'). The fix is to remove all '&' from
- * the string.
- */
- if (string.indexOf ('&') != -1) {
- int length = string.length ();
- char[] text = new char [length];
- string.getChars( 0, length, text, 0);
- int i = 0, j = 0;
- for (i=0; i<length; i++) {
- if (text[i] != '&') text [j++] = text [i];
- }
- if (j < i) string = new String (text, 0, j);
- }
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- long /*int*/ hwndCB = parent.hwndCB;
- TBBUTTONINFO info2 = new TBBUTTONINFO ();
- info2.cbSize = TBBUTTONINFO.sizeof;
- info2.dwMask = OS.TBIF_TEXT;
- info2.pszText = pszText;
- success = OS.SendMessage (hwndCB, OS.TB_SETBUTTONINFO, id, info2) != 0;
- } else {
- MENUITEMINFO info = new MENUITEMINFO ();
- info.cbSize = MENUITEMINFO.sizeof;
- long /*int*/ hMenu = parent.handle;
+ MENUITEMINFO info = new MENUITEMINFO ();
+ info.cbSize = MENUITEMINFO.sizeof;
+ long /*int*/ hMenu = parent.handle;
- /* Use the character encoding for the default locale */
- TCHAR buffer = new TCHAR (0, string, true);
- int byteCount = buffer.length () * TCHAR.sizeof;
- pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
- OS.MoveMemory (pszText, buffer, byteCount);
- /*
- * Bug in Windows 2000. For some reason, when MIIM_TYPE is set
- * on a menu item that also has MIIM_BITMAP, the MIIM_TYPE clears
- * the MIIM_BITMAP style. The fix is to use MIIM_STRING.
- */
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- info.fMask = OS.MIIM_STRING;
- } else {
- info.fMask = OS.MIIM_TYPE;
- info.fType = widgetStyle ();
- }
- info.dwTypeData = pszText;
- success = OS.SetMenuItemInfo (hMenu, id, false, info);
- }
+ /* Use the character encoding for the default locale */
+ TCHAR buffer = new TCHAR (0, string, true);
+ int byteCount = buffer.length () * TCHAR.sizeof;
+ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+ OS.MoveMemory (pszText, buffer, byteCount);
+ /*
+ * Bug in Windows 2000. For some reason, when MIIM_TYPE is set
+ * on a menu item that also has MIIM_BITMAP, the MIIM_TYPE clears
+ * the MIIM_BITMAP style. The fix is to use MIIM_STRING.
+ */
+ info.fMask = OS.MIIM_STRING;
+ info.dwTypeData = pszText;
+ boolean success = OS.SetMenuItemInfo (hMenu, id, false, info);
if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
if (!success) {
int error = OS.GetLastError();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java
index 07a69b40f9..686383dc59 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MessageBox.java
@@ -150,17 +150,10 @@ public int open () {
if ((style & SWT.ICON_WARNING) != 0) iconBits = OS.MB_ICONWARNING;
if ((style & SWT.ICON_WORKING) != 0) iconBits = OS.MB_ICONINFORMATION;
- /* Only MB_APPLMODAL is supported on WinCE */
int modalBits = 0;
- if (OS.IsWinCE) {
- if ((style & (SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL)) != 0) {
- modalBits = OS.MB_APPLMODAL;
- }
- } else {
- if ((style & SWT.PRIMARY_MODAL) != 0) modalBits = OS.MB_APPLMODAL;
- if ((style & SWT.APPLICATION_MODAL) != 0) modalBits = OS.MB_TASKMODAL;
- if ((style & SWT.SYSTEM_MODAL) != 0) modalBits = OS.MB_SYSTEMMODAL;
- }
+ if ((style & SWT.PRIMARY_MODAL) != 0) modalBits = OS.MB_APPLMODAL;
+ if ((style & SWT.APPLICATION_MODAL) != 0) modalBits = OS.MB_TASKMODAL;
+ if ((style & SWT.SYSTEM_MODAL) != 0) modalBits = OS.MB_SYSTEMMODAL;
int bits = buttonBits | iconBits | modalBits;
if ((style & SWT.RIGHT_TO_LEFT) != 0) bits |= OS.MB_RTLREADING | OS.MB_RIGHT;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java
index e3f76f49a0..9504cae0e0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java
@@ -38,8 +38,6 @@ import org.eclipse.swt.graphics.*;
*/
public class ProgressBar extends Control {
static final int DELAY = 100;
- static final int TIMER_ID = 100;
- static final int MINIMUM_WIDTH = 100;
static final long /*int*/ ProgressBarProc;
static final TCHAR ProgressBarClass = new TCHAR (0, OS.PROGRESS_CLASS, true);
static {
@@ -141,7 +139,9 @@ static int checkStyle (int style) {
@Override
void createHandle () {
super.createHandle ();
- startTimer ();
+ if ((style & SWT.INDETERMINATE) != 0) {
+ OS.SendMessage (handle, OS.PBM_SETMARQUEE, 1, DELAY);
+ }
}
@Override
@@ -213,46 +213,16 @@ public int getSelection () {
*/
public int getState () {
checkWidget ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- int state = (int)/*64*/OS.SendMessage (handle, OS.PBM_GETSTATE, 0, 0);
- switch (state) {
- case OS.PBST_NORMAL: return SWT.NORMAL;
- case OS.PBST_ERROR: return SWT.ERROR;
- case OS.PBST_PAUSED: return SWT.PAUSED;
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.PBM_GETSTATE, 0, 0);
+ switch (state) {
+ case OS.PBST_NORMAL: return SWT.NORMAL;
+ case OS.PBST_ERROR: return SWT.ERROR;
+ case OS.PBST_PAUSED: return SWT.PAUSED;
}
return SWT.NORMAL;
}
@Override
-void releaseWidget () {
- super.releaseWidget ();
- stopTimer ();
-}
-
-void startTimer () {
- if ((style & SWT.INDETERMINATE) != 0) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if (OS.COMCTL32_MAJOR < 6 || (bits & OS.PBS_MARQUEE) == 0) {
- OS.SetTimer (handle, TIMER_ID, DELAY, 0);
- } else {
- OS.SendMessage (handle, OS.PBM_SETMARQUEE, 1, DELAY);
- }
- }
-}
-
-void stopTimer () {
- if ((style & SWT.INDETERMINATE) != 0) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if (OS.COMCTL32_MAJOR < 6 || (bits & OS.PBS_MARQUEE) == 0) {
- OS.KillTimer (handle, TIMER_ID);
- } else {
- OS.SendMessage (handle, OS.PBM_SETMARQUEE, 0, 0);
- }
- }
-}
-
-@Override
void setBackgroundPixel (int pixel) {
if (pixel == -1) pixel = OS.CLR_DEFAULT;
OS.SendMessage (handle, OS.PBM_SETBKCOLOR, 0, pixel);
@@ -328,11 +298,9 @@ public void setSelection (int value) {
* PBM_SETPOS. This is undocumented. The fix is to call PBM_SETPOS
* a second time.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- long /*int*/ state = OS.SendMessage (handle, OS.PBM_GETSTATE, 0, 0);
- if (state != OS.PBST_NORMAL) {
- OS.SendMessage (handle, OS.PBM_SETPOS, value, 0);
- }
+ long /*int*/ state = OS.SendMessage (handle, OS.PBM_GETSTATE, 0, 0);
+ if (state != OS.PBST_NORMAL) {
+ OS.SendMessage (handle, OS.PBM_SETPOS, value, 0);
}
}
@@ -359,18 +327,16 @@ public void setSelection (int value) {
*/
public void setState (int state) {
checkWidget ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- switch (state) {
- case SWT.NORMAL:
- OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_NORMAL, 0);
- break;
- case SWT.ERROR:
- OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_ERROR, 0);
- break;
- case SWT.PAUSED:
- OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_PAUSED, 0);
- break;
- }
+ switch (state) {
+ case SWT.NORMAL:
+ OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_NORMAL, 0);
+ break;
+ case SWT.ERROR:
+ OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_ERROR, 0);
+ break;
+ case SWT.PAUSED:
+ OS.SendMessage (handle, OS.PBM_SETSTATE, OS.PBST_PAUSED, 0);
+ break;
}
}
@@ -409,56 +375,4 @@ LRESULT WM_GETDLGCODE (long /*int*/ wParam, long /*int*/ lParam) {
return new LRESULT (OS.DLGC_STATIC);
}
-@Override
-LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.WM_SIZE (wParam, lParam);
- if (result != null) return result;
- /*
- * Feature in Windows. When a progress bar with the style
- * PBS_MARQUEE becomes too small, the animation (currently
- * a small bar moving from right to left) does not have
- * enough space to draw. The result is that the progress
- * bar does not appear to be moving. The fix is to detect
- * this case, clear the PBS_MARQUEE style and emulate the
- * animation using PBM_STEPIT.
- *
- * NOTE: This only happens on Window XP.
- */
- if ((style & SWT.INDETERMINATE) != 0) {
- if (OS.WIN32_VERSION == OS.VERSION (5,1) || (OS.COMCTL32_MAJOR >= 6 && !OS.IsAppThemed())) {
- forceResize ();
- RECT rect = new RECT ();
- OS.GetClientRect (handle, rect);
- int oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- int newBits = oldBits;
- if (rect.right - rect.left < MINIMUM_WIDTH) {
- newBits &= ~OS.PBS_MARQUEE;
- } else {
- newBits |= OS.PBS_MARQUEE;
- }
- if (newBits != oldBits) {
- stopTimer ();
- OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
- startTimer ();
- }
- }
- }
- return result;
-}
-
-@Override
-LRESULT WM_TIMER (long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.WM_TIMER (wParam, lParam);
- if (result != null) return result;
- if ((style & SWT.INDETERMINATE) != 0) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if (OS.COMCTL32_MAJOR < 6 || (bits & OS.PBS_MARQUEE) == 0) {
- if (wParam == TIMER_ID) {
- OS.SendMessage (handle, OS.PBM_STEPIT, 0, 0);
- }
- }
- }
- return result;
-}
-
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
index 659b2e0e01..5e2ee910bc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Sash.java
@@ -299,12 +299,8 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
lastY = bounds.y;
menuShell ().bringToTop ();
if (isDisposed ()) return LRESULT.ZERO;
- if (OS.IsWinCE) {
- OS.UpdateWindow (hwndTrack);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (hwndTrack, null, 0, flags);
- }
+ int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (hwndTrack, null, 0, flags);
drawBand (bounds.x, bounds.y, width, height);
if ((style & SWT.SMOOTH) != 0) {
setBoundsInPixels (bounds.x, bounds.y, width, height);
@@ -383,12 +379,8 @@ LRESULT WM_MOUSEMOVE (long /*int*/ wParam, long /*int*/ lParam) {
lastX = boundsInPixels.x;
lastY = boundsInPixels.y;
}
- if (OS.IsWinCE) {
- OS.UpdateWindow (hwndTrack);
- } else {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (hwndTrack, null, 0, flags);
- }
+ int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (hwndTrack, null, 0, flags);
drawBand (lastX, lastY, width, height);
if ((style & SWT.SMOOTH) != 0) {
setBoundsInPixels (lastX, lastY, width, height);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java
index e2e716a2d0..3ed4e60b9b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java
@@ -535,7 +535,7 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
*/
boolean fixPaint = findBackgroundControl () != null;
if (!fixPaint) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
Control control = findThemeControl ();
fixPaint = control != null;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java
index df731bd999..ce90866a9f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ScrollBar.java
@@ -185,17 +185,7 @@ void createWidget () {
void destroyWidget () {
long /*int*/ hwnd = hwndScrollBar ();
int type = scrollBarType ();
- if (OS.IsWinCE) {
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_RANGE | OS.SIF_PAGE;
- info.nPage = 101;
- info.nMax = 100;
- info.nMin = 0;
- OS.SetScrollInfo (hwnd, type, info, true);
- } else {
- OS.ShowScrollBar (hwnd, type, false);
- }
+ OS.ShowScrollBar (hwnd, type, false);
parent.destroyScrollBar (style);
releaseHandle ();
//This code is intentionally commented
@@ -533,14 +523,11 @@ Rectangle getThumbTrackBoundsInPixels () {
*/
public boolean getVisible () {
checkWidget();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- SCROLLBARINFO psbi = new SCROLLBARINFO ();
- psbi.cbSize = SCROLLBARINFO.sizeof;
- int idObject = (style & SWT.VERTICAL) != 0 ? OS.OBJID_VSCROLL : OS.OBJID_HSCROLL;
- OS.GetScrollBarInfo (hwndScrollBar (), idObject, psbi);
- return (psbi.rgstate [0] & OS.STATE_SYSTEM_INVISIBLE) == 0;
- }
- return (state & HIDDEN) == 0;
+ SCROLLBARINFO psbi = new SCROLLBARINFO ();
+ psbi.cbSize = SCROLLBARINFO.sizeof;
+ int idObject = (style & SWT.VERTICAL) != 0 ? OS.OBJID_VSCROLL : OS.OBJID_HSCROLL;
+ OS.GetScrollBarInfo (hwndScrollBar (), idObject, psbi);
+ return (psbi.rgstate [0] & OS.STATE_SYSTEM_INVISIBLE) == 0;
}
long /*int*/ hwndScrollBar () {
@@ -643,21 +630,14 @@ int scrollBarType () {
*/
public void setEnabled (boolean enabled) {
checkWidget();
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- long /*int*/ hwnd = hwndScrollBar ();
- int type = scrollBarType ();
- int flags = enabled ? OS.ESB_ENABLE_BOTH : OS.ESB_DISABLE_BOTH;
- OS.EnableScrollBar (hwnd, type, flags);
- if (enabled) {
- state &= ~DISABLED;
- } else {
- state |= DISABLED;
- }
+ long /*int*/ hwnd = hwndScrollBar ();
+ int type = scrollBarType ();
+ int flags = enabled ? OS.ESB_ENABLE_BOTH : OS.ESB_DISABLE_BOTH;
+ OS.EnableScrollBar (hwnd, type, flags);
+ if (enabled) {
+ state &= ~DISABLED;
+ } else {
+ state |= DISABLED;
}
}
@@ -765,23 +745,16 @@ boolean SetScrollInfo (long /*int*/ hwnd, int flags, SCROLLINFO info, boolean fR
boolean barVisible = false;
boolean visible = getVisible ();
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
ScrollBar bar = null;
- if (!OS.IsWinCE) {
- switch (flags) {
- case OS.SB_HORZ:
- bar = parent.getVerticalBar ();
- break;
- case OS.SB_VERT:
- bar = parent.getHorizontalBar ();
- break;
- }
- barVisible = bar != null && bar.getVisible ();
+ switch (flags) {
+ case OS.SB_HORZ:
+ bar = parent.getVerticalBar ();
+ break;
+ case OS.SB_VERT:
+ bar = parent.getHorizontalBar ();
+ break;
}
+ barVisible = bar != null && bar.getVisible ();
if (!visible || (state & DISABLED) != 0) fRedraw = false;
boolean result = OS.SetScrollInfo (hwnd, flags, info, fRedraw);
@@ -795,14 +768,7 @@ boolean SetScrollInfo (long /*int*/ hwnd, int flags, SCROLLINFO info, boolean fR
* to hide the scroll bar (again) when already hidden.
*/
if (!visible) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.ShowScrollBar (hwnd, !barVisible ? OS.SB_BOTH : flags, false);
- }
+ OS.ShowScrollBar (hwnd, !barVisible ? OS.SB_BOTH : flags, false);
}
/*
@@ -816,10 +782,8 @@ boolean SetScrollInfo (long /*int*/ hwnd, int flags, SCROLLINFO info, boolean fR
*
* NOTE: This problem only happens on Vista
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (visible && bar != null && !barVisible) {
- OS.ShowScrollBar (hwnd, flags == OS.SB_HORZ ? OS.SB_VERT : OS.SB_HORZ, false);
- }
+ if (visible && bar != null && !barVisible) {
+ OS.ShowScrollBar (hwnd, flags == OS.SB_HORZ ? OS.SB_VERT : OS.SB_HORZ, false);
}
/*
@@ -831,14 +795,7 @@ boolean SetScrollInfo (long /*int*/ hwnd, int flags, SCROLLINFO info, boolean fR
* the application has disabled the scroll bar.
*/
if ((state & DISABLED) != 0) {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- if (!OS.IsWinCE) {
- OS.EnableScrollBar (hwnd, flags, OS.ESB_DISABLE_BOTH);
- }
+ OS.EnableScrollBar (hwnd, flags, OS.ESB_DISABLE_BOTH);
}
return result;
}
@@ -959,43 +916,6 @@ public void setValues (int selection, int minimum, int maximum, int thumb, int i
public void setVisible (boolean visible) {
checkWidget();
if (visible == getVisible ()) return;
-
- /*
- * On Windows CE, use SIF_DISABLENOSCROLL to show and
- * hide the scroll bar when the page size is equal to
- * the range.
- */
- if (OS.IsWinCE) {
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- long /*int*/ hwnd = hwndScrollBar ();
- int type = scrollBarType ();
- info.fMask = OS.SIF_RANGE | OS.SIF_PAGE;
- if (visible) info.fMask |= OS.SIF_DISABLENOSCROLL;
- OS.GetScrollInfo (hwnd, type, info);
- if (info.nPage == info.nMax - info.nMin + 1) {
- /*
- * Bug in Windows. When the only changed flag to
- * SetScrollInfo () is OS.SIF_DISABLENOSCROLL,
- * Windows does not update the scroll bar state.
- * The fix is to increase and then decrease the
- * maximum, causing Windows to honour the flag.
- */
- int max = info.nMax;
- info.nMax++;
- OS.SetScrollInfo (hwnd, type, info, false);
- info.nMax = max;
- OS.SetScrollInfo (hwnd, type, info, true);
- } else {
- /*
- * This line is intentionally commented. Currently
- * always show scrollbar as being enabled and visible.
- */
-// if (OS.IsWinCE) error (SWT.ERROR_NOT_IMPLEMENTED);
- }
- return;
- }
-
/*
* Set the state bits before calling ShowScrollBar ()
* because hiding and showing the scroll bar can cause
@@ -1014,7 +934,7 @@ public void setVisible (boolean visible) {
* bar and hide both.
*/
if (!visible) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
SCROLLBARINFO psbi = new SCROLLBARINFO ();
psbi.cbSize = SCROLLBARINFO.sizeof;
int idObject = (style & SWT.VERTICAL) != 0 ? OS.OBJID_HSCROLL : OS.OBJID_VSCROLL;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
index 239711b876..8dc1b3ba05 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scrollable.java
@@ -342,15 +342,7 @@ long /*int*/ windowProc () {
LRESULT WM_HSCROLL (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_HSCROLL (wParam, lParam);
if (result != null) return result;
-
- /*
- * Bug on WinCE. lParam should be NULL when the message is not sent
- * by a scroll bar control, but it contains the handle to the window.
- * When the message is sent by a scroll bar control, it correctly
- * contains the handle to the scroll bar. The fix is to check for
- * both.
- */
- if (horizontalBar != null && (lParam == 0 || lParam == handle)) {
+ if (horizontalBar != null && lParam == 0) {
return wmScroll (horizontalBar, (state & CANVAS) != 0, handle, OS.WM_HSCROLL, wParam, lParam);
}
return result;
@@ -374,84 +366,13 @@ LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT WM_VSCROLL (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_VSCROLL (wParam, lParam);
if (result != null) return result;
- /*
- * Bug on WinCE. lParam should be NULL when the message is not sent
- * by a scroll bar control, but it contains the handle to the window.
- * When the message is sent by a scroll bar control, it correctly
- * contains the handle to the scroll bar. The fix is to check for
- * both.
- */
- if (verticalBar != null && (lParam == 0 || lParam == handle)) {
+ if (verticalBar != null && lParam == 0) {
return wmScroll (verticalBar, (state & CANVAS) != 0, handle, OS.WM_VSCROLL, wParam, lParam);
}
return result;
}
-@Override
-LRESULT wmNCPaint (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.wmNCPaint (hwnd, wParam, lParam);
- if (result != null) return result;
- /*
- * Bug in Windows. On XP only (not Vista), Windows sometimes
- * does not redraw the bottom right corner of a window that
- * has scroll bars, causing pixel corruption. The fix is to
- * always draw the corner.
- */
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 0)) {
- int bits1 = OS.GetWindowLong (hwnd, OS.GWL_STYLE);
- if ((bits1 & (OS.WS_HSCROLL | OS.WS_VSCROLL)) != 0) {
- RECT windowRect = new RECT ();
- OS.GetWindowRect (hwnd, windowRect);
- RECT trimRect = new RECT ();
- int bits2 = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
- OS.AdjustWindowRectEx (trimRect, bits1, false, bits2);
- boolean hVisible = false, vVisible = false;
- SCROLLBARINFO psbi = new SCROLLBARINFO ();
- psbi.cbSize = SCROLLBARINFO.sizeof;
- if (OS.GetScrollBarInfo (hwnd, OS.OBJID_HSCROLL, psbi)) {
- hVisible = (psbi.rgstate [0] & OS.STATE_SYSTEM_INVISIBLE) == 0;
- }
- if (OS.GetScrollBarInfo (hwnd, OS.OBJID_VSCROLL, psbi)) {
- vVisible = (psbi.rgstate [0] & OS.STATE_SYSTEM_INVISIBLE) == 0;
- }
- RECT cornerRect = new RECT ();
- cornerRect.bottom = windowRect.bottom - windowRect.top - trimRect.bottom;
- cornerRect.top = cornerRect.bottom - (vVisible ? OS.GetSystemMetrics (OS.SM_CYHSCROLL) : 0);
- if ((bits2 & OS.WS_EX_LEFTSCROLLBAR) != 0) {
- cornerRect.left = trimRect.left;
- cornerRect.right = cornerRect.left + (hVisible ? OS.GetSystemMetrics (OS.SM_CXVSCROLL) : 0);
- } else {
- cornerRect.right = windowRect.right - windowRect.left - trimRect.right;
- cornerRect.left = cornerRect.right - (hVisible ? OS.GetSystemMetrics (OS.SM_CXVSCROLL) : 0);
- }
- if (cornerRect.left != cornerRect.right && cornerRect.top != cornerRect.bottom) {
- long /*int*/ hDC = OS.GetWindowDC (hwnd);
- OS.FillRect (hDC, cornerRect, OS.COLOR_BTNFACE + 1);
- Decorations shell = menuShell ();
- if ((shell.style & SWT.RESIZE) != 0) {
- long /*int*/ hwndScroll = shell.scrolledHandle ();
- boolean drawGripper = hwnd == hwndScroll;
- if (!drawGripper) {
- RECT shellRect = new RECT ();
- OS.GetClientRect (hwndScroll, shellRect);
- OS.MapWindowPoints (hwndScroll, 0, shellRect, 2);
- drawGripper = shellRect.right == windowRect.right && shellRect.bottom == windowRect.bottom;
- }
- if (drawGripper) {
- OS.DrawThemeBackground (display.hScrollBarTheme(), hDC, OS.SBP_SIZEBOX, 0, cornerRect, null);
- }
- }
- OS.ReleaseDC (hwnd, hDC);
- }
- }
- }
- }
- return result;
-}
-
LRESULT wmScrollWheel (boolean update, long /*int*/ wParam, long /*int*/ lParam) {
- int scrollRemainder = display.scrollRemainder;
LRESULT result = super.WM_MOUSEWHEEL (wParam, lParam);
if (result != null) return result;
/*
@@ -467,32 +388,16 @@ LRESULT wmScrollWheel (boolean update, long /*int*/ wParam, long /*int*/ lParam)
OS.SystemParametersInfo (OS.SPI_GETWHEELSCROLLLINES, 0, linesToScroll, 0);
int delta = OS.GET_WHEEL_DELTA_WPARAM (wParam);
boolean pageScroll = linesToScroll [0] == OS.WHEEL_PAGESCROLL;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- ScrollBar bar = vertical ? verticalBar : horizontalBar;
- SCROLLINFO info = new SCROLLINFO ();
- info.cbSize = SCROLLINFO.sizeof;
- info.fMask = OS.SIF_POS;
- OS.GetScrollInfo (handle, bar.scrollBarType (), info);
- if (vertical && !pageScroll) delta *= linesToScroll [0];
- int increment = pageScroll ? bar.getPageIncrement () : bar.getIncrement ();
- info.nPos -= increment * delta / OS.WHEEL_DELTA;
- OS.SetScrollInfo (handle, bar.scrollBarType (), info, true);
- OS.SendMessage (handle, msg, OS.SB_THUMBPOSITION, 0);
- } else {
- int code = 0;
- if (pageScroll) {
- code = delta < 0 ? OS.SB_PAGEDOWN : OS.SB_PAGEUP;
- } else {
- code = delta < 0 ? OS.SB_LINEDOWN : OS.SB_LINEUP;
- if (msg == OS.WM_VSCROLL) delta *= linesToScroll [0];
- }
- /* Check if the delta and the remainder have the same direction (sign) */
- if ((delta ^ scrollRemainder) >= 0) delta += scrollRemainder;
- int count = Math.abs (delta) / OS.WHEEL_DELTA;
- for (int i=0; i<count; i++) {
- OS.SendMessage (handle, msg, code, 0);
- }
- }
+ ScrollBar bar = vertical ? verticalBar : horizontalBar;
+ SCROLLINFO info = new SCROLLINFO ();
+ info.cbSize = SCROLLINFO.sizeof;
+ info.fMask = OS.SIF_POS;
+ OS.GetScrollInfo (handle, bar.scrollBarType (), info);
+ if (vertical && !pageScroll) delta *= linesToScroll [0];
+ int increment = pageScroll ? bar.getPageIncrement () : bar.getIncrement ();
+ info.nPos -= increment * delta / OS.WHEEL_DELTA;
+ OS.SetScrollInfo (handle, bar.scrollBarType (), info, true);
+ OS.SendMessage (handle, msg, OS.SB_THUMBPOSITION, 0);
return LRESULT.ZERO;
}
@@ -543,12 +448,6 @@ LRESULT wmScroll (ScrollBar bar, boolean update, long /*int*/ hwnd, int msg, lon
case OS.SB_ENDSCROLL: return null;
case OS.SB_THUMBPOSITION:
case OS.SB_THUMBTRACK:
- /*
- * Note: On WinCE, the value in SB_THUMBPOSITION is relative to nMin.
- * Same for SB_THUMBPOSITION 'except' for the very first thumb track
- * message which has the actual value of nMin. This is a problem when
- * nMin is not zero.
- */
info.nPos = info.nTrackPos;
break;
case OS.SB_TOP:
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 14607cb821..c5da1593d1 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
@@ -128,10 +128,9 @@ public class Shell extends Decorations {
long /*int*/ toolIcon, balloonIcon;
long /*int*/ windowProc;
Control lastActive;
- SHACTIVATEINFO psai;
static /*final*/ long /*int*/ ToolTipProc;
static final long /*int*/ DialogProc;
- static final TCHAR DialogClass = new TCHAR (0, OS.IsWinCE ? "Dialog" : "#32770", true);
+ static final TCHAR DialogClass = new TCHAR (0, "#32770", true);
final static int [] SYSTEM_COLORS = {
OS.COLOR_BTNFACE,
OS.COLOR_WINDOW,
@@ -223,7 +222,7 @@ public Shell (int style) {
* </ul>
*/
public Shell (Display display) {
- this (display, OS.IsWinCE ? SWT.NONE : SWT.SHELL_TRIM);
+ this (display, SWT.SHELL_TRIM);
}
/**
@@ -323,7 +322,7 @@ Shell (Display display, Shell parent, int style, long /*int*/ handle, boolean em
* </ul>
*/
public Shell (Shell parent) {
- this (parent, OS.IsWinCE ? SWT.NONE : SWT.DIALOG_TRIM);
+ this (parent, SWT.DIALOG_TRIM);
}
/**
@@ -607,7 +606,7 @@ void createHandle () {
if (!embedded) {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
bits &= ~(OS.WS_OVERLAPPED | OS.WS_CAPTION);
- if (!OS.IsWinCE) bits |= OS.WS_POPUP;
+ bits |= OS.WS_POPUP;
if ((style & SWT.TITLE) != 0) bits |= OS.WS_CAPTION;
if ((style & SWT.NO_TRIM) == 0) {
if ((style & (SWT.BORDER | SWT.RESIZE)) == 0) bits |= OS.WS_BORDER;
@@ -621,12 +620,7 @@ void createHandle () {
*/
OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
int flags = OS.SWP_DRAWFRAME | OS.SWP_NOMOVE | OS.SWP_NOSIZE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE;
- SetWindowPos (handle, 0, 0, 0, 0, 0, flags);
- if (OS.IsWinCE) _setMaximized (true);
- if (OS.IsPPC) {
- psai = new SHACTIVATEINFO ();
- psai.cbSize = SHACTIVATEINFO.sizeof;
- }
+ OS.SetWindowPos (handle, 0, 0, 0, 0, 0, flags);
}
if (OS.IsDBLocale) {
hIMC = OS.ImmCreateContext ();
@@ -649,7 +643,6 @@ void createToolTip (ToolTip toolTip) {
}
toolTips [id] = toolTip;
toolTip.id = id + Display.ID_START;
- if (OS.IsWinCE) return;
TOOLINFO lpti = new TOOLINFO ();
lpti.cbSize = TOOLINFO.sizeof;
lpti.hwnd = handle;
@@ -702,7 +695,6 @@ void deregister () {
void destroyToolTip (ToolTip toolTip) {
if (toolTips == null) return;
toolTips [toolTip.id - Display.ID_START] = null;
- if (OS.IsWinCE) return;
if (balloonTipHandle != 0) {
TOOLINFO lpti = new TOOLINFO ();
lpti.cbSize = TOOLINFO.sizeof;
@@ -857,23 +849,21 @@ void fixToolTip () {
* current tooltip and add it again every time
* the mouse leaves the control.
*/
- if (OS.COMCTL32_MAJOR >= 6) {
- if (toolTipHandle == 0) return;
- TOOLINFO lpti = new TOOLINFO ();
- lpti.cbSize = TOOLINFO.sizeof;
- if (OS.SendMessage (toolTipHandle, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) {
- if ((lpti.uFlags & OS.TTF_IDISHWND) != 0) {
- OS.SendMessage (toolTipHandle, OS.TTM_DELTOOL, 0, lpti);
- OS.SendMessage (toolTipHandle, OS.TTM_ADDTOOL, 0, lpti);
- }
+ if (toolTipHandle == 0) return;
+ TOOLINFO lpti = new TOOLINFO ();
+ lpti.cbSize = TOOLINFO.sizeof;
+ if (OS.SendMessage (toolTipHandle, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) {
+ if ((lpti.uFlags & OS.TTF_IDISHWND) != 0) {
+ OS.SendMessage (toolTipHandle, OS.TTM_DELTOOL, 0, lpti);
+ OS.SendMessage (toolTipHandle, OS.TTM_ADDTOOL, 0, lpti);
}
- TOOLINFO lptiMt = new TOOLINFO ();
- lptiMt.cbSize = TOOLINFO.sizeof;
- if (OS.SendMessage (menuItemToolTipHandle, OS.TTM_GETCURRENTTOOL, 0, lptiMt) != 0) {
- if ((lptiMt.uFlags & OS.TTF_IDISHWND) != 0) {
- OS.SendMessage (menuItemToolTipHandle, OS.TTM_DELTOOL, 0, lptiMt);
- OS.SendMessage (menuItemToolTipHandle, OS.TTM_ADDTOOL, 0, lptiMt);
- }
+ }
+ TOOLINFO lptiMt = new TOOLINFO ();
+ lptiMt.cbSize = TOOLINFO.sizeof;
+ if (OS.SendMessage (menuItemToolTipHandle, OS.TTM_GETCURRENTTOOL, 0, lptiMt) != 0) {
+ if ((lptiMt.uFlags & OS.TTF_IDISHWND) != 0) {
+ OS.SendMessage (menuItemToolTipHandle, OS.TTM_DELTOOL, 0, lptiMt);
+ OS.SendMessage (menuItemToolTipHandle, OS.TTM_ADDTOOL, 0, lptiMt);
}
}
}
@@ -925,19 +915,15 @@ void forceResize () {
*/
public int getAlpha () {
checkWidget ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- byte [] pbAlpha = new byte [1];
- if (OS.GetLayeredWindowAttributes (handle, null, pbAlpha, null)) {
- return pbAlpha [0] & 0xFF;
- }
+ byte [] pbAlpha = new byte [1];
+ if (OS.GetLayeredWindowAttributes (handle, null, pbAlpha, null)) {
+ return pbAlpha [0] & 0xFF;
}
return 0xFF;
}
@Override Rectangle getBoundsInPixels () {
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) return super.getBoundsInPixels ();
- }
+ if (OS.IsIconic (handle)) return super.getBoundsInPixels ();
RECT rect = new RECT ();
OS.GetWindowRect (handle, rect);
int width = rect.right - rect.left;
@@ -1033,11 +1019,7 @@ public int getImeInputMode () {
}
@Override Point getLocationInPixels () {
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) {
- return super.getLocationInPixels ();
- }
- }
+ if (OS.IsIconic (handle)) return super.getLocationInPixels ();
RECT rect = new RECT ();
OS.GetWindowRect (handle, rect);
return new Point (rect.left, rect.top);
@@ -1135,9 +1117,7 @@ public Shell getShell () {
}
@Override Point getSizeInPixels () {
- if (!OS.IsWinCE) {
- if (OS.IsIconic (handle)) return super.getSizeInPixels ();
- }
+ if (OS.IsIconic (handle)) return super.getSizeInPixels ();
RECT rect = new RECT ();
OS.GetWindowRect (handle, rect);
int width = rect.right - rect.left;
@@ -1270,14 +1250,6 @@ public void open () {
bringToTop ();
if (isDisposed ()) return;
}
- /*
- * Feature on WinCE PPC. A new application becomes
- * the foreground application only if it has at least
- * one visible window before the event loop is started.
- * The workaround is to explicitly force the shell to
- * be the foreground window.
- */
- if (OS.IsWinCE) OS.SetForegroundWindow (handle);
OS.SendMessage (handle, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0);
setVisible (true);
if (isDisposed ()) return;
@@ -1563,17 +1535,15 @@ void setActiveControl (Control control, int type) {
*/
public void setAlpha (int alpha) {
checkWidget ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- alpha &= 0xFF;
- int bits = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
- if (alpha == 0xFF) {
- OS.SetWindowLong (handle, OS.GWL_EXSTYLE, bits & ~OS.WS_EX_LAYERED);
- int flags = OS.RDW_ERASE | OS.RDW_INVALIDATE | OS.RDW_FRAME | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- } else {
- OS.SetWindowLong (handle, OS.GWL_EXSTYLE, bits | OS.WS_EX_LAYERED);
- OS.SetLayeredWindowAttributes (handle, 0, (byte)alpha, OS.LWA_ALPHA);
- }
+ alpha &= 0xFF;
+ int bits = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
+ if (alpha == 0xFF) {
+ OS.SetWindowLong (handle, OS.GWL_EXSTYLE, bits & ~OS.WS_EX_LAYERED);
+ int flags = OS.RDW_ERASE | OS.RDW_INVALIDATE | OS.RDW_FRAME | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
+ } else {
+ OS.SetWindowLong (handle, OS.GWL_EXSTYLE, bits | OS.WS_EX_LAYERED);
+ OS.SetLayeredWindowAttributes (handle, 0, (byte)alpha, OS.LWA_ALPHA);
}
}
@@ -1854,7 +1824,6 @@ public void setRegion (Region region) {
}
void setToolTipText (long /*int*/ hwnd, String text) {
- if (OS.IsWinCE) return;
TOOLINFO lpti = new TOOLINFO ();
lpti.cbSize = TOOLINFO.sizeof;
lpti.hwnd = handle;
@@ -2000,7 +1969,7 @@ public void setVisible (boolean visible) {
* to hide children before hiding the parent.
*/
if (showWithParent && !visible) {
- if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, false);
+ OS.ShowOwnedPopups (handle, false);
}
if (!visible) fixActiveShell ();
if (visible && center && !moved) {
@@ -2012,7 +1981,7 @@ public void setVisible (boolean visible) {
if (showWithParent != visible) {
showWithParent = visible;
if (visible) {
- if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, true);
+ OS.ShowOwnedPopups (handle, true);
}
}
@@ -2118,42 +2087,21 @@ int widgetExtStyle () {
* even when it has no title. The fix is to use WS_EX_TOOLWINDOW
* which does not cause the window to appear in the Task Bar.
*/
- if (!OS.IsWinCE) {
- if (parent == null) {
- if ((style & SWT.ON_TOP) != 0) {
- int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX;
- if ((style & SWT.NO_TRIM) != 0 || (style & trim) == 0) {
- bits |= OS.WS_EX_TOOLWINDOW;
- }
+ if (parent == null) {
+ if ((style & SWT.ON_TOP) != 0) {
+ int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX;
+ if ((style & SWT.NO_TRIM) != 0 || (style & trim) == 0) {
+ bits |= OS.WS_EX_TOOLWINDOW;
}
}
}
- /*
- * Bug in Windows 98 and NT. Creating a window with the
- * WS_EX_TOPMOST extended style can result in a dialog shell
- * being moved behind its parent. The exact case where this
- * happens is a shell with two dialog shell children where
- * each dialog child has another hidden dialog child with
- * the WS_EX_TOPMOST extended style. Clicking on either of
- * the visible dialogs causes them to become active but move
- * to the back, behind the parent shell. The fix is to
- * disallow the WS_EX_TOPMOST extended style on Windows 98
- * and NT.
- */
- if (parent != null) {
- if (OS.IsWin95) return bits;
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- return bits;
- }
- }
if ((style & SWT.ON_TOP) != 0) bits |= OS.WS_EX_TOPMOST;
return bits;
}
@Override
TCHAR windowClass () {
- if (OS.IsSP) return DialogClass;
if ((style & SWT.TOOL) != 0) {
int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX | SWT.BORDER | SWT.RESIZE;
if ((style & trim) == 0) return display.windowShadowClass;
@@ -2164,7 +2112,6 @@ TCHAR windowClass () {
@Override
long /*int*/ windowProc () {
if (windowProc != 0) return windowProc;
- if (OS.IsSP) return DialogProc;
if ((style & SWT.TOOL) != 0) {
int trim = SWT.TITLE | SWT.CLOSE | SWT.MIN | SWT.MAX | SWT.BORDER | SWT.RESIZE;
if ((style & trim) == 0) return super.windowProc ();
@@ -2205,24 +2152,6 @@ int widgetStyle () {
int bits = super.widgetStyle ();
if (handle != 0) return bits | OS.WS_CHILD;
bits &= ~OS.WS_CHILD;
- /*
- * Feature in WinCE. Calling CreateWindowEx () with WS_OVERLAPPED
- * and a parent window causes the new window to become a WS_CHILD of
- * the parent instead of a dialog child. The fix is to use WS_POPUP
- * for a window with a parent.
- *
- * Feature in WinCE PPC. A window without a parent with WS_POPUP
- * always shows on top of the Pocket PC 'Today Screen'. The fix
- * is to not set WS_POPUP for a window without a parent on WinCE
- * devices.
- *
- * NOTE: WS_POPUP causes CreateWindowEx () to ignore CW_USEDEFAULT
- * and causes the default window location and size to be zero.
- */
- if (OS.IsWinCE) {
- if (OS.IsSP) return bits | OS.WS_POPUP;
- return parent == null ? bits : bits | OS.WS_POPUP;
- }
/*
* Use WS_OVERLAPPED for all windows, either dialog or top level
@@ -2242,35 +2171,15 @@ int widgetStyle () {
@Override
LRESULT WM_ACTIVATE (long /*int*/ wParam, long /*int*/ lParam) {
- if (OS.IsPPC) {
- /*
- * Note: this does not work when we get WM_ACTIVATE prior
- * to adding a listener.
- */
- if (hooks (SWT.HardKeyDown) || hooks (SWT.HardKeyUp)) {
- int fActive = OS.LOWORD (wParam);
- long /*int*/ hwnd = fActive != 0 ? handle : 0;
- for (int bVk=OS.VK_APP1; bVk<=OS.VK_APP6; bVk++) {
- OS.SHSetAppKeyWndAssoc ((byte) bVk, hwnd);
- }
- }
- /* Restore SIP state when window is activated */
- if (OS.LOWORD (wParam) != 0) {
- OS.SHSipPreference (handle, psai.fSipUp == 0 ? OS.SIP_DOWN : OS.SIP_UP);
- }
- }
-
/*
* Bug in Windows XP. When a Shell is deactivated, the
* IME composition window does not go away. This causes
* repaint issues. The fix is to commit the composition
* string.
*/
- if (OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
- if (OS.LOWORD (wParam) == 0 && OS.IsDBLocale && hIMC != 0) {
- if (OS.ImmGetOpenStatus (hIMC)) {
- OS.ImmNotifyIME (hIMC, OS.NI_COMPOSITIONSTR, OS.CPS_COMPLETE, 0);
- }
+ if (OS.LOWORD (wParam) == 0 && OS.IsDBLocale && hIMC != 0) {
+ if (OS.ImmGetOpenStatus (hIMC)) {
+ OS.ImmNotifyIME (hIMC, OS.NI_COMPOSITIONSTR, OS.CPS_COMPLETE, 0);
}
}
@@ -2287,46 +2196,6 @@ LRESULT WM_ACTIVATE (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT WM_COMMAND (long /*int*/ wParam, long /*int*/ lParam) {
- if (OS.IsPPC) {
- /*
- * Note in WinCE PPC: Close the Shell when the "Done Button" has
- * been pressed. lParam is either 0 (PocketPC 2002) or the handle
- * to the Shell (PocketPC).
- */
- int loWord = OS.LOWORD (wParam);
- if (loWord == OS.IDOK && (lParam == 0 || lParam == handle)) {
- OS.PostMessage (handle, OS.WM_CLOSE, 0, 0);
- return LRESULT.ZERO;
- }
- }
- /*
- * Feature in Windows. On PPC, the menu is not actually an HMENU.
- * By observation, it is a tool bar that is configured to look like
- * a menu. Therefore, when the PPC menu sends WM_COMMAND messages,
- * lParam is not zero because the WM_COMMAND was not sent from a menu.
- * Sub menu item events originate from the menu bar. Top menu items
- * events originate from a tool bar. The fix is to detect the source
- * of the WM_COMMAND and set lParam to zero to pretend that the message
- * came from a real Windows menu, not a tool bar.
- */
- if (OS.IsPPC || OS.IsSP) {
- if (menuBar != null) {
- long /*int*/ hwndCB = menuBar.hwndCB;
- if (lParam != 0 && hwndCB != 0) {
- if (lParam == hwndCB) {
- return super.WM_COMMAND (wParam, 0);
- } else {
- long /*int*/ hwndChild = OS.GetWindow (hwndCB, OS.GW_CHILD);
- if (lParam == hwndChild) return super.WM_COMMAND (wParam, 0);
- }
- }
- }
- }
- return super.WM_COMMAND (wParam, lParam);
-}
-
-@Override
LRESULT WM_DESTROY (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_DESTROY (wParam, lParam);
/*
@@ -2355,7 +2224,7 @@ LRESULT WM_ERASEBKGND (long /*int*/ wParam, long /*int*/ lParam) {
*
* NOTE: This only happens on Vista.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION == OS.VERSION (6, 0)) {
+ if (OS.WIN32_VERSION == OS.VERSION (6, 0)) {
drawBackground (wParam);
return LRESULT.ONE;
}
@@ -2367,9 +2236,7 @@ LRESULT WM_ENTERIDLE (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_ENTERIDLE (wParam, lParam);
if (result != null) return result;
Display display = this.display;
- if (display.runMessages) {
- if (display.runAsyncMessages (false)) display.wakeThread ();
- }
+ if (display.runAsyncMessages (false)) display.wakeThread ();
return result;
}
@@ -2416,9 +2283,6 @@ LRESULT WM_MOUSEACTIVATE (long /*int*/ wParam, long /*int*/ lParam) {
display.lastHittestControl = control;
return null;
}
- if (OS.IsWin95 && hittest == OS.HTCAPTION) {
- display.lastHittestControl = control;
- }
return new LRESULT (OS.MA_NOACTIVATE);
}
}
@@ -2508,13 +2372,9 @@ LRESULT WM_NCLBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
*/
if (!display.ignoreRestoreFocus) return result;
Display display = this.display;
- long /*int*/ hwndActive = 0;
- boolean fixActive = OS.IsWin95 && display.lastHittest == OS.HTCAPTION;
- if (fixActive) hwndActive = OS.SetActiveWindow (handle);
display.lockActiveWindow = true;
long /*int*/ code = callWindowProc (handle, OS.WM_NCLBUTTONDOWN, wParam, lParam);
display.lockActiveWindow = false;
- if (fixActive) OS.SetActiveWindow (hwndActive);
Control focusControl = display.lastHittestControl;
if (focusControl != null && !focusControl.isDisposed ()) {
focusControl.setFocus ();
@@ -2562,13 +2422,11 @@ LRESULT WM_SETCURSOR (long /*int*/ wParam, long /*int*/ lParam) {
}
}
if (!OS.IsWindowEnabled (handle)) {
- if (!OS.IsWinCE) {
- long /*int*/ hwndPopup = OS.GetLastActivePopup (handle);
- if (hwndPopup != 0 && hwndPopup != handle) {
- if (display.getControl (hwndPopup) == null) {
- if (OS.IsWindowEnabled (hwndPopup)) {
- OS.SetActiveWindow (hwndPopup);
- }
+ long /*int*/ hwndPopup = OS.GetLastActivePopup (handle);
+ if (hwndPopup != 0 && hwndPopup != handle) {
+ if (display.getControl (hwndPopup) == null) {
+ if (OS.IsWindowEnabled (hwndPopup)) {
+ OS.SetActiveWindow (hwndPopup);
}
}
}
@@ -2614,32 +2472,6 @@ LRESULT WM_SETCURSOR (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT WM_SETTINGCHANGE (long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.WM_SETTINGCHANGE (wParam, lParam);
- if (result != null) return result;
- if (OS.IsPPC) {
- if (wParam == OS.SPI_SETSIPINFO) {
- /*
- * The SIP is in a new state. Cache its new value.
- * Resize the Shell if it has the style SWT.RESIZE.
- * Note that SHHandleWMSettingChange resizes the
- * Shell and also updates the cached state.
- */
- if ((style & SWT.RESIZE) != 0) {
- OS.SHHandleWMSettingChange (handle, wParam, lParam, psai);
- return LRESULT.ZERO;
- } else {
- SIPINFO pSipInfo = new SIPINFO ();
- pSipInfo.cbSize = SIPINFO.sizeof;
- OS.SipGetInfo (pSipInfo);
- psai.fSipUp = pSipInfo.fdwFlags & OS.SIPF_ON;
- }
- }
- }
- return result;
-}
-
-@Override
LRESULT WM_SHOWWINDOW (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_SHOWWINDOW (wParam, lParam);
if (result != null) return result;
@@ -2663,56 +2495,6 @@ LRESULT WM_SHOWWINDOW (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT WM_SYSCOMMAND (long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
- if (result != null) return result;
- /*
- * Feature in Windows. When the last visible window in
- * a process is minimized, Windows swaps out the memory for
- * the process. The assumption is that the user can no
- * longer interact with the window, so the memory can be
- * released to other applications. However, for programs
- * that use a lot of memory, swapping the memory back in
- * can take a long time, sometimes minutes. The fix is
- * to intercept WM_SYSCOMMAND looking for SC_MINIMIZE
- * and use ShowWindow() with SW_SHOWMINIMIZED to minimize
- * the window, rather than running the default window proc.
- *
- * NOTE: The default window proc activates the next
- * top-level window in the Z-order while ShowWindow()
- * with SW_SHOWMINIMIZED does not. There is no fix for
- * this at this time.
- *
- * NOTE: Second guessing the effectiveness of the
- * operating system's memory manager and breaking UI
- * convention if the JVM has reserved over 32MB
- * of memory is not necessary on more recent Windows
- * versions like Windows Vista.
- */
- if (OS.IsWinNT && OS.WIN32_VERSION < OS.VERSION (6, 0)) {
- int cmd = (int)/*64*/wParam & 0xFFF0;
- switch (cmd) {
- case OS.SC_MINIMIZE:
- Shell [] shells = display.getShells ();
- int count = 0;
- for (int i = 0; i < shells.length; i++) {
- Shell shell = shells [i];
- if (shell != null && shell.getVisible () && !shell.getMinimized ()) {
- count++;
- }
- }
- if (count > 1) break;
- long memory = Runtime.getRuntime ().totalMemory ();
- if (memory >= 32 * 1024 * 1024) {
- OS.ShowWindow (handle, OS.SW_SHOWMINIMIZED);
- return LRESULT.ZERO;
- }
- }
- }
- return result;
-}
-
-@Override
LRESULT WM_WINDOWPOSCHANGING (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_WINDOWPOSCHANGING (wParam,lParam);
if (result != null) return result;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java
index 324fd8826b..436fccfdbe 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Slider.java
@@ -223,10 +223,8 @@ int defaultForeground () {
@Override
void enableWidget (boolean enabled) {
super.enableWidget (enabled);
- if (!OS.IsWinCE) {
- int flags = enabled ? OS.ESB_ENABLE_BOTH : OS.ESB_DISABLE_BOTH;
- OS.EnableScrollBar (handle, OS.SB_CTL, flags);
- }
+ int flags = enabled ? OS.ESB_ENABLE_BOTH : OS.ESB_DISABLE_BOTH;
+ OS.EnableScrollBar (handle, OS.SB_CTL, flags);
if (enabled) {
state &= ~DISABLED;
} else {
@@ -493,9 +491,7 @@ boolean SetScrollInfo (long /*int*/ hwnd, int flags, SCROLLINFO info, boolean fR
boolean result = OS.SetScrollInfo (hwnd, flags, info, fRedraw);
if ((state & DISABLED) != 0) {
OS.EnableWindow (handle, false);
- if (!OS.IsWinCE) {
- OS.EnableScrollBar (handle, OS.SB_CTL, OS.ESB_DISABLE_BOTH);
- }
+ OS.EnableScrollBar (handle, OS.SB_CTL, OS.ESB_DISABLE_BOTH);
}
/*
@@ -692,11 +688,9 @@ LRESULT WM_LBUTTONDBLCLK (long /*int*/ wParam, long /*int*/ lParam) {
* is consumed. The fix is to send a fake mouse up and
* release the automatic capture.
*/
- if (!OS.IsWinCE) {
- if (OS.GetCapture () == handle) OS.ReleaseCapture ();
- if (!sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam)) {
- return LRESULT.ZERO;
- }
+ if (OS.GetCapture () == handle) OS.ReleaseCapture ();
+ if (!sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam)) {
+ return LRESULT.ZERO;
}
return result;
}
@@ -726,11 +720,9 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
* is consumed. The fix is to send a fake mouse up and
* release the automatic capture.
*/
- if (!OS.IsWinCE) {
- if (OS.GetCapture () == handle) OS.ReleaseCapture ();
- if (!sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam)) {
- return LRESULT.ONE;
- }
+ if (OS.GetCapture () == handle) OS.ReleaseCapture ();
+ if (!sendMouseEvent (SWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam)) {
+ return LRESULT.ONE;
}
return result;
}
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 963fb7e51e..8dac39919a 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
@@ -71,7 +71,7 @@ public class Spinner extends Composite {
* to stop the compiler from inlining.
*/
static {
- LIMIT = OS.IsWinNT ? 0x7FFFFFFF : 0x7FFF;
+ LIMIT = 0x7FFFFFFF;
}
/**
@@ -148,9 +148,7 @@ void createHandle () {
int textExStyle = (style & SWT.BORDER) != 0 ? OS.WS_EX_CLIENTEDGE : 0;
int textStyle = OS.WS_CHILD | OS.WS_VISIBLE | OS.ES_AUTOHSCROLL | OS.WS_CLIPSIBLINGS;
if ((style & SWT.READ_ONLY) != 0) textStyle |= OS.ES_READONLY;
- if (OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- if ((style & SWT.RIGHT_TO_LEFT) != 0) textExStyle |= OS.WS_EX_LAYOUTRTL;
- }
+ if ((style & SWT.RIGHT_TO_LEFT) != 0) textExStyle |= OS.WS_EX_LAYOUTRTL;
hwndText = OS.CreateWindowEx (
textExStyle,
EditClass,
@@ -184,7 +182,7 @@ void createHandle () {
null);
if (hwndUpDown == 0) error (SWT.ERROR_NO_HANDLES);
int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- SetWindowPos (hwndText, hwndUpDown, 0, 0, 0, 0, flags);
+ OS.SetWindowPos (hwndText, hwndUpDown, 0, 0, 0, 0, flags);
OS.SetWindowLongPtr (hwndUpDown, OS.GWLP_ID, hwndUpDown);
if (OS.IsDBLocale) {
long /*int*/ hIMC = OS.ImmGetContext (handle);
@@ -193,7 +191,7 @@ void createHandle () {
OS.ImmReleaseContext (handle, hIMC);
}
OS.SendMessage (hwndUpDown, OS.UDM_SETRANGE32, 0, 100);
- OS.SendMessage (hwndUpDown, OS.IsWinCE ? OS.UDM_SETPOS : OS.UDM_SETPOS32, 0, 0);
+ OS.SendMessage (hwndUpDown, OS.UDM_SETPOS32, 0, 0);
pageIncrement = 10;
digits = 0;
TCHAR buffer = new TCHAR (getCodePage (), "0", true);
@@ -329,9 +327,7 @@ long /*int*/ borderHandle () {
Rectangle trim = computeTrimInPixels (0, 0, width, height);
if (hHint == SWT.DEFAULT) {
int upDownHeight = OS.GetSystemMetrics (OS.SM_CYVSCROLL) + 2 * getBorderWidthInPixels ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- upDownHeight += (style & SWT.BORDER) != 0 ? 1 : 3;
- }
+ upDownHeight += (style & SWT.BORDER) != 0 ? 1 : 3;
trim.height = Math.max (trim.height, upDownHeight);
}
return new Point (trim.width, trim.height);
@@ -531,11 +527,7 @@ public int getPageIncrement () {
*/
public int getSelection () {
checkWidget ();
- if (OS.IsWinCE) {
- return OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0));
- } else {
- return (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
- }
+ return (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
}
int getSelectionText (boolean [] parseFail) {
@@ -626,17 +618,6 @@ public int getTextLimit () {
return (int)/*64*/OS.SendMessage (hwndText, OS.EM_GETLIMITTEXT, 0, 0) & 0x7FFFFFFF;
}
-int mbcsToWcsPos (int mbcsPos) {
- if (mbcsPos <= 0) return 0;
- if (OS.IsUnicode) return mbcsPos;
- int mbcsSize = OS.GetWindowTextLengthA (hwndText);
- if (mbcsSize == 0) return 0;
- if (mbcsPos >= mbcsSize) return mbcsSize;
- byte [] buffer = new byte [mbcsSize + 1];
- OS.GetWindowTextA (hwndText, buffer, mbcsSize + 1);
- return OS.MultiByteToWideChar (getCodePage (), OS.MB_PRECOMPOSED, buffer, mbcsPos, null, 0);
-}
-
/**
* Pastes text from clipboard.
* <p>
@@ -786,12 +767,6 @@ boolean sendKeyEvent (int type, int msg, long /*int*/ wParam, long /*int*/ lPara
if (start [0] == end [0]) {
if (start [0] == 0) return true;
start [0] = start [0] - 1;
- if (!OS.IsUnicode && OS.IsDBLocale) {
- int [] newStart = new int [1], newEnd = new int [1];
- OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (hwndText, OS.EM_GETSEL, newStart, newEnd);
- if (start [0] != newStart [0]) start [0] = start [0] - 1;
- }
start [0] = Math.max (start [0], 0);
}
break;
@@ -800,12 +775,6 @@ boolean sendKeyEvent (int type, int msg, long /*int*/ wParam, long /*int*/ lPara
int length = OS.GetWindowTextLength (hwndText);
if (start [0] == length) return true;
end [0] = end [0] + 1;
- if (!OS.IsUnicode && OS.IsDBLocale) {
- int [] newStart = new int [1], newEnd = new int [1];
- OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (hwndText, OS.EM_GETSEL, newStart, newEnd);
- if (end [0] != newEnd [0]) end [0] = end [0] + 1;
- }
end [0] = Math.min (end [0], length);
}
break;
@@ -862,12 +831,7 @@ public void setDigits (int value) {
if (value < 0) error (SWT.ERROR_INVALID_ARGUMENT);
if (value == this.digits) return;
this.digits = value;
- int pos;
- if (OS.IsWinCE) {
- pos = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0));
- } else {
- pos = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
- }
+ int pos = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
setSelection (pos, false, true, false);
}
@@ -927,12 +891,7 @@ public void setMaximum (int value) {
int [] min = new int [1];
OS.SendMessage (hwndUpDown , OS.UDM_GETRANGE32, min, null);
if (value < min [0]) return;
- int pos;
- if (OS.IsWinCE) {
- pos = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0));
- } else {
- pos = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
- }
+ int pos = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
OS.SendMessage (hwndUpDown , OS.UDM_SETRANGE32, min [0], value);
if (pos > value) setSelection (value, true, true, false);
}
@@ -955,12 +914,7 @@ public void setMinimum (int value) {
int [] max = new int [1];
OS.SendMessage (hwndUpDown , OS.UDM_GETRANGE32, null, max);
if (value > max [0]) return;
- int pos;
- if (OS.IsWinCE) {
- pos = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0));
- } else {
- pos = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
- }
+ int pos = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
OS.SendMessage (hwndUpDown , OS.UDM_SETRANGE32, value, max [0]);
if (pos < value) setSelection (value, true, true, false);
}
@@ -1006,7 +960,7 @@ public void setSelection (int value) {
void setSelection (int value, boolean setPos, boolean setText, boolean notify) {
if (setPos) {
- OS.SendMessage (hwndUpDown , OS.IsWinCE ? OS.UDM_SETPOS : OS.UDM_SETPOS32, 0, value);
+ OS.SendMessage (hwndUpDown, OS.UDM_SETPOS32, 0, value);
}
if (setText) {
String string;
@@ -1038,9 +992,7 @@ void setSelection (int value, boolean setPos, boolean setText, boolean notify) {
TCHAR buffer = new TCHAR (getCodePage (), string, true);
OS.SetWindowText (hwndText, buffer);
OS.SendMessage (hwndText, OS.EM_SETSEL, 0, -1);
- if (!OS.IsWinCE) {
- OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, hwndText, OS.OBJID_CLIENT, 0);
- }
+ OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, hwndText, OS.OBJID_CLIENT, 0);
}
if (notify) sendSelectionEvent (SWT.Selection);
}
@@ -1182,10 +1134,6 @@ String verifyText (String string, int start, int end, Event keyEvent) {
index++;
}
event.doit = index == string.length ();
- if (!OS.IsUnicode && OS.IsDBLocale) {
- event.start = mbcsToWcsPos (start);
- event.end = mbcsToWcsPos (end);
- }
sendEvent (SWT.Verify, event);
if (!event.doit || isDisposed ()) return null;
return event.text;
@@ -1293,8 +1241,8 @@ LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
int textWidth = width - upDownWidth;
int border = OS.GetSystemMetrics (OS.SM_CXEDGE);
int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
- SetWindowPos (hwndText, 0, 0, 0, textWidth + border, height, flags);
- SetWindowPos (hwndUpDown, 0, textWidth, 0, upDownWidth, height, flags);
+ OS.SetWindowPos (hwndText, 0, 0, 0, textWidth + border, height, flags);
+ OS.SetWindowPos (hwndUpDown, 0, textWidth, 0, upDownWidth, height, flags);
return result;
}
@@ -1430,12 +1378,7 @@ LRESULT wmCommandChild (long /*int*/ wParam, long /*int*/ lParam) {
boolean [] parseFail = new boolean [1];
int value = getSelectionText (parseFail);
if (!parseFail [0]) {
- int pos;
- if (OS.IsWinCE) {
- pos = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0));
- } else {
- pos = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
- }
+ int pos = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
if (pos != value) setSelection (value, true, false, true);
}
sendEvent (SWT.Modify);
@@ -1465,11 +1408,7 @@ LRESULT wmKeyDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam)
boolean [] parseFail = new boolean [1];
int value = getSelectionText (parseFail);
if (parseFail [0]) {
- if (OS.IsWinCE) {
- value = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0));
- } else {
- value = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
- }
+ value = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
}
int newValue = value + delta;
int [] max = new int [1], min = new int [1];
@@ -1496,11 +1435,7 @@ LRESULT wmKillFocus (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam
boolean [] parseFail = new boolean [1];
int value = getSelectionText (parseFail);
if (parseFail [0]) {
- if (OS.IsWinCE) {
- value = OS.LOWORD (OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0));
- } else {
- value = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
- }
+ value = (int)/*64*/OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
setSelection (value, false, true, false);
}
return super.wmKillFocus (hwnd, wParam, lParam);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
index f595e5bffa..8eafcba578 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
@@ -169,13 +169,6 @@ long /*int*/ callWindowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, lo
}
static int checkStyle (int style) {
- /*
- * When the SWT.TOP style has not been set, force the
- * tabs to be on the bottom for tab folders on PPC.
- */
- if (OS.IsPPC) {
- if ((style & SWT.TOP) == 0) style |= SWT.BOTTOM;
- }
style = checkBits (style, SWT.TOP, SWT.BOTTOM, 0, 0, 0, 0);
/*
@@ -260,11 +253,6 @@ void createHandle () {
super.createHandle ();
state &= ~(CANVAS | THEME_BACKGROUND);
- /* Enable the flat look for tab folders on PPC */
- if (OS.IsPPC) {
- OS.SendMessage (handle, OS.CCM_SETVERSION, 0x020c /*COMCTL32_VERSION*/, 0);
- }
-
/*
* Feature in Windows. Despite the fact that the
* tool tip text contains \r\n, the tooltip will
@@ -964,15 +952,13 @@ LRESULT WM_MOUSELEAVE (long /*int*/ wParam, long /*int*/ lParam) {
* current tooltip and add it again every time
* the mouse leaves the control.
*/
- if (OS.COMCTL32_MAJOR >= 6) {
- TOOLINFO lpti = new TOOLINFO ();
- lpti.cbSize = TOOLINFO.sizeof;
- long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
- if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) {
- if ((lpti.uFlags & OS.TTF_IDISHWND) == 0) {
- OS.SendMessage (hwndToolTip, OS.TTM_DELTOOL, 0, lpti);
- OS.SendMessage (hwndToolTip, OS.TTM_ADDTOOL, 0, lpti);
- }
+ TOOLINFO lpti = new TOOLINFO ();
+ lpti.cbSize = TOOLINFO.sizeof;
+ long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.TCM_GETTOOLTIPS, 0, 0);
+ if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) {
+ if ((lpti.uFlags & OS.TTF_IDISHWND) == 0) {
+ OS.SendMessage (hwndToolTip, OS.TTM_DELTOOL, 0, lpti);
+ OS.SendMessage (hwndToolTip, OS.TTM_ADDTOOL, 0, lpti);
}
}
return result;
@@ -1034,10 +1020,7 @@ LRESULT WM_PARENTNOTIFY (long /*int*/ wParam, long /*int*/ lParam) {
* and WS_EX_NOINHERITLAYOUT are specified for the tab folder, the buddy control
* will not be oriented correctly. The fix is to explicitly set the orientation
* for the buddy control.
- *
- * NOTE: WS_EX_LAYOUTRTL is not supported on Windows NT.
*/
- if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return result;
if ((style & SWT.RIGHT_TO_LEFT) != 0) {
int code = OS.LOWORD (wParam);
switch (code) {
@@ -1088,7 +1071,7 @@ LRESULT WM_WINDOWPOSCHANGING (long /*int*/ wParam, long /*int*/ lParam) {
return result;
}
// TEMPORARY CODE
-// if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+// if (OS.IsAppThemed ()) {
// OS.InvalidateRect (handle, null, true);
// return result;
// }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java
index 6fb9518c4f..f81028648e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabItem.java
@@ -120,7 +120,7 @@ void _setText (int index, String string) {
* The image overlaps the label. The fix is to remove
* all '&' characters from the string.
*/
- if (OS.COMCTL32_MAJOR >= 6 && image != null) {
+ if (image != null) {
if (string.indexOf ('&') != -1) {
int length = string.length ();
char[] text = new char [length];
@@ -310,9 +310,7 @@ public void setImage (Image image) {
* all '&' characters from the string and set the text
* whenever the image or text is changed.
*/
- if (OS.COMCTL32_MAJOR >= 6) {
- if (text.indexOf ('&') != -1) _setText (index, text);
- }
+ if (text.indexOf ('&') != -1) _setText (index, text);
long /*int*/ hwnd = parent.handle;
TCITEM tcItem = new TCITEM ();
tcItem.mask = OS.TCIF_IMAGE;
@@ -366,7 +364,7 @@ public void setText (String string) {
@Override
boolean updateTextDirection(int textDirection) {
/* AUTO is handled by super */
- if (super.updateTextDirection(textDirection) && OS.IsUnicode) {
+ if (super.updateTextDirection(textDirection)) {
int index = parent.indexOf (this);
if (index != -1) {
if ((textDirection & SWT.RIGHT_TO_LEFT) != 0) {
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 0f2218899b..f5c30bc2ed 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
@@ -99,7 +99,6 @@ public class Table extends Composite {
static final int H_SCROLL_LIMIT = 32;
static final int V_SCROLL_LIMIT = 16;
static final int DRAG_IMAGE_SIZE = 301;
- static final boolean EXPLORER_THEME = true;
static boolean COMPRESS_ITEMS = true;
static final long /*int*/ TableProc;
static final TCHAR TableClass = new TCHAR (0, OS.WC_LISTVIEW, true);
@@ -159,8 +158,6 @@ void _addListener (int eventType, Listener listener) {
case SWT.PaintItem:
setCustomDraw (true);
setBackgroundTransparent (true);
- if (OS.COMCTL32_MAJOR < 6) style |= SWT.DOUBLE_BUFFERED;
- if (OS.IsWinCE) OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, OS.LVS_EX_LABELTIP, 0);
break;
}
}
@@ -805,20 +802,12 @@ LRESULT CDDS_POSTPAINT (NMLVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*/ l
* the tooltip before setting the bits and then reset it.
*/
long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.LVM_SETTOOLTIPS, 0, 0);
- if (OS.IsWinCE) {
- RECT rect = new RECT ();
- boolean damaged = OS.GetUpdateRect (handle, rect, true);
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits);
- OS.ValidateRect (handle, null);
- if (damaged) OS.InvalidateRect (handle, rect, true);
- } else {
- long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
- int result = OS.GetUpdateRgn (handle, rgn, true);
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits);
- OS.ValidateRect (handle, null);
- if (result != OS.NULLREGION) OS.InvalidateRgn (handle, rgn, true);
- OS.DeleteObject (rgn);
- }
+ long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
+ int result = OS.GetUpdateRgn (handle, rgn, true);
+ OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits);
+ OS.ValidateRect (handle, null);
+ if (result != OS.NULLREGION) OS.InvalidateRgn (handle, rgn, true);
+ OS.DeleteObject (rgn);
/*
* Bug in Windows. Despite the documentation, LVM_SETTOOLTIPS
* uses WPARAM instead of LPARAM for the new tooltip The fix
@@ -857,20 +846,12 @@ LRESULT CDDS_PREPAINT (NMLVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*/ lP
* the tooltip before setting the bits and then reset it.
*/
long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.LVM_SETTOOLTIPS, 0, 0);
- if (OS.IsWinCE) {
- RECT rect = new RECT ();
- boolean damaged = OS.GetUpdateRect (handle, rect, true);
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0);
- OS.ValidateRect (handle, null);
- if (damaged) OS.InvalidateRect (handle, rect, true);
- } else {
- long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
- int result = OS.GetUpdateRgn (handle, rgn, true);
- OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0);
- OS.ValidateRect (handle, null);
- if (result != OS.NULLREGION) OS.InvalidateRgn (handle, rgn, true);
- OS.DeleteObject (rgn);
- }
+ long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
+ int result = OS.GetUpdateRgn (handle, rgn, true);
+ OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0);
+ OS.ValidateRect (handle, null);
+ if (result != OS.NULLREGION) OS.InvalidateRgn (handle, rgn, true);
+ OS.DeleteObject (rgn);
/*
* Bug in Windows. Despite the documentation, LVM_SETTOOLTIPS
* uses WPARAM instead of LPARAM for the new tooltip The fix
@@ -906,7 +887,7 @@ LRESULT CDDS_PREPAINT (NMLVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*/ lP
if (OS.IsWindowEnabled (handle) || hasCustomBackground()) {
if (control == null) control = this;
fillBackground (nmcd.hdc, control.getBackgroundPixel (), rect);
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (sortColumn != null && sortDirection != SWT.NONE) {
int index = indexOf (sortColumn);
if (index != -1) {
@@ -945,6 +926,9 @@ LRESULT CDDS_SUBITEMPOSTPAINT (NMLVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*
* color draws on top of the background color for an item. The fix
* is to clear the sort column in CDDS_SUBITEMPREPAINT, and reset it
* in CDDS_SUBITEMPOSTPAINT.
+ *
+ * Update region is saved and restored around LVM_SETSELECTEDCOLUMN
+ * to prevent infinite WM_PAINT on Vista.
*/
if ((int)/*64*/OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) != OS.CLR_NONE) {
if ((sortDirection & (SWT.UP | SWT.DOWN)) != 0) {
@@ -952,18 +936,12 @@ LRESULT CDDS_SUBITEMPOSTPAINT (NMLVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*
int oldColumn = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETSELECTEDCOLUMN, 0, 0);
if (oldColumn == -1) {
int newColumn = indexOf (sortColumn);
- int result = 0;
- long /*int*/ rgn = 0;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- rgn = OS.CreateRectRgn (0, 0, 0, 0);
- result = OS.GetUpdateRgn (handle, rgn, true);
- }
+ long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
+ int result = OS.GetUpdateRgn (handle, rgn, true);
OS.SendMessage (handle, OS.LVM_SETSELECTEDCOLUMN, newColumn, 0);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.ValidateRect (handle, null);
- if (result != OS.NULLREGION) OS.InvalidateRgn (handle, rgn, true);
- OS.DeleteObject (rgn);
- }
+ OS.ValidateRect (handle, null);
+ if (result != OS.NULLREGION) OS.InvalidateRgn (handle, rgn, true);
+ OS.DeleteObject (rgn);
}
}
}
@@ -1122,22 +1100,19 @@ LRESULT CDDS_SUBITEMPREPAINT (NMLVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*i
* color draws on top of the background color for an item. The fix
* is to clear the sort column in CDDS_SUBITEMPREPAINT, and reset it
* in CDDS_SUBITEMPOSTPAINT.
+ *
+ * Update region is saved and restored around LVM_SETSELECTEDCOLUMN
+ * to prevent infinite WM_PAINT on Vista.
*/
if (clrTextBk != -1 || hasCustomBackground()) {
int oldColumn = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETSELECTEDCOLUMN, 0, 0);
if (oldColumn != -1 && oldColumn == nmcd.iSubItem) {
- int result = 0;
- long /*int*/ rgn = 0;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- rgn = OS.CreateRectRgn (0, 0, 0, 0);
- result = OS.GetUpdateRgn (handle, rgn, true);
- }
+ long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
+ int result = OS.GetUpdateRgn (handle, rgn, true);
OS.SendMessage (handle, OS.LVM_SETSELECTEDCOLUMN, -1, 0);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.ValidateRect (handle, null);
- if (result != OS.NULLREGION) OS.InvalidateRgn (handle, rgn, true);
- OS.DeleteObject (rgn);
- }
+ OS.ValidateRect (handle, null);
+ if (result != OS.NULLREGION) OS.InvalidateRgn (handle, rgn, true);
+ OS.DeleteObject (rgn);
code |= OS.CDRF_NOTIFYPOSTPAINT;
}
}
@@ -1164,8 +1139,7 @@ LRESULT CDDS_SUBITEMPREPAINT (NMLVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*i
@Override
void checkBuffered () {
super.checkBuffered ();
- if (OS.COMCTL32_MAJOR >= 6) style |= SWT.DOUBLE_BUFFERED;
- if ((style & SWT.VIRTUAL) != 0) style |= SWT.DOUBLE_BUFFERED;
+ style |= SWT.DOUBLE_BUFFERED;
}
boolean checkData (TableItem item, boolean redraw) {
@@ -1529,33 +1503,15 @@ void createHandle () {
state &= ~(CANVAS | THEME_BACKGROUND);
/* Use the Explorer theme */
- if (EXPLORER_THEME) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0) && OS.IsAppThemed ()) {
- explorerTheme = true;
- OS.SetWindowTheme (handle, Display.EXPLORER, null);
- }
+ if (OS.IsAppThemed ()) {
+ explorerTheme = true;
+ OS.SetWindowTheme (handle, Display.EXPLORER, null);
}
/* Get the header window handle */
hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
/*
- * Feature in Windows. In version 5.8 of COMCTL32.DLL,
- * if the font is changed for an item, the bounds for the
- * item are not updated, causing the text to be clipped.
- * The fix is to detect the version of COMCTL32.DLL, and
- * if it is one of the versions with the problem, then
- * use version 5.00 of the control (a version that does
- * not have the problem). This is the recommended work
- * around from the MSDN.
- */
- if (!OS.IsWinCE) {
- if (OS.COMCTL32_MAJOR < 6) {
- OS.SendMessage (handle, OS.CCM_SETVERSION, 5, 0);
- }
- }
-
- /*
* This code is intentionally commented. According to
* the documentation, setting the default item size is
* supposed to improve performance. By experimentation,
@@ -1603,9 +1559,8 @@ void createHandle () {
OS.HeapFree (hHeap, 0, pszText);
/* Set the extended style bits */
- int bits1 = OS.LVS_EX_LABELTIP;
+ int bits1 = OS.LVS_EX_LABELTIP | OS.LVS_EX_DOUBLEBUFFER;
if ((style & SWT.FULL_SELECTION) != 0) bits1 |= OS.LVS_EX_FULLROWSELECT;
- if (OS.COMCTL32_MAJOR >= 6) bits1 |= OS.LVS_EX_DOUBLEBUFFER;
OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits1, bits1);
/*
@@ -1615,17 +1570,13 @@ void createHandle () {
* and WS_EX_NOINHERITLAYOUT are specified for the table, the header will
* not be oriented correctly. The fix is to explicitly set the orientation
* for the header.
- *
- * NOTE: WS_EX_LAYOUTRTL is not supported on Windows NT.
*/
- if (OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- if ((style & SWT.RIGHT_TO_LEFT) != 0) {
- int bits2 = OS.GetWindowLong (hwndHeader, OS.GWL_EXSTYLE);
- OS.SetWindowLong (hwndHeader, OS.GWL_EXSTYLE, bits2 | OS.WS_EX_LAYOUTRTL);
- long /*int*/ hwndTooltop = OS.SendMessage (handle, OS.LVM_GETTOOLTIPS, 0, 0);
- int bits3 = OS.GetWindowLong (hwndTooltop, OS.GWL_EXSTYLE);
- OS.SetWindowLong (hwndTooltop, OS.GWL_EXSTYLE, bits3 | OS.WS_EX_LAYOUTRTL);
- }
+ if ((style & SWT.RIGHT_TO_LEFT) != 0) {
+ int bits2 = OS.GetWindowLong (hwndHeader, OS.GWL_EXSTYLE);
+ OS.SetWindowLong (hwndHeader, OS.GWL_EXSTYLE, bits2 | OS.WS_EX_LAYOUTRTL);
+ long /*int*/ hwndTooltop = OS.SendMessage (handle, OS.LVM_GETTOOLTIPS, 0, 0);
+ int bits3 = OS.GetWindowLong (hwndTooltop, OS.GWL_EXSTYLE);
+ OS.SetWindowLong (hwndTooltop, OS.GWL_EXSTYLE, bits3 | OS.WS_EX_LAYOUTRTL);
}
}
@@ -1639,12 +1590,9 @@ int applyThemeBackground () {
}
void createHeaderToolTips () {
- if (OS.IsWinCE) return;
if (headerToolTipHandle != 0) return;
int bits = 0;
- if (OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- if ((style & SWT.RIGHT_TO_LEFT) != 0) bits |= OS.WS_EX_LAYOUTRTL;
- }
+ if ((style & SWT.RIGHT_TO_LEFT) != 0) bits |= OS.WS_EX_LAYOUTRTL;
headerToolTipHandle = OS.CreateWindowEx (
bits,
new TCHAR (0, OS.TOOLTIPS_CLASS, true),
@@ -2059,13 +2007,11 @@ void destroyItem (TableColumn column) {
lvColumn.fmt = OS.LVCFMT_LEFT;
OS.SendMessage (handle, OS.LVM_SETCOLUMN, 0, lvColumn);
if (pszText != 0) OS.HeapFree (hHeap, 0, pszText);
- if (OS.COMCTL32_MAJOR >= 6) {
- HDITEM hdItem = new HDITEM ();
- hdItem.mask = OS.HDI_FORMAT;
- hdItem.fmt = OS.HDF_LEFT;
- long /*int*/ hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);
- }
+ HDITEM hdItem = new HDITEM ();
+ hdItem.mask = OS.HDI_FORMAT;
+ hdItem.fmt = OS.HDF_LEFT;
+ long /*int*/ hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
+ OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);
}
setRedraw (true);
/*
@@ -2275,57 +2221,6 @@ void fixCheckboxImageListColor (boolean fixScroll) {
setCheckboxImageList (cx [0], cy [0], fixScroll);
}
-void fixItemHeight (boolean fixScroll) {
- /*
- * Bug in Windows. When both a header and grid lines are
- * displayed, the grid lines do not take into account the
- * height of the header and draw in the wrong place. The
- * fix is to set the height of the table items to be the
- * height of the header so that the lines draw in the right
- * place. The height of a table item is the maximum of the
- * height of the font or the height of image list.
- *
- * NOTE: In version 5.80 of COMCTL32.DLL, the bug is fixed.
- */
- if (itemHeight != -1) return;
- if (OS.COMCTL32_VERSION >= OS.VERSION (5, 80)) return;
- if (!_getLinesVisible()) return;
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.LVS_NOCOLUMNHEADER) != 0) return;
- /*
- * Bug in Windows. Making any change to an item that
- * changes the item height of a table while the table
- * is scrolled can cause the lines to draw incorrectly.
- * This happens even when the lines are not currently
- * visible and are shown afterwards. The fix is to
- * save the top index, scroll to the top of the table
- * and then restore the original top index.
- */
- int topIndex = getTopIndex ();
- if (fixScroll && topIndex != 0) {
- setRedraw (false);
- setTopIndex (0);
- }
- long /*int*/ hOldList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0);
- if (hOldList != 0) return;
- RECT rect = new RECT ();
- OS.GetWindowRect (hwndHeader, rect);
- int height = rect.bottom - rect.top - 1;
- long /*int*/ hImageList = OS.ImageList_Create (1, height, 0, 0, 0);
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, hImageList);
- fixCheckboxImageList (false);
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, 0);
- if (headerImageList != null) {
- long /*int*/ hHeaderImageList = headerImageList.getHandle ();
- OS.SendMessage (hwndHeader, OS.HDM_SETIMAGELIST, 0, hHeaderImageList);
- }
- OS.ImageList_Destroy (hImageList);
- if (fixScroll && topIndex != 0) {
- setTopIndex (topIndex);
- setRedraw (true);
- }
-}
-
/**
* Returns the column at the given, zero-relative index in the
* receiver. Throws an exception if the index is out of range.
@@ -3140,42 +3035,15 @@ void register () {
void releaseChildren (boolean destroy) {
if (_hasItems ()) {
int itemCount = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETITEMCOUNT, 0, 0);
- /*
- * Feature in Windows 98. When there are a large number
- * of columns and items in a table (>1000) where each
- * of the subitems in the table has a string, it is much
- * faster to delete each item with LVM_DELETEITEM rather
- * than using LVM_DELETEALLITEMS. The fix is to detect
- * this case and delete the items, one by one. The fact
- * that the fix is only necessary on Windows 98 was
- * confirmed using version 5.81 of COMCTL32.DLL on both
- * Windows 98 and NT.
- *
- * NOTE: LVM_DELETEALLITEMS is also sent by the table
- * when the table is destroyed.
- */
- if (OS.IsWin95 && columnCount > 1) {
- /* Turn off redraw and resize events and leave them off */
- resizeCount = 1;
- OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- for (int i=itemCount-1; i>=0; --i) {
+ if (keys == null) {
+ for (int i=0; i<itemCount; i++) {
TableItem item = _getItem (i, false);
if (item != null && !item.isDisposed ()) item.release (false);
- ignoreSelect = ignoreShrink = true;
- OS.SendMessage (handle, OS.LVM_DELETEITEM, i, 0);
- ignoreSelect = ignoreShrink = false;
}
} else {
- if (keys == null) {
- for (int i=0; i<itemCount; i++) {
- TableItem item = _getItem (i, false);
- if (item != null && !item.isDisposed ()) item.release (false);
- }
- } else {
- for (int i=0; i<keyCount; i++) {
- TableItem item = items [i];
- if (item != null && !item.isDisposed ()) item.release (false);
- }
+ for (int i=0; i<keyCount; i++) {
+ TableItem item = items [i];
+ if (item != null && !item.isDisposed ()) item.release (false);
}
}
_clearItems ();
@@ -3353,50 +3221,11 @@ public void removeAll () {
TableItem item = _getItem (i, false);
if (item != null && !item.isDisposed ()) item.release (false);
}
- /*
- * Feature in Windows 98. When there are a large number
- * of columns and items in a table (>1000) where each
- * of the subitems in the table has a string, it is much
- * faster to delete each item with LVM_DELETEITEM rather
- * than using LVM_DELETEALLITEMS. The fix is to detect
- * this case and delete the items, one by one. The fact
- * that the fix is only necessary on Windows 98 was
- * confirmed using version 5.81 of COMCTL32.DLL on both
- * Windows 98 and NT.
- *
- * NOTE: LVM_DELETEALLITEMS is also sent by the table
- * when the table is destroyed.
- */
setDeferResize (true);
- if (OS.IsWin95 && columnCount > 1) {
- boolean redraw = getDrawing () && OS.IsWindowVisible (handle);
- if (redraw) OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
- int index = itemCount - 1;
- while (index >= 0) {
- ignoreSelect = ignoreShrink = true;
- long /*int*/ code = OS.SendMessage (handle, OS.LVM_DELETEITEM, index, 0);
- ignoreSelect = ignoreShrink = false;
- if (code == 0) break;
- --index;
- }
- if (redraw) {
- OS.SendMessage (handle, OS.WM_SETREDRAW, 1, 0);
- /*
- * This code is intentionally commented. The window proc
- * for the table implements WM_SETREDRAW to invalidate
- * and erase the table so it is not necessary to do this
- * again.
- */
-// int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
-// OS.RedrawWindow (handle, null, 0, flags);
- }
- if (index != -1) error (SWT.ERROR_ITEM_NOT_REMOVED);
- } else {
- ignoreSelect = ignoreShrink = true;
- long /*int*/ code = OS.SendMessage (handle, OS.LVM_DELETEALLITEMS, 0, 0);
- ignoreSelect = ignoreShrink = false;
- if (code == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
- }
+ ignoreSelect = ignoreShrink = true;
+ long /*int*/ code = OS.SendMessage (handle, OS.LVM_DELETEALLITEMS, 0, 0);
+ ignoreSelect = ignoreShrink = false;
+ if (code == 0) error (SWT.ERROR_ITEM_NOT_REMOVED);
setTableEmpty ();
setDeferResize (false);
}
@@ -3591,7 +3420,7 @@ void sendEraseItemEvent (TableItem item, NMLVCUSTOMDRAW nmcd, long /*int*/ lPara
int clrText = item.cellForeground != null ? item.cellForeground [nmcd.iSubItem] : -1;
if (clrText == -1) clrText = item.foreground;
int clrTextBk = -1;
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (sortColumn != null && sortDirection != SWT.NONE) {
if (findImageControl () == null) {
if (indexOf (sortColumn) == nmcd.iSubItem) {
@@ -4406,13 +4235,8 @@ void setDeferResize (boolean defer) {
if (--drawCount == 0 /*&& OS.IsWindowVisible (handle)*/) {
OS.SendMessage (handle, OS.LVM_SETBKCOLOR, 0, OS.CLR_NONE);
OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
- if (OS.IsWinCE) {
- if (hwndHeader != 0) OS.InvalidateRect (hwndHeader, null, true);
- OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
}
if (wasResized) {
@@ -4432,26 +4256,9 @@ void setDeferResize (boolean defer) {
void setCheckboxImageList (int width, int height, boolean fixScroll) {
if ((style & SWT.CHECK) == 0) return;
- int count = 8, flags = 0;
- if (OS.IsWinCE) {
- flags |= OS.ILC_COLOR;
- } else {
- long /*int*/ hDC = OS.GetDC (handle);
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
- OS.ReleaseDC (handle, hDC);
- int depth = bits * planes;
- switch (depth) {
- case 4: flags |= OS.ILC_COLOR4; break;
- case 8: flags |= OS.ILC_COLOR8; break;
- case 16: flags |= OS.ILC_COLOR16; break;
- case 24: flags |= OS.ILC_COLOR24; break;
- case 32: flags |= OS.ILC_COLOR32; break;
- default: flags |= OS.ILC_COLOR; break;
- }
- }
+ int count = 8, flags = OS.ILC_COLOR32;
if ((style & SWT.RIGHT_TO_LEFT) != 0) flags |= OS.ILC_MIRROR;
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) flags |= OS.ILC_MASK;
+ if (!OS.IsAppThemed ()) flags |= OS.ILC_MASK;
long /*int*/ hStateList = OS.ImageList_Create (width, height, flags, count, count);
long /*int*/ hDC = OS.GetDC (handle);
long /*int*/ memDC = OS.CreateCompatibleDC (hDC);
@@ -4460,7 +4267,7 @@ void setCheckboxImageList (int width, int height, boolean fixScroll) {
RECT rect = new RECT ();
OS.SetRect (rect, 0, 0, width * count, height);
int clrBackground;
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
Control control = findBackgroundControl ();
if (control == null) control = this;
clrBackground = control.getBackgroundPixel ();
@@ -4481,7 +4288,7 @@ void setCheckboxImageList (int width, int height, boolean fixScroll) {
int itemHeight = Math.min (tm.tmHeight, height);
int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2;
OS.SetRect (rect, left, top, left + itemWidth, top + itemHeight);
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
long /*int*/ hTheme = display.hButtonTheme ();
OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, rect, null);
rect.left += width; rect.right += width;
@@ -4518,7 +4325,7 @@ void setCheckboxImageList (int width, int height, boolean fixScroll) {
OS.SelectObject (memDC, hOldBitmap);
OS.DeleteDC (memDC);
OS.ReleaseDC (handle, hDC);
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
OS.ImageList_Add (hStateList, hBitmap, 0);
} else {
OS.ImageList_AddMasked (hStateList, hBitmap, clrBackground);
@@ -4547,10 +4354,8 @@ void setCheckboxImageList (int width, int height, boolean fixScroll) {
* pixel corruption of the images. The fix is to reset the
* LVSIL_SMALL image list.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- long /*int*/ hImageList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0);
- OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, hImageList);
- }
+ long /*int*/ hImageList = OS.SendMessage (handle, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0);
+ OS.SendMessage (handle, OS.LVM_SETIMAGELIST, OS.LVSIL_SMALL, hImageList);
if (fixScroll && topIndex != 0) {
setTopIndex (topIndex);
setRedraw (true);
@@ -4742,7 +4547,6 @@ public void setHeaderVisible (boolean show) {
setRedraw (false);
setTopIndex (0);
}
- if (show && _getLinesVisible()) fixItemHeight (false);
setTopIndex (oldIndex);
if (newIndex != 0) {
setRedraw (true);
@@ -4847,8 +4651,8 @@ void setItemHeight (boolean fixScroll) {
OS.SetWindowLong (handle, OS.GWL_STYLE, bits | OS.LVS_OWNERDRAWFIXED);
int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOREDRAW | OS.SWP_NOZORDER;
ignoreResize = true;
- SetWindowPos (handle, 0 , 0, 0, width, height + 1, flags);
- SetWindowPos (handle, 0 , 0, 0, width, height, flags);
+ OS.SetWindowPos (handle, 0 , 0, 0, width, height + 1, flags);
+ OS.SetWindowPos (handle, 0 , 0, 0, width, height, flags);
ignoreResize = false;
OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
}
@@ -4900,10 +4704,6 @@ public void setLinesVisible (boolean show) {
checkWidget ();
int newBits = show ? OS.LVS_EX_GRIDLINES : 0;
OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, OS.LVS_EX_GRIDLINES, newBits);
- if (show) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.LVS_NOCOLUMNHEADER) == 0) fixItemHeight (true);
- }
OS.InvalidateRect (hwndHeader, null, true);
}
@@ -4958,15 +4758,8 @@ public void setRedraw (boolean redraw) {
state &= ~HIDDEN;
OS.ShowWindow (handle, OS.SW_HIDE);
} else {
- if (OS.IsWinCE) {
- OS.InvalidateRect (handle, null, false);
- if (hwndHeader != 0) {
- OS.InvalidateRect (hwndHeader, null, false);
- }
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
setDeferResize (false);
}
@@ -5011,14 +4804,8 @@ void setScrollWidth (int width) {
OS.SendMessage (handle, OS.LVM_SETCOLUMNWIDTH, 0, width);
if (redraw) {
OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
- if (OS.IsWinCE) {
- long /*int*/ hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- if (hwndHeader != 0) OS.InvalidateRect (hwndHeader, null, true);
- OS.InvalidateRect (handle, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
}
}
@@ -5113,11 +4900,8 @@ boolean setScrollWidth (TableItem item, boolean force) {
*/
newWidth++;
}
- newWidth += INSET * 2;
+ newWidth += INSET * 2 + VISTA_EXTRA;
int oldWidth = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETCOLUMNWIDTH, 0, 0);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- newWidth += VISTA_EXTRA;
- }
if (newWidth > oldWidth) {
setScrollWidth (newWidth);
return true;
@@ -5377,7 +5161,6 @@ void setTableEmpty () {
if (control.backgroundImage == null) {
setCustomDraw (false);
setBackgroundTransparent (false);
- if (OS.COMCTL32_MAJOR < 6) style &= ~SWT.DOUBLE_BUFFERED;
}
}
_initItems ();
@@ -5577,7 +5360,7 @@ void showItem (int index) {
if (index != OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0)) {
OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 1);
}
- } else if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ } else {
/*
* Bug in Windows Vista and onwards: For some reason,
* LVM_ENSUREVISIBLE command scrolls the table to the leftmost
@@ -5587,8 +5370,6 @@ void showItem (int index) {
if (topIndex > index || index >= topIndex + counterPage ) {
OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 0);
}
- } else {
- OS.SendMessage (handle, OS.LVM_ENSUREVISIBLE, index, 0);
}
}
@@ -5681,25 +5462,14 @@ void subclass () {
}
RECT toolTipInset (RECT rect) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- RECT insetRect = new RECT ();
- OS.SetRect (insetRect, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1);
- return insetRect;
- }
- return rect;
+ RECT insetRect = new RECT ();
+ OS.SetRect (insetRect, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1);
+ return insetRect;
}
RECT toolTipRect (RECT rect) {
RECT toolRect = new RECT ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.SetRect (toolRect, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1);
- } else {
- long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.LVM_GETTOOLTIPS, 0, 0);
- OS.SetRect (toolRect, rect.left, rect.top, rect.right, rect.bottom);
- int dwStyle = OS.GetWindowLong (hwndToolTip, OS.GWL_STYLE);
- int dwExStyle = OS.GetWindowLong (hwndToolTip, OS.GWL_EXSTYLE);
- OS.AdjustWindowRectEx (toolRect, dwStyle, false, dwExStyle);
- }
+ OS.SetRect (toolRect, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1);
return toolRect;
}
@@ -5774,20 +5544,6 @@ void updateHeaderToolTips () {
}
@Override
-void updateImages () {
- if (sortColumn != null && !sortColumn.isDisposed ()) {
- if (OS.COMCTL32_MAJOR < 6) {
- switch (sortDirection) {
- case SWT.UP:
- case SWT.DOWN:
- sortColumn.setImage (display.getSortImage (sortDirection), true, true);
- break;
- }
- }
- }
-}
-
-@Override
void updateMenuLocation (Event event) {
Rectangle clientArea = getClientAreaInPixels ();
int x = clientArea.x, y = clientArea.y;
@@ -5867,28 +5623,15 @@ void updateOrientation () {
if (column != null) {
Image image = column.image;
if (image != null) {
- if (OS.COMCTL32_MAJOR < 6) {
- HDITEM hdItem = new HDITEM ();
- hdItem.mask = OS.HDI_FORMAT;
- OS.SendMessage (hwndHeader, OS.HDM_GETITEM, i, hdItem);
- if ((hdItem.fmt & OS.HDF_IMAGE) != 0) {
- int index = headerImageList.indexOf (image);
- if (index == -1) headerImageList.add (image);
- hdItem.mask = OS.HDI_IMAGE;
- hdItem.iImage = index;
- OS.SendMessage (hwndHeader, OS.HDM_SETITEM, i, hdItem);
- }
- } else {
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_FMT;
- OS.SendMessage (hwndHeader, OS.LVM_GETCOLUMN, i, lvColumn);
- if ((lvColumn.fmt & OS.LVCFMT_IMAGE) != 0) {
- int index = headerImageList.indexOf (image);
- if (index == -1) headerImageList.add (image);
- lvColumn.iImage = index;
- lvColumn.mask = OS.LVCF_IMAGE;
- OS.SendMessage (hwndHeader, OS.LVM_SETCOLUMN, i, lvColumn);
- }
+ LVCOLUMN lvColumn = new LVCOLUMN ();
+ lvColumn.mask = OS.LVCF_FMT;
+ OS.SendMessage (hwndHeader, OS.LVM_GETCOLUMN, i, lvColumn);
+ if ((lvColumn.fmt & OS.LVCFMT_IMAGE) != 0) {
+ int index = headerImageList.indexOf (image);
+ if (index == -1) headerImageList.add (image);
+ lvColumn.iImage = index;
+ lvColumn.mask = OS.LVCF_IMAGE;
+ OS.SendMessage (hwndHeader, OS.LVM_SETCOLUMN, i, lvColumn);
}
}
}
@@ -5952,28 +5695,6 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /
if (result != null) return result.value;
break;
}
- case OS.WM_CAPTURECHANGED: {
- /*
- * Bug in Windows. When the capture changes during a
- * header drag, Windows does not redraw the header item
- * such that the header remains pressed. For example,
- * when focus is assigned to a push button, the mouse is
- * pressed (but not released), then the SPACE key is
- * pressed to activate the button, the capture changes,
- * the header not notified and NM_RELEASEDCAPTURE is not
- * sent. The fix is to redraw the header when the capture
- * changes to another control.
- *
- * This does not happen on XP.
- */
- if (OS.COMCTL32_MAJOR < 6) {
- if (lParam != 0) {
- long /*int*/ hwndHeader = OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
- if (lParam != hwndHeader) OS.InvalidateRect (hwndHeader, null, true);
- }
- }
- break;
- }
case OS.WM_MOUSELEAVE: {
/*
* Bug in Windows. On XP, when a tooltip is hidden
@@ -5982,7 +5703,7 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /
* won't show again until another tooltip becomes
* active. The fix is to reset the tooltip bounds.
*/
- if (OS.COMCTL32_MAJOR >= 6) updateHeaderToolTips ();
+ updateHeaderToolTips ();
updateHeaderToolTips ();
break;
}
@@ -6034,81 +5755,79 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /
*
* The fix for both cases is to create the image using PrintWindow().
*/
- if ((!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) || (style & SWT.VIRTUAL) != 0 || hooks (SWT.EraseItem) || hooks (SWT.PaintItem)) {
- int topIndex = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0);
- int selection = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETNEXTITEM, topIndex - 1, OS.LVNI_SELECTED);
- if (selection == -1) return 0;
- POINT mousePos = new POINT ();
- OS.POINTSTOPOINT (mousePos, OS.GetMessagePos ());
- OS.MapWindowPoints(0, handle, mousePos, 1);
- RECT clientRect = new RECT ();
- OS.GetClientRect (handle, clientRect);
- TableItem item = _getItem (selection);
- RECT rect = item.getBounds (selection, 0, true, true, true);
- if ((style & SWT.FULL_SELECTION) != 0) {
- int width = DRAG_IMAGE_SIZE;
- rect.left = Math.max (clientRect.left, mousePos.x - width / 2);
- if (clientRect.right > rect.left + width) {
- rect.right = rect.left + width;
- } else {
- rect.right = clientRect.right;
- rect.left = Math.max (clientRect.left, rect.right - width);
- }
- }
- long /*int*/ hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
- while ((selection = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETNEXTITEM, selection, OS.LVNI_SELECTED)) != -1) {
- if (rect.bottom - rect.top > DRAG_IMAGE_SIZE) break;
- if (rect.bottom > clientRect.bottom) break;
- RECT itemRect = item.getBounds (selection, 0, true, true, true);
- long /*int*/ rectRgn = OS.CreateRectRgn (rect.left, itemRect.top, rect.right, itemRect.bottom);
- OS.CombineRgn (hRgn, hRgn, rectRgn, OS.RGN_OR);
- OS.DeleteObject (rectRgn);
- rect.bottom = itemRect.bottom;
- }
- OS.GetRgnBox (hRgn, rect);
-
- /* Create resources */
- long /*int*/ hdc = OS.GetDC (handle);
- long /*int*/ memHdc = OS.CreateCompatibleDC (hdc);
- BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER ();
- bmiHeader.biSize = BITMAPINFOHEADER.sizeof;
- bmiHeader.biWidth = rect.right - rect.left;
- bmiHeader.biHeight = -(rect.bottom - rect.top);
- bmiHeader.biPlanes = 1;
- bmiHeader.biBitCount = 32;
- bmiHeader.biCompression = OS.BI_RGB;
- byte [] bmi = new byte [BITMAPINFOHEADER.sizeof];
- OS.MoveMemory (bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
- long /*int*/ [] pBits = new long /*int*/ [1];
- long /*int*/ memDib = OS.CreateDIBSection (0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
- if (memDib == 0) error (SWT.ERROR_NO_HANDLES);
- long /*int*/ oldMemBitmap = OS.SelectObject (memHdc, memDib);
- int colorKey = 0x0000FD;
- POINT pt = new POINT();
- OS.SetWindowOrgEx (memHdc, rect.left, rect.top, pt);
- OS.FillRect (memHdc, rect, findBrush (colorKey, OS.BS_SOLID));
- OS.OffsetRgn (hRgn, -rect.left, -rect.top);
- OS.SelectClipRgn (memHdc, hRgn);
- OS.PrintWindow (handle, memHdc, 0);
- OS.SetWindowOrgEx (memHdc, pt.x, pt.y, null);
- OS.SelectObject (memHdc, oldMemBitmap);
- OS.DeleteDC (memHdc);
- OS.ReleaseDC (0, hdc);
- OS.DeleteObject (hRgn);
-
- SHDRAGIMAGE shdi = new SHDRAGIMAGE ();
- shdi.hbmpDragImage = memDib;
- shdi.crColorKey = colorKey;
- shdi.sizeDragImage.cx = bmiHeader.biWidth;
- shdi.sizeDragImage.cy = -bmiHeader.biHeight;
- shdi.ptOffset.x = mousePos.x - rect.left;
- shdi.ptOffset.y = mousePos.y - rect.top;
- if ((style & SWT.MIRRORED) != 0) {
- shdi.ptOffset.x = shdi.sizeDragImage.cx - shdi.ptOffset.x;
- }
- OS.MoveMemory (lParam, shdi, SHDRAGIMAGE.sizeof);
- return 1;
- }
+ int topIndex = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0);
+ int selection = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETNEXTITEM, topIndex - 1, OS.LVNI_SELECTED);
+ if (selection == -1) return 0;
+ POINT mousePos = new POINT ();
+ OS.POINTSTOPOINT (mousePos, OS.GetMessagePos ());
+ OS.MapWindowPoints(0, handle, mousePos, 1);
+ RECT clientRect = new RECT ();
+ OS.GetClientRect (handle, clientRect);
+ TableItem item = _getItem (selection);
+ RECT rect = item.getBounds (selection, 0, true, true, true);
+ if ((style & SWT.FULL_SELECTION) != 0) {
+ int width = DRAG_IMAGE_SIZE;
+ rect.left = Math.max (clientRect.left, mousePos.x - width / 2);
+ if (clientRect.right > rect.left + width) {
+ rect.right = rect.left + width;
+ } else {
+ rect.right = clientRect.right;
+ rect.left = Math.max (clientRect.left, rect.right - width);
+ }
+ }
+ long /*int*/ hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
+ while ((selection = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETNEXTITEM, selection, OS.LVNI_SELECTED)) != -1) {
+ if (rect.bottom - rect.top > DRAG_IMAGE_SIZE) break;
+ if (rect.bottom > clientRect.bottom) break;
+ RECT itemRect = item.getBounds (selection, 0, true, true, true);
+ long /*int*/ rectRgn = OS.CreateRectRgn (rect.left, itemRect.top, rect.right, itemRect.bottom);
+ OS.CombineRgn (hRgn, hRgn, rectRgn, OS.RGN_OR);
+ OS.DeleteObject (rectRgn);
+ rect.bottom = itemRect.bottom;
+ }
+ OS.GetRgnBox (hRgn, rect);
+
+ /* Create resources */
+ long /*int*/ hdc = OS.GetDC (handle);
+ long /*int*/ memHdc = OS.CreateCompatibleDC (hdc);
+ BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER ();
+ bmiHeader.biSize = BITMAPINFOHEADER.sizeof;
+ bmiHeader.biWidth = rect.right - rect.left;
+ bmiHeader.biHeight = -(rect.bottom - rect.top);
+ bmiHeader.biPlanes = 1;
+ bmiHeader.biBitCount = 32;
+ bmiHeader.biCompression = OS.BI_RGB;
+ byte [] bmi = new byte [BITMAPINFOHEADER.sizeof];
+ OS.MoveMemory (bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
+ long /*int*/ [] pBits = new long /*int*/ [1];
+ long /*int*/ memDib = OS.CreateDIBSection (0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
+ if (memDib == 0) error (SWT.ERROR_NO_HANDLES);
+ long /*int*/ oldMemBitmap = OS.SelectObject (memHdc, memDib);
+ int colorKey = 0x0000FD;
+ POINT pt = new POINT();
+ OS.SetWindowOrgEx (memHdc, rect.left, rect.top, pt);
+ OS.FillRect (memHdc, rect, findBrush (colorKey, OS.BS_SOLID));
+ OS.OffsetRgn (hRgn, -rect.left, -rect.top);
+ OS.SelectClipRgn (memHdc, hRgn);
+ OS.PrintWindow (handle, memHdc, 0);
+ OS.SetWindowOrgEx (memHdc, pt.x, pt.y, null);
+ OS.SelectObject (memHdc, oldMemBitmap);
+ OS.DeleteDC (memHdc);
+ OS.ReleaseDC (0, hdc);
+ OS.DeleteObject (hRgn);
+
+ SHDRAGIMAGE shdi = new SHDRAGIMAGE ();
+ shdi.hbmpDragImage = memDib;
+ shdi.crColorKey = colorKey;
+ shdi.sizeDragImage.cx = bmiHeader.biWidth;
+ shdi.sizeDragImage.cy = -bmiHeader.biHeight;
+ shdi.ptOffset.x = mousePos.x - rect.left;
+ shdi.ptOffset.y = mousePos.y - rect.top;
+ if ((style & SWT.MIRRORED) != 0) {
+ shdi.ptOffset.x = shdi.sizeDragImage.cx - shdi.ptOffset.x;
+ }
+ OS.MoveMemory (lParam, shdi, SHDRAGIMAGE.sizeof);
+ return 1;
}
return super.windowProc (hwnd, msg, wParam, lParam);
}
@@ -6124,9 +5843,7 @@ LRESULT WM_CHAR (long /*int*/ wParam, long /*int*/ lParam) {
if (index != -1) {
TableItem item = _getItem (index);
item.setChecked (!item.getChecked (), true);
- if (!OS.IsWinCE) {
- OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
- }
+ OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
}
}
/*
@@ -6178,12 +5895,6 @@ LRESULT WM_CONTEXTMENU (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT WM_ERASEBKGND (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
if (findImageControl () != null) return LRESULT.ONE;
- if (!OS.IsWinCE && OS.COMCTL32_MAJOR < 6) {
- if ((style & SWT.DOUBLE_BUFFERED) != 0) {
- int bits = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
- if ((bits & OS.LVS_EX_DOUBLEBUFFER) == 0) return LRESULT.ONE;
- }
- }
return result;
}
@@ -6326,9 +6037,7 @@ LRESULT WM_LBUTTONDBLCLK (long /*int*/ wParam, long /*int*/ lParam) {
TableItem item = _getItem (index);
if (item != null && !item.isDisposed ()) {
item.setChecked (!item.getChecked (), true);
- if (!OS.IsWinCE) {
- OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
- }
+ OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
}
}
}
@@ -6365,9 +6074,7 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
TableItem item = _getItem (index);
if (item != null && !item.isDisposed ()) {
item.setChecked (!item.getChecked (), true);
- if (!OS.IsWinCE) {
- OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
- }
+ OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
}
}
}
@@ -6396,62 +6103,6 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
_checkShrink();
if (fixScrollWidth) setScrollWidth (null, true);
- if (!OS.IsWinCE && OS.COMCTL32_MAJOR < 6) {
- if ((style & SWT.DOUBLE_BUFFERED) != 0 || findImageControl () != null) {
- int bits = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
- if ((bits & OS.LVS_EX_DOUBLEBUFFER) == 0) {
- GC gc = null;
- long /*int*/ paintDC = 0;
- PAINTSTRUCT ps = new PAINTSTRUCT ();
- boolean hooksPaint = hooks (SWT.Paint) || filters (SWT.Paint);
- if (hooksPaint) {
- GCData data = new GCData ();
- data.ps = ps;
- data.hwnd = handle;
- gc = GC.win32_new (this, data);
- paintDC = gc.handle;
- } else {
- paintDC = OS.BeginPaint (handle, ps);
- }
- int width = ps.right - ps.left;
- int height = ps.bottom - ps.top;
- if (width != 0 && height != 0) {
- long /*int*/ hDC = OS.CreateCompatibleDC (paintDC);
- POINT lpPoint1 = new POINT (), lpPoint2 = new POINT ();
- OS.SetWindowOrgEx (hDC, ps.left, ps.top, lpPoint1);
- OS.SetBrushOrgEx (hDC, ps.left, ps.top, lpPoint2);
- long /*int*/ hBitmap = OS.CreateCompatibleBitmap (paintDC, width, height);
- long /*int*/ hOldBitmap = OS.SelectObject (hDC, hBitmap);
- if ((int)/*64*/OS.SendMessage (handle, OS.LVM_GETBKCOLOR, 0, 0) != OS.CLR_NONE) {
- RECT rect = new RECT ();
- OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom);
- drawBackground (hDC, rect);
- }
- callWindowProc (handle, OS.WM_PAINT, hDC, 0);
- OS.SetWindowOrgEx (hDC, lpPoint1.x, lpPoint1.y, null);
- OS.SetBrushOrgEx (hDC, lpPoint2.x, lpPoint2.y, null);
- OS.BitBlt (paintDC, ps.left, ps.top, width, height, hDC, 0, 0, OS.SRCCOPY);
- OS.SelectObject (hDC, hOldBitmap);
- OS.DeleteObject (hBitmap);
- OS.DeleteObject (hDC);
- if (hooksPaint) {
- Event event = new Event ();
- event.gc = gc;
- event.setBoundsInPixels(new Rectangle(ps.left, ps.top, ps.right - ps.left, ps.bottom - ps.top));
- sendEvent (SWT.Paint, event);
- // widget could be disposed at this point
- event.gc = null;
- }
- }
- if (hooksPaint) {
- gc.dispose ();
- } else {
- OS.EndPaint (handle, ps);
- }
- return LRESULT.ZERO;
- }
- }
- }
return super.WM_PAINT (wParam, lParam);
}
@@ -6663,11 +6314,9 @@ LRESULT WM_HSCROLL (long /*int*/ wParam, long /*int*/ lParam) {
*/
boolean fixScroll = false;
if (OS.LOWORD (wParam) != OS.SB_ENDSCROLL) {
- if (OS.COMCTL32_MAJOR >= 6) {
- if (columnCount > H_SCROLL_LIMIT) {
- int rowCount = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0);
- if (rowCount > V_SCROLL_LIMIT) fixScroll = getDrawing () && OS.IsWindowVisible (handle);
- }
+ if (columnCount > H_SCROLL_LIMIT) {
+ int rowCount = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0);
+ if (rowCount > V_SCROLL_LIMIT) fixScroll = getDrawing () && OS.IsWindowVisible (handle);
}
}
if (fixScroll) OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
@@ -6682,7 +6331,7 @@ LRESULT WM_HSCROLL (long /*int*/ wParam, long /*int*/ lParam) {
* of a table when scrolling, rather than just return
* the data for each column when asked.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
RECT headerRect = new RECT (), rect = new RECT ();
OS.GetClientRect (handle, rect);
boolean [] visible = new boolean [columnCount];
@@ -6766,11 +6415,9 @@ LRESULT WM_VSCROLL (long /*int*/ wParam, long /*int*/ lParam) {
*/
boolean fixScroll = false;
if (OS.LOWORD (wParam) != OS.SB_ENDSCROLL) {
- if (OS.COMCTL32_MAJOR >= 6) {
- if (columnCount > H_SCROLL_LIMIT) {
- int rowCount = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0);
- if (rowCount > V_SCROLL_LIMIT) fixScroll = getDrawing () && OS.IsWindowVisible (handle);
- }
+ if (columnCount > H_SCROLL_LIMIT) {
+ int rowCount = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETCOUNTPERPAGE, 0, 0);
+ if (rowCount > V_SCROLL_LIMIT) fixScroll = getDrawing () && OS.IsWindowVisible (handle);
}
}
if (fixScroll) OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
@@ -6785,7 +6432,7 @@ LRESULT WM_VSCROLL (long /*int*/ wParam, long /*int*/ lParam) {
* of a table when scrolling, rather than just return
* the data for each column when asked.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
RECT headerRect = new RECT (), rect = new RECT ();
OS.GetClientRect (handle, rect);
boolean [] visible = new boolean [columnCount];
@@ -6949,7 +6596,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
* can never be used from a LVN_GETDISPINFO handler. The fix is to
* InvalidateRect() passing the bounds for the entire item.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
RECT rect = new RECT ();
rect.left = OS.LVIR_BOUNDS;
ignoreCustomDraw = true;
@@ -7048,12 +6695,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
length -= shift;
}
buffer [length++] = 0;
- if (OS.IsUnicode) {
- OS.MoveMemory (plvfi.pszText, buffer, length * 2);
- } else {
- OS.WideCharToMultiByte (getCodePage (), 0, buffer, length, plvfi.pszText, plvfi.cchTextMax, null, null);
- OS.MoveMemory (plvfi.pszText + plvfi.cchTextMax - 1, new byte [1], 1);
- }
+ OS.MoveMemory (plvfi.pszText, buffer, length * 2);
}
}
boolean move = false;
@@ -7211,32 +6853,6 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
break;
}
- case OS.NM_RECOGNIZEGESTURE:
- /*
- * Feature on Pocket PC. The tree and table controls detect the tap
- * and hold gesture by default. They send a GN_CONTEXTMENU message to show
- * the popup menu. This default behaviour is unwanted on Pocket PC 2002
- * when no menu has been set, as it still draws a red circle. The fix
- * is to disable this default behaviour when no menu is set by returning
- * TRUE when receiving the Pocket PC 2002 specific NM_RECOGNIZEGESTURE
- * message.
- */
- if (OS.IsPPC) {
- boolean hasMenu = menu != null && !menu.isDisposed ();
- if (!hasMenu && !hooks (SWT.MenuDetect)) return LRESULT.ONE;
- }
- break;
- case OS.GN_CONTEXTMENU:
- if (OS.IsPPC) {
- boolean hasMenu = menu != null && !menu.isDisposed ();
- if (hasMenu || hooks (SWT.MenuDetect)) {
- NMRGINFO nmrg = new NMRGINFO ();
- OS.MoveMemory (nmrg, lParam, NMRGINFO.sizeof);
- showMenu (nmrg.x, nmrg.y);
- return LRESULT.ONE;
- }
- }
- break;
}
return super.wmNotifyChild (hdr, wParam, lParam);
}
@@ -7272,20 +6888,7 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
switch (hdr.code) {
case OS.HDN_DIVIDERDBLCLICKW:
case OS.HDN_DIVIDERDBLCLICKA:
- /*
- * Bug in Windows. When the first column of a table does not
- * have an image and the user double clicks on the divider,
- * Windows packs the column but does not take into account
- * the empty space left for the image. The fix is to pack
- * the column explicitly rather than letting Windows do it.
- *
- * NOTE: This bug does not happen on Vista.
- */
- boolean fixPack = false;
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 0)) {
- fixPack = phdn.iItem == 0 && !firstColumnImage;
- }
- if (column != null && (fixPack || hooks (SWT.MeasureItem))) {
+ if (column != null && hooks (SWT.MeasureItem)) {
column.pack ();
return LRESULT.ONE;
}
@@ -7561,7 +7164,6 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
- if (OS.IsWinCE) return null;
switch (hdr.code) {
case OS.NM_CUSTOMDRAW: {
if (toolTipText != null) break;
@@ -7613,7 +7215,7 @@ LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.LVM_GETTOOLTIPS, 0, 0);
int flags = OS.SWP_NOACTIVATE | OS.SWP_NOZORDER;
int width = toolRect.right - toolRect.left, height = toolRect.bottom - toolRect.top;
- SetWindowPos (hwndToolTip, 0, toolRect.left , toolRect.top, width, height, flags);
+ OS.SetWindowPos (hwndToolTip, 0, toolRect.left , toolRect.top, width, height, flags);
} else {
NMTTDISPINFO lpnmtdi = null;
if (hdr.code == OS.TTN_GETDISPINFOA) {
@@ -7673,7 +7275,6 @@ LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long /*int*/ lParam) {
- if (OS.IsWinCE) return null;
switch (nmcd.dwDrawStage) {
case OS.CDDS_PREPAINT: {
if (isCustomToolTip ()) {
@@ -7733,10 +7334,7 @@ LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long /*int*/ lParam) {
Rectangle rect = image.getBoundsInPixels ();
RECT imageRect = item.getBounds (pinfo.iItem, pinfo.iSubItem, false, true, false, false, hDC);
Point size = imageList == null ? new Point (rect.width, rect.height) : imageList.getImageSize ();
- int y = imageRect.top;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- y = y + Math.max (0, (imageRect.bottom - imageRect.top - size.y) / 2);
- }
+ int y = imageRect.top + Math.max (0, (imageRect.bottom - imageRect.top - size.y) / 2);
rect = DPIUtil.autoScaleDown(rect);
gc.drawImage (image, rect.x, rect.y, rect.width, rect.height, DPIUtil.autoScaleDown(x), DPIUtil.autoScaleDown(y), DPIUtil.autoScaleDown(size.x), DPIUtil.autoScaleDown(size.y));
x += size.x + INSET + (pinfo.iSubItem == 0 ? -2 : 4);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
index be3e0f2cb6..d67088a9b8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableColumn.java
@@ -339,31 +339,18 @@ public void pack () {
int oldWidth = (int)/*64*/OS.SendMessage (hwnd, OS.LVM_GETCOLUMNWIDTH, index, 0);
TCHAR buffer = new TCHAR (parent.getCodePage (), text, true);
int headerWidth = (int)/*64*/OS.SendMessage (hwnd, OS.LVM_GETSTRINGWIDTH, 0, buffer) + Table.HEADER_MARGIN;
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) headerWidth += Table.HEADER_EXTRA;
+ if (OS.IsAppThemed ()) headerWidth += Table.HEADER_EXTRA;
boolean hasHeaderImage = false;
if (image != null || parent.sortColumn == this) {
hasHeaderImage = true;
- Image headerImage = null;
if (parent.sortColumn == this && parent.sortDirection != SWT.NONE) {
- if (OS.COMCTL32_MAJOR < 6) {
- headerImage = display.getSortImage (parent.sortDirection);
- } else {
- headerWidth += Table.SORT_WIDTH;
- }
- } else {
- headerImage = image;
- }
- if (headerImage != null) {
- Rectangle bounds = headerImage.getBoundsInPixels ();
+ headerWidth += Table.SORT_WIDTH;
+ } else if (image != null) {
+ Rectangle bounds = image.getBoundsInPixels ();
headerWidth += bounds.width;
}
- int margin = 0;
- if (OS.COMCTL32_VERSION >= OS.VERSION (5, 80)) {
- long /*int*/ hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
- margin = (int)/*64*/OS.SendMessage (hwndHeader, OS.HDM_GETBITMAPMARGIN, 0, 0);
- } else {
- margin = OS.GetSystemMetrics (OS.SM_CXEDGE) * 3;
- }
+ long /*int*/ hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
+ int margin = (int)/*64*/OS.SendMessage (hwndHeader, OS.HDM_GETBITMAPMARGIN, 0, 0);
headerWidth += margin * 4;
}
parent.ignoreColumnResize = true;
@@ -405,25 +392,6 @@ public void pack () {
*/
if (parent.imageList == null) columnWidth += 2;
/*
- * Bug in Windows. When the first column of a table does not
- * have an image and the user double clicks on the divider,
- * Windows packs the column but does not take into account
- * the empty space left for the image. The fix is to increase
- * the column width by the width of the image list.
- *
- * NOTE: This bug does not happen on Vista.
- */
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 0)) {
- if (!parent.firstColumnImage) {
- long /*int*/ hImageList = OS.SendMessage (hwnd, OS.LVM_GETIMAGELIST, OS.LVSIL_SMALL, 0);
- if (hImageList != 0) {
- int [] cx = new int [1], cy = new int [1];
- OS.ImageList_GetIconSize (hImageList, cx, cy);
- columnWidth += cx [0];
- }
- }
- }
- /*
* Bug in Windows. When LVM_SETCOLUMNWIDTH is used with LVSCW_AUTOSIZE
* for a table with a state image list, the column is width does not
* include space for the state icon. The fix is to increase the column
@@ -455,12 +423,12 @@ public void pack () {
OS.GetWindowRect (hwnd, rect);
OS.UpdateWindow (hwnd);
int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOREDRAW | OS.SWP_NOZORDER;
- SetWindowPos (hwnd, 0, 0, 0, 0, rect.bottom - rect.top, flags);
+ OS.SetWindowPos (hwnd, 0, 0, 0, 0, rect.bottom - rect.top, flags);
}
OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, OS.LVSCW_AUTOSIZE_USEHEADER);
if (fixWidth) {
int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOZORDER;
- SetWindowPos (hwnd, 0, 0, 0, rect.right - rect.left, rect.bottom - rect.top, flags);
+ OS.SetWindowPos (hwnd, 0, 0, 0, rect.right - rect.left, rect.bottom - rect.top, flags);
}
} else {
OS.SendMessage (hwnd, OS.LVM_SETCOLUMNWIDTH, index, headerWidth);
@@ -622,43 +590,18 @@ void setImage (Image image, boolean sort, boolean right) {
int index = parent.indexOf (this);
if (index == -1) return;
long /*int*/ hwnd = parent.handle;
- if (OS.COMCTL32_MAJOR < 6) {
- long /*int*/ hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
- HDITEM hdItem = new HDITEM ();
- hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE | OS.HDI_BITMAP;
- OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
- hdItem.fmt &= ~OS.HDF_BITMAP_ON_RIGHT;
- if (image != null) {
- if (sort) {
- hdItem.mask &= ~OS.HDI_IMAGE;
- hdItem.fmt &= ~OS.HDF_IMAGE;
- hdItem.fmt |= OS.HDF_BITMAP;
- hdItem.hbm = image.handle;
- } else {
- hdItem.mask &= ~OS.HDI_BITMAP;
- hdItem.fmt &= ~OS.HDF_BITMAP;
- hdItem.fmt |= OS.HDF_IMAGE;
- hdItem.iImage = parent.imageIndexHeader (image);
- }
- if (right) hdItem.fmt |= OS.HDF_BITMAP_ON_RIGHT;
- } else {
- hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_BITMAP);
- }
- OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);
+ LVCOLUMN lvColumn = new LVCOLUMN ();
+ lvColumn.mask = OS.LVCF_FMT | OS.LVCF_IMAGE;
+ OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, lvColumn);
+ if (image != null) {
+ lvColumn.fmt |= OS.LVCFMT_IMAGE;
+ lvColumn.iImage = parent.imageIndexHeader (image);
+ if (right) lvColumn.fmt |= OS.LVCFMT_BITMAP_ON_RIGHT;
} else {
- LVCOLUMN lvColumn = new LVCOLUMN ();
- lvColumn.mask = OS.LVCF_FMT | OS.LVCF_IMAGE;
- OS.SendMessage (hwnd, OS.LVM_GETCOLUMN, index, lvColumn);
- if (image != null) {
- lvColumn.fmt |= OS.LVCFMT_IMAGE;
- lvColumn.iImage = parent.imageIndexHeader (image);
- if (right) lvColumn.fmt |= OS.LVCFMT_BITMAP_ON_RIGHT;
- } else {
- lvColumn.mask &= ~OS.LVCF_IMAGE;
- lvColumn.fmt &= ~(OS.LVCFMT_IMAGE | OS.LVCFMT_BITMAP_ON_RIGHT);
- }
- OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
+ lvColumn.mask &= ~OS.LVCF_IMAGE;
+ lvColumn.fmt &= ~(OS.LVCFMT_IMAGE | OS.LVCFMT_BITMAP_ON_RIGHT);
}
+ OS.SendMessage (hwnd, OS.LVM_SETCOLUMN, index, lvColumn);
}
/**
@@ -708,85 +651,73 @@ public void setResizable (boolean resizable) {
}
void setSortDirection (int direction) {
- if (OS.COMCTL32_MAJOR >= 6) {
- int index = parent.indexOf (this);
- if (index == -1) return;
- long /*int*/ hwnd = parent.handle;
- long /*int*/ hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
- HDITEM hdItem = new HDITEM ();
- hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE;
- OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
- switch (direction) {
- case SWT.UP:
- hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTDOWN);
- hdItem.fmt |= OS.HDF_SORTUP;
- if (image == null) hdItem.mask &= ~OS.HDI_IMAGE;
- break;
- case SWT.DOWN:
- hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTUP);
- hdItem.fmt |= OS.HDF_SORTDOWN;
- if (image == null) hdItem.mask &= ~OS.HDI_IMAGE;
- break;
- case SWT.NONE:
- hdItem.fmt &= ~(OS.HDF_SORTUP | OS.HDF_SORTDOWN);
- if (image != null) {
- hdItem.fmt |= OS.HDF_IMAGE;
- hdItem.iImage = parent.imageIndexHeader (image);
- } else {
- hdItem.fmt &= ~OS.HDF_IMAGE;
- hdItem.mask &= ~OS.HDI_IMAGE;
- }
- break;
- }
- OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);
- /*
- * Bug in Windows. When LVM_SETSELECTEDCOLUMN is used to
- * specify a selected column, Windows does not redraw either
- * the new or the previous selected column. The fix is to
- * force a redraw of both.
- *
- * Feature in Windows. When LVM_SETBKCOLOR is used with
- * CLR_NONE and LVM_SETSELECTEDCOLUMN is used to select
- * a column, Windows fills the column with the selection
- * color, drawing on top of the background image and any
- * other custom drawing. The fix is to avoid setting the
- * selected column.
- */
- parent.forceResize ();
- RECT rect = new RECT ();
- OS.GetClientRect (hwnd, rect);
- if ((int)/*64*/OS.SendMessage (hwnd, OS.LVM_GETBKCOLOR, 0, 0) != OS.CLR_NONE) {
- int oldColumn = (int)/*64*/OS.SendMessage (hwnd, OS.LVM_GETSELECTEDCOLUMN, 0, 0);
- int newColumn = direction == SWT.NONE ? -1 : index;
- OS.SendMessage (hwnd, OS.LVM_SETSELECTEDCOLUMN, newColumn, 0);
- RECT headerRect = new RECT ();
- if (oldColumn != -1) {
- if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, oldColumn, headerRect) != 0) {
- OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);
- rect.left = headerRect.left;
- rect.right = headerRect.right;
- OS.InvalidateRect (hwnd, rect, true);
- }
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ long /*int*/ hwnd = parent.handle;
+ long /*int*/ hwndHeader = OS.SendMessage (hwnd, OS.LVM_GETHEADER, 0, 0);
+ HDITEM hdItem = new HDITEM ();
+ hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE;
+ OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
+ switch (direction) {
+ case SWT.UP:
+ hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTDOWN);
+ hdItem.fmt |= OS.HDF_SORTUP;
+ if (image == null) hdItem.mask &= ~OS.HDI_IMAGE;
+ break;
+ case SWT.DOWN:
+ hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTUP);
+ hdItem.fmt |= OS.HDF_SORTDOWN;
+ if (image == null) hdItem.mask &= ~OS.HDI_IMAGE;
+ break;
+ case SWT.NONE:
+ hdItem.fmt &= ~(OS.HDF_SORTUP | OS.HDF_SORTDOWN);
+ if (image != null) {
+ hdItem.fmt |= OS.HDF_IMAGE;
+ hdItem.iImage = parent.imageIndexHeader (image);
+ } else {
+ hdItem.fmt &= ~OS.HDF_IMAGE;
+ hdItem.mask &= ~OS.HDI_IMAGE;
}
- }
+ break;
+ }
+ OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);
+ /*
+ * Bug in Windows. When LVM_SETSELECTEDCOLUMN is used to
+ * specify a selected column, Windows does not redraw either
+ * the new or the previous selected column. The fix is to
+ * force a redraw of both.
+ *
+ * Feature in Windows. When LVM_SETBKCOLOR is used with
+ * CLR_NONE and LVM_SETSELECTEDCOLUMN is used to select
+ * a column, Windows fills the column with the selection
+ * color, drawing on top of the background image and any
+ * other custom drawing. The fix is to avoid setting the
+ * selected column.
+ */
+ parent.forceResize ();
+ RECT rect = new RECT ();
+ OS.GetClientRect (hwnd, rect);
+ if ((int)/*64*/OS.SendMessage (hwnd, OS.LVM_GETBKCOLOR, 0, 0) != OS.CLR_NONE) {
+ int oldColumn = (int)/*64*/OS.SendMessage (hwnd, OS.LVM_GETSELECTEDCOLUMN, 0, 0);
+ int newColumn = direction == SWT.NONE ? -1 : index;
+ OS.SendMessage (hwnd, OS.LVM_SETSELECTEDCOLUMN, newColumn, 0);
RECT headerRect = new RECT ();
- if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect) != 0) {
- OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);
- rect.left = headerRect.left;
- rect.right = headerRect.right;
- OS.InvalidateRect (hwnd, rect, true);
- }
- } else {
- switch (direction) {
- case SWT.UP:
- case SWT.DOWN:
- setImage (display.getSortImage (direction), true, true);
- break;
- case SWT.NONE:
- setImage (image, false, false);
- break;
+ if (oldColumn != -1) {
+ if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, oldColumn, headerRect) != 0) {
+ OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);
+ rect.left = headerRect.left;
+ rect.right = headerRect.right;
+ OS.InvalidateRect (hwnd, rect, true);
+ }
}
}
+ RECT headerRect = new RECT ();
+ if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect) != 0) {
+ OS.MapWindowPoints (hwndHeader, hwnd, headerRect, 2);
+ rect.left = headerRect.left;
+ rect.right = headerRect.right;
+ OS.InvalidateRect (hwnd, rect, true);
+ }
}
@Override
@@ -815,12 +746,10 @@ public void setText (String string) {
* mnemonic character, Windows does not measure the
* text properly. This causes '...' to always appear
* at the end of the text. The fix is to remove
- * mnemonic characters and replace doubled mnemonics
- * with spaces.
+ * mnemonic characters.
*/
- boolean replace = !OS.IsWinCE && OS.WIN32_VERSION <= OS.VERSION (4, 10);
long /*int*/ hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string, replace), true);
+ TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string), true);
int byteCount = buffer.length () * TCHAR.sizeof;
long /*int*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory (pszText, buffer, byteCount);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
index 83a2c14c81..b671cbe0c5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TableItem.java
@@ -409,7 +409,7 @@ RECT getBounds (int row, int column, boolean getText, boolean getImage, boolean
* move the top of the rectangle up by the grid width.
*/
int gridWidth = parent.getLinesVisible () ? Table.GRID_WIDTH : 0;
- if (OS.COMCTL32_VERSION >= OS.VERSION (5, 80)) rect.top -= gridWidth;
+ rect.top -= gridWidth;
if (column != 0) rect.left += gridWidth;
rect.right = Math.max (rect.right, rect.left);
rect.top += gridWidth;
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 7e1b915c9a..944eac9e8e 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
@@ -93,7 +93,7 @@ public class Text extends Scrollable {
* to stop the compiler from inlining.
*/
static {
- LIMIT = OS.IsWinNT ? 0x7FFFFFFF : 0x7FFF;
+ LIMIT = 0x7FFFFFFF;
DELIMITER = "\r\n";
}
@@ -180,10 +180,8 @@ long /*int*/ callWindowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, lo
case OS.WM_PAINT: {
boolean doubleBuffer = findImageControl () != null;
boolean drawMessage = false;
- if ((style & SWT.SINGLE) != 0 && message.length () > 0) {
- if ((!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 0)) || (style & SWT.READ_ONLY) != 0) {
- drawMessage = hwnd != OS.GetFocus () && OS.GetWindowTextLength (handle) == 0;
- }
+ if ((style & SWT.SINGLE) != 0 && (style & SWT.READ_ONLY) != 0 && message.length () > 0 ) {
+ drawMessage = hwnd != OS.GetFocus () && OS.GetWindowTextLength (handle) == 0;
}
if (doubleBuffer || drawMessage) {
long /*int*/ paintDC = 0;
@@ -209,10 +207,8 @@ long /*int*/ callWindowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, lo
OS.CallWindowProc (EditProc, hwnd, OS.WM_PAINT, hDC, lParam);
/*
- * Bug in XP. Windows does not draw the cue message on XP when
- * East Asian language pack is installed. The fix is to draw
- * the cue messages ourselves.
- * Note: This bug is fixed on Vista.
+ * Bug in Windows. Windows does not draw the cue message when the Edit
+ * control is read-only. The fix is to draw the cue messages ourselves.
*/
if (drawMessage) {
RECT rect = new RECT();
@@ -537,10 +533,6 @@ void applySegments () {
/* Get the current selection */
int [] start = new int [1], end = new int [1];
OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = mbcsToWcsPos (start [0]);
- end [0] = mbcsToWcsPos (end [0]);
- }
boolean oldIgnoreCharacter = ignoreCharacter, oldIgnoreModify = ignoreModify, oldIgnoreVerify = ignoreVerify;
ignoreCharacter = ignoreModify = ignoreVerify = true;
/*
@@ -555,10 +547,6 @@ void applySegments () {
/* Restore selection */
start [0] = translateOffset (start [0]);
end [0] = translateOffset (end [0]);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = wcsToMbcsPos (start [0]);
- end [0] = wcsToMbcsPos (end [0]);
- }
OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
ignoreCharacter = oldIgnoreCharacter;
ignoreModify = oldIgnoreModify;
@@ -613,10 +601,6 @@ void clearSegments (boolean applyText) {
/* Get the current selection */
int [] start = new int [1], end = new int [1];
OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = mbcsToWcsPos (start[0]);
- end [0]= mbcsToWcsPos (end [0]);
- }
start [0] = untranslateOffset (start [0]);
end [0] = untranslateOffset (end[0]);
segments = null;
@@ -627,11 +611,6 @@ void clearSegments (boolean applyText) {
OS.SendMessage (handle, OS.EM_SETSEL, 0, -1);
long /*int*/ undo = OS.SendMessage (handle, OS.EM_CANUNDO, 0, 0);
OS.SendMessage (handle, OS.EM_REPLACESEL, undo, buffer);
- /* Restore selection */
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = wcsToMbcsPos (start [0]);
- end [0] = wcsToMbcsPos (end [0]);
- }
OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
ignoreCharacter = oldIgnoreCharacter;
ignoreModify = oldIgnoreModify;
@@ -648,20 +627,7 @@ void clearSegments (boolean applyText) {
*/
public void clearSelection () {
checkWidget ();
- if (OS.IsWinCE) {
- /*
- * Bug in WinCE. Calling EM_SETSEL with -1 and 0 is equivalent
- * to calling EM_SETSEL with 0 and -1. It causes the entire
- * text to be selected instead of clearing the selection. The
- * fix is to set the start of the selection to the end of the
- * current selection.
- */
- int [] end = new int [1];
- OS.SendMessage (handle, OS.EM_GETSEL, (int []) null, end);
- OS.SendMessage (handle, OS.EM_SETSEL, end [0], end [0]);
- } else {
- OS.SendMessage (handle, OS.EM_SETSEL, -1, 0);
- }
+ OS.SendMessage (handle, OS.EM_SETSEL, -1, 0);
}
@Override Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
@@ -788,13 +754,8 @@ TCHAR deprocessText (TCHAR text, int start, int end, boolean terminate) {
int length = text.length ();
char [] chars;
if (start < 0) start = 0;
- if (OS.IsUnicode) {
- chars = text.chars;
- if (text.chars [length - 1] == 0) length--;
- } else {
- chars = new char [length];
- length = OS.MultiByteToWideChar (getCodePage (), OS.MB_PRECOMPOSED, text.bytes, length, chars, length);
- }
+ chars = text.chars;
+ if (text.chars [length - 1] == 0) length--;
if (end == -1) end = length;
if (segments != null && end > segments [0]) {
int nSegments = segments.length;
@@ -860,14 +821,6 @@ void fixAlignment () {
int bits1 = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
int bits2 = OS.GetWindowLong (handle, OS.GWL_STYLE);
if ((style & SWT.LEFT_TO_RIGHT) != 0) {
- /*
- * Bug in Windows 98. When the edit control is created
- * with the style ES_RIGHT it automatically sets the
- * WS_EX_LEFTSCROLLBAR bit. The fix is to clear the
- * bit when the orientation of the control is left
- * to right.
- */
- bits1 &= ~OS.WS_EX_LEFTSCROLLBAR;
if ((style & SWT.RIGHT) != 0) {
bits1 |= OS.WS_EX_RIGHT;
bits2 |= OS.ES_RIGHT;
@@ -1018,23 +971,21 @@ public int getCaretPosition () {
int startLine = (int)/*64*/OS.SendMessage (handle, OS.EM_LINEFROMCHAR, start [0], 0);
int endLine = (int)/*64*/OS.SendMessage (handle, OS.EM_LINEFROMCHAR, end [0], 0);
if (startLine == endLine) {
- if (!OS.IsWinCE) {
- int idThread = OS.GetWindowThreadProcessId (handle, null);
- GUITHREADINFO lpgui = new GUITHREADINFO ();
- lpgui.cbSize = GUITHREADINFO.sizeof;
- if (OS.GetGUIThreadInfo (idThread, lpgui)) {
- if (lpgui.hwndCaret == handle || lpgui.hwndCaret == 0) {
- POINT ptCurrentPos = new POINT ();
- if (OS.GetCaretPos (ptCurrentPos)) {
- long /*int*/ endPos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, end [0], 0);
- if (endPos == -1) {
- long /*int*/ startPos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, start [0], 0);
- int startX = OS.GET_X_LPARAM (startPos);
- if (ptCurrentPos.x > startX) caret = end [0];
- } else {
- int endX = OS.GET_X_LPARAM (endPos);
- if (ptCurrentPos.x >= endX) caret = end [0];
- }
+ int idThread = OS.GetWindowThreadProcessId (handle, null);
+ GUITHREADINFO lpgui = new GUITHREADINFO ();
+ lpgui.cbSize = GUITHREADINFO.sizeof;
+ if (OS.GetGUIThreadInfo (idThread, lpgui)) {
+ if (lpgui.hwndCaret == handle || lpgui.hwndCaret == 0) {
+ POINT ptCurrentPos = new POINT ();
+ if (OS.GetCaretPos (ptCurrentPos)) {
+ long /*int*/ endPos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, end [0], 0);
+ if (endPos == -1) {
+ long /*int*/ startPos = OS.SendMessage (handle, OS.EM_POSFROMCHAR, start [0], 0);
+ int startX = OS.GET_X_LPARAM (startPos);
+ if (ptCurrentPos.x > startX) caret = end [0];
+ } else {
+ int endX = OS.GET_X_LPARAM (endPos);
+ if (ptCurrentPos.x >= endX) caret = end [0];
}
}
}
@@ -1045,7 +996,6 @@ public int getCaretPosition () {
if (caretLine == endLine) caret = end [0];
}
}
- if (!OS.IsUnicode && OS.IsDBLocale) caret = mbcsToWcsPos (caret);
return untranslateOffset (caret);
}
@@ -1062,7 +1012,6 @@ public int getCaretPosition () {
public int getCharCount () {
checkWidget ();
int length = OS.GetWindowTextLength (handle);
- if (!OS.IsUnicode && OS.IsDBLocale) length = mbcsToWcsPos (length);
return untranslateOffset (length);
}
@@ -1105,9 +1054,7 @@ public boolean getDoubleClickEnabled () {
*/
public char getEchoChar () {
checkWidget ();
- char echo = (char) OS.SendMessage (handle, OS.EM_GETPASSWORDCHAR, 0, 0);
- if (echo != 0 && (echo = Display.mbcsToWcs (echo, getCodePage ())) == 0) echo = '*';
- return echo;
+ return (char) OS.SendMessage (handle, OS.EM_GETPASSWORDCHAR, 0, 0);
}
/**
@@ -1247,7 +1194,6 @@ public String getMessage () {
if (point == null) error (SWT.ERROR_NULL_ARGUMENT);
long /*int*/ lParam = OS.MAKELPARAM (point.x, point.y);
int position = OS.LOWORD (OS.SendMessage (handle, OS.EM_CHARFROMPOS, 0, lParam));
- if (!OS.IsUnicode && OS.IsDBLocale) position = mbcsToWcsPos (position);
return untranslateOffset (position);
}
@@ -1273,10 +1219,6 @@ public Point getSelection () {
checkWidget ();
int [] start = new int [1], end = new int [1];
OS.SendMessage (handle, OS.EM_GETSEL, start, end);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start [0] = mbcsToWcsPos (start [0]);
- end [0] = mbcsToWcsPos (end [0]);
- }
return new Point (untranslateOffset (start [0]), untranslateOffset (end [0]));
}
@@ -1443,7 +1385,6 @@ public String getText (int start, int end) {
checkWidget ();
if (!(start <= end && 0 <= end)) return "";
int length = OS.GetWindowTextLength (handle);
- if (!OS.IsUnicode && OS.IsDBLocale) length = mbcsToWcsPos (length);
end = Math.min (end, untranslateOffset (length) - 1);
if (start > end) return "";
start = Math.max (0, start);
@@ -1583,46 +1524,6 @@ public void insert (String string) {
applySegments ();
}
-int mbcsToWcsPos (int mbcsPos) {
- if (mbcsPos <= 0) return 0;
- if (OS.IsUnicode) return mbcsPos;
- int cp = getCodePage ();
- int wcsTotal = 0, mbcsTotal = 0;
- byte [] buffer = new byte [128];
- String delimiter = getLineDelimiter();
- int delimiterSize = delimiter.length ();
- int count = (int)/*64*/OS.SendMessageA (handle, OS.EM_GETLINECOUNT, 0, 0);
- for (int line=0; line<count; line++) {
- int wcsSize = 0;
- int linePos = (int)/*64*/OS.SendMessageA (handle, OS.EM_LINEINDEX, line, 0);
- int mbcsSize = (int)/*64*/OS.SendMessageA (handle, OS.EM_LINELENGTH, linePos, 0);
- if (mbcsSize != 0) {
- if (mbcsSize + delimiterSize > buffer.length) {
- buffer = new byte [mbcsSize + delimiterSize];
- }
- //ENDIAN
- buffer [0] = (byte) (mbcsSize & 0xFF);
- buffer [1] = (byte) (mbcsSize >> 8);
- mbcsSize = (int)/*64*/OS.SendMessageA (handle, OS.EM_GETLINE, line, buffer);
- wcsSize = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, mbcsSize, null, 0);
- }
- if (line - 1 != count) {
- for (int i=0; i<delimiterSize; i++) {
- buffer [mbcsSize++] = (byte) delimiter.charAt (i);
- }
- wcsSize += delimiterSize;
- }
- if ((mbcsTotal + mbcsSize) >= mbcsPos) {
- int bufferSize = mbcsPos - mbcsTotal;
- wcsSize = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, bufferSize, null, 0);
- return wcsTotal + wcsSize;
- }
- wcsTotal += wcsSize;
- mbcsTotal += mbcsSize;
- }
- return wcsTotal;
-}
-
/**
* Pastes text from clipboard.
* <p>
@@ -1837,12 +1738,6 @@ boolean sendKeyEvent (int type, int msg, long /*int*/ wParam, long /*int*/ lPara
start [0] = start [0] - DELIMITER.length ();
} else {
start [0] = start [0] - 1;
- if (!OS.IsUnicode && OS.IsDBLocale) {
- int [] newStart = new int [1], newEnd = new int [1];
- OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (handle, OS.EM_GETSEL, newStart, newEnd);
- if (start [0] != newStart [0]) start [0] = start [0] - 1;
- }
}
start [0] = Math.max (start [0], 0);
}
@@ -1857,12 +1752,6 @@ boolean sendKeyEvent (int type, int msg, long /*int*/ wParam, long /*int*/ lPara
end [0] = end [0] + DELIMITER.length ();
} else {
end [0] = end [0] + 1;
- if (!OS.IsUnicode && OS.IsDBLocale) {
- int [] newStart = new int [1], newEnd = new int [1];
- OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
- OS.SendMessage (handle, OS.EM_GETSEL, newStart, newEnd);
- if (end [0] != newEnd [0]) end [0] = end [0] + 1;
- }
}
end [0] = Math.min (end [0], length);
}
@@ -1925,7 +1814,7 @@ void setBoundsInPixels (int x, int y, int width, int height, int flags) {
int [] start = new int [1], end = new int [1];
OS.SendMessage (handle, OS.EM_GETSEL, start, end);
if (start [0] != 0 || end [0] != 0) {
- SetWindowPos (handle, 0, x, y, width, height, flags);
+ OS.SetWindowPos (handle, 0, x, y, width, height, flags);
OS.SendMessage (handle, OS.EM_SETSEL, 0, 0);
OS.SendMessage (handle, OS.EM_SETSEL, start [0], end [0]);
return;
@@ -2018,9 +1907,6 @@ public void setDoubleClickEnabled (boolean doubleClick) {
public void setEchoChar (char echo) {
checkWidget ();
if ((style & SWT.MULTI) != 0) return;
- if (echo != 0) {
- if ((echo = (char) Display.wcsToMbcs (echo, getCodePage ())) == 0) echo = '*';
- }
allowPasswordChar = true;
OS.SendMessage (handle, OS.EM_SETPASSWORDCHAR, echo, 0);
allowPasswordChar = false;
@@ -2065,9 +1951,7 @@ void setMargins () {
* fix is to set the margins to zero.
*/
if ((style & SWT.SEARCH) != 0) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.SendMessage (handle, OS.EM_SETMARGINS, OS.EC_LEFTMARGIN | OS.EC_RIGHTMARGIN, 0);
- }
+ OS.SendMessage (handle, OS.EM_SETMARGINS, OS.EC_LEFTMARGIN | OS.EC_RIGHTMARGIN, 0);
}
}
@@ -2094,18 +1978,12 @@ public void setMessage (String message) {
checkWidget ();
if (message == null) error (SWT.ERROR_NULL_ARGUMENT);
this.message = message;
- if (!OS.IsWinCE) {
- if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.ES_MULTILINE) == 0) {
- int length = message.length ();
- char [] chars = new char [length + 1];
- message.getChars(0, length, chars, 0);
- OS.SendMessage (handle, OS.EM_SETCUEBANNER, 0, chars);
- }
- } else {
- OS.InvalidateRect (handle, null, true);
- }
+ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
+ if ((bits & OS.ES_MULTILINE) == 0) {
+ int length = message.length ();
+ char [] chars = new char [length + 1];
+ message.getChars(0, length, chars, 0);
+ OS.SendMessage (handle, OS.EM_SETCUEBANNER, 0, chars);
}
}
@@ -2157,7 +2035,6 @@ public void setOrientation (int orientation) {
public void setSelection (int start) {
checkWidget ();
start = translateOffset (start);
- if (!OS.IsUnicode && OS.IsDBLocale) start = wcsToMbcsPos (start);
OS.SendMessage (handle, OS.EM_SETSEL, start, start);
OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
}
@@ -2191,10 +2068,6 @@ public void setSelection (int start, int end) {
checkWidget ();
start = translateOffset (start);
end = translateOffset (end);
- if (!OS.IsUnicode && OS.IsDBLocale) {
- start = wcsToMbcsPos (start);
- end = wcsToMbcsPos (end);
- }
OS.SendMessage (handle, OS.EM_SETSEL, start, end);
OS.SendMessage (handle, OS.EM_SCROLLCARET, 0, 0);
}
@@ -2532,10 +2405,6 @@ String verifyText (String string, int start, int end, Event keyEvent) {
event.keyCode = keyEvent.keyCode;
event.stateMask = keyEvent.stateMask;
}
- if (!OS.IsUnicode && OS.IsDBLocale) {
- event.start = mbcsToWcsPos (start);
- event.end = mbcsToWcsPos (end);
- }
event.start = untranslateOffset (event.start);
event.end = untranslateOffset (event.end);
@@ -2550,53 +2419,6 @@ String verifyText (String string, int start, int end, Event keyEvent) {
return event.text;
}
-int wcsToMbcsPos (int wcsPos) {
- if (wcsPos <= 0) return 0;
- if (OS.IsUnicode) return wcsPos;
- int cp = getCodePage ();
- int wcsTotal = 0, mbcsTotal = 0;
- byte [] buffer = new byte [128];
- String delimiter = getLineDelimiter ();
- int delimiterSize = delimiter.length ();
- int count = (int)/*64*/OS.SendMessageA (handle, OS.EM_GETLINECOUNT, 0, 0);
- for (int line=0; line<count; line++) {
- int wcsSize = 0;
- int linePos = (int)/*64*/OS.SendMessageA (handle, OS.EM_LINEINDEX, line, 0);
- int mbcsSize = (int)/*64*/OS.SendMessageA (handle, OS.EM_LINELENGTH, linePos, 0);
- if (mbcsSize != 0) {
- if (mbcsSize + delimiterSize > buffer.length) {
- buffer = new byte [mbcsSize + delimiterSize];
- }
- //ENDIAN
- buffer [0] = (byte) (mbcsSize & 0xFF);
- buffer [1] = (byte) (mbcsSize >> 8);
- mbcsSize = (int)/*64*/OS.SendMessageA (handle, OS.EM_GETLINE, line, buffer);
- wcsSize = OS.MultiByteToWideChar (cp, OS.MB_PRECOMPOSED, buffer, mbcsSize, null, 0);
- }
- if (line - 1 != count) {
- for (int i=0; i<delimiterSize; i++) {
- buffer [mbcsSize++] = (byte) delimiter.charAt (i);
- }
- wcsSize += delimiterSize;
- }
- if ((wcsTotal + wcsSize) >= wcsPos) {
- wcsSize = 0;
- int index = 0;
- while (index < mbcsSize) {
- if ((wcsTotal + wcsSize) == wcsPos) {
- return mbcsTotal + index;
- }
- if (OS.IsDBCSLeadByte (buffer [index++])) index++;
- wcsSize++;
- }
- return mbcsTotal + mbcsSize;
- }
- wcsTotal += wcsSize;
- mbcsTotal += mbcsSize;
- }
- return mbcsTotal;
-}
-
@Override
int widgetStyle () {
int bits = super.widgetStyle () | OS.ES_AUTOHSCROLL;
@@ -2618,7 +2440,7 @@ int widgetStyle () {
*/
if ((style & SWT.READ_ONLY) != 0) {
if ((style & (SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.PASSWORD)) == 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
bits |= OS.ES_MULTILINE;
}
}
@@ -2732,12 +2554,7 @@ LRESULT WM_CHAR (long /*int*/ wParam, long /*int*/ lParam) {
switch ((int)/*64*/wParam) {
case SWT.DEL:
if (OS.GetKeyState (OS.VK_CONTROL) < 0) {
- /*
- * 'Ctrl + BackSpace' functionality uses 'EM_REPLACESEL' native
- * API which is supported from Windows Vista. Adding OS version
- * check to avoid crash on WinXP, see more details on bug 496939
- */
- if (OS.WIN32_VERSION < OS.VERSION (6, 0) || (style & SWT.READ_ONLY) != 0 || (style & SWT.PASSWORD) != 0) return LRESULT.ZERO;
+ if ((style & SWT.READ_ONLY) != 0 || (style & SWT.PASSWORD) != 0) return LRESULT.ZERO;
Point selection = getSelection ();
int x = selection.x;
int y = selection.y;
@@ -2804,7 +2621,7 @@ LRESULT WM_ERASEBKGND (long /*int*/ wParam, long /*int*/ lParam) {
Control control = findBackgroundControl ();
if (control == null && background == -1) {
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
control = findThemeControl ();
if (control != null) {
RECT rect = new RECT ();
@@ -2827,18 +2644,6 @@ LRESULT WM_GETDLGCODE (long /*int*/ wParam, long /*int*/ lParam) {
if (result != null) return result;
/*
- * Bug in WinCE PPC. For some reason, sending WM_GETDLGCODE
- * to a multi-line edit control causes it to ignore return and
- * tab keys. The fix is to return the value which is normally
- * returned by the text window proc on other versions of Windows.
- */
- if (OS.IsPPC) {
- if ((style & SWT.MULTI) != 0 && (style & SWT.READ_ONLY) == 0 && lParam == 0) {
- return new LRESULT (OS.DLGC_HASSETSEL | OS.DLGC_WANTALLKEYS | OS.DLGC_WANTCHARS);
- }
- }
-
- /*
* Feature in Windows. Despite the fact that the
* edit control is read only, it still returns a
* dialog code indicating that it wants all keys.
@@ -2943,51 +2748,6 @@ LRESULT WM_LBUTTONDBLCLK (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
- if (OS.IsPPC) {
- LRESULT result = null;
- Display display = this.display;
- display.captureChanged = false;
- boolean dispatch = sendMouseEvent (SWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
- /*
- * Note: On WinCE PPC, only attempt to recognize the gesture for
- * a context menu when the control contains a valid menu or there
- * are listeners for the MenuDetect event.
- *
- * Note: On WinCE PPC, the gesture that brings up a popup menu
- * on the text widget must keep the current text selection. As a
- * result, the window proc is only called if the menu is not shown.
- */
- boolean hasMenu = menu != null && !menu.isDisposed ();
- if (hasMenu || hooks (SWT.MenuDetect)) {
- int x = OS.GET_X_LPARAM (lParam);
- int y = OS.GET_Y_LPARAM (lParam);
- SHRGINFO shrg = new SHRGINFO ();
- shrg.cbSize = SHRGINFO.sizeof;
- shrg.hwndClient = handle;
- shrg.ptDown_x = x;
- shrg.ptDown_y = y;
- shrg.dwFlags = OS.SHRG_RETURNCMD;
- int type = OS.SHRecognizeGesture (shrg);
- if (type == OS.GN_CONTEXTMENU) {
- showMenu (x, y);
- return LRESULT.ONE;
- }
- }
- if (dispatch) {
- result = new LRESULT (callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam));
- } else {
- result = LRESULT.ZERO;
- }
- if (!display.captureChanged && !isDisposed ()) {
- if (OS.GetCapture () != handle) OS.SetCapture (handle);
- }
- return result;
- }
- return super.WM_LBUTTONDOWN (wParam, lParam);
-}
-
-@Override
LRESULT WM_PASTE (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_PASTE (wParam, lParam);
if (result != null) return result;
@@ -3086,7 +2846,7 @@ LRESULT wmColorChild (long /*int*/ wParam, long /*int*/ lParam) {
Control control = findBackgroundControl ();
if (control == null && background == -1) {
if ((state & THEME_BACKGROUND) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
control = findThemeControl ();
if (control != null) {
OS.SetTextColor (wParam, getForegroundPixel ());
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
index f2dc0e944d..33cb9a7bd8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolBar.java
@@ -130,7 +130,7 @@ public ToolBar (Composite parent, int style) {
* not lay out properly. The work around does not run
* in this case.
*/
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if ((style & SWT.RIGHT) != 0) bits |= OS.TBSTYLE_LIST;
}
OS.SetWindowLong (handle, OS.GWL_STYLE, bits | OS.CCS_VERT);
@@ -180,7 +180,7 @@ static int checkStyle (int style) {
@Override
void checkBuffered () {
super.checkBuffered ();
- if (OS.COMCTL32_MAJOR >= 6) style |= SWT.DOUBLE_BUFFERED;
+ style |= SWT.DOUBLE_BUFFERED;
}
@Override
@@ -220,7 +220,7 @@ protected void checkSubclass () {
ignoreResize = true;
if (redraw) OS.UpdateWindow (handle);
int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOREDRAW | OS.SWP_NOZORDER;
- SetWindowPos (handle, 0, 0, 0, newWidth, newHeight, flags);
+ OS.SetWindowPos (handle, 0, 0, 0, newWidth, newHeight, flags);
int count = (int)/*64*/OS.SendMessage (handle, OS.TB_BUTTONCOUNT, 0, 0);
if (count != 0) {
RECT rect = new RECT ();
@@ -228,7 +228,7 @@ protected void checkSubclass () {
width = Math.max (width, rect.right);
height = Math.max (height, rect.bottom);
}
- SetWindowPos (handle, 0, 0, 0, oldWidth, oldHeight, flags);
+ OS.SetWindowPos (handle, 0, 0, 0, oldWidth, oldHeight, flags);
if (redraw) OS.ValidateRect (handle, null);
ignoreResize = false;
}
@@ -315,7 +315,7 @@ void createHandle () {
* with the XP theme.
*/
if ((style & SWT.FLAT) != 0) {
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
+ if (!OS.IsAppThemed ()) {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
bits &= ~OS.TBSTYLE_TRANSPARENT;
OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
@@ -358,8 +358,7 @@ void createHandle () {
OS.SendMessage (handle, OS.TB_SETBUTTONSIZE, 0, 0);
/* Set the extended style bits */
- int bits = OS.TBSTYLE_EX_DRAWDDARROWS | OS.TBSTYLE_EX_MIXEDBUTTONS | OS.TBSTYLE_EX_HIDECLIPPEDBUTTONS;
- if (OS.COMCTL32_MAJOR >= 6) bits |= OS.TBSTYLE_EX_DOUBLEBUFFER;
+ int bits = OS.TBSTYLE_EX_DRAWDDARROWS | OS.TBSTYLE_EX_MIXEDBUTTONS | OS.TBSTYLE_EX_HIDECLIPPEDBUTTONS | OS.TBSTYLE_EX_DOUBLEBUFFER;
OS.SendMessage (handle, OS.TB_SETEXTENDEDSTYLE, 0, bits);
}
@@ -412,12 +411,6 @@ int applyThemeBackground () {
return -1; /* No Change */
}
-@Override
-int defaultBackground () {
- if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_BTNFACE);
- return super.defaultBackground ();
-}
-
void destroyItem (ToolItem item) {
TBBUTTONINFO info = new TBBUTTONINFO ();
info.cbSize = TBBUTTONINFO.sizeof;
@@ -683,7 +676,7 @@ void layoutItems () {
* not lay out properly. The work around does not run
* in this case.
*/
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if ((style & SWT.RIGHT) != 0 && (style & SWT.VERTICAL) == 0) {
boolean hasText = false, hasImage = false;
for (int i=0; i<items.length; i++) {
@@ -795,9 +788,8 @@ void layoutItems () {
@Override
boolean mnemonicHit (char ch) {
- int key = Display.wcsToMbcs (ch);
int [] id = new int [1];
- if (OS.SendMessage (handle, OS.TB_MAPACCELERATOR, key, id) == 0) {
+ if (OS.SendMessage (handle, OS.TB_MAPACCELERATOR, ch, id) == 0) {
return false;
}
if ((style & SWT.FLAT) != 0 && !setTabGroupFocus ()) return false;
@@ -810,9 +802,8 @@ boolean mnemonicHit (char ch) {
@Override
boolean mnemonicMatch (char ch) {
- int key = Display.wcsToMbcs (ch);
int [] id = new int [1];
- if (OS.SendMessage (handle, OS.TB_MAPACCELERATOR, key, id) == 0) {
+ if (OS.SendMessage (handle, OS.TB_MAPACCELERATOR, ch, id) == 0) {
return false;
}
/*
@@ -905,7 +896,7 @@ void setBackgroundTransparent (boolean transparent) {
* platform.
*/
if ((style & SWT.FLAT) != 0) {
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
+ if (!OS.IsAppThemed ()) {
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
if (!transparent && findBackgroundControl () == null) {
bits &= ~OS.TBSTYLE_TRANSPARENT;
@@ -956,7 +947,7 @@ void setDropDownItems (boolean set) {
* NOTE: This work around only runs when the tool bar contains
* only images.
*/
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
boolean hasText = false, hasImage = false;
for (int i=0; i<items.length; i++) {
ToolItem item = items [i];
@@ -1102,7 +1093,7 @@ void setRowCount (int count) {
count += 2;
OS.SendMessage (handle, OS.TB_SETROWS, OS.MAKEWPARAM (count, 1), 0);
int flags = OS.SWP_NOACTIVATE | OS.SWP_NOMOVE | OS.SWP_NOZORDER;
- SetWindowPos (handle, 0, 0, 0, rect.right - rect.left, rect.bottom - rect.top, flags);
+ OS.SetWindowPos (handle, 0, 0, 0, rect.right - rect.left, rect.bottom - rect.top, flags);
ignoreResize = false;
}
}
@@ -1244,7 +1235,7 @@ void updateOrientation () {
@Override
int widgetStyle () {
int bits = super.widgetStyle () | OS.CCS_NORESIZE | OS.TBSTYLE_TOOLTIPS | OS.TBSTYLE_CUSTOMERASE;
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) bits |= OS.TBSTYLE_TRANSPARENT;
+ if (OS.IsAppThemed ()) bits |= OS.TBSTYLE_TRANSPARENT;
if ((style & SWT.SHADOW_OUT) == 0) bits |= OS.CCS_NODIVIDER;
if ((style & SWT.WRAP) != 0) bits |= OS.TBSTYLE_WRAPABLE;
if ((style & SWT.FLAT) != 0) bits |= OS.TBSTYLE_FLAT;
@@ -1261,7 +1252,7 @@ int widgetStyle () {
* not lay out properly. The work around does not run
* in this case.
*/
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
+ if (!OS.IsAppThemed ()) {
if ((style & SWT.RIGHT) != 0) bits |= OS.TBSTYLE_LIST;
}
return bits;
@@ -1344,24 +1335,6 @@ LRESULT WM_COMMAND (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT WM_ERASEBKGND (long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
- /*
- * Bug in Windows. For some reason, NM_CUSTOMDRAW with
- * CDDS_PREERASE and CDDS_POSTERASE is never sent for
- * versions of Windows earlier than XP. The fix is to
- * draw the background in WM_ERASEBKGND;
- */
- if (findBackgroundControl () != null) {
- if (OS.COMCTL32_MAJOR < 6) {
- drawBackground (wParam);
- return LRESULT.ONE;
- }
- }
- return result;
-}
-
-@Override
LRESULT WM_GETDLGCODE (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
/*
@@ -1425,15 +1398,13 @@ LRESULT WM_MOUSELEAVE (long /*int*/ wParam, long /*int*/ lParam) {
* current tooltip and add it again every time
* the mouse leaves the control.
*/
- if (OS.COMCTL32_MAJOR >= 6) {
- TOOLINFO lpti = new TOOLINFO ();
- lpti.cbSize = TOOLINFO.sizeof;
- long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0);
- if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) {
- if ((lpti.uFlags & OS.TTF_IDISHWND) == 0) {
- OS.SendMessage (hwndToolTip, OS.TTM_DELTOOL, 0, lpti);
- OS.SendMessage (hwndToolTip, OS.TTM_ADDTOOL, 0, lpti);
- }
+ TOOLINFO lpti = new TOOLINFO ();
+ lpti.cbSize = TOOLINFO.sizeof;
+ long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.TB_GETTOOLTIPS, 0, 0);
+ if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) {
+ if ((lpti.uFlags & OS.TTF_IDISHWND) == 0) {
+ OS.SendMessage (hwndToolTip, OS.TTM_DELTOOL, 0, lpti);
+ OS.SendMessage (hwndToolTip, OS.TTM_ADDTOOL, 0, lpti);
}
}
return result;
@@ -1595,7 +1566,6 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
break;
case OS.NM_CUSTOMDRAW:
- if (OS.COMCTL32_MAJOR < 6) break;
/*
* Bug in Windows. For some reason, under the XP Silver
* theme, tool bars continue to draw using the gray color
@@ -1605,7 +1575,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
NMTBCUSTOMDRAW nmcd = new NMTBCUSTOMDRAW ();
OS.MoveMemory (nmcd, lParam, NMTBCUSTOMDRAW.sizeof);
// if (drawCount != 0 || !OS.IsWindowVisible (handle)) {
-// if (!OS.IsWinCE && OS.WindowFromDC (nmcd.hdc) == handle) break;
+// if (OS.WindowFromDC (nmcd.hdc) == handle) break;
// }
switch (nmcd.dwDrawStage) {
case OS.CDDS_PREERASE: {
@@ -1639,41 +1609,39 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
break;
case OS.TBN_HOTITEMCHANGE:
- if (!OS.IsWinCE) {
- NMTBHOTITEM lpnmhi = new NMTBHOTITEM ();
- OS.MoveMemory (lpnmhi, lParam, NMTBHOTITEM.sizeof);
- switch (lpnmhi.dwFlags) {
- case OS.HICF_MOUSE: {
- /*
- * Bug in Windows. When the tool bar has focus, a mouse is
- * in an item and hover help for that item is displayed and
- * then the arrow keys are used to change the hot item,
- * for some reason, Windows snaps the hot item back to the
- * one that is under the mouse. The fix is to disallow
- * hot item changes when the user is traversing using the
- * arrow keys.
- */
- if (lastArrowId != -1) return LRESULT.ONE;
- break;
- }
- case OS.HICF_ARROWKEYS: {
- RECT client = new RECT ();
- OS.GetClientRect (handle, client);
- int index = (int)/*64*/OS.SendMessage (handle, OS.TB_COMMANDTOINDEX, lpnmhi.idNew, 0);
- RECT rect = new RECT ();
- OS.SendMessage (handle, OS.TB_GETITEMRECT, index, rect);
- if (rect.right > client.right || rect.bottom > client.bottom) {
- return LRESULT.ONE;
- }
- lastArrowId = lpnmhi.idNew;
- break;
- }
- default:
- lastArrowId = -1;
+ NMTBHOTITEM lpnmhi = new NMTBHOTITEM ();
+ OS.MoveMemory (lpnmhi, lParam, NMTBHOTITEM.sizeof);
+ switch (lpnmhi.dwFlags) {
+ case OS.HICF_MOUSE: {
+ /*
+ * Bug in Windows. When the tool bar has focus, a mouse is
+ * in an item and hover help for that item is displayed and
+ * then the arrow keys are used to change the hot item,
+ * for some reason, Windows snaps the hot item back to the
+ * one that is under the mouse. The fix is to disallow
+ * hot item changes when the user is traversing using the
+ * arrow keys.
+ */
+ if (lastArrowId != -1) return LRESULT.ONE;
+ break;
}
- if ((lpnmhi.dwFlags & OS.HICF_LEAVING) == 0) {
- lastHotId = lpnmhi.idNew;
+ case OS.HICF_ARROWKEYS: {
+ RECT client = new RECT ();
+ OS.GetClientRect (handle, client);
+ int index = (int)/*64*/OS.SendMessage (handle, OS.TB_COMMANDTOINDEX, lpnmhi.idNew, 0);
+ RECT rect = new RECT ();
+ OS.SendMessage (handle, OS.TB_GETITEMRECT, index, rect);
+ if (rect.right > client.right || rect.bottom > client.bottom) {
+ return LRESULT.ONE;
+ }
+ lastArrowId = lpnmhi.idNew;
+ break;
}
+ default:
+ lastArrowId = -1;
+ }
+ if ((lpnmhi.dwFlags & OS.HICF_LEAVING) == 0) {
+ lastHotId = lpnmhi.idNew;
}
break;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
index 3805e49625..ae49bd1b44 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
@@ -802,7 +802,7 @@ void _setText (String string) {
if (string.length () != 0) {
info.fsStyle |= OS.BTNS_SHOWTEXT;
TCHAR buffer;
- if (OS.IsUnicode && (style & SWT.FLIP_TEXT_DIRECTION) != 0) {
+ if ((style & SWT.FLIP_TEXT_DIRECTION) != 0) {
int bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
if ((bits & OS.WS_EX_LAYOUTRTL) != 0) {
buffer = new TCHAR (parent.getCodePage (), LRE + string, true);
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 a5e9a2f515..7bb5ebf430 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
@@ -214,7 +214,6 @@ public String getText () {
*/
public boolean getVisible () {
checkWidget();
- if (OS.IsWinCE) return false;
if (item != null) return visible;
long /*int*/ hwndToolTip = hwndToolTip ();
if (OS.SendMessage (hwndToolTip, OS.TTM_GETCURRENTTOOL, 0, 0) != 0) {
@@ -229,19 +228,12 @@ public boolean getVisible () {
int getWidth () {
long /*int*/ hwnd = parent.handle;
- int maxWidth = 0;
- if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) {
- RECT rect = new RECT ();
- OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
- maxWidth = rect.right - rect.left;
- } else {
- long /*int*/ hmonitor = OS.MonitorFromWindow (hwnd, OS.MONITOR_DEFAULTTONEAREST);
- MONITORINFO lpmi = new MONITORINFO ();
- lpmi.cbSize = MONITORINFO.sizeof;
- OS.GetMonitorInfo (hmonitor, lpmi);
- maxWidth = lpmi.rcWork_right - lpmi.rcWork_left;
- }
- return maxWidth /= 4;
+ long /*int*/ hmonitor = OS.MonitorFromWindow (hwnd, OS.MONITOR_DEFAULTTONEAREST);
+ MONITORINFO lpmi = new MONITORINFO ();
+ lpmi.cbSize = MONITORINFO.sizeof;
+ OS.GetMonitorInfo (hmonitor, lpmi);
+ int maxWidth = lpmi.rcWork_right - lpmi.rcWork_left;
+ return maxWidth / 4;
}
long /*int*/ hwndToolTip () {
@@ -497,7 +489,6 @@ void updateMessage () {
*/
public void setVisible (boolean visible) {
checkWidget ();
- if (OS.IsWinCE) return;
if (visible == getVisible ()) return;
if (item == null) {
long /*int*/ hwnd = parent.handle;
@@ -562,7 +553,7 @@ public void setVisible (boolean visible) {
}
return;
}
- if (item != null && OS.SHELL32_MAJOR >= 5) {
+ if (item != null) {
if (visible) {
NOTIFYICONDATA iconData = OS.IsUnicode ? (NOTIFYICONDATA) new NOTIFYICONDATAW () : new NOTIFYICONDATAA ();
TCHAR buffer1 = new TCHAR (0, text, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java
index 44e2a01bd5..930c4d8bb6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tracker.java
@@ -53,8 +53,6 @@ public class Tracker extends Widget {
long /*int*/ hwndTransparent, hwndOpaque, oldTransparentProc, oldOpaqueProc;
int oldX, oldY;
- static boolean IsVista = !OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0);
-
/*
* The following values mirror step sizes on Windows
*/
@@ -495,7 +493,7 @@ public boolean open () {
* Note that one window (almost opaque) is used for catching all events and a
* second window is used for drawing the rectangles.
*/
- if (IsVista && parent == null) {
+ if (parent == null) {
Rectangle bounds = display.getBoundsInPixels();
hwndTransparent = OS.CreateWindowEx (
OS.WS_EX_LAYERED | OS.WS_EX_NOACTIVATE | OS.WS_EX_TOOLWINDOW,
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 df15e474e9..50c8c4f0bc 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
@@ -533,7 +533,7 @@ public void setToolTipText (String string) {
/*
* Note that the size of the szTip field is different in version 5.0 of shell32.dll.
*/
- int length = OS.SHELL32_MAJOR < 5 ? 64 : 128;
+ int length = 128;
if (OS.IsUnicode) {
char [] szTip = ((NOTIFYICONDATAW) iconData).szTip;
length = Math.min (length - 1, buffer.length ());
@@ -578,22 +578,10 @@ public void setVisible (boolean visible) {
iconData.cbSize = NOTIFYICONDATA.sizeof;
iconData.uID = id;
iconData.hWnd = display.hwndMessage;
- if (OS.SHELL32_MAJOR < 5) {
- if (visible) {
- iconData.uFlags = OS.NIF_MESSAGE;
- iconData.uCallbackMessage = Display.SWT_TRAYICONMSG;
- OS.Shell_NotifyIcon (OS.NIM_MODIFY, iconData);
- setImage (image);
- setToolTipText (toolTipText);
- } else {
- OS.Shell_NotifyIcon (OS.NIM_DELETE, iconData);
- }
- } else {
- iconData.uFlags = OS.NIF_STATE;
- iconData.dwState = visible ? 0 : OS.NIS_HIDDEN;
- iconData.dwStateMask = OS.NIS_HIDDEN;
- OS.Shell_NotifyIcon (OS.NIM_MODIFY, iconData);
- }
+ iconData.uFlags = OS.NIF_STATE;
+ iconData.dwState = visible ? 0 : OS.NIS_HIDDEN;
+ iconData.dwStateMask = OS.NIS_HIDDEN;
+ OS.Shell_NotifyIcon (OS.NIM_MODIFY, iconData);
if (!visible) sendEvent (SWT.Hide);
}
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 1a244cdb98..e9f88b3f63 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
@@ -89,7 +89,7 @@ public class Tree extends Composite {
boolean dragStarted, gestureCompleted, insertAfter, shrink, ignoreShrink;
boolean ignoreSelect, ignoreExpand, ignoreDeselect, ignoreResize;
boolean lockSelection, oldSelected, newSelected, ignoreColumnMove;
- boolean linesVisible, customDraw, printClient, painted, ignoreItemHeight;
+ boolean linesVisible, customDraw, painted, ignoreItemHeight;
boolean ignoreCustomDraw, ignoreDrawForeground, ignoreDrawBackground, ignoreDrawFocus;
boolean ignoreDrawSelection, ignoreDrawHot, ignoreFullSelection, explorerTheme;
boolean createdAsRTL;
@@ -110,7 +110,6 @@ public class Tree extends Composite {
static final int INCREMENT = 5;
static final int EXPLORER_EXTRA = 2;
static final int DRAG_IMAGE_SIZE = 301;
- static final boolean EXPLORER_THEME = true;
static final long /*int*/ TreeProc;
static final TCHAR TreeClass = new TCHAR (0, OS.WC_TREEVIEW, true);
static final long /*int*/ HeaderProc;
@@ -236,7 +235,7 @@ void _addListener (int eventType, Listener listener) {
*/
int count = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
if (count != 0 && (bits & OS.TVS_NOHSCROLL) != 0) {
- if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
+ OS.ShowScrollBar (handle, OS.SB_HORZ, false);
}
}
break;
@@ -444,7 +443,7 @@ LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int
}
}
int sortIndex = -1, clrSortBk = -1;
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (sortColumn != null && sortDirection != SWT.NONE) {
if (findImageControl () == null) {
sortIndex = indexOf (sortColumn);
@@ -959,17 +958,11 @@ LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*
}
RECT clipRect = null;
if (columnCount != 0) {
- boolean clip = !printClient;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- clip = true;
- }
- if (clip) {
- clipRect = new RECT ();
- HDITEM hdItem = new HDITEM ();
- hdItem.mask = OS.HDI_WIDTH;
- OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
- OS.SetRect (clipRect, nmcd.left, nmcd.top, nmcd.left + hdItem.cxy, nmcd.bottom);
- }
+ clipRect = new RECT ();
+ HDITEM hdItem = new HDITEM ();
+ hdItem.mask = OS.HDI_WIDTH;
+ OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
+ OS.SetRect (clipRect, nmcd.left, nmcd.top, nmcd.left + hdItem.cxy, nmcd.bottom);
}
int clrText = -1, clrTextBk = -1;
if (OS.IsWindowEnabled (handle)) {
@@ -979,7 +972,7 @@ LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*
if (clrTextBk == -1) clrTextBk = item.background;
}
int clrSortBk = -1;
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (sortColumn != null && sortDirection != SWT.NONE) {
if (findImageControl () == null) {
if (indexOf (sortColumn) == index) {
@@ -1236,7 +1229,7 @@ LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*
hdItem.mask = OS.HDI_WIDTH;
OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.left + hdItem.cxy, nmcd.bottom);
- if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
+ if (!OS.IsAppThemed ()) {
RECT itemRect = new RECT ();
if (OS.TreeView_GetItemRect (handle, item.handle, itemRect, true)) {
rect.left = Math.min (itemRect.left, rect.right);
@@ -1341,7 +1334,7 @@ LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*
LRESULT CDDS_POSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*/ lParam) {
if (ignoreCustomDraw) return null;
if (OS.IsWindowVisible (handle)) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (sortColumn != null && sortDirection != SWT.NONE) {
if (findImageControl () == null) {
int index = indexOf (sortColumn);
@@ -1364,7 +1357,7 @@ LRESULT CDDS_POSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*/ l
* WM_NOTIFY with NM_CUSTOMDRAW and CDDS_POSTPAINT.
*/
long /*int*/ hItem = 0;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
hItem = getBottomItem ();
} else {
hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
@@ -1420,7 +1413,7 @@ LRESULT CDDS_POSTPAINT (NMTVCUSTOMDRAW nmcd, long /*int*/ wParam, long /*int*/ l
* WM_NOTIFY with NM_CUSTOMDRAW and CDDS_POSTPAINT.
*/
long /*int*/ hItem = 0;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
hItem = getBottomItem ();
} else {
hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
@@ -1628,11 +1621,9 @@ void checkBuffered () {
style |= SWT.DOUBLE_BUFFERED;
OS.SendMessage (handle, OS.TVM_SETSCROLLTIME, 0, 0);
}
- if (EXPLORER_THEME) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0) && OS.IsAppThemed ()) {
- int exStyle = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETEXTENDEDSTYLE, 0, 0);
- if ((exStyle & OS.TVS_EX_DOUBLEBUFFER) != 0) style |= SWT.DOUBLE_BUFFERED;
- }
+ if (OS.IsAppThemed ()) {
+ int exStyle = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETEXTENDEDSTYLE, 0, 0);
+ if ((exStyle & OS.TVS_EX_DOUBLEBUFFER) != 0) style |= SWT.DOUBLE_BUFFERED;
}
}
@@ -1865,41 +1856,23 @@ void createHandle () {
state &= ~(CANVAS | THEME_BACKGROUND);
/* Use the Explorer theme */
- if (EXPLORER_THEME) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0) && OS.IsAppThemed ()) {
- explorerTheme = true;
- OS.SetWindowTheme (handle, Display.EXPLORER, null);
- int bits = OS.TVS_EX_DOUBLEBUFFER | OS.TVS_EX_RICHTOOLTIP;
- if (ENABLE_TVS_EX_FADEINOUTEXPANDOS) bits |= OS.TVS_EX_FADEINOUTEXPANDOS;
- /*
- * This code is intentionally commented.
- */
-// if ((style & SWT.FULL_SELECTION) == 0) bits |= OS.TVS_EX_AUTOHSCROLL;
- OS.SendMessage (handle, OS.TVM_SETEXTENDEDSTYLE, 0, bits);
- /*
- * Bug in Windows. When the tree is using the explorer
- * theme, it does not use COLOR_WINDOW_TEXT for the
- * default foreground color. The fix is to explicitly
- * set the foreground.
- */
- setForegroundPixel (-1);
- }
- }
-
- /*
- * Feature in Windows. In version 5.8 of COMCTL32.DLL,
- * if the font is changed for an item, the bounds for the
- * item are not updated, causing the text to be clipped.
- * The fix is to detect the version of COMCTL32.DLL, and
- * if it is one of the versions with the problem, then
- * use version 5.00 of the control (a version that does
- * not have the problem). This is the recommended work
- * around from the MSDN.
- */
- if (!OS.IsWinCE) {
- if (OS.COMCTL32_MAJOR < 6) {
- OS.SendMessage (handle, OS.CCM_SETVERSION, 5, 0);
- }
+ if (OS.IsAppThemed ()) {
+ explorerTheme = true;
+ OS.SetWindowTheme (handle, Display.EXPLORER, null);
+ int bits = OS.TVS_EX_DOUBLEBUFFER | OS.TVS_EX_RICHTOOLTIP;
+ if (ENABLE_TVS_EX_FADEINOUTEXPANDOS) bits |= OS.TVS_EX_FADEINOUTEXPANDOS;
+ /*
+ * This code is intentionally commented.
+ */
+// if ((style & SWT.FULL_SELECTION) == 0) bits |= OS.TVS_EX_AUTOHSCROLL;
+ OS.SendMessage (handle, OS.TVM_SETEXTENDEDSTYLE, 0, bits);
+ /*
+ * Bug in Windows. When the tree is using the explorer
+ * theme, it does not use COLOR_WINDOW_TEXT for the
+ * default foreground color. The fix is to explicitly
+ * set the foreground.
+ */
+ setForegroundPixel (-1);
}
/* Set the checkbox image list */
@@ -1924,12 +1897,9 @@ void createHandle () {
}
void createHeaderToolTips () {
- if (OS.IsWinCE) return;
if (headerToolTipHandle != 0) return;
int bits = 0;
- if (OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- if ((style & SWT.RIGHT_TO_LEFT) != 0) bits |= OS.WS_EX_LAYOUTRTL;
- }
+ if ((style & SWT.RIGHT_TO_LEFT) != 0) bits |= OS.WS_EX_LAYOUTRTL;
headerToolTipHandle = OS.CreateWindowEx (
bits,
new TCHAR (0, OS.TOOLTIPS_CLASS, true),
@@ -2051,7 +2021,7 @@ void createItem (TreeColumn column, int index) {
*/
int count = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
if (count != 0) {
- if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
+ OS.ShowScrollBar (handle, OS.SB_HORZ, false);
}
createItemToolTips ();
if (itemToolTipHandle != 0) {
@@ -2187,18 +2157,13 @@ void createItem (TreeItem item, long /*int*/ hParent, long /*int*/ hInsertAfter,
RECT damageRect = new RECT ();
boolean damaged = OS.GetUpdateRect (handle, damageRect, true);
if (damaged && damageRect.top < rect.bottom) {
- if (OS.IsWinCE) {
- OS.OffsetRect (damageRect, 0, rect.bottom - rect.top);
- OS.InvalidateRect (handle, damageRect, true);
- } else {
- long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
- int result = OS.GetUpdateRgn (handle, rgn, true);
- if (result != OS.NULLREGION) {
- OS.OffsetRgn (rgn, 0, rect.bottom - rect.top);
- OS.InvalidateRgn (handle, rgn, true);
- }
- OS.DeleteObject (rgn);
+ long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
+ int result = OS.GetUpdateRgn (handle, rgn, true);
+ if (result != OS.NULLREGION) {
+ OS.OffsetRgn (rgn, 0, rect.bottom - rect.top);
+ OS.InvalidateRgn (handle, rgn, true);
}
+ OS.DeleteObject (rgn);
}
}
}
@@ -2208,26 +2173,20 @@ void createItem (TreeItem item, long /*int*/ hParent, long /*int*/ hInsertAfter,
}
void createItemToolTips () {
- if (OS.IsWinCE) return;
if (itemToolTipHandle != 0) return;
int bits1 = OS.GetWindowLong (handle, OS.GWL_STYLE);
bits1 |= OS.TVS_NOTOOLTIPS;
OS.SetWindowLong (handle, OS.GWL_STYLE, bits1);
int bits2 = 0;
- if (OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- if ((style & SWT.RIGHT_TO_LEFT) != 0) bits2 |= OS.WS_EX_LAYOUTRTL;
- }
+ if ((style & SWT.RIGHT_TO_LEFT) != 0) bits2 |= OS.WS_EX_LAYOUTRTL;
/*
* Feature in Windows. For some reason, when the user
* clicks on a tool tip, it temporarily takes focus, even
* when WS_EX_NOACTIVATE is specified. The fix is to
* use WS_EX_TRANSPARENT, even though WS_EX_TRANSPARENT
* is documented to affect painting, not hit testing.
- *
- * NOTE: Windows 2000 doesn't have the problem and
- * setting WS_EX_TRANSPARENT causes pixel corruption.
*/
- if (OS.COMCTL32_MAJOR >= 6) bits2 |= OS.WS_EX_TRANSPARENT;
+ bits2 |= OS.WS_EX_TRANSPARENT;
itemToolTipHandle = OS.CreateWindowEx (
bits2,
new TCHAR (0, OS.TOOLTIPS_CLASS, true),
@@ -2281,11 +2240,8 @@ void createParent () {
null);
if (hwndParent == 0) error (SWT.ERROR_NO_HANDLES);
OS.SetWindowLongPtr (hwndParent, OS.GWLP_ID, hwndParent);
- int bits = 0;
- if (OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
- bits |= OS.WS_EX_NOINHERITLAYOUT;
- if ((style & SWT.RIGHT_TO_LEFT) != 0) bits |= OS.WS_EX_LAYOUTRTL;
- }
+ int bits = OS.WS_EX_NOINHERITLAYOUT;
+ if ((style & SWT.RIGHT_TO_LEFT) != 0) bits |= OS.WS_EX_LAYOUTRTL;
hwndHeader = OS.CreateWindowEx (
bits,
HeaderClass,
@@ -2316,7 +2272,7 @@ void createParent () {
if (hFont != 0) OS.SendMessage (hwndHeader, OS.WM_SETFONT, hFont, 0);
long /*int*/ hwndInsertAfter = OS.GetWindow (handle, OS.GW_HWNDPREV);
int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
- SetWindowPos (hwndParent, hwndInsertAfter, 0, 0, 0, 0, flags);
+ OS.SetWindowPos (hwndParent, hwndInsertAfter, 0, 0, 0, 0, flags);
SCROLLINFO info = new SCROLLINFO ();
info.cbSize = SCROLLINFO.sizeof;
info.fMask = OS.SIF_RANGE | OS.SIF_PAGE;
@@ -2628,10 +2584,8 @@ void destroyItem (TreeItem item, long /*int*/ hItem) {
*
* NOTE: This only happens on Vista.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.TVM_GETTOOLTIPS, 0, 0);
- if (hwndToolTip != 0) OS.SendMessage (hwndToolTip, OS.TTM_POP, 0 ,0);
- }
+ long /*int*/ hwndToolTip = OS.SendMessage (handle, OS.TVM_GETTOOLTIPS, 0, 0);
+ if (hwndToolTip != 0) OS.SendMessage (hwndToolTip, OS.TTM_POP, 0 ,0);
shrink = ignoreShrink = true;
OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, hItem);
@@ -2709,13 +2663,9 @@ void enableWidget (boolean enabled) {
* changed, causing Windows to draw correctly.
*/
Control control = findBackgroundControl ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (control == null) control = this;
- }
- if (control != null) {
- if (control.backgroundImage == null) {
- _setBackgroundPixel (hasCustomBackground() ? control.getBackgroundPixel () : -1);
- }
+ if (control == null) control = this;
+ if (control.backgroundImage == null) {
+ _setBackgroundPixel (hasCustomBackground() ? control.getBackgroundPixel () : -1);
}
if (hwndParent != 0) OS.EnableWindow (hwndParent, enabled);
@@ -3407,19 +3357,12 @@ public boolean getLinesVisible () {
return linesVisible;
}
-long /*int*/ getNextSelection (long /*int*/ hItem, TVITEM tvItem) {
+long /*int*/ getNextSelection (long /*int*/ hItem) {
while (hItem != 0) {
- int state = 0;
- if (OS.IsWinCE) {
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
if ((state & OS.TVIS_SELECTED) != 0) return hItem;
long /*int*/ hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
- long /*int*/ hSelected = getNextSelection (hFirstItem, tvItem);
+ long /*int*/ hSelected = getNextSelection (hFirstItem);
if (hSelected != 0) return hSelected;
hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
}
@@ -3446,7 +3389,7 @@ public TreeItem getParentItem () {
int getSelection (long /*int*/ hItem, TVITEM tvItem, TreeItem [] selection, int index, int count, boolean bigSelection, boolean all) {
while (hItem != 0) {
boolean expanded = true;
- if (OS.IsWinCE || bigSelection) {
+ if (bigSelection) {
tvItem.hItem = hItem;
OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
if ((tvItem.state & OS.TVIS_SELECTED) != 0) {
@@ -3534,23 +3477,11 @@ public TreeItem [] getSelection () {
long /*int*/ hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
count = getSelection (hItem, tvItem, guess, 0, -1, false, true);
} else {
- TVITEM tvItem = null;
- if (OS.IsWinCE) {
- tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- }
for (int i=0; i<items.length; i++) {
TreeItem item = items [i];
if (item != null) {
long /*int*/ hItem = item.handle;
- int state = 0;
- if (OS.IsWinCE) {
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
if ((state & OS.TVIS_SELECTED) != 0) {
if (count < guess.length) guess [count] = item;
count++;
@@ -3599,42 +3530,21 @@ public int getSelectionCount () {
if ((style & SWT.SINGLE) != 0) {
long /*int*/ hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
if (hItem == 0) return 0;
- int state = 0;
- if (OS.IsWinCE) {
- TVITEM tvItem = new TVITEM ();
- tvItem.hItem = hItem;
- tvItem.mask = OS.TVIF_STATE;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
return (state & OS.TVIS_SELECTED) == 0 ? 0 : 1;
}
int count = 0;
long /*int*/ oldProc = OS.GetWindowLongPtr (handle, OS.GWLP_WNDPROC);
- TVITEM tvItem = null;
- if (OS.IsWinCE) {
- tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- }
OS.SetWindowLongPtr (handle, OS.GWLP_WNDPROC, TreeProc);
if ((style & SWT.VIRTUAL) != 0) {
long /*int*/ hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- count = getSelection (hItem, tvItem, null, 0, -1, false, true);
+ count = getSelection (hItem, null, null, 0, -1, false, true);
} else {
for (int i=0; i<items.length; i++) {
TreeItem item = items [i];
if (item != null) {
long /*int*/ hItem = item.handle;
- int state = 0;
- if (OS.IsWinCE) {
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
if ((state & OS.TVIS_SELECTED) != 0) count++;
}
}
@@ -3916,22 +3826,10 @@ void redrawSelection () {
} else {
long /*int*/ hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
if (hItem != 0) {
- TVITEM tvItem = null;
- if (OS.IsWinCE) {
- tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- }
RECT rect = new RECT ();
int index = 0, count = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETVISIBLECOUNT, 0, 0);
while (index <= count && hItem != 0) {
- int state = 0;
- if (OS.IsWinCE) {
- tvItem.hItem = hItem;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
if ((state & OS.TVIS_SELECTED) != 0) {
if (OS.TreeView_GetItemRect (handle, hItem, rect, false)) {
OS.InvalidateRect (handle, rect, true);
@@ -4215,21 +4113,14 @@ void setItemCount (int count, long /*int*/ hParent, long /*int*/ hItem) {
TVITEM tvItem = new TVITEM ();
tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
if (!redraw && (style & SWT.VIRTUAL) != 0) {
- if (OS.IsWinCE) {
- tvItem.hItem = hParent;
- tvItem.mask = OS.TVIF_STATE;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- expanded = (tvItem.state & OS.TVIS_EXPANDED) != 0;
- } else {
- /*
- * Bug in Windows. Despite the fact that TVM_GETITEMSTATE claims
- * to return only the bits specified by the stateMask, when called
- * with TVIS_EXPANDED, the entire state is returned. The fix is
- * to explicitly check for the TVIS_EXPANDED bit.
- */
- int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hParent, OS.TVIS_EXPANDED);
- expanded = (state & OS.TVIS_EXPANDED) != 0;
- }
+ /*
+ * Bug in Windows. Despite the fact that TVM_GETITEMSTATE claims
+ * to return only the bits specified by the stateMask, when called
+ * with TVIS_EXPANDED, the entire state is returned. The fix is
+ * to explicitly check for the TVIS_EXPANDED bit.
+ */
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hParent, OS.TVIS_EXPANDED);
+ expanded = (state & OS.TVIS_EXPANDED) != 0;
}
while (hItem != 0) {
tvItem.hItem = hItem;
@@ -4355,16 +4246,7 @@ public void select (TreeItem item) {
if (item.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
if ((style & SWT.SINGLE) != 0) {
long /*int*/ hItem = item.handle;
- int state = 0;
- if (OS.IsWinCE) {
- TVITEM tvItem = new TVITEM ();
- tvItem.hItem = hItem;
- tvItem.mask = OS.TVIF_STATE;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
if ((state & OS.TVIS_SELECTED) != 0) return;
/*
* Feature in Windows. When an item is selected with
@@ -4407,9 +4289,7 @@ public void select (TreeItem item) {
*
* NOTE: This code is only necessary on Windows Vista.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.SetScrollInfo (handle, OS.SB_VERT, vInfo, true);
- }
+ OS.SetScrollInfo (handle, OS.SB_VERT, vInfo, true);
long /*int*/ vThumb = OS.MAKELPARAM (OS.SB_THUMBPOSITION, vInfo.nPos);
OS.SendMessage (handle, OS.WM_VSCROLL, vThumb, 0);
if (redraw) {
@@ -4681,30 +4561,9 @@ public void setColumnOrder (int [] order) {
void setCheckboxImageList () {
if ((style & SWT.CHECK) == 0) return;
- int count = 5, flags = 0;
- if (OS.IsWinCE) {
- flags |= OS.ILC_COLOR;
- } else {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
- flags |= OS.ILC_COLOR32;
- } else {
- long /*int*/ hDC = OS.GetDC (handle);
- int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
- int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
- OS.ReleaseDC (handle, hDC);
- int depth = bits * planes;
- switch (depth) {
- case 4: flags |= OS.ILC_COLOR4; break;
- case 8: flags |= OS.ILC_COLOR8; break;
- case 16: flags |= OS.ILC_COLOR16; break;
- case 24: flags |= OS.ILC_COLOR24; break;
- case 32: flags |= OS.ILC_COLOR32; break;
- default: flags |= OS.ILC_COLOR; break;
- }
- flags |= OS.ILC_MASK;
- }
- }
+ int count = 5, flags = OS.ILC_COLOR32;
if ((style & SWT.RIGHT_TO_LEFT) != 0) flags |= OS.ILC_MIRROR;
+ if (!OS.IsAppThemed ()) flags |= OS.ILC_MASK;
int height = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMHEIGHT, 0, 0), width = height;
long /*int*/ hStateList = OS.ImageList_Create (width, height, flags, count, count);
long /*int*/ hDC = OS.GetDC (handle);
@@ -4720,7 +4579,7 @@ void setCheckboxImageList () {
* fill it with a color that is neither black or white.
*/
int clrBackground = 0;
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
Control control = findBackgroundControl ();
if (control == null) control = this;
clrBackground = control.getBackgroundPixel ();
@@ -4751,7 +4610,7 @@ void setCheckboxImageList () {
itemHeight = Math.min (20, itemHeight);
int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2 + 1;
OS.SetRect (rect, left + width, top, left + width + itemWidth, top + itemHeight);
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
long /*int*/ hTheme = display.hButtonTheme ();
OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, rect, null);
rect.left += width; rect.right += width;
@@ -4772,7 +4631,7 @@ void setCheckboxImageList () {
OS.SelectObject (memDC, hOldBitmap);
OS.DeleteDC (memDC);
OS.ReleaseDC (handle, hDC);
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
OS.ImageList_Add (hStateList, hBitmap, 0);
} else {
OS.ImageList_AddMasked (hStateList, hBitmap, clrBackground);
@@ -5011,14 +4870,14 @@ void setScrollWidth (int width) {
OS.MoveMemory (pos, playout.pwpos, WINDOWPOS.sizeof);
if (playout.prc != 0) OS.HeapFree (hHeap, 0, playout.prc);
if (playout.pwpos != 0) OS.HeapFree (hHeap, 0, playout.pwpos);
- SetWindowPos (hwndHeader, OS.HWND_TOP, pos.x - left, pos.y, pos.cx + left, pos.cy, OS.SWP_NOACTIVATE);
+ OS.SetWindowPos (hwndHeader, OS.HWND_TOP, pos.x - left, pos.y, pos.cx + left, pos.cy, OS.SWP_NOACTIVATE);
int bits = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
int b = (bits & OS.WS_EX_CLIENTEDGE) != 0 ? OS.GetSystemMetrics (OS.SM_CXEDGE) : 0;
int w = pos.cx + (columnCount == 0 && width == 0 ? 0 : OS.GetSystemMetrics (OS.SM_CXVSCROLL));
int h = rect.bottom - rect.top - pos.cy;
boolean oldIgnore = ignoreResize;
ignoreResize = true;
- SetWindowPos (handle, 0, pos.x - left - b, pos.y + pos.cy - b, w + left + b * 2, h + b * 2, OS.SWP_NOACTIVATE | OS.SWP_NOZORDER);
+ OS.SetWindowPos (handle, 0, pos.x - left - b, pos.y + pos.cy - b, w + left + b * 2, h + b * 2, OS.SWP_NOACTIVATE | OS.SWP_NOZORDER);
ignoreResize = oldIgnore;
}
@@ -5500,42 +5359,21 @@ public void showSelection () {
if ((style & SWT.SINGLE) != 0) {
hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
if (hItem == 0) return;
- int state = 0;
- if (OS.IsWinCE) {
- TVITEM tvItem = new TVITEM ();
- tvItem.hItem = hItem;
- tvItem.mask = OS.TVIF_STATE;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
if ((state & OS.TVIS_SELECTED) == 0) return;
} else {
long /*int*/ oldProc = OS.GetWindowLongPtr (handle, OS.GWLP_WNDPROC);
OS.SetWindowLongPtr (handle, OS.GWLP_WNDPROC, TreeProc);
- TVITEM tvItem = null;
- if (OS.IsWinCE) {
- tvItem = new TVITEM ();
- tvItem.mask = OS.TVIF_STATE;
- }
if ((style & SWT.VIRTUAL) != 0) {
long /*int*/ hRoot = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
- hItem = getNextSelection (hRoot, tvItem);
+ hItem = getNextSelection (hRoot);
} else {
//FIXME - this code expands first selected item it finds
int index = 0;
while (index <items.length) {
TreeItem item = items [index];
if (item != null) {
- int state = 0;
- if (OS.IsWinCE) {
- tvItem.hItem = item.handle;
- OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, item.handle, OS.TVIS_SELECTED);
- }
+ int state = (int)/*64*/OS.SendMessage (handle, OS.TVM_GETITEMSTATE, item.handle, OS.TVIS_SELECTED);
if ((state & OS.TVIS_SELECTED) != 0) {
hItem = item.handle;
break;
@@ -5583,24 +5421,14 @@ void subclass () {
}
RECT toolTipInset (RECT rect) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- RECT insetRect = new RECT ();
- OS.SetRect (insetRect, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1);
- return insetRect;
- }
- return rect;
+ RECT insetRect = new RECT ();
+ OS.SetRect (insetRect, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1);
+ return insetRect;
}
RECT toolTipRect (RECT rect) {
RECT toolRect = new RECT ();
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- OS.SetRect (toolRect, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1);
- } else {
- OS.SetRect (toolRect, rect.left, rect.top, rect.right, rect.bottom);
- int dwStyle = OS.GetWindowLong (itemToolTipHandle, OS.GWL_STYLE);
- int dwExStyle = OS.GetWindowLong (itemToolTipHandle, OS.GWL_EXSTYLE);
- OS.AdjustWindowRectEx (toolRect, dwStyle, false, dwExStyle);
- }
+ OS.SetRect (toolRect, rect.left - 1, rect.top - 1, rect.right + 1, rect.bottom + 1);
return toolRect;
}
@@ -5633,9 +5461,7 @@ String toolTipText (NMTTDISPINFO hdr) {
if (strings != null) text = strings [index [0]];
}
//TEMPORARY CODE
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (isCustomToolTip ()) text = " ";
- }
+ if (isCustomToolTip ()) text = " ";
if (text != null) return text;
}
}
@@ -5720,20 +5546,6 @@ void updateImageList () {
}
@Override
-void updateImages () {
- if (sortColumn != null && !sortColumn.isDisposed ()) {
- if (OS.COMCTL32_MAJOR < 6) {
- switch (sortDirection) {
- case SWT.UP:
- case SWT.DOWN:
- sortColumn.setImage (display.getSortImage (sortDirection), true, true);
- break;
- }
- }
- }
-}
-
-@Override
void updateMenuLocation (Event event) {
Rectangle clientArea = getClientAreaInPixels ();
int x = clientArea.x, y = clientArea.y;
@@ -5847,14 +5659,12 @@ void updateScrollBar () {
OS.SetScrollInfo (hwndParent, OS.SB_VERT, info, true);
} else {
OS.GetScrollInfo (handle, OS.SB_VERT, info);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION(4, 10)) {
- if (info.nPage == 0) {
- SCROLLBARINFO psbi = new SCROLLBARINFO ();
- psbi.cbSize = SCROLLBARINFO.sizeof;
- OS.GetScrollBarInfo (handle, OS.OBJID_VSCROLL, psbi);
- if ((psbi.rgstate [0] & OS.STATE_SYSTEM_INVISIBLE) != 0) {
- info.nPage = info.nMax + 1;
- }
+ if (info.nPage == 0) {
+ SCROLLBARINFO psbi = new SCROLLBARINFO ();
+ psbi.cbSize = SCROLLBARINFO.sizeof;
+ OS.GetScrollBarInfo (handle, OS.OBJID_VSCROLL, psbi);
+ if ((psbi.rgstate [0] & OS.STATE_SYSTEM_INVISIBLE) != 0) {
+ info.nPage = info.nMax + 1;
}
}
OS.SetScrollInfo (hwndParent, OS.SB_VERT, info, true);
@@ -5874,7 +5684,7 @@ void unsubclass () {
@Override
int widgetStyle () {
int bits = super.widgetStyle () | OS.TVS_SHOWSELALWAYS | OS.TVS_LINESATROOT | OS.TVS_HASBUTTONS | OS.TVS_NONEVENHEIGHT;
- if (EXPLORER_THEME && !OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0) && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
bits |= OS.TVS_TRACKSELECT;
if ((style & SWT.FULL_SELECTION) != 0) bits |= OS.TVS_FULLROWSELECT;
} else {
@@ -5916,27 +5726,6 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /
if (result != null) return result.value;
break;
}
- case OS.WM_CAPTURECHANGED: {
- /*
- * Bug in Windows. When the capture changes during a
- * header drag, Windows does not redraw the header item
- * such that the header remains pressed. For example,
- * when focus is assigned to a push button, the mouse is
- * pressed (but not released), then the SPACE key is
- * pressed to activate the button, the capture changes,
- * the header not notified and NM_RELEASEDCAPTURE is not
- * sent. The fix is to redraw the header when the capture
- * changes to another control.
- *
- * This does not happen on XP.
- */
- if (OS.COMCTL32_MAJOR < 6) {
- if (lParam != 0 && lParam != hwndHeader) {
- OS.InvalidateRect (hwndHeader, null, true);
- }
- }
- break;
- }
case OS.WM_MOUSELEAVE: {
/*
* Bug in Windows. On XP, when a tooltip is hidden
@@ -5945,7 +5734,7 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /
* won't show again until another tooltip becomes
* active. The fix is to reset the tooltip bounds.
*/
- if (OS.COMCTL32_MAJOR >= 6) updateHeaderToolTips ();
+ updateHeaderToolTips ();
updateHeaderToolTips ();
break;
}
@@ -6049,10 +5838,8 @@ long /*int*/ windowProc (long /*int*/ hwnd, int msg, long /*int*/ wParam, long /
* NOTE: For some reason, this code is only necessary
* on Windows Vista.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (OS.LOWORD (wParam) == OS.SB_THUMBTRACK) {
- info.nPos = info.nTrackPos;
- }
+ if (OS.LOWORD (wParam) == OS.SB_THUMBTRACK) {
+ info.nPos = info.nTrackPos;
}
OS.SetScrollInfo (handle, OS.SB_VERT, info, true);
long /*int*/ code = OS.SendMessage (handle, OS.WM_VSCROLL, wParam, lParam);
@@ -6196,13 +5983,8 @@ LRESULT WM_CHAR (long /*int*/ wParam, long /*int*/ lParam) {
}
tvItem.state = state << 12;
OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- if (!OS.IsWinCE) {
- long /*int*/ id = hItem;
- if (OS.COMCTL32_MAJOR >= 6) {
- id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, hItem, 0);
- }
- OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, (int)/*64*/id);
- }
+ long /*int*/ id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, hItem, 0);
+ OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, (int)/*64*/id);
}
tvItem.stateMask = OS.TVIS_SELECTED;
OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
@@ -6464,11 +6246,8 @@ LRESULT WM_KEYDOWN (long /*int*/ wParam, long /*int*/ lParam) {
}
if (redraw) {
RECT rect1 = new RECT (), rect2 = new RECT ();
- boolean fItemRect = (style & SWT.FULL_SELECTION) == 0;
- if (hooks (SWT.EraseItem) || hooks (SWT.PaintItem)) fItemRect = false;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) fItemRect = false;
- OS.TreeView_GetItemRect (handle, hItem, rect1, fItemRect);
- OS.TreeView_GetItemRect (handle, hNewItem, rect2, fItemRect);
+ OS.TreeView_GetItemRect (handle, hItem, rect1, false);
+ OS.TreeView_GetItemRect (handle, hNewItem, rect2, false);
OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
OS.InvalidateRect (handle, rect1, true);
OS.InvalidateRect (handle, rect2, true);
@@ -6503,14 +6282,10 @@ LRESULT WM_KILLFOCUS (long /*int*/ wParam, long /*int*/ lParam) {
* selection when focus is gained or lost.
*/
boolean redraw = (style & SWT.MULTI) != 0;
- if (!redraw) {
- if (!OS.IsWinCE && OS.COMCTL32_MAJOR >= 6) {
- if (imageList != null) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.TVS_FULLROWSELECT) == 0) {
- redraw = true;
- }
- }
+ if (!redraw && imageList != null) {
+ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
+ if ((bits & OS.TVS_FULLROWSELECT) == 0) {
+ redraw = true;
}
}
if (redraw) redrawSelection ();
@@ -6552,13 +6327,8 @@ LRESULT WM_LBUTTONDBLCLK (long /*int*/ wParam, long /*int*/ lParam) {
}
tvItem.state = state << 12;
OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- if (!OS.IsWinCE) {
- long /*int*/ id = tvItem.hItem;
- if (OS.COMCTL32_MAJOR >= 6) {
- id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, tvItem.hItem, 0);
- }
- OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, (int)/*64*/id);
- }
+ long /*int*/ id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, tvItem.hItem, 0);
+ OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, (int)/*64*/id);
Event event = new Event ();
event.item = _getItem (tvItem.hItem, (int)/*64*/tvItem.lParam);
event.detail = SWT.CHECK;
@@ -6646,9 +6416,8 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
ignoreDeselect = ignoreSelect = lockSelection = true;
}
long /*int*/ code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (OS.GetFocus () != handle) OS.SetFocus (handle);
- }
+ /* Bug 225404 */
+ if (OS.GetFocus () != handle) OS.SetFocus (handle);
if (fixSelection) {
hSelect = 0;
ignoreDeselect = ignoreSelect = lockSelection = false;
@@ -6720,13 +6489,8 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
}
tvItem.state = state << 12;
OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
- if (!OS.IsWinCE) {
- long /*int*/ id = tvItem.hItem;
- if (OS.COMCTL32_MAJOR >= 6) {
- id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, tvItem.hItem, 0);
- }
- OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, (int)/*64*/id);
- }
+ long /*int*/ id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, tvItem.hItem, 0);
+ OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, (int)/*64*/id);
Event event = new Event ();
event.item = _getItem (tvItem.hItem, (int)/*64*/tvItem.lParam);
event.detail = SWT.CHECK;
@@ -6770,9 +6534,8 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
return LRESULT.ZERO;
}
long /*int*/ code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (OS.GetFocus () != handle) OS.SetFocus (handle);
- }
+ /* Bug 225404 */
+ if (OS.GetFocus () != handle) OS.SetFocus (handle);
if (!display.captureChanged && !isDisposed ()) {
if (OS.GetCapture () != handle) OS.SetCapture (handle);
}
@@ -6846,9 +6609,8 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
dragStarted = gestureCompleted = false;
ignoreDeselect = ignoreSelect = true;
long /*int*/ code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam);
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if (OS.GetFocus () != handle) OS.SetFocus (handle);
- }
+ /* Bug 225404 */
+ if (OS.GetFocus () != handle) OS.SetFocus (handle);
long /*int*/ hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
if (fakeSelection) {
if (hOldItem == 0 || (hNewItem == hOldItem && lpht.hItem != hOldItem)) {
@@ -6910,11 +6672,8 @@ LRESULT WM_LBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
}
}
RECT rect1 = new RECT (), rect2 = new RECT ();
- boolean fItemRect = (style & SWT.FULL_SELECTION) == 0;
- if (hooks (SWT.EraseItem) || hooks (SWT.PaintItem)) fItemRect = false;
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) fItemRect = false;
- OS.TreeView_GetItemRect (handle, hOldItem, rect1, fItemRect);
- OS.TreeView_GetItemRect (handle, hNewItem, rect2, fItemRect);
+ OS.TreeView_GetItemRect (handle, hOldItem, rect1, false);
+ OS.TreeView_GetItemRect (handle, hNewItem, rect2, false);
OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
OS.InvalidateRect (handle, rect1, true);
OS.InvalidateRect (handle, rect2, true);
@@ -7083,6 +6842,7 @@ LRESULT WM_RBUTTONDOWN (long /*int*/ wParam, long /*int*/ lParam) {
* This code is intentionally commented.
*/
// if (OS.GetCapture () != handle) OS.SetCapture (handle);
+ /* Bug 225404 */
if (OS.GetFocus () != handle) OS.SetFocus (handle);
/*
@@ -7211,26 +6971,6 @@ LRESULT WM_PAINT (long /*int*/ wParam, long /*int*/ lParam) {
}
@Override
-LRESULT WM_PRINTCLIENT (long /*int*/ wParam, long /*int*/ lParam) {
- LRESULT result = super.WM_PRINTCLIENT (wParam, lParam);
- if (result != null) return result;
- /*
- * Feature in Windows. For some reason, when WM_PRINT is used
- * to capture an image of a hierarchy that contains a tree with
- * columns, the clipping that is used to stop the first column
- * from drawing on top of subsequent columns stops the first
- * column and the tree lines from drawing. This does not happen
- * during WM_PAINT. The fix is to draw without clipping and
- * then draw the rest of the columns on top. Since the drawing
- * is happening in WM_PRINTCLIENT, the redrawing is not visible.
- */
- printClient = true;
- long /*int*/ code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam);
- printClient = false;
- return new LRESULT (code);
-}
-
-@Override
LRESULT WM_SETCURSOR (long /*int*/ wParam, long /*int*/ lParam) {
LRESULT result = super.WM_SETCURSOR (wParam, lParam);
if (result != null) return result;
@@ -7241,7 +6981,7 @@ LRESULT WM_SETCURSOR (long /*int*/ wParam, long /*int*/ lParam) {
* correct Windows 7 behavior but not correct for SWT. The fix
* is to always ensure a cursor is set.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
+ if (OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
if (wParam == handle) {
int hitTest = (short) OS.LOWORD (lParam);
if (hitTest == OS.HTCLIENT) {
@@ -7270,14 +7010,10 @@ LRESULT WM_SETFOCUS (long /*int*/ wParam, long /*int*/ lParam) {
* selection when focus is gained or lost.
*/
boolean redraw = (style & SWT.MULTI) != 0;
- if (!redraw) {
- if (!OS.IsWinCE && OS.COMCTL32_MAJOR >= 6) {
- if (imageList != null) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.TVS_FULLROWSELECT) == 0) {
- redraw = true;
- }
- }
+ if (!redraw && imageList != null) {
+ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
+ if ((bits & OS.TVS_FULLROWSELECT) == 0) {
+ redraw = true;
}
}
if (redraw) redrawSelection ();
@@ -7326,11 +7062,8 @@ LRESULT WM_SETREDRAW (long /*int*/ wParam, long /*int*/ lParam) {
* NOTE: This problem is intermittent and happens on
* Windows Vista running under the theme manager.
*/
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- long /*int*/ code = OS.DefWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam);
- return code == 0 ? LRESULT.ZERO : new LRESULT (code);
- }
- return result;
+ long /*int*/ code = OS.DefWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam);
+ return code == 0 ? LRESULT.ZERO : new LRESULT (code);
}
@Override
@@ -7344,7 +7077,7 @@ LRESULT WM_SIZE (long /*int*/ wParam, long /*int*/ lParam) {
*/
int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
if ((bits & OS.TVS_NOHSCROLL) != 0) {
- if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
+ OS.ShowScrollBar (handle, OS.SB_HORZ, false);
}
/*
* Bug in Windows. On Vista, when the Explorer theme
@@ -7450,9 +7183,6 @@ LRESULT WM_TIMER (long /*int*/ wParam, long /*int*/ lParam) {
@Override
LRESULT wmColorChild (long /*int*/ wParam, long /*int*/ lParam) {
if (findImageControl () != null) {
- if (OS.COMCTL32_MAJOR < 6) {
- return super.wmColorChild (wParam, lParam);
- }
return new LRESULT (OS.GetStockObject (OS.NULL_BRUSH));
}
/*
@@ -7617,7 +7347,7 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
if (hwndHeader == 0) createParent ();
}
if (!customDraw && findImageControl () == null) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
if (sortColumn == null || sortDirection == SWT.NONE) {
break;
}
@@ -7670,14 +7400,12 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
*/
case OS.TVN_ITEMCHANGINGA:
case OS.TVN_ITEMCHANGINGW: {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- if ((style & SWT.MULTI) != 0) {
- if (hSelect != 0) {
- NMTVITEMCHANGE pnm = new NMTVITEMCHANGE ();
- OS.MoveMemory (pnm, lParam, NMTVITEMCHANGE.sizeof);
- if (hSelect == pnm.hItem) break;
- return LRESULT.ONE;
- }
+ if ((style & SWT.MULTI) != 0) {
+ if (hSelect != 0) {
+ NMTVITEMCHANGE pnm = new NMTVITEMCHANGE ();
+ OS.MoveMemory (pnm, lParam, NMTVITEMCHANGE.sizeof);
+ if (hSelect == pnm.hItem) break;
+ return LRESULT.ONE;
}
}
break;
@@ -7837,18 +7565,16 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
* This means that the image gets darker each time.
* The fix is to redraw the item.
*/
- if (!OS.IsWinCE && OS.COMCTL32_MAJOR >= 6) {
- if (imageList != null) {
- NMTREEVIEW treeView = new NMTREEVIEW ();
- OS.MoveMemory (treeView, lParam, NMTREEVIEW.sizeof);
- TVITEM tvItem = treeView.itemNew;
- if (tvItem.hItem != 0) {
- int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
- if ((bits & OS.TVS_FULLROWSELECT) == 0) {
- RECT rect = new RECT ();
- if (OS.TreeView_GetItemRect (handle, tvItem.hItem, rect, false)) {
- OS.InvalidateRect (handle, rect, true);
- }
+ if (imageList != null) {
+ NMTREEVIEW treeView = new NMTREEVIEW ();
+ OS.MoveMemory (treeView, lParam, NMTREEVIEW.sizeof);
+ TVITEM tvItem = treeView.itemNew;
+ if (tvItem.hItem != 0) {
+ int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
+ if ((bits & OS.TVS_FULLROWSELECT) == 0) {
+ RECT rect = new RECT ();
+ if (OS.TreeView_GetItemRect (handle, tvItem.hItem, rect, false)) {
+ OS.InvalidateRect (handle, rect, true);
}
}
}
@@ -7875,35 +7601,6 @@ LRESULT wmNotifyChild (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
break;
}
- case OS.NM_RECOGNIZEGESTURE: {
- /*
- * Feature in Pocket PC. The tree and table controls detect the tap
- * and hold gesture by default. They send a GN_CONTEXTMENU message to show
- * the popup menu. This default behaviour is unwanted on Pocket PC 2002
- * when no menu has been set, as it still draws a red circle. The fix
- * is to disable this default behaviour when no menu is set by returning
- * TRUE when receiving the Pocket PC 2002 specific NM_RECOGNIZEGESTURE
- * message.
- */
- if (OS.IsPPC) {
- boolean hasMenu = menu != null && !menu.isDisposed ();
- if (!hasMenu && !hooks (SWT.MenuDetect)) return LRESULT.ONE;
- }
- break;
- }
- case OS.GN_CONTEXTMENU: {
- if (OS.IsPPC) {
- boolean hasMenu = menu != null && !menu.isDisposed ();
- if (hasMenu || hooks (SWT.MenuDetect)) {
- NMRGINFO nmrg = new NMRGINFO ();
- OS.MoveMemory (nmrg, lParam, NMRGINFO.sizeof);
- showMenu (nmrg.x, nmrg.y);
- gestureCompleted = true;
- return LRESULT.ONE;
- }
- }
- break;
- }
}
return super.wmNotifyChild (hdr, wParam, lParam);
}
@@ -8187,17 +7884,8 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof);
if ((pitem.mask & OS.HDI_WIDTH) != 0) {
if (ignoreColumnMove) {
- if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
- int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (handle, null, 0, flags);
- } else {
- if ((style & SWT.DOUBLE_BUFFERED) == 0) {
- int oldStyle = style;
- style |= SWT.DOUBLE_BUFFERED;
- OS.UpdateWindow (handle);
- style = oldStyle;
- }
- }
+ int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (handle, null, 0, flags);
}
TreeColumn column = columns [phdn.iItem];
if (column != null) {
@@ -8248,7 +7936,6 @@ LRESULT wmNotifyHeader (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
- if (OS.IsWinCE) return null;
switch (hdr.code) {
case OS.NM_CUSTOMDRAW: {
NMTTCUSTOMDRAW nmcd = new NMTTCUSTOMDRAW ();
@@ -8272,7 +7959,7 @@ LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
int height = toolRect.bottom - toolRect.top;
int flags = OS.SWP_NOACTIVATE | OS.SWP_NOZORDER | OS.SWP_NOSIZE;
if (isCustomToolTip ()) flags &= ~OS.SWP_NOSIZE;
- SetWindowPos (itemToolTipHandle, 0, toolRect.left, toolRect.top, width, height, flags);
+ OS.SetWindowPos (itemToolTipHandle, 0, toolRect.left, toolRect.top, width, height, flags);
return LRESULT.ONE;
}
return result;
@@ -8282,24 +7969,17 @@ LRESULT wmNotifyToolTip (NMHDR hdr, long /*int*/ wParam, long /*int*/ lParam) {
}
LRESULT wmNotifyToolTip (NMTTCUSTOMDRAW nmcd, long /*int*/ lParam) {
- if (OS.IsWinCE) return null;
switch (nmcd.dwDrawStage) {
case OS.CDDS_PREPAINT: {
if (isCustomToolTip ()) {
//TEMPORARY CODE
//nmcd.uDrawFlags |= OS.DT_CALCRECT;
//OS.MoveMemory (lParam, nmcd, NMTTCUSTOMDRAW.sizeof);
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 0)) {
- OS.SetTextColor (nmcd.hdc, OS.GetSysColor (OS.COLOR_INFOBK));
- }
return new LRESULT (OS.CDRF_NOTIFYPOSTPAINT | OS.CDRF_NEWFONT);
}
break;
}
case OS.CDDS_POSTPAINT: {
- if (!OS.IsWinCE && OS.WIN32_VERSION < OS.VERSION (6, 0)) {
- OS.SetTextColor (nmcd.hdc, OS.GetSysColor (OS.COLOR_INFOTEXT));
- }
if (OS.SendMessage (itemToolTipHandle, OS.TTM_GETCURRENTTOOL, 0, 0) != 0) {
TOOLINFO lpti = new TOOLINFO ();
lpti.cbSize = TOOLINFO.sizeof;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
index 817cbe031b..eafad9398f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeColumn.java
@@ -378,15 +378,11 @@ public void pack () {
TCHAR buffer = new TCHAR (parent.getCodePage (), text, false);
OS.DrawText (hDC, buffer, buffer.length (), rect, flags);
int headerWidth = rect.right - rect.left + Tree.HEADER_MARGIN;
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) headerWidth += Tree.HEADER_EXTRA;
+ if (OS.IsAppThemed ()) headerWidth += Tree.HEADER_EXTRA;
if (image != null || parent.sortColumn == this) {
Image headerImage = null;
if (parent.sortColumn == this && parent.sortDirection != SWT.NONE) {
- if (OS.COMCTL32_MAJOR < 6) {
- headerImage = display.getSortImage (parent.sortDirection);
- } else {
- headerWidth += Tree.SORT_WIDTH;
- }
+ headerWidth += Tree.SORT_WIDTH;
} else {
headerImage = image;
}
@@ -395,7 +391,7 @@ public void pack () {
headerWidth += bounds.width;
}
int margin = 0;
- if (hwndHeader != 0 && OS.COMCTL32_VERSION >= OS.VERSION (5, 80)) {
+ if (hwndHeader != 0) {
margin = (int)/*64*/OS.SendMessage (hwndHeader, OS.HDM_GETBITMAPMARGIN, 0, 0);
} else {
margin = OS.GetSystemMetrics (OS.SM_CXEDGE) * 3;
@@ -601,58 +597,46 @@ public void setResizable (boolean resizable) {
}
void setSortDirection (int direction) {
- if (OS.COMCTL32_MAJOR >= 6) {
- long /*int*/ hwndHeader = parent.hwndHeader;
- if (hwndHeader != 0) {
- int index = parent.indexOf (this);
- if (index == -1) return;
- HDITEM hdItem = new HDITEM ();
- hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE;
- OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
- switch (direction) {
- case SWT.UP:
- hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTDOWN);
- hdItem.fmt |= OS.HDF_SORTUP;
- if (image == null) hdItem.mask &= ~OS.HDI_IMAGE;
- break;
- case SWT.DOWN:
- hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTUP);
- hdItem.fmt |= OS.HDF_SORTDOWN;
- if (image == null) hdItem.mask &= ~OS.HDI_IMAGE;
- break;
- case SWT.NONE:
- hdItem.fmt &= ~(OS.HDF_SORTUP | OS.HDF_SORTDOWN);
- if (image != null) {
- hdItem.fmt |= OS.HDF_IMAGE;
- hdItem.iImage = parent.imageIndexHeader (image);
- } else {
- hdItem.fmt &= ~OS.HDF_IMAGE;
- hdItem.mask &= ~OS.HDI_IMAGE;
- }
- break;
- }
- OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
- long /*int*/ hwnd = parent.handle;
- parent.forceResize ();
- RECT rect = new RECT (), headerRect = new RECT ();
- OS.GetClientRect (hwnd, rect);
- OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect);
- rect.left = headerRect.left;
- rect.right = headerRect.right;
- OS.InvalidateRect (hwnd, rect, true);
- }
- }
- } else {
+ long /*int*/ hwndHeader = parent.hwndHeader;
+ if (hwndHeader != 0) {
+ int index = parent.indexOf (this);
+ if (index == -1) return;
+ HDITEM hdItem = new HDITEM ();
+ hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE;
+ OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
switch (direction) {
case SWT.UP:
+ hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTDOWN);
+ hdItem.fmt |= OS.HDF_SORTUP;
+ if (image == null) hdItem.mask &= ~OS.HDI_IMAGE;
+ break;
case SWT.DOWN:
- setImage (display.getSortImage (direction), true, true);
+ hdItem.fmt &= ~(OS.HDF_IMAGE | OS.HDF_SORTUP);
+ hdItem.fmt |= OS.HDF_SORTDOWN;
+ if (image == null) hdItem.mask &= ~OS.HDI_IMAGE;
break;
case SWT.NONE:
- setImage (image, false, false);
+ hdItem.fmt &= ~(OS.HDF_SORTUP | OS.HDF_SORTDOWN);
+ if (image != null) {
+ hdItem.fmt |= OS.HDF_IMAGE;
+ hdItem.iImage = parent.imageIndexHeader (image);
+ } else {
+ hdItem.fmt &= ~OS.HDF_IMAGE;
+ hdItem.mask &= ~OS.HDI_IMAGE;
+ }
break;
}
+ OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);
+ if (OS.IsAppThemed ()) {
+ long /*int*/ hwnd = parent.handle;
+ parent.forceResize ();
+ RECT rect = new RECT (), headerRect = new RECT ();
+ OS.GetClientRect (hwnd, rect);
+ OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect);
+ rect.left = headerRect.left;
+ rect.right = headerRect.right;
+ OS.InvalidateRect (hwnd, rect, true);
+ }
}
}
@@ -669,12 +653,10 @@ public void setText (String string) {
* mnemonic character, Windows does not measure the
* text properly. This causes '...' to always appear
* at the end of the text. The fix is to remove
- * mnemonic characters and replace doubled mnemonics
- * with spaces.
+ * mnemonic characters.
*/
- boolean replace = !OS.IsWinCE && OS.WIN32_VERSION <= OS.VERSION (4, 10);
long /*int*/ hHeap = OS.GetProcessHeap ();
- TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string, replace), true);
+ TCHAR buffer = new TCHAR (parent.getCodePage (), fixMnemonic (string), true);
int byteCount = buffer.length () * TCHAR.sizeof;
long /*int*/ pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory (pszText, buffer, byteCount);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
index 9e98f80edb..7484c288a6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TreeItem.java
@@ -597,22 +597,13 @@ public boolean getChecked () {
public boolean getExpanded () {
checkWidget ();
long /*int*/ hwnd = parent.handle;
- int state = 0;
- if (OS.IsWinCE) {
- TVITEM tvItem = new TVITEM ();
- tvItem.hItem = handle;
- tvItem.mask = OS.TVIF_STATE;
- OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- /*
- * Bug in Windows. Despite the fact that TVM_GETITEMSTATE claims
- * to return only the bits specified by the stateMask, when called
- * with TVIS_EXPANDED, the entire state is returned. The fix is
- * to explicitly check for the TVIS_EXPANDED bit.
- */
- state = (int)/*64*/OS.SendMessage (hwnd, OS.TVM_GETITEMSTATE, handle, OS.TVIS_EXPANDED);
- }
+ /*
+ * Bug in Windows. Despite the fact that TVM_GETITEMSTATE claims
+ * to return only the bits specified by the stateMask, when called
+ * with TVIS_EXPANDED, the entire state is returned. The fix is
+ * to explicitly check for the TVIS_EXPANDED bit.
+ */
+ int state = (int)/*64*/OS.SendMessage (hwnd, OS.TVM_GETITEMSTATE, handle, OS.TVIS_EXPANDED);
return (state & OS.TVIS_EXPANDED) != 0;
}
@@ -1217,22 +1208,13 @@ public void setExpanded (boolean expanded) {
if (OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, handle) == 0) {
return;
}
- int state = 0;
- if (OS.IsWinCE) {
- TVITEM tvItem = new TVITEM ();
- tvItem.hItem = handle;
- tvItem.mask = OS.TVIF_STATE;
- OS.SendMessage (hwnd, OS.TVM_GETITEM, 0, tvItem);
- state = tvItem.state;
- } else {
- /*
- * Bug in Windows. Despite the fact that TVM_GETITEMSTATE claims
- * to return only the bits specified by the stateMask, when called
- * with TVIS_EXPANDED, the entire state is returned. The fix is
- * to explicitly check for the TVIS_EXPANDED bit.
- */
- state = (int)/*64*/OS.SendMessage (hwnd, OS.TVM_GETITEMSTATE, handle, OS.TVIS_EXPANDED);
- }
+ /*
+ * Bug in Windows. Despite the fact that TVM_GETITEMSTATE claims
+ * to return only the bits specified by the stateMask, when called
+ * with TVIS_EXPANDED, the entire state is returned. The fix is
+ * to explicitly check for the TVIS_EXPANDED bit.
+ */
+ int state = (int)/*64*/OS.SendMessage (hwnd, OS.TVM_GETITEMSTATE, handle, OS.TVIS_EXPANDED);
if (((state & OS.TVIS_EXPANDED) != 0) == expanded) return;
/*
@@ -1386,13 +1368,8 @@ public void setExpanded (boolean expanded) {
}
}
} else {
- if (OS.IsWinCE) {
- OS.InvalidateRect (topHandle, null, true);
- if (hwnd != topHandle) OS.InvalidateRect (hwnd, null, true);
- } else {
- int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
- OS.RedrawWindow (topHandle, null, 0, flags);
- }
+ int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
+ OS.RedrawWindow (topHandle, null, 0, flags);
}
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
index 41c013776d..5d161e56bb 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java
@@ -106,15 +106,8 @@ public abstract class Widget {
/* Bidi flag and for auto text direction */
static final int AUTO_TEXT_DIRECTION = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- /* Check and initialize the Common Controls DLL */
- static final int MAJOR = 5, MINOR = 80;
+ /* Initialize the Common Controls DLL */
static {
- if (!OS.IsWinCE) {
- if (OS.COMCTL32_VERSION < OS.VERSION (MAJOR, MINOR)) {
- System.out.println ("***WARNING: SWT requires comctl32.dll version " + MAJOR + "." + MINOR + " or greater"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- System.out.println ("***WARNING: Detected: " + OS.COMCTL32_MAJOR + "." + OS.COMCTL32_MINOR); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
OS.InitCommonControls ();
}
@@ -399,33 +392,6 @@ void destroyWidget () {
releaseHandle ();
}
-long /*int*/ DeferWindowPos(long /*int*/ hWinPosInfo, long /*int*/ hWnd, long /*int*/ hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags){
- if (OS.IsWinCE) {
- /*
- * Feature in Windows. On Windows CE, DeferWindowPos always causes
- * a WM_SIZE message, even when the new size is the same as the old
- * size. The fix is to detect that the size has not changed and set
- * SWP_NOSIZE.
- */
- if ((uFlags & OS.SWP_NOSIZE) == 0) {
- RECT lpRect = new RECT ();
- OS.GetWindowRect (hWnd, lpRect);
- if (cy == lpRect.bottom - lpRect.top && cx == lpRect.right - lpRect.left) {
- /*
- * Feature in Windows. On Windows CE, DeferWindowPos when called
- * with SWP_DRAWFRAME always causes a WM_SIZE message, even
- * when SWP_NOSIZE is set and when the new size is the same as the
- * old size. The fix is to clear SWP_DRAWFRAME when the size is
- * the same.
- */
- uFlags &= ~OS.SWP_DRAWFRAME;
- uFlags |= OS.SWP_NOSIZE;
- }
- }
- }
- return OS.DeferWindowPos (hWinPosInfo, hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
-}
-
/**
* Disposes of the operating system resources associated with
* the receiver and all its descendants. After this method has
@@ -1404,7 +1370,7 @@ boolean setKeyState (Event event, int type, long /*int*/ wParam, long /*int*/ lP
event.keyCode = display.lastKey;
}
if (display.lastAscii != 0 || display.lastNull) {
- event.character = Display.mbcsToWcs ((char) display.lastAscii);
+ event.character = (char) display.lastAscii;
}
if (event.keyCode == 0 && event.character == 0) {
if (!display.lastNull) return false;
@@ -1462,33 +1428,6 @@ boolean setTabItemFocus () {
return false;
}
-boolean SetWindowPos (long /*int*/ hWnd, long /*int*/ hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags) {
- if (OS.IsWinCE) {
- /*
- * Feature in Windows. On Windows CE, SetWindowPos() always causes
- * a WM_SIZE message, even when the new size is the same as the old
- * size. The fix is to detect that the size has not changed and set
- * SWP_NOSIZE.
- */
- if ((uFlags & OS.SWP_NOSIZE) == 0) {
- RECT lpRect = new RECT ();
- OS.GetWindowRect (hWnd, lpRect);
- if (cy == lpRect.bottom - lpRect.top && cx == lpRect.right - lpRect.left) {
- /*
- * Feature in Windows. On Windows CE, SetWindowPos() when called
- * with SWP_DRAWFRAME always causes a WM_SIZE message, even
- * when SWP_NOSIZE is set and when the new size is the same as the
- * old size. The fix is to clear SWP_DRAWFRAME when the size is
- * the same.
- */
- uFlags &= ~OS.SWP_DRAWFRAME;
- uFlags |= OS.SWP_NOSIZE;
- }
- }
- }
- return OS.SetWindowPos (hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
-}
-
boolean showMenu (int x, int y) {
return showMenu (x, y, SWT.MENU_MOUSE);
}
@@ -1542,13 +1481,6 @@ LRESULT wmCaptureChanged (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ l
}
LRESULT wmChar (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
- /*
- * Do not report a lead byte as a key pressed.
- */
- if (!OS.IsUnicode && OS.IsDBLocale) {
- byte lead = (byte) (wParam & 0xFF);
- if (OS.IsDBCSLeadByte (lead)) return null;
- }
display.lastAscii = (int)/*64*/wParam;
display.lastNull = wParam == 0;
if (!sendKeyEvent (SWT.KeyDown, OS.WM_CHAR, wParam, lParam)) {
@@ -1562,19 +1494,6 @@ LRESULT wmContextMenu (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lPar
if (wParam != hwnd) return null;
/*
- * Feature in Windows. SHRecognizeGesture() sends an undocumented
- * WM_CONTEXTMENU notification when the flag SHRG_NOTIFY_PARENT is
- * not set. This causes the context menu to be displayed twice,
- * once by the caller of SHRecognizeGesture() and once from this
- * method. The fix is to ignore WM_CONTEXTMENU notifications on
- * all WinCE platforms.
- *
- * NOTE: This only happens on WM2003. Previous WinCE versions did
- * not support WM_CONTEXTMENU.
- */
- if (OS.IsWinCE) return null;
-
- /*
* Feature in Windows. When the user presses WM_NCRBUTTONUP,
* a WM_CONTEXTMENU message is generated. This happens when
* the user releases the mouse over a scroll bar. Normally,
@@ -1638,49 +1557,21 @@ LRESULT wmKeyDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam)
display.lastAscii = display.lastKey = 0;
display.lastVirtual = display.lastNull = display.lastDead = false;
- /*
- * Do not report a lead byte as a key pressed.
- */
- if (!OS.IsUnicode && OS.IsDBLocale) {
- byte lead = (byte) (wParam & 0xFF);
- if (OS.IsDBCSLeadByte (lead)) return null;
- }
-
/* Map the virtual key */
+ int mapKey = OS.MapVirtualKey ((int)/*64*/wParam, 2);
/*
- * Bug in WinCE. MapVirtualKey() returns incorrect values.
- * The fix is to rely on a key mappings table to determine
- * whether the key event must be sent now or if a WM_CHAR
- * event will follow. The key mappings table maps virtual
- * keys to SWT key codes and does not contain mappings for
- * Windows virtual keys like VK_A. Virtual keys that are
- * both virtual and ASCII are a special case.
+ * Feature in Windows. For Devanagari and Bengali numbers,
+ * MapVirtualKey() returns the localized number instead of
+ * the ASCII equivalent. For example, MapVirtualKey()
+ * maps VK_1 on the numbers keyboard to \u0967, which is
+ * the Devanagari digit '1', but not ASCII.
+ * The fix is to test for Devanagari and Bengali digits and
+ * map these explicitly.
+ *
+ * NOTE: VK_0 to VK_9 are the same as ASCII.
*/
- int mapKey = 0;
- if (OS.IsWinCE) {
- switch ((int)/*64*/wParam) {
- case OS.VK_BACK: mapKey = SWT.BS; break;
- case OS.VK_RETURN: mapKey = SWT.CR; break;
- case OS.VK_DELETE: mapKey = SWT.DEL; break;
- case OS.VK_ESCAPE: mapKey = SWT.ESC; break;
- case OS.VK_TAB: mapKey = SWT.TAB; break;
- }
- } else {
- mapKey = OS.MapVirtualKey ((int)/*64*/wParam, 2);
- /*
- * Feature in Windows. For Devanagari and Bengali numbers,
- * MapVirtualKey() returns the localized number instead of
- * the ASCII equivalent. For example, MapVirtualKey()
- * maps VK_1 on the numbers keyboard to \u0967, which is
- * the Devanagari digit '1', but not ASCII.
- * The fix is to test for Devanagari and Bengali digits and
- * map these explicitly.
- *
- * NOTE: VK_0 to VK_9 are the same as ASCII.
- */
- if (('\u09e6' <= mapKey && mapKey <= '\u09ef') || ('\u0966' <= mapKey && mapKey <= '\u096f')) {
- mapKey = (int)/*64*/wParam;
- }
+ if (('\u09e6' <= mapKey && mapKey <= '\u09ef') || ('\u0966' <= mapKey && mapKey <= '\u096f')) {
+ mapKey = (int)/*64*/wParam;
}
/*
@@ -1689,9 +1580,7 @@ LRESULT wmKeyDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam)
* key should be ignored and the next key that the user types is the
* accented key. The fix is to detect the accent key stroke (called
* a dead key) by testing the high bit of the value returned by
- * MapVirtualKey(). A further problem is that the high bit on
- * Windows NT is bit 32 while the high bit on Windows 95 is bit 16.
- * They should both be bit 32.
+ * MapVirtualKey().
*
* When the user types an accent key that does not correspond to a
* virtual key, MapVirtualKey() won't set the high bit to indicate
@@ -1700,11 +1589,8 @@ LRESULT wmKeyDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam)
* returns the unshifted key. The fix is to peek for a WM_DEADCHAR
* and avoid issuing the event.
*/
- if (OS.IsWinNT) {
- if ((mapKey & 0x80000000) != 0) return null;
- } else {
- if ((mapKey & 0x8000) != 0) return null;
- }
+ if ((mapKey & 0x80000000) != 0) return null;
+
MSG msg = new MSG ();
int flags = OS.PM_NOREMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
if (OS.PeekMessage (msg, hwnd, OS.WM_DEADCHAR, OS.WM_DEADCHAR, flags)) {
@@ -1863,21 +1749,6 @@ LRESULT wmKeyDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam)
LRESULT wmKeyUp (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
Display display = this.display;
- /* Check for hardware keys */
- if (OS.IsWinCE) {
- if (OS.VK_APP1 <= wParam && wParam <= OS.VK_APP6) {
- display.lastKey = display.lastAscii = 0;
- display.lastVirtual = display.lastNull = display.lastDead = false;
- Event event = new Event ();
- event.detail = (int)/*64*/wParam - OS.VK_APP1 + 1;
- /* Check the bit 30 to get the key state */
- int type = (lParam & 0x40000000) != 0 ? SWT.HardKeyUp : SWT.HardKeyDown;
- if (setInputState (event, type)) sendEvent (type, event);
- // widget could be disposed at this point
- return null;
- }
- }
-
/*
* If the key up is not hooked, reset last key
* and last ascii in case the key down is hooked.
@@ -1889,27 +1760,7 @@ LRESULT wmKeyUp (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
}
/* Map the virtual key. */
- /*
- * Bug in WinCE. MapVirtualKey() returns incorrect values.
- * The fix is to rely on a key mappings table to determine
- * whether the key event must be sent now or if a WM_CHAR
- * event will follow. The key mappings table maps virtual
- * keys to SWT key codes and does not contain mappings for
- * Windows virtual keys like VK_A. Virtual keys that are
- * both virtual and ASCII are a special case.
- */
- int mapKey = 0;
- if (OS.IsWinCE) {
- switch ((int)/*64*/wParam) {
- case OS.VK_BACK: mapKey = SWT.BS; break;
- case OS.VK_RETURN: mapKey = SWT.CR; break;
- case OS.VK_DELETE: mapKey = SWT.DEL; break;
- case OS.VK_ESCAPE: mapKey = SWT.ESC; break;
- case OS.VK_TAB: mapKey = SWT.TAB; break;
- }
- } else {
- mapKey = OS.MapVirtualKey ((int)/*64*/wParam, 2);
- }
+ int mapKey = OS.MapVirtualKey ((int)/*64*/wParam, 2);
/*
* Bug in Windows 95 and NT. When the user types an accent key such
@@ -1917,15 +1768,10 @@ LRESULT wmKeyUp (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
* key should be ignored and the next key that the user types is the
* accented key. The fix is to detect the accent key stroke (called
* a dead key) by testing the high bit of the value returned by
- * MapVirtualKey (). A further problem is that the high bit on
- * Windows NT is bit 32 while the high bit on Windows 95 is bit 16.
- * They should both be bit 32.
+ * MapVirtualKey ().
*/
- if (OS.IsWinNT) {
- if ((mapKey & 0x80000000) != 0) return null;
- } else {
- if ((mapKey & 0x8000) != 0) return null;
- }
+ if ((mapKey & 0x80000000) != 0) return null;
+
if (display.lastDead) return null;
/*
@@ -2018,21 +1864,19 @@ LRESULT wmLButtonDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lPar
boolean dragging = false, mouseDown = true;
int count = display.getClickCount (SWT.MouseDown, 1, hwnd, lParam);
if (count == 1 && (state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect)) {
- if (!OS.IsWinCE) {
- /*
- * Feature in Windows. It's possible that the drag
- * operation will not be started while the mouse is
- * down, meaning that the mouse should be captured.
- * This can happen when the user types the ESC key
- * to cancel the drag. The fix is to query the state
- * of the mouse and capture the mouse accordingly.
- */
- detect = new boolean [1];
- consume = new boolean [1];
- dragging = dragDetect (hwnd, x, y, true, detect, consume);
- if (isDisposed ()) return LRESULT.ZERO;
- mouseDown = OS.GetKeyState (OS.VK_LBUTTON) < 0;
- }
+ /*
+ * Feature in Windows. It's possible that the drag
+ * operation will not be started while the mouse is
+ * down, meaning that the mouse should be captured.
+ * This can happen when the user types the ESC key
+ * to cancel the drag. The fix is to query the state
+ * of the mouse and capture the mouse accordingly.
+ */
+ detect = new boolean [1];
+ consume = new boolean [1];
+ dragging = dragDetect (hwnd, x, y, true, detect, consume);
+ if (isDisposed ()) return LRESULT.ZERO;
+ mouseDown = OS.GetKeyState (OS.VK_LBUTTON) < 0;
}
display.captureChanged = false;
boolean dispatch = sendMouseEvent (SWT.MouseDown, 1, count, 0, false, hwnd, OS.WM_LBUTTONDOWN, wParam, lParam);
@@ -2041,25 +1885,6 @@ LRESULT wmLButtonDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lPar
} else {
result = LRESULT.ZERO;
}
- if (OS.IsPPC) {
- /*
- * Note: On WinCE PPC, only attempt to recognize the gesture for
- * a context menu when the control contains a valid menu or there
- * are listeners for the MenuDetect event.
- */
- Menu menu = getMenu ();
- boolean hasMenu = menu != null && !menu.isDisposed ();
- if (hasMenu || hooks (SWT.MenuDetect)) {
- SHRGINFO shrg = new SHRGINFO ();
- shrg.cbSize = SHRGINFO.sizeof;
- shrg.hwndClient = hwnd;
- shrg.ptDown_x = x;
- shrg.ptDown_y = y;
- shrg.dwFlags = OS.SHRG_RETURNCMD;
- int type = OS.SHRecognizeGesture (shrg);
- if (type == OS.GN_CONTEXTMENU) showMenu (x, y);
- }
- }
if (mouseDown) {
if (!display.captureChanged && !isDisposed ()) {
if (OS.GetCapture () != hwnd) OS.SetCapture (hwnd);
@@ -2210,40 +2035,38 @@ LRESULT wmMouseMove (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam
Display display = this.display;
int pos = OS.GetMessagePos ();
if (pos != display.lastMouse || display.captureChanged) {
- if (!OS.IsWinCE) {
- boolean trackMouse = (state & TRACK_MOUSE) != 0;
- boolean mouseEnter = hooks (SWT.MouseEnter) || display.filters (SWT.MouseEnter);
- boolean mouseExit = hooks (SWT.MouseExit) || display.filters (SWT.MouseExit);
- boolean mouseHover = hooks (SWT.MouseHover) || display.filters (SWT.MouseHover);
- if (trackMouse || mouseEnter || mouseExit || mouseHover) {
- TRACKMOUSEEVENT lpEventTrack = new TRACKMOUSEEVENT ();
- lpEventTrack.cbSize = TRACKMOUSEEVENT.sizeof;
- lpEventTrack.dwFlags = OS.TME_QUERY;
+ boolean trackMouse = (state & TRACK_MOUSE) != 0;
+ boolean mouseEnter = hooks (SWT.MouseEnter) || display.filters (SWT.MouseEnter);
+ boolean mouseExit = hooks (SWT.MouseExit) || display.filters (SWT.MouseExit);
+ boolean mouseHover = hooks (SWT.MouseHover) || display.filters (SWT.MouseHover);
+ if (trackMouse || mouseEnter || mouseExit || mouseHover) {
+ TRACKMOUSEEVENT lpEventTrack = new TRACKMOUSEEVENT ();
+ lpEventTrack.cbSize = TRACKMOUSEEVENT.sizeof;
+ lpEventTrack.dwFlags = OS.TME_QUERY;
+ lpEventTrack.hwndTrack = hwnd;
+ OS.TrackMouseEvent (lpEventTrack);
+ if (lpEventTrack.dwFlags == 0) {
+ lpEventTrack.dwFlags = OS.TME_LEAVE | OS.TME_HOVER;
lpEventTrack.hwndTrack = hwnd;
OS.TrackMouseEvent (lpEventTrack);
- if (lpEventTrack.dwFlags == 0) {
- lpEventTrack.dwFlags = OS.TME_LEAVE | OS.TME_HOVER;
- lpEventTrack.hwndTrack = hwnd;
- OS.TrackMouseEvent (lpEventTrack);
- if (mouseEnter) {
- /*
- * Force all outstanding WM_MOUSELEAVE messages to be dispatched before
- * issuing a mouse enter. This causes mouse exit events to be processed
- * before mouse enter events. Note that WM_MOUSELEAVE is posted to the
- * event queue by TrackMouseEvent().
- */
- MSG msg = new MSG ();
- int flags = OS.PM_REMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
- while (OS.PeekMessage (msg, 0, OS.WM_MOUSELEAVE, OS.WM_MOUSELEAVE, flags)) {
- OS.TranslateMessage (msg);
- OS.DispatchMessage (msg);
- }
- sendMouseEvent (SWT.MouseEnter, 0, hwnd, OS.WM_MOUSEMOVE, wParam, lParam);
+ if (mouseEnter) {
+ /*
+ * Force all outstanding WM_MOUSELEAVE messages to be dispatched before
+ * issuing a mouse enter. This causes mouse exit events to be processed
+ * before mouse enter events. Note that WM_MOUSELEAVE is posted to the
+ * event queue by TrackMouseEvent().
+ */
+ MSG msg = new MSG ();
+ int flags = OS.PM_REMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
+ while (OS.PeekMessage (msg, 0, OS.WM_MOUSELEAVE, OS.WM_MOUSELEAVE, flags)) {
+ OS.TranslateMessage (msg);
+ OS.DispatchMessage (msg);
}
- } else {
- lpEventTrack.dwFlags = OS.TME_HOVER;
- OS.TrackMouseEvent (lpEventTrack);
+ sendMouseEvent (SWT.MouseEnter, 0, hwnd, OS.WM_MOUSEMOVE, wParam, lParam);
}
+ } else {
+ lpEventTrack.dwFlags = OS.TME_HOVER;
+ OS.TrackMouseEvent (lpEventTrack);
}
}
if (pos != display.lastMouse) {
@@ -2277,69 +2100,33 @@ LRESULT wmPaint (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
}
/* Issue a paint event */
- long /*int*/ result = 0;
- if (OS.IsWinCE) {
- RECT rect = new RECT ();
- OS.GetUpdateRect (hwnd, rect, false);
- result = callWindowProc (hwnd, OS.WM_PAINT, wParam, lParam);
- /*
- * Bug in Windows. When InvalidateRgn(), InvalidateRect()
- * or RedrawWindow() with RDW_INVALIDATE is called from
- * within WM_PAINT to invalidate a region for a further
- * BeginPaint(), the caret is not properly erased causing
- * pixel corruption. The fix is to hide and show the
- * caret.
- */
+ long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
+ OS.GetUpdateRgn (hwnd, rgn, false);
+ long /*int*/ result = callWindowProc (hwnd, OS.WM_PAINT, wParam, lParam);
+ GCData data = new GCData ();
+ data.hwnd = hwnd;
+ GC gc = new_GC (data);
+ if (gc != null) {
OS.HideCaret (hwnd);
- OS.InvalidateRect (hwnd, rect, false);
- OS.ShowCaret (hwnd);
- PAINTSTRUCT ps = new PAINTSTRUCT ();
- GCData data = new GCData ();
- data.ps = ps;
- data.hwnd = hwnd;
- GC gc = new_GC (data);
- if (gc != null) {
- int width = ps.right - ps.left;
- int height = ps.bottom - ps.top;
- if (width != 0 && height != 0) {
- Event event = new Event ();
- event.gc = gc;
- event.setBoundsInPixels(new Rectangle(ps.left, ps.top, width, height));
- sendEvent (SWT.Paint, event);
- // widget could be disposed at this point
- event.gc = null;
- }
- gc.dispose ();
- }
- } else {
- long /*int*/ rgn = OS.CreateRectRgn (0, 0, 0, 0);
- OS.GetUpdateRgn (hwnd, rgn, false);
- result = callWindowProc (hwnd, OS.WM_PAINT, wParam, lParam);
- GCData data = new GCData ();
- data.hwnd = hwnd;
- GC gc = new_GC (data);
- if (gc != null) {
- OS.HideCaret (hwnd);
- RECT rect = new RECT();
- OS.GetRgnBox (rgn, rect);
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- if (width != 0 && height != 0) {
- long /*int*/ hDC = gc.handle;
- OS.SelectClipRgn (hDC, rgn);
- OS.SetMetaRgn (hDC);
- Event event = new Event ();
- event.gc = gc;
- event.setBoundsInPixels(new Rectangle(rect.left, rect.top, width, height));
- sendEvent (SWT.Paint, event);
- // widget could be disposed at this point
- event.gc = null;
- }
- gc.dispose ();
- OS.ShowCaret (hwnd);
+ RECT rect = new RECT();
+ OS.GetRgnBox (rgn, rect);
+ int width = rect.right - rect.left;
+ int height = rect.bottom - rect.top;
+ if (width != 0 && height != 0) {
+ long /*int*/ hDC = gc.handle;
+ OS.SelectClipRgn (hDC, rgn);
+ OS.SetMetaRgn (hDC);
+ Event event = new Event ();
+ event.gc = gc;
+ event.setBoundsInPixels(new Rectangle(rect.left, rect.top, width, height));
+ sendEvent (SWT.Paint, event);
+ // widget could be disposed at this point
+ event.gc = null;
}
- OS.DeleteObject (rgn);
+ gc.dispose ();
+ OS.ShowCaret (hwnd);
}
+ OS.DeleteObject (rgn);
if (result == 0) return LRESULT.ZERO;
return new LRESULT (result);
}
@@ -2352,7 +2139,7 @@ LRESULT wmPrint (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lParam) {
* default window proc and then draw the theme border on top.
*/
if ((lParam & OS.PRF_NONCLIENT) != 0) {
- if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
+ if (OS.IsAppThemed ()) {
int bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
if ((bits & OS.WS_EX_CLIENTEDGE) != 0) {
long /*int*/ code = callWindowProc (hwnd, OS.WM_PRINT, wParam, lParam);
@@ -2523,27 +2310,8 @@ LRESULT wmSysKeyDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lPara
display.lastVirtual = display.lastNull = display.lastDead = false;
/* If are going to get a WM_SYSCHAR, ignore this message. */
- /*
- * Bug in WinCE. MapVirtualKey() returns incorrect values.
- * The fix is to rely on a key mappings table to determine
- * whether the key event must be sent now or if a WM_CHAR
- * event will follow. The key mappings table maps virtual
- * keys to SWT key codes and does not contain mappings for
- * Windows virtual keys like VK_A. Virtual keys that are
- * both virtual and ASCII are a special case.
- */
- int mapKey = 0;
- if (OS.IsWinCE) {
- switch ((int)/*64*/wParam) {
- case OS.VK_BACK: mapKey = SWT.BS; break;
- case OS.VK_RETURN: mapKey = SWT.CR; break;
- case OS.VK_DELETE: mapKey = SWT.DEL; break;
- case OS.VK_ESCAPE: mapKey = SWT.ESC; break;
- case OS.VK_TAB: mapKey = SWT.TAB; break;
- }
- } else {
- mapKey = OS.MapVirtualKey ((int)/*64*/wParam, 2);
- }
+ int mapKey = OS.MapVirtualKey ((int)/*64*/wParam, 2);
+
display.lastVirtual = mapKey == 0 || display.numpadKey ((int)/*64*/wParam) != 0;
if (display.lastVirtual) {
display.lastKey = (int)/*64*/wParam;
@@ -2584,16 +2352,7 @@ LRESULT wmSysKeyDown (long /*int*/ hwnd, long /*int*/ wParam, long /*int*/ lPara
* Shift was not pressed.
*/
display.lastKey = (int)/*64*/OS.CharLower ((short) mapKey);
-
- /*
- * Feature in Windows 98. MapVirtualKey() indicates that
- * a WM_SYSCHAR message will occur for Alt+Enter but
- * this message never happens. The fix is to issue the
- * event from WM_SYSKEYDOWN and map VK_RETURN to '\r'.
- */
- if (OS.IsWinNT) return null;
- if (wParam != OS.VK_RETURN) return null;
- display.lastAscii = '\r';
+ return null;
}
if (!sendKeyEvent (SWT.KeyDown, OS.WM_SYSKEYDOWN, wParam, lParam)) {

Back to the top