aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-12-18 02:34:17 +0100
committerSven Gothel <[email protected]>2023-12-18 02:34:17 +0100
commit8b30ea9859fb1a1e9d1a373a0e355748b9a7c8ef (patch)
tree58b42d390c25c384cf9ad57565ede90723fb5f5d /src
parentb7f8a70674e36a8c324f91d0f73f89667c3c8300 (diff)
GraphUI Shape: Rename [set|is]{Enabled -> Visible}(..) for clarity
Note that invisible shapes are still considered for picking/activation. To completely mute the shape, issue {@link #setInteractive(boolean)} as well.
Diffstat (limited to 'src')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java18
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java4
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java4
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Group.java6
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Scene.java2
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Shape.java20
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java2
8 files changed, 32 insertions, 26 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
index 18ce9c0e6..6a30c057a 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java
@@ -488,11 +488,11 @@ public class UISceneDemo20 implements GLEventListener {
@Override
public void mouseClicked(final MouseEvent e) {
if( null != labels[currentText] ) {
- labels[currentText].setEnabled(false);
+ labels[currentText].setVisible(false);
}
currentText = (currentText+1)%labels.length;
if( null != labels[currentText] ) {
- labels[currentText].setEnabled(true);
+ labels[currentText].setVisible(true);
}
} } );
button.addMouseListener(dragZoomRotateListener);
@@ -501,7 +501,7 @@ public class UISceneDemo20 implements GLEventListener {
button = new Button(renderModes, fontButtons, "Show fps", "Hide fps", buttonLWidth, buttonLHeight, Button.DEFAULT_LABEL_ZOFFSET);
button.setID(BUTTON_FPS);
button.setToggleable(true);
- button.setToggle(fpsLabel.isEnabled());
+ button.setToggle(fpsLabel.isVisible());
button.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
@@ -509,7 +509,7 @@ public class UISceneDemo20 implements GLEventListener {
if( null != a ) {
a.resetFPSCounter();
}
- fpsLabel.setEnabled(!fpsLabel.isEnabled());
+ fpsLabel.setVisible(!fpsLabel.isVisible());
} } );
button.addMouseListener(dragZoomRotateListener);
buttonsLeft.addShape(button);
@@ -952,11 +952,11 @@ public class UISceneDemo20 implements GLEventListener {
private void initLabels(final GL2ES2 gl) {
jogampLabel = new Label(renderModes, font, fontSizeFixedNorm, jogamp);
jogampLabel.addMouseListener(dragZoomRotateListener);
- jogampLabel.setEnabled(enableOthers);
+ jogampLabel.setVisible(enableOthers);
scene.addShape(jogampLabel);
truePtSizeLabel = new Label(renderModes, font, truePtSize);
- truePtSizeLabel.setEnabled(enableOthers);
+ truePtSizeLabel.setVisible(enableOthers);
truePtSizeLabel.setColor(0.1f, 0.1f, 0.1f, 1.0f);
scene.addShape(truePtSizeLabel);
@@ -967,7 +967,7 @@ public class UISceneDemo20 implements GLEventListener {
*/
fpsLabel = new Label(renderModes, fontFPS, "Nothing there yet");
fpsLabel.addMouseListener(dragZoomRotateListener);
- fpsLabel.setEnabled(enableOthers);
+ fpsLabel.setVisible(enableOthers);
fpsLabel.setColor(0.1f, 0.1f, 0.1f, 1.0f);
scene.addShape(fpsLabel);
}
@@ -1128,7 +1128,7 @@ public class UISceneDemo20 implements GLEventListener {
labels[currentText] = new Label(renderModes, font, fontSizeFixedNorm, strings[currentText]);
labels[currentText].setScale(sceneHeight, sceneHeight, 1f);
labels[currentText].setColor(0.1f, 0.1f, 0.1f, 1.0f);
- labels[currentText].setEnabled(enableOthers);
+ labels[currentText].setVisible(enableOthers);
labels[currentText].setFixedARatioResize(true);
labels[currentText].validate(gl);
labels[currentText].move(dxMiddle,
@@ -1140,7 +1140,7 @@ public class UISceneDemo20 implements GLEventListener {
System.err.println("Label["+currentText+"] CTOR: "+labels[currentText]);
System.err.println("Label["+currentText+"] CTOR: "+labels[currentText].getPosition());
}
- if( fpsLabel.isEnabled() ) {
+ if( fpsLabel.isVisible() ) {
final String text;
if( null == actionText ) {
text = scene.getStatusText(drawable, renderModes, fpsLabel.getQuality(), dpiV);
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
index dc36f9fbb..61f420d81 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java
@@ -190,7 +190,7 @@ public class UIShapeDemo01 implements GLEventListener {
System.err.println(button);
crossHair = new CrossHair(renderModes, sz2, sz2, 1/1000f);
crossHair.setColor(0f,0f,1f,1f);
- crossHair.setEnabled(true);
+ crossHair.setVisible(true);
}
public final RegionRenderer getRegionRenderer() { return rRenderer; }
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
index 38181cc83..8042bb550 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
@@ -198,7 +198,7 @@ public class UITypeDemo01 implements GLEventListener {
crossHair = new CrossHair(renderModes, 1/20f, 1/20f, 1/1000f);
crossHair.setColor(0f,0f,1f,1f);
- crossHair.setEnabled(true);
+ crossHair.setVisible(true);
if (false ) {
final Rectangle o = new Rectangle(renderModes, 1/10f, 1/20f, 1/1000f);
@@ -213,7 +213,7 @@ public class UITypeDemo01 implements GLEventListener {
testObj = o;
}
testObj.setColor(0f, 0f, 0f, 1f);
- testObj.setEnabled(true);
+ testObj.setVisible(true);
}
public final RegionRenderer getRegionRenderer() { return rRenderer; }
diff --git a/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java b/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
index b17399a01..f28c8984e 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/AnimGroup.java
@@ -737,9 +737,9 @@ public class AnimGroup extends Group {
pos.add( p_t.normalize().scale( dxy ) );
}
if( clip.intersects2DRegion(pos.x(), pos.y(), sd.shape.getScaledWidth(), sd.shape.getScaledHeight()) ) {
- sd.shape.setEnabled(true);
+ sd.shape.setVisible(true);
} else {
- sd.shape.setEnabled(false);
+ sd.shape.setVisible(false);
}
sd.shape.moveTo(pos);
return true;
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java
index aa5079b02..e5f98d164 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Group.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java
@@ -219,7 +219,7 @@ public class Group extends Shape implements Container {
final int shapeCount = shapesS.length;
for(int i=0; i<shapeCount; i++) {
final Shape shape = (Shape) shapesS[i];
- if( shape.isEnabled() ) {
+ if( shape.isVisible() ) {
pmv.pushMv();
shape.setTransformMv(pmv);
@@ -319,12 +319,12 @@ public class Group extends Shape implements Container {
final int myRMs = Region.isVBAA(firstRMs) ? Region.VBAA_RENDERING_BIT : 0;
border = new Rectangle(myRMs, box, getBorderThickness());
} else {
- border.setEnabled(true);
+ border.setVisible(true);
border.setBounds(box, getBorderThickness());
}
border.setColor(getBorderColor());
} else if( null != border ) {
- border.setEnabled(false);
+ border.setVisible(false);
}
}
}
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
index e35ce5c31..ea5e98b84 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java
@@ -489,7 +489,7 @@ public final class Scene implements Container, GLEventListener {
// final Shape shape = shapes.get(i);
final Shape shape = (Shape)shapes[i];
// System.err.println("Id "+i+": "+uiShape);
- if( shape.isEnabled() ) {
+ if( shape.isVisible() ) {
pmv.pushMv();
shape.setTransformMv(pmv);
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
index a80f07403..7f218fcbe 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java
@@ -165,7 +165,7 @@ public abstract class Shape {
private int id = -1;
private String name = "noname";
- private static final int IO_ENABLED = 1 << 0;
+ private static final int IO_VISIBLE = 1 << 0;
private static final int IO_INTERACTIVE = 1 << 1;
private static final int IO_ACTIVABLE = 1 << 2;
private static final int IO_TOGGLEABLE = 1 << 3;
@@ -179,7 +179,7 @@ public abstract class Shape {
private static final int IO_IN_MOVE = 1 << 11;
private static final int IO_IN_RESIZE_BR = 1 << 12;
private static final int IO_IN_RESIZE_BL = 1 << 13;
- private volatile int ioState = IO_DRAGGABLE | IO_RESIZABLE | IO_INTERACTIVE | IO_ACTIVABLE | IO_ENABLED;
+ private volatile int ioState = IO_DRAGGABLE | IO_RESIZABLE | IO_INTERACTIVE | IO_ACTIVABLE | IO_VISIBLE;
private final boolean isIO(final int mask) { return mask == ( ioState & mask ); }
private final Shape setIO(final int mask, final boolean v) { if( v ) { ioState |= mask; } else { ioState &= ~mask; } return this; }
@@ -219,10 +219,16 @@ public abstract class Shape {
/** Returns true if this shape denotes a container, e.g. {@link Group}, otherwise false. */
public boolean isContainer() { return false; }
- /** Returns true if this shape is enabled and hence visible, otherwise false. */
- public final boolean isEnabled() { return isIO(IO_ENABLED); }
- /** Enable or disable this shape, i.e. its visibility. */
- public final Shape setEnabled(final boolean v) { return setIO(IO_ENABLED, v); }
+ /** Returns true if this shape is visible, otherwise false. */
+ public final boolean isVisible() { return isIO(IO_VISIBLE); }
+ /**
+ * Enable or disable this shape's visibility.
+ * <p>
+ * Note that invisible shapes are still considered for picking/activation.
+ * To completely mute the shape, issue {@link #setInteractive(boolean)} as well.
+ * </p>
+ */
+ public final Shape setVisible(final boolean v) { return setIO(IO_VISIBLE, v); }
/**
* Sets the padding for this shape, which is included in {@link #getBounds()B} and also includes the border. Default is zero.
@@ -1170,7 +1176,7 @@ public abstract class Shape {
final String bs = hasBorder() ? "border[l "+getBorderThickness()+", c "+getBorderColor()+"], " : "";
final String idS = -1 != id ? ", id "+id : "";
final String nameS = "noname" != name ? ", '"+name+"'" : "";
- return getDirtyString()+idS+nameS+", enabled "+isIO(IO_ENABLED)+activeS+", toggle "+isIO(IO_TOGGLE)+
+ return getDirtyString()+idS+nameS+", visible "+isIO(IO_VISIBLE)+activeS+", toggle "+isIO(IO_TOGGLE)+
", able[toggle "+isIO(IO_TOGGLEABLE)+", iactive "+isInteractive()+", resize "+isResizable()+", move "+this.isDraggable()+
"], pos["+position+"], "+pivotS+scaleS+rotateS+
ps+bs+"box"+box;
diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
index f55bd927f..493135a14 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/GlyphShape.java
@@ -69,7 +69,7 @@ public class GlyphShape extends GraphShape {
this.glyph = glyph;
this.origPos = new Vec3f(x, y, 0f);
if( glyph.isNonContour() ) {
- setEnabled(false);
+ setVisible(false);
}
final int[/*2*/] vertIndexCount = Region.countOutlineShape(glyph.getShape(), new int[2]);
regionVertCount = vertIndexCount[0];