01: // Copyright (c) 2002 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.jemacs.buffer;
05:
06: import gnu.lists.LList;
07:
08: public abstract class EFrame {
09: public static EFrame selectedFrame;
10: public EWindow selectedWindow;
11:
12: static int counter;
13: protected int id = ++counter;
14: public EWindow firstWindow;
15:
16: public static String defaultName() {
17: return "Emacs";
18: }
19:
20: public EFrame() {
21: if (selectedFrame == null)
22: selectedFrame = this ;
23: }
24:
25: public EFrame(EWindow win) {
26: win.frame = this ;
27: firstWindow = win;
28: win.nextWindow = win;
29: win.prevWindow = win;
30: EWindow.setSelected(win);
31: }
32:
33: public void validate() {
34: }
35:
36: public void delete() {
37: for (;;) {
38: EWindow win = firstWindow;
39: if (win == null)
40: break;
41: win.deleteNoValidate();
42: }
43: if (this == selectedFrame)
44: selectedFrame = null;
45: }
46:
47: public abstract boolean isLive();
48:
49: public EWindow getFirstWindow() {
50: return firstWindow;
51: }
52:
53: public EWindow getLastWindow() {
54: return firstWindow.prevWindow;
55: }
56:
57: public static EFrame getSelectedFrame() {
58: return selectedFrame;
59: }
60:
61: public EWindow getSelectedWindow() {
62: return selectedWindow;
63: }
64:
65: public EWindow otherWindow(int count) {
66: return selectedWindow.getNextWindowInFrame(count);
67: }
68:
69: public abstract void setMenu(LList menu);
70:
71: public abstract String ask(String prompt);
72:
73: public String toString() {
74: StringBuffer sbuf = new StringBuffer(100);
75: sbuf.append("#<frame #");
76: sbuf.append(id);
77: sbuf.append('>');
78: return sbuf.toString();
79: }
80: }
|