diff --git a/src/dorkbox/util/jna/windows/COLORREF.java b/src/dorkbox/util/jna/windows/COLORREF.java deleted file mode 100644 index aae3454..0000000 --- a/src/dorkbox/util/jna/windows/COLORREF.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package dorkbox.util.jna.windows; - -import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.WinNT; - -public class COLORREF extends WinNT.HANDLE { - public COLORREF() { - - } - - public COLORREF(Pointer p) { - super(p); - } -} diff --git a/src/dorkbox/util/jna/windows/GDI32.java b/src/dorkbox/util/jna/windows/GDI32.java index cff3ddf..cee7895 100644 --- a/src/dorkbox/util/jna/windows/GDI32.java +++ b/src/dorkbox/util/jna/windows/GDI32.java @@ -17,89 +17,21 @@ package dorkbox.util.jna.windows; import static com.sun.jna.platform.win32.WinDef.HBITMAP; import static com.sun.jna.platform.win32.WinDef.HDC; -import static com.sun.jna.platform.win32.WinDef.HFONT; -import static com.sun.jna.platform.win32.WinDef.RECT; import static com.sun.jna.platform.win32.WinGDI.BITMAPINFO; import static com.sun.jna.platform.win32.WinNT.HANDLE; import com.sun.jna.Native; import com.sun.jna.NativeLibrary; import com.sun.jna.Pointer; -import com.sun.jna.platform.win32.WinUser; import com.sun.jna.ptr.PointerByReference; import com.sun.jna.win32.W32APIOptions; -import dorkbox.util.jna.windows.structs.LOGFONT; - public class GDI32 { - public static final int ETO_OPAQUE = 2; - public static final int SRCCOPY = 0xCC0020; - /** - * Number of pixels per logical inch along the screen width. In a system with multiple display monitors, this value is the same for - * all monitors. - */ - public static final int LOGPIXELSX = 88; - static { Native.register(NativeLibrary.getInstance("GDI32", W32APIOptions.DEFAULT_OPTIONS)); } - /** - * The GetDeviceCaps function retrieves device-specific information for the specified device. - *

- * https://msdn.microsoft.com/en-us/library/dd144877(v=vs.85).aspx - * - * @param handle A handle to the DC. - * @param nIndex The item to be returned. - */ - public static native - int GetDeviceCaps(HDC handle, int nIndex); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/dd144938(v=vs.85).aspx - */ - public static native - boolean GetTextExtentPoint32(HDC hdc, String lpString, int c, WinUser.SIZE lpSize); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/dd145093(v=vs.85).aspx - */ - public static native - COLORREF SetTextColor(HDC hdc, COLORREF crColor); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/dd162964(v=vs.85).aspx - */ - public static native - COLORREF SetBkColor(HDC hdc, COLORREF crColor); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/dd162713(v=vs.85).aspx - */ - public static native - boolean ExtTextOut(HDC hdc, int X, int Y, int fuOptions, RECT lprc, String lpString, int cbCount, int[] lpDx); - - /** - * https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd183500(v=vs.85).aspx - */ - public static native - HFONT CreateFontIndirect(LOGFONT l); - - /** - * The SelectObject function selects an object into the specified device context (DC). - * The new object replaces the previous object of the same type. - * - * @param hDC Handle to the DC. - * @param hGDIObj Handle to the object to be selected. - * - * @return If the selected object is not a region and the function succeeds, the return value - * is a handle to the object being replaced. If the selected object is a region and the - * function succeeds, the return value is one of the REGION values. - */ - public static native - HANDLE SelectObject(HDC hDC, HANDLE hGDIObj); - /** * The CreateCompatibleDC function creates a memory device context (DC) compatible with the specified device. * diff --git a/src/dorkbox/util/jna/windows/Kernel32.java b/src/dorkbox/util/jna/windows/Kernel32.java index 79f3aaf..78b5c08 100644 --- a/src/dorkbox/util/jna/windows/Kernel32.java +++ b/src/dorkbox/util/jna/windows/Kernel32.java @@ -116,7 +116,6 @@ class Kernel32 { public static native int FormatMessage(int flags, Pointer source, int messageId, int languageId, PointerByReference buffer, int size, long[] args); - /** * https://msdn.microsoft.com/en-us/library/ms683171%28VS.85%29.aspx */ @@ -147,7 +146,6 @@ class Kernel32 { public static native int FillConsoleOutputCharacter(HANDLE consoleOutput, char character, int length, COORD.ByValue writeCoord, IntByReference numberOfCharsWritten); - /** * https://msdn.microsoft.com/en-us/library/ms683167%28VS.85%29.aspx */ @@ -160,7 +158,6 @@ class Kernel32 { public static native int SetConsoleMode(HANDLE handle, int mode); - /** * https://msdn.microsoft.com/en-us/library/ms684961(v=VS.85).aspx */ diff --git a/src/dorkbox/util/jna/windows/ProcessDpiAwareness.java b/src/dorkbox/util/jna/windows/ProcessDpiAwareness.java deleted file mode 100644 index 3bcca0d..0000000 --- a/src/dorkbox/util/jna/windows/ProcessDpiAwareness.java +++ /dev/null @@ -1,90 +0,0 @@ -package dorkbox.util.jna.windows; - -/** - * Important - * - * Previous versions of Windows required you to set the DPI awareness for the entire application. Now the DPI awareness is tied to - * individual threads, processes, or windows. This means that the DPI awareness can change while the app is running and that multiple - * windows can have their own independent DPI awareness values. See DPI_AWARENESS for more information about how DPI awareness currently - * works. The recommendations below about setting the DPI awareness in the application manifest are still supported, but the current - * recommendation is to use the DPI_AWARENESS_CONTEXT. - * - * - * The DPI awareness for an application should be set through the application manifest so that it is determined before any actions are - * taken which depend on the DPI of the system. Alternatively, you can set the DPI awareness using SetProcessDpiAwareness, but if you do - * so, you need to make sure to set it before taking any actions dependent on the system DPI. Once you set the DPI awareness for a - * process, it cannot be changed. - * - * - * Tip - * If your app is PROCESS_DPI_UNAWARE, there is no need to set any value in the application manifest. PROCESS_DPI_UNAWARE is the - * default value for apps unless another value is specified. - * - * - * PROCESS_DPI_UNAWARE and PROCESS_SYSTEM_DPI_AWARE apps do not need to respond to WM_DPICHANGED and are not expected to handle changes - * in DPI. The system will automatically scale these types of apps up or down as necessary when the DPI changes. - * PROCESS_PER_MONITOR_DPI_AWARE apps are responsible for recognizing and responding to changes in DPI, signaled by WM_DPICHANGED. These - * will not be scaled by the system. If an app of this type does not resize the window and its content, it will appear to grow or shrink - * by the relative DPI changes as the window is moved from one display to the another with a different DPI setting. - * - * - * Tip - * In previous versions of Windows, there was no setting for PROCESS_PER_MONITOR_DPI_AWARE. Apps were either DPI unaware or DPI aware. - * Legacy applications that were classified as DPI aware before Windows 8.1 are considered to have a PROCESS_DPI_AWARENESS setting of - * PROCESS_SYSTEM_DPI_AWARE in current versions of Windows. - * - * - * - * To understand the importance and impact of the different DPI awareness values, consider a user who has three displays: A, B, and C. - * Display A is set to 100% scaling factor (96 DPI), display B is set to 200% scaling factor (192 DPI), and display C is set to 300% - * scaling factor (288 DPI). The system DPI is set to 200%. - * - * An application that is PROCESS_DPI_UNAWARE will always use a scaling factor of 100% (96 DPI). In this scenario, a PROCESS_DPI_UNAWARE - * window is created with a size of 500 by 500. On display A, it will render natively with no scaling. On displays B and C, it will be - * scaled up by the system automatically by a factor of 2 and 3 respectively. This is because a PROCESS_DPI_UNAWARE always assumes a DPI - * of 96, and the system accounts for that. If the app queries for window size, it will always get a value of 500 by 500 regardless of - * what display it is in. If this app were to ask for the DPI of any of the three monitors, it will receive 96. - * - * Now consider an application that is PROCESS_SYSTEM_DPI_AWARE. Remember that in the sample, the system DPI is 200% or 192 DPI. This - * means that any windows created by this app will render natively on display B. It the window moves to display A, it will automatically - * be scaled down by a factor of 2. This is because a PROCESS_SYSTEM_DPI_AWARE app in this scenario assumes that the DPI will always be - * 192. It queries for the DPI on startup, and then never changes it. The system accommodates this by automatically scaling down when - * moving to display A. Likewise, if the window moves to display C, the system will automatically scale up by a factor of 1.5. If the app - * queries for window size, it will always get the same value, similar to PROCESS_DPI_UNAWARE. If it asks for the DPI of any of the three - * monitors, it will receive 192. - * - * Unlike the other awareness values, PROCESS_PER_MONITOR_DPI_AWARE should adapt to the display that it is on. This means that it is - * always rendered natively and is never scaled by the system. The responsibility is on the app to adjust the scale factor when receiving - * the WM_DPICHANGED message. Part of this message includes a suggested rect for the window. This suggestion is the current window scaled - * from the old DPI value to the new DPI value. For example, a window that is 500 by 500 on display A and moved to display B will receive - * a suggested window rect that is 1000 by 1000. If that same window is moved to display C, the suggested window rect attached to - * WM_DPICHANGED will be 1500 by 1500. Furthermore, when this app queries for the window size, it will always get the actual native value. - * Likewise, if it asks for the DPI of any of the three monitors, it will receive 96, 192, and 288 respectively. - * - * Because of DPI virtualization, if one application queries another with a different awareness level for DPI-dependent information, - * the system will automatically scale values to match the awareness level of the caller. One example of this is if you call GetWindowRect - * and pass in a window created by another application. Using the situation described above, assume that a PROCESS_DPI_UNAWARE app - * created a 500 by 500 window on display C. If you query for the window rect from a different application, the size of the rect will - * vary based upon the DPI awareness of your app. - */ -public -class ProcessDpiAwareness { - /** - * DPI unaware. This app does not scale for DPI changes and is always assumed to have a scale factor of 100% (96 DPI). - * It will be automatically scaled by the system on any other DPI setting. - */ - public static final int PROCESS_DPI_UNAWARE = 0; - - /** - * System DPI aware. This app does not scale for DPI changes. It will query for the DPI once and use that value for the lifetime - * of the app. If the DPI changes, the app will not adjust to the new DPI value. It will be automatically scaled up or down by the - * system when the DPI changes from the system value. - */ - public static final int PROCESS_SYSTEM_DPI_AWARE = 1; - - /** - * Per monitor DPI aware. This app checks for the DPI when it is created and adjusts the scale factor whenever the DPI changes. - * These applications are not automatically scaled by the system. - */ - public static final int PROCESS_PER_MONITOR_DPI_AWARE = 2; -} diff --git a/src/dorkbox/util/jna/windows/ShCore.java b/src/dorkbox/util/jna/windows/ShCore.java deleted file mode 100644 index 10b7f4d..0000000 --- a/src/dorkbox/util/jna/windows/ShCore.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2017 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package dorkbox.util.jna.windows; - -import com.sun.jna.Native; -import com.sun.jna.NativeLibrary; -import com.sun.jna.Pointer; -import com.sun.jna.ptr.IntByReference; -import com.sun.jna.win32.W32APIOptions; - - -/** - * bindings for ShCore.dll - * - * Minimum supported client - * Windows 8.1 [desktop apps only] - * - * Minimum supported server - * Windows Server 2012 R2 [desktop apps only] - * - *

- * Direct-mapping, See: https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md - */ -public -class ShCore { - static { - Native.register(NativeLibrary.getInstance("shcore", W32APIOptions.DEFAULT_OPTIONS)); - } - - /** - * https://msdn.microsoft.com/de-de/library/windows/desktop/dn280510(v=vs.85).aspx - * - * @param hmonitor A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire - * screen. - * - * @param dpiType - * MDT_EFFECTIVE_DPI = 0, - * The effective DPI. This value should be used when determining the correct scale factor for scaling UI elements. This - * incorporates the scale factor set by the user for this specific display. - * MDT_ANGULAR_DPI = 1, - * The angular DPI. This DPI ensures rendering at a compliant angular resolution on the screen. This does not include the - * scale factor set by the user for this specific display. - * MDT_RAW_DPI = 2, - * The raw DPI. This value is the linear DPI of the screen as measured on the screen itself. Use this value when you want - * to read the pixel density and not the recommended scaling setting. This does not include the scale factor set by the user - * for this specific display and is not guaranteed to be a supported DPI value. - * MDT_DEFAULT = MDT_EFFECTIVE_DPI - * - * - * @return if the function succeeds, the return value is a handle to the DC for the specified window's client area. If the function - * fails, the return value is NULL. - */ - public static native - Pointer GetDpiForMonitor(Pointer hmonitor, int dpiType, IntByReference dpiX, IntByReference dpiY); - - public static native - Pointer SetProcessDpiAwareness(int dpiAwareness); -} diff --git a/src/dorkbox/util/jna/windows/User32.java b/src/dorkbox/util/jna/windows/User32.java index a819a5f..3408cfc 100644 --- a/src/dorkbox/util/jna/windows/User32.java +++ b/src/dorkbox/util/jna/windows/User32.java @@ -23,7 +23,6 @@ import static com.sun.jna.platform.win32.WinDef.HWND; import static com.sun.jna.platform.win32.WinDef.LPARAM; import static com.sun.jna.platform.win32.WinDef.LRESULT; import static com.sun.jna.platform.win32.WinDef.POINT; -import static com.sun.jna.platform.win32.WinDef.RECT; import static com.sun.jna.platform.win32.WinDef.WPARAM; import com.sun.jna.Callback; @@ -33,83 +32,22 @@ import com.sun.jna.platform.win32.WinNT; import dorkbox.util.OS; import dorkbox.util.jna.windows.structs.ICONINFO; -import dorkbox.util.jna.windows.structs.MENUITEMINFO; -import dorkbox.util.jna.windows.structs.NONCLIENTMETRICS; @SuppressWarnings("WeakerAccess") public interface User32 { User32 IMPL = OS.is64bit() ? new User32_64() : new User32_32(); - int SPI_GETNONCLIENTMETRICS = 0x0029; - int COLOR_MENU = 4; - int COLOR_MENUTEXT = 7; - int COLOR_HIGHLIGHTTEXT = 14; - int COLOR_HIGHLIGHT = 13; - int COLOR_GRAYTEXT = 17; - int GWL_WNDPROC = -4; int WM_LBUTTONUP = 0x202; int WM_RBUTTONUP = 0x205; - int MF_BYPOSITION = 0x400; - /** * This is overridden by the 64-bit version to be SetWindowLongPtr instead. */ int SetWindowLong(HWND hWnd, int nIndex, Callback procedure); - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms647626(v=vs.85).aspx - */ - HMENU CreatePopupMenu(); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms647616(v=vs.85).aspx - */ - boolean AppendMenu(HMENU hMenu, int uFlags, int uIDNewItem, String lpNewItem); - - /** - * https://msdn.microsoft.com/en-us/library/windows/desktop/ms647629(v=vs.85).aspx - */ - boolean DeleteMenu(HMENU hMenu, int uPosition, int uFlags); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms647631(v=vs.85).aspx - */ - boolean DestroyMenu(HMENU hMenu); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms648002(v=vs.85).aspx - */ - boolean TrackPopupMenu(HMENU hMenu, int uFlags, int x, int y, int nReserved, HWND hWnd, RECT prcRect); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms648001(v=vs.85).aspx - */ - boolean SetMenuItemInfo(HMENU hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms647980(v=vs.85).aspx - */ - boolean GetMenuItemInfo(HMENU hMenu, int uItem, boolean fByPosition, MENUITEMINFO lpmii); - - /** - * Brings the thread that created the specified window into the foreground - * and activates the window. Keyboard input is directed to the window, and - * various visual cues are changed for the user. The system assigns a - * slightly higher priority to the thread that created the foreground window - * than it does to other threads. - * - * @param hWnd A handle to the window that should be activated and brought to - * the foreground. - * - * @return If the window was brought to the foreground, the return value is - * nonzero. - */ - boolean SetForegroundWindow(HWND hWnd); - /** * The GetSystemMetrics function retrieves various system metrics (widths * and heights of display elements) and system configuration settings. All @@ -129,11 +67,6 @@ interface User32 { */ int GetSystemMetrics(int nIndex); - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms633500(v=vs.85).aspx - */ - HWND FindWindowEx(HWND hwndParent, HWND hwndChildAfter, String lpszClass, String lpszWindow); - /** * http://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx */ @@ -149,16 +82,6 @@ interface User32 { */ boolean DestroyWindow(HWND hWnd); - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx - */ - boolean SystemParametersInfo(int uiAction, int uiParam, NONCLIENTMETRICS pvParam, int fWinIni); - - /** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx - */ - COLORREF GetSysColor(int nIndex); - /** * This function places a message in the message queue associated with the * thread that created the specified window and then returns without waiting @@ -238,10 +161,8 @@ interface User32 { int ReleaseDC(HWND hWnd, HDC hDC); - boolean GetCursorPos(POINT point); - /** - * https://msdn.microsoft.com/en-us/library/windows/desktop/dd145062(v=vs.85).aspx + * https://msdn.microsoft.com/en-us/library/windows/desktop/ms648390(v=vs.85).aspx */ - Pointer MonitorFromPoint(POINT pt, int shouldBeOne); + boolean GetCursorPos(POINT point); } diff --git a/src/dorkbox/util/jna/windows/User32_32.java b/src/dorkbox/util/jna/windows/User32_32.java index fe6d237..664b5b4 100644 --- a/src/dorkbox/util/jna/windows/User32_32.java +++ b/src/dorkbox/util/jna/windows/User32_32.java @@ -23,7 +23,6 @@ import static com.sun.jna.platform.win32.WinDef.HWND; import static com.sun.jna.platform.win32.WinDef.LPARAM; import static com.sun.jna.platform.win32.WinDef.LRESULT; import static com.sun.jna.platform.win32.WinDef.POINT; -import static com.sun.jna.platform.win32.WinDef.RECT; import static com.sun.jna.platform.win32.WinDef.WPARAM; import com.sun.jna.Callback; @@ -35,8 +34,6 @@ import com.sun.jna.platform.win32.WinNT; import com.sun.jna.win32.W32APIOptions; import dorkbox.util.jna.windows.structs.ICONINFO; -import dorkbox.util.jna.windows.structs.MENUITEMINFO; -import dorkbox.util.jna.windows.structs.NONCLIENTMETRICS; /** * On first glance, this appears to be unnecessary to have a DirectMapping class implement an interface - however this is so different @@ -56,52 +53,10 @@ class User32_32 implements User32 { public native int SetWindowLong(HWND hWnd, int nIndex, Callback procedure); - @Override - public native - HMENU CreatePopupMenu(); - - @Override - public native - boolean AppendMenu(final HMENU hMenu, final int uFlags, final int uIDNewItem, final String lpNewItem); - - @Override - public native - boolean DeleteMenu(final HMENU hMenu, final int uPosition, final int uFlags); - - @Override - public native - boolean DestroyMenu(final HMENU hMenu); - - @Override - public native - boolean TrackPopupMenu(final HMENU hMenu, - final int uFlags, - final int x, - final int y, - final int nReserved, - final HWND hWnd, - final RECT prcRect); - - @Override - public native - boolean SetMenuItemInfo(final HMENU hMenu, final int uItem, final boolean fByPosition, final MENUITEMINFO lpmii); - - @Override - public native - boolean GetMenuItemInfo(final HMENU hMenu, final int uItem, final boolean fByPosition, final MENUITEMINFO lpmii); - - @Override - public native - boolean SetForegroundWindow(final HWND hWnd); - @Override public native int GetSystemMetrics(final int nIndex); - @Override - public native - HWND FindWindowEx(final HWND hwndParent, final HWND hwndChildAfter, final String lpszClass, final String lpszWindow); - @Override public native LRESULT SendMessage(final HWND hWnd, final int Msg, final WPARAM wParam, final LPARAM lParam); @@ -114,14 +69,6 @@ class User32_32 implements User32 { public native boolean DestroyWindow(final HWND hWnd); - @Override - public native - boolean SystemParametersInfo(final int uiAction, final int uiParam, final NONCLIENTMETRICS pvParam, final int fWinIni); - - @Override - public native - COLORREF GetSysColor(final int nIndex); - @Override public native void PostMessage(final HWND hWnd, final int msg, final WPARAM wParam, final LPARAM lParam); @@ -172,8 +119,4 @@ class User32_32 implements User32 { @Override public native boolean GetCursorPos(final POINT point); - - @Override - public native - Pointer MonitorFromPoint(final POINT pt, final int shouldBeOne); } diff --git a/src/dorkbox/util/jna/windows/User32_64.java b/src/dorkbox/util/jna/windows/User32_64.java index 060b490..1f6020d 100644 --- a/src/dorkbox/util/jna/windows/User32_64.java +++ b/src/dorkbox/util/jna/windows/User32_64.java @@ -23,7 +23,6 @@ import static com.sun.jna.platform.win32.WinDef.HWND; import static com.sun.jna.platform.win32.WinDef.LPARAM; import static com.sun.jna.platform.win32.WinDef.LRESULT; import static com.sun.jna.platform.win32.WinDef.POINT; -import static com.sun.jna.platform.win32.WinDef.RECT; import static com.sun.jna.platform.win32.WinDef.WPARAM; import com.sun.jna.Callback; @@ -35,8 +34,6 @@ import com.sun.jna.platform.win32.WinNT; import com.sun.jna.win32.W32APIOptions; import dorkbox.util.jna.windows.structs.ICONINFO; -import dorkbox.util.jna.windows.structs.MENUITEMINFO; -import dorkbox.util.jna.windows.structs.NONCLIENTMETRICS; /** * On first glance, this appears to be unnecessary to have a DirectMapping class implement an interface - however this is so different @@ -61,52 +58,10 @@ class User32_64 implements User32 { public native int SetWindowLongPtr(HWND hWnd, int nIndex, Callback procedure); - @Override - public native - HMENU CreatePopupMenu(); - - @Override - public native - boolean AppendMenu(final HMENU hMenu, final int uFlags, final int uIDNewItem, final String lpNewItem); - - @Override - public native - boolean DeleteMenu(final HMENU hMenu, final int uPosition, final int uFlags); - - @Override - public native - boolean DestroyMenu(final HMENU hMenu); - - @Override - public native - boolean TrackPopupMenu(final HMENU hMenu, - final int uFlags, - final int x, - final int y, - final int nReserved, - final HWND hWnd, - final RECT prcRect); - - @Override - public native - boolean SetMenuItemInfo(final HMENU hMenu, final int uItem, final boolean fByPosition, final MENUITEMINFO lpmii); - - @Override - public native - boolean GetMenuItemInfo(final HMENU hMenu, final int uItem, final boolean fByPosition, final MENUITEMINFO lpmii); - - @Override - public native - boolean SetForegroundWindow(final HWND hWnd); - @Override public native int GetSystemMetrics(final int nIndex); - @Override - public native - HWND FindWindowEx(final HWND hwndParent, final HWND hwndChildAfter, final String lpszClass, final String lpszWindow); - @Override public native LRESULT SendMessage(final HWND hWnd, final int Msg, final WPARAM wParam, final LPARAM lParam); @@ -119,14 +74,6 @@ class User32_64 implements User32 { public native boolean DestroyWindow(final HWND hWnd); - @Override - public native - boolean SystemParametersInfo(final int uiAction, final int uiParam, final NONCLIENTMETRICS pvParam, final int fWinIni); - - @Override - public native - COLORREF GetSysColor(final int nIndex); - @Override public native void PostMessage(final HWND hWnd, final int msg, final WPARAM wParam, final LPARAM lParam); @@ -177,8 +124,4 @@ class User32_64 implements User32 { @Override public native boolean GetCursorPos(final POINT point); - - @Override - public native - Pointer MonitorFromPoint(final POINT pt, final int shouldBeOne); } diff --git a/src/dorkbox/util/jna/windows/structs/LOGFONT.java b/src/dorkbox/util/jna/windows/structs/LOGFONT.java deleted file mode 100644 index 7820e9e..0000000 --- a/src/dorkbox/util/jna/windows/structs/LOGFONT.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2017 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package dorkbox.util.jna.windows.structs; - -import java.util.Arrays; -import java.util.List; - -import com.sun.jna.Pointer; -import com.sun.jna.Structure; -import com.sun.jna.platform.win32.WinDef; - -/** - * https://msdn.microsoft.com/en-us/library/windows/desktop/dd145037(v=vs.85).aspx - */ -public class LOGFONT extends Structure { - - public static final int LF_FACESIZE = 32; - - public static class ByValue extends LOGFONT implements Structure.ByValue { - } - - public WinDef.LONG lfHeight; - public WinDef.LONG lfWidth; - public WinDef.LONG lfEscapement; - public WinDef.LONG lfOrientation; - public WinDef.LONG lfWeight; - public byte lfItalic; - public byte lfUnderline; - public byte lfStrikeOut; - public byte lfCharSet; - public byte lfOutPrecision; - public byte lfClipPrecision; - public byte lfQuality; - public byte lfPitchAndFamily; - public char[] lfFaceName = new char[LF_FACESIZE]; - - public LOGFONT() { - } - - public LOGFONT(Pointer p) { - super(p); - - read(); - } - - @Override - protected - List getFieldOrder() { - return Arrays.asList("lfHeight", - "lfWidth", - "lfEscapement", - "lfOrientation", - "lfWeight", - "lfItalic", - "lfUnderline", - "lfStrikeOut", - "lfCharSet", - "lfOutPrecision", - "lfClipPrecision", - "lfQuality", - "lfPitchAndFamily", - "lfFaceName"); - } -} diff --git a/src/dorkbox/util/jna/windows/structs/MENUITEMINFO.java b/src/dorkbox/util/jna/windows/structs/MENUITEMINFO.java deleted file mode 100644 index a9be9e1..0000000 --- a/src/dorkbox/util/jna/windows/structs/MENUITEMINFO.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package dorkbox.util.jna.windows.structs; - -import static com.sun.jna.platform.win32.BaseTSD.ULONG_PTR; -import static com.sun.jna.platform.win32.WinDef.HBITMAP; -import static com.sun.jna.platform.win32.WinDef.HMENU; - -import java.util.Arrays; -import java.util.List; - -import com.sun.jna.Pointer; -import com.sun.jna.Structure; - -/** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ms647578(v=vs.85).aspx - */ -public -class MENUITEMINFO extends Structure { - - public static final int MFS_ENABLED = 0x00000000; - public static final int MFS_DISABLED = 0x00000003; - - public static final int MFS_GRAYED = 0x00000003; - public static final int MFS_DEFAULT = 0x00001000; - - public static final int MFS_CHECKED = 0x00000008; - public static final int MFS_UNCHECKED= 0x00000000; - - public static final int MFS_HILITE = 0x00000080; - public static final int MFS_UNHILITE = 0x00000000; - - public static final int MIIM_DATA = 0x00000020; - - - public int cbSize; - public int fMask; - public int fType; - public int fState; - public int wID; - - public HMENU hSubMenu; - public HBITMAP hbmpChecked; - public HBITMAP hbmpUnchecked; - public ULONG_PTR dwItemData; - public String dwTypeData; - public int cch; - public HBITMAP hbmpItem; - - public - MENUITEMINFO() { - cbSize = size(); - } - - public - MENUITEMINFO(Pointer p) { - super(p); - } - - @Override - protected - List getFieldOrder() { - return Arrays.asList("cbSize", - "fMask", - "fType", - "fState", - "wID", - "hSubMenu", - "hbmpChecked", - "hbmpUnchecked", - "dwItemData", - "dwTypeData", - "cch", - "hbmpItem"); - } -} diff --git a/src/dorkbox/util/jna/windows/structs/NONCLIENTMETRICS.java b/src/dorkbox/util/jna/windows/structs/NONCLIENTMETRICS.java deleted file mode 100644 index ba03693..0000000 --- a/src/dorkbox/util/jna/windows/structs/NONCLIENTMETRICS.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2017 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package dorkbox.util.jna.windows.structs; - -import java.util.Arrays; -import java.util.List; - -import com.sun.jna.Pointer; -import com.sun.jna.Structure; - -/** - * http://msdn.microsoft.com/en-us/library/windows/desktop/ff729175(v=vs.85).aspx - */ -public class NONCLIENTMETRICS extends Structure { - public static class ByValue extends NONCLIENTMETRICS implements Structure.ByValue { - } - - public static class ByReference extends NONCLIENTMETRICS implements Structure.ByReference { - } - - public static final int ODT_MENU = 1; - public static final int ODT_LISTBOX = 2; - public static final int ODT_COMBOBOX = 3; - public static final int ODT_BUTTON = 4; - public static final int ODT_STATIC = 5; - - public int cbSize; - public int iBorderWidth; - public int iScrollWidth; - public int iScrollHeight; - public int iCaptionWidth; - public int iCaptionHeight; - public LOGFONT.ByValue lfCaptionFont; - public int iSmCaptionWidth; - public int iSmCaptionHeight; - public LOGFONT.ByValue lfSmCaptionFont; - public int iMenuWidth; - public int iMenuHeight; - public LOGFONT.ByValue lfMenuFont; - public LOGFONT.ByValue lfStatusFont; - public LOGFONT.ByValue lfMessageFont; - //public int iPaddedBorderWidth; - - public NONCLIENTMETRICS() { - cbSize = size(); - } - - public NONCLIENTMETRICS(Pointer p) { - super(p); - - read(); - } - - @Override - protected - List getFieldOrder() { - return Arrays.asList("cbSize", - "iBorderWidth", - "iScrollWidth", - "iScrollHeight", - "iCaptionWidth", - "iCaptionHeight", - "lfCaptionFont", - "iSmCaptionWidth", - "iSmCaptionHeight", - "lfSmCaptionFont", - "iMenuWidth", - "iMenuHeight", - "lfMenuFont", - "lfStatusFont", - "lfMessageFont" - //"iPaddedBorderWidth" - ); - } -}