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
support for kbTab in AWT
[fanfix.git]
/
src
/
jexer
/
menu
/
TMenu.java
diff --git
a/src/jexer/menu/TMenu.java
b/src/jexer/menu/TMenu.java
index da349bf3ccc7d7faa5dbf066b7cad7f51be8c258..56cbad5be6661425575ea9039f2392f785b03405 100644
(file)
--- a/
src/jexer/menu/TMenu.java
+++ b/
src/jexer/menu/TMenu.java
@@
-126,15
+126,8
@@
public final class TMenu extends TWindow {
*/
@Override
public void draw() {
*/
@Override
public void draw() {
- CellAttributes menuColor;
CellAttributes background = getTheme().getColor("tmenu");
CellAttributes background = getTheme().getColor("tmenu");
- if (getAbsoluteActive()) {
- menuColor = getTheme().getColor("tmenu.highlighted");
- } else {
- menuColor = getTheme().getColor("tmenu");
- }
-
assert (getAbsoluteActive());
// Fill in the interior background
assert (getAbsoluteActive());
// Fill in the interior background
@@
-177,7
+170,6
@@
public final class TMenu extends TWindow {
@Override
public void onMouseDown(final TMouseEvent mouse) {
this.mouse = mouse;
@Override
public void onMouseDown(final TMouseEvent mouse) {
this.mouse = mouse;
- setRepaint();
// Pass to children
for (TWidget widget: getChildren()) {
// Pass to children
for (TWidget widget: getChildren()) {
@@
-202,7
+194,6
@@
public final class TMenu extends TWindow {
@Override
public void onMouseUp(final TMouseEvent mouse) {
this.mouse = mouse;
@Override
public void onMouseUp(final TMouseEvent mouse) {
this.mouse = mouse;
- setRepaint();
// Pass to children
for (TWidget widget: getChildren()) {
// Pass to children
for (TWidget widget: getChildren()) {
@@
-227,7
+218,6
@@
public final class TMenu extends TWindow {
@Override
public void onMouseMotion(final TMouseEvent mouse) {
this.mouse = mouse;
@Override
public void onMouseMotion(final TMouseEvent mouse) {
this.mouse = mouse;
- setRepaint();
// See if we should activate a different menu item
for (TWidget widget: getChildren()) {
// See if we should activate a different menu item
for (TWidget widget: getChildren()) {
@@
-306,7
+296,6
@@
public final class TMenu extends TWindow {
// Dispatch the keypress to an active widget
for (TWidget widget: getChildren()) {
if (widget.getActive()) {
// Dispatch the keypress to an active widget
for (TWidget widget: getChildren()) {
if (widget.getActive()) {
- setRepaint();
widget.handleEvent(keypress);
return;
}
widget.handleEvent(keypress);
return;
}
@@
-321,7
+310,7
@@
public final class TMenu extends TWindow {
* @param key global keyboard accelerator
* @return the new menu item
*/
* @param key global keyboard accelerator
* @return the new menu item
*/
- public TMenuItem addItem(final int id, final String label,
+ public
final
TMenuItem addItem(final int id, final String label,
final TKeypress key) {
assert (id >= 1024);
final TKeypress key) {
assert (id >= 1024);
@@
-351,7
+340,7
@@
public final class TMenu extends TWindow {
for (TWidget widget: getChildren()) {
widget.setWidth(getWidth() - 2);
}
for (TWidget widget: getChildren()) {
widget.setWidth(getWidth() - 2);
}
- getApplication().addAccelerator(menuItem,
toLower(key
));
+ getApplication().addAccelerator(menuItem,
key.toLowerCase(
));
getApplication().recomputeMenuX();
activate(0);
return menuItem;
getApplication().recomputeMenuX();
activate(0);
return menuItem;
@@
-364,7
+353,7
@@
public final class TMenu extends TWindow {
* @param label menu item label
* @return the new menu item
*/
* @param label menu item label
* @return the new menu item
*/
- public TMenuItem addItem(final int id, final String label) {
+ public
final
TMenuItem addItem(final int id, final String label) {
assert (id >= 1024);
return addItemInternal(id, label);
}
assert (id >= 1024);
return addItemInternal(id, label);
}
@@
-400,7
+389,7
@@
public final class TMenu extends TWindow {
* (inclusive).
* @return the new menu item
*/
* (inclusive).
* @return the new menu item
*/
- public TMenuItem addDefaultItem(final int id) {
+ public
final
TMenuItem addDefaultItem(final int id) {
assert (id >= 0);
assert (id < 1024);
assert (id >= 0);
assert (id < 1024);
@@
-439,7
+428,8
@@
public final class TMenu extends TWindow {
break;
case MID_CLEAR:
label = "C&lear";
break;
case MID_CLEAR:
label = "C&lear";
- key = kbDel;
+ hasKey = false;
+ // key = kbDel;
break;
case MID_TILE:
break;
case MID_TILE:
@@
-472,7
+462,8
@@
public final class TMenu extends TWindow {
break;
case MID_WINDOW_CLOSE:
label = "&Close";
break;
case MID_WINDOW_CLOSE:
label = "&Close";
- key = kbCtrlW;
+ hasKey = false;
+ // key = kbCtrlW;
break;
default:
break;
default:
@@
-488,11
+479,13
@@
public final class TMenu extends TWindow {
/**
* Convenience function to add a menu separator.
*/
/**
* Convenience function to add a menu separator.
*/
- public void addSeparator() {
+ public
final
void addSeparator() {
int newY = getChildren().size() + 1;
assert (newY < getHeight());
int newY = getChildren().size() + 1;
assert (newY < getHeight());
- TMenuItem menuItem = new TMenuSeparator(this, 1, newY);
+ // We just have to construct it, don't need to hang onto what it
+ // makes.
+ new TMenuSeparator(this, 1, newY);
setHeight(getHeight() + 1);
}
setHeight(getHeight() + 1);
}
@@
-503,7
+496,7
@@
public final class TMenu extends TWindow {
* denoted by prefixing a letter with "&", e.g. "&File"
* @return the new sub-menu
*/
* denoted by prefixing a letter with "&", e.g. "&File"
* @return the new sub-menu
*/
- public TSubMenu addSubMenu(final String title) {
+ public
final
TSubMenu addSubMenu(final String title) {
int newY = getChildren().size() + 1;
assert (newY < getHeight());
int newY = getChildren().size() + 1;
assert (newY < getHeight());