mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
option to block mouse clicks through balloon
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -93,4 +93,7 @@ public interface BalloonBuilder {
|
||||
|
||||
@NotNull
|
||||
BalloonBuilder setLayer(Balloon.Layer layer);
|
||||
|
||||
@NotNull
|
||||
BalloonBuilder setBlockClicksThroughBalloon(boolean block);
|
||||
}
|
||||
@@ -155,6 +155,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
|
||||
private boolean myAnimationEnabled = true;
|
||||
private boolean myShadow = false;
|
||||
private Layer myLayer;
|
||||
private boolean myBlockClicks;
|
||||
|
||||
public boolean isInsideBalloon(MouseEvent me) {
|
||||
return isInside(new RelativePoint(me));
|
||||
@@ -212,6 +213,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
|
||||
Insets contentInsets,
|
||||
boolean shadow,
|
||||
boolean smallVariant,
|
||||
boolean blockClicks,
|
||||
Layer layer) {
|
||||
myBorderColor = borderColor;
|
||||
myFillColor = fillColor;
|
||||
@@ -230,6 +232,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
|
||||
myDialogMode = dialogMode;
|
||||
myTitle = title;
|
||||
myLayer = layer != null ? layer : Layer.normal;
|
||||
myBlockClicks = blockClicks;
|
||||
|
||||
if (!myDialogMode) {
|
||||
new AwtVisitor(content) {
|
||||
@@ -532,22 +535,24 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
|
||||
myLayeredPane.add(myComp);
|
||||
myLayeredPane.setLayer(myComp, getLayer());
|
||||
myPosition.updateBounds(this);
|
||||
myComp.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
e.consume();
|
||||
}
|
||||
if (myBlockClicks) {
|
||||
myComp.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
e.consume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
e.consume();
|
||||
}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
e.consume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
e.consume();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
e.consume();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1519,7 +1524,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
|
||||
//pane.setBorder(new LineBorder(Color.blue));
|
||||
|
||||
balloon.set(new BalloonImpl(new JLabel("FUCK"), Color.black, MessageType.ERROR.getPopupBackground(), true, true, true, true, true, 0, true, null, false, 500, 25, 0, 0, false, "This is the title",
|
||||
new Insets(2, 2, 2, 2), true, false, Layer.normal));
|
||||
new Insets(2, 2, 2, 2), true, false, false, Layer.normal));
|
||||
balloon.get().setShowPointer(true);
|
||||
|
||||
if (e.isShiftDown()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,6 +55,7 @@ public class BalloonPopupBuilderImpl implements BalloonBuilder {
|
||||
private boolean mySmallVariant = false;
|
||||
|
||||
private Balloon.Layer myLayer;
|
||||
private boolean myBlockClicks = false;
|
||||
|
||||
public BalloonPopupBuilderImpl(@NotNull final JComponent content) {
|
||||
myContent = content;
|
||||
@@ -121,6 +122,12 @@ public class BalloonPopupBuilderImpl implements BalloonBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public BalloonBuilder setBlockClicksThroughBalloon(boolean block) {
|
||||
myBlockClicks = block;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public BalloonBuilder setAnimationCycle(int time) {
|
||||
@@ -151,7 +158,7 @@ public class BalloonPopupBuilderImpl implements BalloonBuilder {
|
||||
@NotNull
|
||||
public Balloon createBalloon() {
|
||||
return new BalloonImpl(myContent, myBorder, myFill, myHideOnMouseOutside, myHideOnKeyOutside, myHideOnAction, myShowCalllout, myCloseButtonEnabled, myFadeoutTime, myHideOnFrameResize, myClickHandler, myCloseOnClick, myAnimationCycle,
|
||||
myCalloutShift, myPositionChangeXShift, myPositionChangeYShift, myDialogMode, myTitle, myContentInsets, myShadow, mySmallVariant, myLayer);
|
||||
myCalloutShift, myPositionChangeXShift, myPositionChangeYShift, myDialogMode, myTitle, myContentInsets, myShadow, mySmallVariant, myBlockClicks, myLayer);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -194,4 +194,11 @@ class GradleBalloonBuilder implements BalloonBuilder {
|
||||
myDelegate.setLayer(layer);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public BalloonBuilder setBlockClicksThroughBalloon(boolean block) {
|
||||
myDelegate.setBlockClicksThroughBalloon(block);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user