}
/**
- * Return the number of windows that are visible.
+ * Return the number of windows that are showing.
*
- * @return the number of windows that are visible
+ * @return the number of windows that are showing on screen
*/
public final int shownWindowCount() {
int n = 0;
return n;
}
+ /**
+ * Return the number of windows that are hidden.
+ *
+ * @return the number of windows that are hidden
+ */
+ public final int hiddenWindowCount() {
+ int n = 0;
+ for (TWindow w: windows) {
+ if (w.isHidden()) {
+ n++;
+ }
+ }
+ return n;
+ }
+
/**
* Check if a window instance is in this application's window list.
*
}
for (TWindow w: windows) {
if (w == window) {
+ assert (window.getApplication() == this);
return true;
}
}
* otherwise switch to the previous window in the list
*/
public final void switchWindow(final boolean forward) {
- // Only switch if there are multiple windows
- if (windows.size() < 2) {
+ // Only switch if there are multiple visible windows
+ if (shownWindowCount() < 2) {
return;
}
assert (activeWindow != null);
return;
}
- int nextWindowI;
- if (forward) {
- nextWindowI = (activeWindowI + 1) % windows.size();
- } else {
- if (activeWindowI == 0) {
- nextWindowI = windows.size() - 1;
+ int nextWindowI = activeWindowI;
+ for (;;) {
+ if (forward) {
+ nextWindowI++;
+ nextWindowI %= windows.size();
} else {
- nextWindowI = activeWindowI - 1;
+ nextWindowI--;
+ if (nextWindowI < 0) {
+ nextWindowI = windows.size() - 1;
+ }
}
- }
- activateWindow(windows.get(nextWindowI));
+ if (windows.get(nextWindowI).isShown()) {
+ activateWindow(windows.get(nextWindowI));
+ break;
+ }
+ }
} // synchronized (windows)
}
continue;
}
for (int x = w.getX(); x < w.getX() + w.getWidth(); x++) {
- if (x == width) {
+ if (x >= width) {
continue;
}
for (int y = w.getY(); y < w.getY() + w.getHeight(); y++) {
- if (y == height) {
+ if (y >= height) {
continue;
}
overlapMatrix[x][y]++;
long newOverlapN = 0;
// Start by adding each new cell.
for (int wx = x; wx < x + window.getWidth(); wx++) {
- if (wx == width) {
+ if (wx >= width) {
continue;
}
for (int wy = y; wy < y + window.getHeight(); wy++) {
- if (wy == height) {
+ if (wy >= height) {
continue;
}
newMatrix[wx][wy]++;
/**
* Convenience function to create a new window and make it active.
*
- * @param application TApplication that manages this window
* @param title window title, will be centered along the top border
* @param x column relative to parent
* @param y row relative to parent