*/
private String filename = "";
+ /**
+ * If true, hide the mouse after typing a keystroke.
+ */
+ private boolean hideMouseWhenTyping = true;
+
+ /**
+ * If true, the mouse should not be displayed because a keystroke was
+ * typed.
+ */
+ private boolean typingHidMouse = false;
+
// ------------------------------------------------------------------------
// Constructors -----------------------------------------------------------
// ------------------------------------------------------------------------
public TEditorWindow(final TApplication parent, final String title) {
super(parent, title, 0, 0, parent.getScreen().getWidth(),
- parent.getScreen().getHeight() - 2, RESIZABLE);
+ parent.getDesktopBottom() - parent.getDesktopTop(), RESIZABLE);
editField = addEditor("", 0, 0, getWidth() - 2, getHeight() - 2);
setupAfterEditor();
final String contents) {
super(parent, title, 0, 0, parent.getScreen().getWidth(),
- parent.getScreen().getHeight() - 2, RESIZABLE);
+ parent.getDesktopBottom() - parent.getDesktopTop(), RESIZABLE);
filename = title;
editField = addEditor(contents, 0, 0, getWidth() - 2, getHeight() - 2);
final File file) throws IOException {
super(parent, file.getName(), 0, 0, parent.getScreen().getWidth(),
- parent.getScreen().getHeight() - 2, RESIZABLE);
+ parent.getDesktopBottom() - parent.getDesktopTop(), RESIZABLE);
filename = file.getName();
String contents = readFileData(file);
// Use TWidget's code to pass the event to the children.
super.onMouseDown(mouse);
+ if (hideMouseWhenTyping) {
+ typingHidMouse = false;
+ }
+
if (mouseOnEditor(mouse)) {
// The editor might have changed, update the scollbars.
setBottomValue(editField.getMaximumRowNumber());
// Use TWidget's code to pass the event to the children.
super.onMouseUp(mouse);
+ if (hideMouseWhenTyping) {
+ typingHidMouse = false;
+ }
+
if (mouse.isMouse1() && mouseOnVerticalScroller(mouse)) {
// Clicked on vertical scrollbar
editField.setVisibleRowNumber(getVerticalValue());
// Use TWidget's code to pass the event to the children.
super.onMouseMotion(mouse);
+ if (hideMouseWhenTyping) {
+ typingHidMouse = false;
+ }
+
if (mouseOnEditor(mouse) && mouse.isMouse1()) {
// The editor might have changed, update the scollbars.
setBottomValue(editField.getMaximumRowNumber());
*/
@Override
public void onKeypress(final TKeypressEvent keypress) {
+ if (hideMouseWhenTyping) {
+ typingHidMouse = true;
+ }
+
// Use TWidget's code to pass the event to the children.
super.onKeypress(keypress);
super.onCommand(command);
}
+ /**
+ * Returns true if this window does not want the application-wide mouse
+ * cursor drawn over it.
+ *
+ * @return true if this window does not want the application-wide mouse
+ * cursor drawn over it
+ */
+ @Override
+ public boolean hasHiddenMouse() {
+ return (super.hasHiddenMouse() || typingHidMouse);
+ }
+
// ------------------------------------------------------------------------
// TEditorWindow ----------------------------------------------------------
// ------------------------------------------------------------------------
i18n.getString("statusBarOpen"));
statusBar.addShortcutKeypress(kbF10, cmMenu,
i18n.getString("statusBarMenu"));
+
+ // Hide mouse when typing option
+ if (System.getProperty("jexer.TEditor.hideMouseWhenTyping",
+ "true").equals("false")) {
+
+ hideMouseWhenTyping = false;
+ }
}
/**