mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 02:00:58 +00:00
Aero Snap - hover over Maximize button.
This commit is contained in:
@@ -48,13 +48,20 @@ import java.awt.event.WindowStateListener;
|
|||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.JButton;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.plaf.RootPaneUI;
|
import javax.swing.plaf.RootPaneUI;
|
||||||
import org.pushingpixels.flamingo.api.ribbon.JRibbon;
|
import org.pushingpixels.flamingo.api.ribbon.JRibbon;
|
||||||
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
|
import org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton;
|
||||||
|
import org.pushingpixels.substance.api.DecorationAreaType;
|
||||||
|
import org.pushingpixels.substance.api.SubstanceColorScheme;
|
||||||
import org.pushingpixels.substance.flamingo.ribbon.ui.SubstanceRibbonRootPaneUI;
|
import org.pushingpixels.substance.flamingo.ribbon.ui.SubstanceRibbonRootPaneUI;
|
||||||
|
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities;
|
||||||
import org.pushingpixels.substance.internal.utils.SubstanceSizeUtils;
|
import org.pushingpixels.substance.internal.utils.SubstanceSizeUtils;
|
||||||
|
import org.pushingpixels.substance.internal.utils.icon.SubstanceIconFactory;
|
||||||
|
import org.pushingpixels.substance.internal.utils.icon.TransitionAwareIcon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author JPEXS
|
* @author JPEXS
|
||||||
@@ -212,7 +219,8 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
|||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
private BaseTSD.LONG_PTR oldWndProc;
|
private BaseTSD.LONG_PTR oldWndProc;
|
||||||
private StdCallLibrary.StdCallCallback newProc;
|
private StdCallLibrary.StdCallCallback newProc;
|
||||||
private Rectangle activeRect = new Rectangle();
|
private Rectangle dragRect = new Rectangle();
|
||||||
|
private Rectangle toggleRect = new Rectangle();
|
||||||
private AffineTransform trans;
|
private AffineTransform trans;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -242,21 +250,27 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
|||||||
private void updateRect() {
|
private void updateRect() {
|
||||||
int appButtonSize = (int) Math.round(trans.getScaleX() * Integer.getInteger("peacock.appButtonSize", 24));
|
int appButtonSize = (int) Math.round(trans.getScaleX() * Integer.getInteger("peacock.appButtonSize", 24));
|
||||||
int titleIconsWidth
|
int titleIconsWidth
|
||||||
= 3 + SubstanceSizeUtils.getTitlePaneIconSize() //close
|
= 3 + SubstanceSizeUtils.getTitlePaneIconSize() //close
|
||||||
+ 10 + SubstanceSizeUtils.getTitlePaneIconSize() //maximize / restore
|
+ 10 + SubstanceSizeUtils.getTitlePaneIconSize() //maximize / restore
|
||||||
+ 2 + SubstanceSizeUtils.getTitlePaneIconSize() //minimize
|
+ 2 + SubstanceSizeUtils.getTitlePaneIconSize() //minimize
|
||||||
+ 2 + SubstanceSizeUtils.getTitlePaneIconSize(); //always on top
|
+ 2 + SubstanceSizeUtils.getTitlePaneIconSize() //always on top
|
||||||
|
;
|
||||||
|
|
||||||
Insets insets = titlePane.getInsets();
|
dragRect = new Rectangle(
|
||||||
if (insets == null) {
|
5 + appButtonSize,
|
||||||
insets = new Insets(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
activeRect = new Rectangle(
|
|
||||||
insets.left + appButtonSize,
|
|
||||||
4,
|
4,
|
||||||
titlePane.getWidth() - titleIconsWidth - insets.right - (insets.left + appButtonSize),
|
titlePane.getWidth() - titleIconsWidth - appButtonSize,
|
||||||
titlePane.getHeight()
|
titlePane.getHeight()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
toggleRect = new Rectangle(
|
||||||
|
titlePane.getWidth() - (3 + SubstanceSizeUtils.getTitlePaneIconSize() // close
|
||||||
|
+ 10 + SubstanceSizeUtils.getTitlePaneIconSize() //maximize / restore
|
||||||
|
),
|
||||||
|
4,
|
||||||
|
SubstanceSizeUtils.getTitlePaneIconSize(),
|
||||||
|
SubstanceSizeUtils.getTitlePaneIconSize()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
titlePane.addComponentListener(ad);
|
titlePane.addComponentListener(ad);
|
||||||
@@ -275,6 +289,9 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
|||||||
if (uMsg == WinUser.WM_NCCALCSIZE) {
|
if (uMsg == WinUser.WM_NCCALCSIZE) {
|
||||||
return new WinDef.LRESULT(0);
|
return new WinDef.LRESULT(0);
|
||||||
}
|
}
|
||||||
|
if (uMsg == WinUser.WM_NCMOUSEMOVE) {
|
||||||
|
User32.INSTANCE.PostMessage(hWnd, WinUser.WM_MOUSEMOVE, wParam, lParam);
|
||||||
|
}
|
||||||
if (uMsg == WinUser.WM_NCHITTEST) {
|
if (uMsg == WinUser.WM_NCHITTEST) {
|
||||||
int y = (short) ((lParam.longValue() >> 16) & 0xFFFF);
|
int y = (short) ((lParam.longValue() >> 16) & 0xFFFF);
|
||||||
int x = (short) (lParam.longValue() & 0xFFFF);
|
int x = (short) (lParam.longValue() & 0xFFFF);
|
||||||
@@ -320,10 +337,14 @@ public final class MainFrameRibbon extends AppRibbonFrame {
|
|||||||
|
|
||||||
p.x -= posOnScreen.x;
|
p.x -= posOnScreen.x;
|
||||||
p.y -= posOnScreen.y;
|
p.y -= posOnScreen.y;
|
||||||
if (activeRect.contains(p)) {
|
if (dragRect.contains(p)) {
|
||||||
return new WinDef.LRESULT(WinUser.HTCAPTION);
|
return new WinDef.LRESULT(WinUser.HTCAPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toggleRect.contains(p)) {
|
||||||
|
return new WinDef.LRESULT(WinUser.HTMAXBUTTON);
|
||||||
|
}
|
||||||
|
|
||||||
//return new WinDef.LRESULT(WinUser.HTCLIENT);
|
//return new WinDef.LRESULT(WinUser.HTCLIENT);
|
||||||
}
|
}
|
||||||
return User32.INSTANCE.CallWindowProc(oldWndProc.toPointer(), hWnd, uMsg, wParam, lParam);
|
return User32.INSTANCE.CallWindowProc(oldWndProc.toPointer(), hWnd, uMsg, wParam, lParam);
|
||||||
|
|||||||
@@ -446,9 +446,13 @@ public interface WinUser extends StdCallLibrary, WinDef {
|
|||||||
|
|
||||||
int WM_NCCALCSIZE = 0x0083;
|
int WM_NCCALCSIZE = 0x0083;
|
||||||
int WM_NCHITTEST = 0x0084;
|
int WM_NCHITTEST = 0x0084;
|
||||||
|
int WM_NCMOUSEMOVE = 0x00A0;
|
||||||
|
|
||||||
|
int WM_MOUSEMOVE = 0x0200;
|
||||||
|
|
||||||
int HTCLIENT = 1;
|
int HTCLIENT = 1;
|
||||||
int HTCAPTION = 2;
|
int HTCAPTION = 2;
|
||||||
|
int HTMAXBUTTON = 9;
|
||||||
int HTLEFT = 10;
|
int HTLEFT = 10;
|
||||||
int HTRIGHT = 11;
|
int HTRIGHT = 11;
|
||||||
int HTTOP = 12;
|
int HTTOP = 12;
|
||||||
|
|||||||
Reference in New Issue
Block a user