+ if (windows.length == 0) {
+ repaint = true;
+ }
+ */
+ // TODO: remove this repaint after the above if (windows.length == 0)
+ // can be used again.
+ repaint = true;
+ }
+
+ /**
+ * Draw everything.
+ */
+ final public void drawAll() {
+ if ((flush) && (!repaint)) {
+ backend.flushScreen();
+ flush = false;
+ return;
+ }
+
+ if (!repaint) {
+ return;
+ }
+
+ // If true, the cursor is not visible
+ boolean cursor = false;
+
+ // Start with a clean screen
+ backend.screen.clear();
+
+ // Draw the background
+ CellAttributes background = theme.getColor("tapplication.background");
+ backend.screen.putAll(GraphicsChars.HATCH, background);
+
+ /*
+ // Draw each window in reverse Z order
+ TWindow [] sorted = windows.dup;
+ sorted.sort.reverse;
+ foreach (w; sorted) {
+ w.drawChildren();
+ }
+
+ // Draw the blank menubar line - reset the screen clipping first so
+ // it won't trim it out.
+ backend.screen.resetClipping();
+ backend.screen.hLineXY(0, 0, backend.screen.getWidth(), ' ',
+ theme.getColor("tmenu"));
+ // Now draw the menus.
+ int x = 1;
+ foreach (m; menus) {
+ CellAttributes menuColor;
+ CellAttributes menuMnemonicColor;
+ if (m.active) {
+ menuColor = theme.getColor("tmenu.highlighted");
+ menuMnemonicColor = theme.getColor("tmenu.mnemonic.highlighted");
+ } else {
+ menuColor = theme.getColor("tmenu");
+ menuMnemonicColor = theme.getColor("tmenu.mnemonic");
+ }
+ // Draw the menu title
+ backend.screen.hLineXY(x, 0, cast(int)m.title.length + 2, ' ',
+ menuColor);
+ backend.screen.putStrXY(x + 1, 0, m.title, menuColor);
+ // Draw the highlight character
+ backend.screen.putCharXY(x + 1 + m.mnemonic.shortcutIdx, 0,
+ m.mnemonic.shortcut, menuMnemonicColor);
+
+ if (m.active) {
+ m.drawChildren();
+ // Reset the screen clipping so we can draw the next title.
+ backend.screen.resetClipping();
+ }
+ x += m.title.length + 2;
+ }
+
+ foreach (m; subMenus) {
+ // Reset the screen clipping so we can draw the next sub-menu.
+ backend.screen.resetClipping();
+ m.drawChildren();
+ }
+ */
+
+ // Draw the mouse pointer
+ drawMouse();