git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
#46 mention Demo7 in readme
[fanfix.git]
/
src
/
jexer
/
TWindow.java
diff --git
a/src/jexer/TWindow.java
b/src/jexer/TWindow.java
index e50e16fd1c5a9eec4f6b45c4e836a5d31b6bbdec..2855209eda870bb5a5bc44c9d2670585f7400d89 100644
(file)
--- a/
src/jexer/TWindow.java
+++ b/
src/jexer/TWindow.java
@@
-32,9
+32,9
@@
import java.util.HashSet;
import java.util.Set;
import jexer.backend.Screen;
import java.util.Set;
import jexer.backend.Screen;
-import jexer.bits.Cell;
import jexer.bits.CellAttributes;
import jexer.bits.GraphicsChars;
import jexer.bits.CellAttributes;
import jexer.bits.GraphicsChars;
+import jexer.bits.StringUtils;
import jexer.event.TCommandEvent;
import jexer.event.TKeypressEvent;
import jexer.event.TMenuEvent;
import jexer.event.TCommandEvent;
import jexer.event.TKeypressEvent;
import jexer.event.TMenuEvent;
@@
-91,6
+91,11
@@
public class TWindow extends TWidget {
*/
public static final int HIDEONCLOSE = 0x40;
*/
public static final int HIDEONCLOSE = 0x40;
+ /**
+ * Menus cannot be used when this window is active (default no).
+ */
+ public static final int OVERRIDEMENU = 0x80;
+
// ------------------------------------------------------------------------
// Variables --------------------------------------------------------------
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Variables --------------------------------------------------------------
// ------------------------------------------------------------------------
@@
-882,10
+887,11
@@
public class TWindow extends TWidget {
true);
// Draw the title
true);
// Draw the title
- int titleLeft = (getWidth() - title.length() - 2) / 2;
+ int titleLength = StringUtils.width(title);
+ int titleLeft = (getWidth() - titleLength - 2) / 2;
putCharXY(titleLeft, 0, ' ', border);
putCharXY(titleLeft, 0, ' ', border);
- putStringXY(titleLeft + 1, 0, title);
- putCharXY(titleLeft + title
.length()
+ 1, 0, ' ', border);
+ putStringXY(titleLeft + 1, 0, title
, border
);
+ putCharXY(titleLeft + title
Length
+ 1, 0, ' ', border);
if (isActive()) {
if (isActive()) {
@@
-1182,6
+1188,7
@@
public class TWindow extends TWidget {
/**
* Activate window (bring to top and receive events).
*/
/**
* Activate window (bring to top and receive events).
*/
+ @Override
public void activate() {
application.activateWindow(this);
}
public void activate() {
application.activateWindow(this);
}
@@
-1190,6
+1197,7
@@
public class TWindow extends TWidget {
* Close window. Note that windows without a close box can still be
* closed by calling the close() method.
*/
* Close window. Note that windows without a close box can still be
* closed by calling the close() method.
*/
+ @Override
public void close() {
application.closeWindow(this);
}
public void close() {
application.closeWindow(this);
}
@@
-1251,6
+1259,20
@@
public class TWindow extends TWidget {
return false;
}
return false;
}
+ /**
+ * Returns true if this window does not want menus to work while it is
+ * visible.
+ *
+ * @return true if this window does not want menus to work while it is
+ * visible
+ */
+ public final boolean hasOverriddenMenu() {
+ if ((flags & OVERRIDEMENU) != 0) {
+ return true;
+ }
+ return false;
+ }
+
/**
* Retrieve the background color.
*
/**
* Retrieve the background color.
*
@@
-1362,7
+1384,7
@@
public class TWindow extends TWidget {
* @return 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
*/
- public
final
boolean hasHiddenMouse() {
+ public boolean hasHiddenMouse() {
return hideMouse;
}
return hideMouse;
}