statusBar = newStatusBar(desc(meta));
statusBar.addShortcutKeypress(TKeypress.kbF10, TCommand.cmExit, "Exit");
- navigationButtons = new ArrayList<TButton>(4);
+ navigationButtons = new ArrayList<TButton>(5);
// -3 because 0-based and 2 for borders
int row = getHeight() - 3;
- addButton(" ", 0, row, null); // for bg colour when << button is pressed
+ navigationButtons.add(addButton(" ", 0, row, null)); // for bg colour when << button is pressed
navigationButtons.add(addButton("<< ", 0, row, new TAction() {
public void DO() {
setChapter(0);
setChapter(getStory().getChapters().size());
}
}));
+
+ navigationButtons.get(0).setEnabled(false);
+ navigationButtons.get(1).setEnabled(false);
+ navigationButtons.get(2).setEnabled(false);
chapterName = addLabel("", 14, row);
chapterName.setWidth(getWidth() - 10);
if (chapter != this.chapter) {
this.chapter = chapter;
+
+ int max = getStory().getChapters().size();
+ navigationButtons.get(0).setEnabled(chapter > 0);
+ navigationButtons.get(1).setEnabled(chapter > 0);
+ navigationButtons.get(2).setEnabled(chapter > 0);
+ navigationButtons.get(3).setEnabled(chapter < max);
+ navigationButtons.get(4).setEnabled(chapter < max);
+
Chapter chap;
String name;
if (chapter == 0) {
name = String.format(" %s", chap.getName());
} else {
chap = getStory().getChapters().get(chapter - 1);
- name = String.format(" %d/%d: %s", chapter, getStory()
- .getChapters().size(), chap.getName());
+ name = String.format(" %d/%d: %s", chapter, max, chap.getName());
}
while (name.length() < getWidth() - chapterName.getX()) {