git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TTerminalWindow sixel support wip
[nikiroo-utils.git]
/
src
/
jexer
/
TStatusBar.java
diff --git
a/src/jexer/TStatusBar.java
b/src/jexer/TStatusBar.java
index 975d285e4fa33082cf7415c7b345c9456a19729d..98565d0f8c8c7d50c29ea86218156dbaa991049b 100644
(file)
--- a/
src/jexer/TStatusBar.java
+++ b/
src/jexer/TStatusBar.java
@@
-3,7
+3,7
@@
*
* The MIT License (MIT)
*
*
* The MIT License (MIT)
*
- * Copyright (C) 201
7
Kevin Lamonte
+ * Copyright (C) 201
9
Kevin Lamonte
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@
-40,7
+40,7
@@
import jexer.event.TMouseEvent;
/**
* TStatusBar implements a status line with clickable buttons.
*/
/**
* TStatusBar implements a status line with clickable buttons.
*/
-public
final
class TStatusBar extends TWidget {
+public class TStatusBar extends TWidget {
// ------------------------------------------------------------------------
// Variables --------------------------------------------------------------
// ------------------------------------------------------------------------
// Variables --------------------------------------------------------------
@@
-125,24
+125,26
@@
public final class TStatusBar extends TWidget {
/**
* Public constructor.
*
/**
* Public constructor.
*
- * @param
parent parent widget
+ * @param
window the window associated with this status bar
* @param text text for the bar on the bottom row
*/
* @param text text for the bar on the bottom row
*/
- public TStatusBar(final TWi
dget parent
, final String text) {
+ public TStatusBar(final TWi
ndow window
, final String text) {
- // Set parent and window
- super(parent, false, 0, 0, text.length(), 1);
+ // TStatusBar is a parentless widget, because TApplication handles
+ // its drawing and event routing directly.
+ super(null, false, 0, 0, text.length(), 1);
this.text = text;
this.text = text;
+ setWindow(window);
}
/**
* Public constructor.
*
}
/**
* Public constructor.
*
- * @param
parent parent widget
+ * @param
window the window associated with this status bar
*/
*/
- public TStatusBar(final TWi
dget parent
) {
- this(
parent
, "");
+ public TStatusBar(final TWi
ndow window
) {
+ this(
window
, "");
}
// ------------------------------------------------------------------------
}
// ------------------------------------------------------------------------
@@
-259,35
+261,34
@@
public final class TStatusBar extends TWidget {
int row = getScreen().getHeight() - 1;
int width = getScreen().getWidth();
int row = getScreen().getHeight() - 1;
int width = getScreen().getWidth();
-
getScreen().
hLineXY(0, row, width, ' ', barColor);
+ hLineXY(0, row, width, ' ', barColor);
int col = 0;
for (TStatusBarKey key: keys) {
String keyStr = key.key.toString();
if (key.selected) {
int col = 0;
for (TStatusBarKey key: keys) {
String keyStr = key.key.toString();
if (key.selected) {
-
getScreen().
putCharXY(col++, row, ' ', selectedColor);
-
getScreen().
putStringXY(col, row, keyStr, selectedColor);
+ putCharXY(col++, row, ' ', selectedColor);
+ putStringXY(col, row, keyStr, selectedColor);
col += keyStr.length();
col += keyStr.length();
-
getScreen().
putCharXY(col++, row, ' ', selectedColor);
-
getScreen().
putStringXY(col, row, key.label, selectedColor);
+ putCharXY(col++, row, ' ', selectedColor);
+ putStringXY(col, row, key.label, selectedColor);
col += key.label.length();
col += key.label.length();
-
getScreen().
putCharXY(col++, row, ' ', selectedColor);
+ putCharXY(col++, row, ' ', selectedColor);
} else {
} else {
-
getScreen().
putCharXY(col++, row, ' ', barColor);
-
getScreen().
putStringXY(col, row, keyStr, keyColor);
+ putCharXY(col++, row, ' ', barColor);
+ putStringXY(col, row, keyStr, keyColor);
col += keyStr.length() + 1;
col += keyStr.length() + 1;
-
getScreen().
putStringXY(col, row, key.label, barColor);
+ putStringXY(col, row, key.label, barColor);
col += key.label.length();
col += key.label.length();
-
getScreen().
putCharXY(col++, row, ' ', barColor);
+ putCharXY(col++, row, ' ', barColor);
}
}
if (text.length() > 0) {
if (keys.size() > 0) {
}
}
if (text.length() > 0) {
if (keys.size() > 0) {
- getScreen().putCharXY(col++, row, GraphicsChars.VERTICAL_BAR,
- barColor);
+ putCharXY(col++, row, GraphicsChars.VERTICAL_BAR, barColor);
}
}
-
getScreen().
putCharXY(col++, row, ' ', barColor);
-
getScreen().
putStringXY(col, row, text, barColor);
+ putCharXY(col++, row, ' ', barColor);
+ putStringXY(col, row, text, barColor);
}
}
}
}