import java.util.List;
import jexer.TAction;
-import jexer.TCommand;
import jexer.TFileOpenBox.Type;
-import jexer.TKeypress;
import jexer.TList;
import jexer.TWindow;
+import jexer.event.TCommandEvent;
import jexer.event.TMenuEvent;
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.data.MetaData;
public TuiReaderMainWindow(TuiReaderApplication reader) {
// Construct a demo window. X and Y don't matter because it will be
// centred on screen.
- super(reader, "Library", 0, 0, 60, 18, CENTERED | RESIZABLE
- | UNCLOSABLE);
+ super(reader, "Library", 0, 0, 60, 18, CENTERED | RESIZABLE);
this.reader = reader;
});
// TODO: add the current "source/type" or filter
- statusBar = newStatusBar("Library");
- statusBar.addShortcutKeypress(TKeypress.kbF10, TCommand.cmExit, "Exit");
+ reader.setStatusBar(this, "Library");
// TODO: remove when not used anymore
// root.addChild("child 2").addChild("sub child");
}
+ @Override
+ public void onClose() {
+ setVisible(false);
+ super.onClose();
+ }
+
/**
* Change the source filter and display all stories matching this source.
*
return String.format("%5s: %s", meta.getLuid(), meta.getTitle());
}
+ @Override
+ public void onCommand(TCommandEvent command) {
+ if (command.getCmd().equals(TuiReaderApplication.CMD_EXIT)) {
+ TuiReaderApplication.close(this);
+ } else {
+ // Handle our own event if needed here
+ super.onCommand(command);
+ }
+ }
+
@Override
public void onMenu(TMenuEvent menu) {
MetaData meta = getSelectedMeta();