mirror of
https://gitlab.com/AutumnMeowMeow/jexer
synced 2024-09-19 11:50:19 -06:00
text widget mouse styles
This commit is contained in:
parent
db75c40f0e
commit
330ff5b09f
9 changed files with 58 additions and 12 deletions
|
@ -30,7 +30,7 @@
|
|||
|
||||
<project name="jexer" basedir="." default="jar">
|
||||
|
||||
<property name="version" value="1.0.0"/>
|
||||
<property name="version" value="1.5.0"/>
|
||||
<property name="src.dir" value="src"/>
|
||||
<property name="resources.dir" value="resources"/>
|
||||
<property name="build.dir" value="build"/>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
|||
<packaging>jar</packaging>
|
||||
<name>Jexer</name>
|
||||
<description>Java Text User Interface library that resembles Turbo Vision</description>
|
||||
<version>1.0.1-SNAPSHOT</version>
|
||||
<version>1.5.0-SNAPSHOT</version>
|
||||
<url>https://gitlab.com/klamonte/jexer</url>
|
||||
|
||||
<licenses>
|
||||
|
|
|
@ -2097,7 +2097,7 @@ public class TApplication implements Runnable {
|
|||
String version = getClass().getPackage().getImplementationVersion();
|
||||
if (version == null) {
|
||||
// This is Java 9+, use a hardcoded string here.
|
||||
version = "1.0.0";
|
||||
version = "1.5.0";
|
||||
}
|
||||
messageBox(i18n.getString("aboutDialogTitle"),
|
||||
MessageFormat.format(i18n.getString("aboutDialogText"), version),
|
||||
|
@ -2253,13 +2253,7 @@ public class TApplication implements Runnable {
|
|||
if (window == null) {
|
||||
return null;
|
||||
}
|
||||
activeWidget = window;
|
||||
for (TWidget widget: window.getChildren()) {
|
||||
if (widget.mouseWouldHit(mouse)) {
|
||||
activeWidget = widget;
|
||||
}
|
||||
}
|
||||
return activeWidget;
|
||||
return window.getWidgetUnderMouse(mouse);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -175,6 +175,7 @@ public class TEditorWidget extends TWidget implements EditMenuUser {
|
|||
super(parent, x, y, width, height);
|
||||
|
||||
setCursorVisible(true);
|
||||
setMouseStyle("text");
|
||||
|
||||
defaultColor = getTheme().getColor("teditor");
|
||||
document = new Document(text, defaultColor);
|
||||
|
|
|
@ -180,6 +180,8 @@ public class TField extends TWidget implements EditMenuUser {
|
|||
super(parent, x, y, width, 1);
|
||||
|
||||
setCursorVisible(true);
|
||||
setMouseStyle("text");
|
||||
|
||||
this.fixed = fixed;
|
||||
this.text = text;
|
||||
this.enterAction = enterAction;
|
||||
|
|
|
@ -239,6 +239,7 @@ public class TTerminalWidget extends TScrollableWidget
|
|||
|
||||
super(parent, x, y, width, height);
|
||||
|
||||
setMouseStyle("text");
|
||||
this.closeAction = closeAction;
|
||||
|
||||
// Save the external command line that can be used to recreate this
|
||||
|
@ -341,6 +342,7 @@ public class TTerminalWidget extends TScrollableWidget
|
|||
|
||||
super(parent, x, y, width, height);
|
||||
|
||||
setMouseStyle("text");
|
||||
this.closeAction = closeAction;
|
||||
|
||||
if (System.getProperty("jexer.TTerminal.shell") != null) {
|
||||
|
@ -917,7 +919,7 @@ public class TTerminalWidget extends TScrollableWidget
|
|||
if (hiddenMouse) {
|
||||
setMouseStyle("none");
|
||||
} else {
|
||||
setMouseStyle("default");
|
||||
setMouseStyle("text");
|
||||
}
|
||||
return hiddenMouse;
|
||||
}
|
||||
|
|
|
@ -1791,6 +1791,25 @@ public abstract class TWidget implements Comparable<TWidget> {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the widget under the mouse.
|
||||
*
|
||||
* @param mouse the mouse position
|
||||
* @return widget that is under the mouse, or null if the mouse is not
|
||||
* over this widget
|
||||
*/
|
||||
public TWidget getWidgetUnderMouse(final TMouseEvent mouse) {
|
||||
if (!mouseWouldHit(mouse)) {
|
||||
return null;
|
||||
}
|
||||
for (TWidget widget: children) {
|
||||
if (widget.mouseWouldHit(mouse)) {
|
||||
return widget.getWidgetUnderMouse(mouse);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a vertical split between this widget and parent, and optionally
|
||||
* put another widget in the other side of the split.
|
||||
|
|
|
@ -131,12 +131,22 @@ public class Tackboard {
|
|||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of items on this board.
|
||||
*
|
||||
* @return the number of items
|
||||
*/
|
||||
public int size() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove everything on this board.
|
||||
*/
|
||||
public void clear() {
|
||||
for (TackboardItem item: items) {
|
||||
while (items.size() > 0) {
|
||||
// Give every item a shot to cleanup if it needs to.
|
||||
TackboardItem item = items.get(0);
|
||||
item.remove();
|
||||
}
|
||||
dirty = false;
|
||||
|
|
|
@ -3642,6 +3642,24 @@ public class ECMA48 implements Runnable {
|
|||
}
|
||||
break;
|
||||
|
||||
case 1047:
|
||||
// Fall through...
|
||||
case 1048:
|
||||
// Fall through...
|
||||
case 1049:
|
||||
if (type == DeviceType.XTERM) {
|
||||
if (decPrivateModeFlag == true) {
|
||||
// Save cursor, select alternate/normal, and clear
|
||||
// screen. We won't switch to a different buffer,
|
||||
// instead we will just clear the screen.
|
||||
eraseScreen(0, 0, height - 1, width - 1, false);
|
||||
scrollRegionTop = 0;
|
||||
scrollRegionBottom = height - 1;
|
||||
cursorPosition(0, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1070:
|
||||
if (type == DeviceType.XTERM) {
|
||||
if (decPrivateModeFlag == true) {
|
||||
|
|
Loading…
Reference in a new issue