Package gg.xp.xivsupport.gui.overlay
Class EnhancedWindowUtils.NativeWindowUtils
java.lang.Object
gg.xp.xivsupport.gui.overlay.EnhancedWindowUtils.NativeWindowUtils
- Enclosing class:
- EnhancedWindowUtils
Window utilities with differing native implementations.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected List<com.sun.jna.platform.DesktopWindow>
getAllWindows
(boolean onlyVisibleWindows) Requests a list of all currently available Desktop windows.Return the default graphics configuration.protected Dimension
getIconSize
(com.sun.jna.platform.win32.WinDef.HICON hIcon) Detects the size of an icon.protected String
getProcessFilePath
(com.sun.jna.platform.win32.WinDef.HWND hwnd) Detects the full file path of the process associated with the specified window handle.protected Window
protected BufferedImage
getWindowIcon
(com.sun.jna.platform.win32.WinDef.HWND hwnd) Obtains the set icon for the window associated with the specified window handle.protected Rectangle
getWindowLocationAndSize
(com.sun.jna.platform.win32.WinDef.HWND hwnd) Requests the location and size of the window associated with the specified window handle.protected String
getWindowTitle
(com.sun.jna.platform.win32.WinDef.HWND hwnd) Tries to obtain the Window's title which belongs to the specified window handle.boolean
Default: no support.protected void
setDoubleBuffered
(Component root, boolean buffered) protected void
setForceHeavyweightPopups
(Window w, boolean force) Use this method to ensure heavyweight popups are used in conjunction with a given window.protected void
setLayersTransparent
(Window w, boolean transparent) protected void
Override this method to provide bitmap masking of the given heavyweight component.protected void
void
setWindowAlpha
(Window w, float alpha) Set the overall alpha transparency of the window.protected void
setWindowMask
(Component w, Raster raster, int which) Set the window mask based on the given Raster, which should be treated as a bitmap (zero/nonzero values only).void
setWindowMask
(Component w, Shape mask, int which) Set the window mask based on aShape
.void
setWindowMask
(Component w, Icon mask) Set the window mask based on an Icon.void
setWindowTransparent
(Window w, boolean transparent) Set the window to be transparent.protected Raster
protected Raster
protected Shape
protected void
whenDisplayable
(Component w, Runnable action) Execute the given action when the given window becomes displayable.
-
Constructor Details
-
NativeWindowUtils
public NativeWindowUtils()
-
-
Method Details
-
setMask
-
getWindow
-
whenDisplayable
Execute the given action when the given window becomes displayable. -
toRaster
-
toRaster
-
toShape
-
setWindowAlpha
Set the overall alpha transparency of the window. An alpha of 1.0 is fully opaque, 0.0 is fully transparent. -
isWindowAlphaSupported
public boolean isWindowAlphaSupported()Default: no support. -
getAlphaCompatibleGraphicsConfiguration
Return the default graphics configuration. -
setWindowTransparent
Set the window to be transparent. Only explicitly painted pixels will be non-transparent. All pixels will be composited with whatever is under the window using their alpha values. -
setDoubleBuffered
-
setLayersTransparent
-
setMask
Override this method to provide bitmap masking of the given heavyweight component. -
setWindowMask
Set the window mask based on the given Raster, which should be treated as a bitmap (zero/nonzero values only). A value ofnull
means to remove the mask. -
setWindowMask
Set the window mask based on aShape
. -
setWindowMask
Set the window mask based on an Icon. All non-transparent pixels will be included in the mask. -
setForceHeavyweightPopups
Use this method to ensure heavyweight popups are used in conjunction with a given window. This prevents the window's alpha setting or mask region from being applied to the popup. -
getWindowIcon
Obtains the set icon for the window associated with the specified window handle.- Parameters:
hwnd
- The concerning window handle.- Returns:
- Either the window's icon or
null
if an error occurred. - Throws:
UnsupportedOperationException
- Thrown if this method wasn't yet implemented for the current platform.
-
getIconSize
Detects the size of an icon.- Parameters:
hIcon
- The icon handle type.- Returns:
- Either the requested icon's dimension or an
Dimension
instance of(0, 0)
. - Throws:
UnsupportedOperationException
- Thrown if this method wasn't yet implemented for the current platform.
-
getAllWindows
Requests a list of all currently available Desktop windows.- Parameters:
onlyVisibleWindows
- Specifies whether only currently visible windows will be considered (true
). That are windows which are not minimized. TheWS_VISIBLE
flag will be checked (see: User32.IsWindowVisible(HWND)).- Returns:
- A list with all windows and some detailed information.
- Throws:
UnsupportedOperationException
- Thrown if this method wasn't yet implemented for the current platform.
-
getWindowTitle
Tries to obtain the Window's title which belongs to the specified window handle.- Parameters:
hwnd
- The concerning window handle.- Returns:
- Either the title or an empty string of no title was found or an error occurred.
- Throws:
UnsupportedOperationException
- Thrown if this method wasn't yet implemented for the
-
getProcessFilePath
Detects the full file path of the process associated with the specified window handle.- Parameters:
hwnd
- The concerning window handle for which the PE file path is required.- Returns:
- The full file path of the PE file that is associated with the specified window handle.
- Throws:
UnsupportedOperationException
- Thrown if this method wasn't yet implemented for the
-
getWindowLocationAndSize
Requests the location and size of the window associated with the specified window handle.- Parameters:
hwnd
- The concerning window handle.- Returns:
- The location and size of the window.
- Throws:
UnsupportedOperationException
- Thrown if this method wasn't yet implemented for the
-