comparison anagram/guisupport/windowreg.h @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * windowreg.h
7 */
8
9 #ifndef WINDOWREG_H
10 #define WINDOWREG_H
11
12 //#include <icmdevt.hpp>
13 //#include <ievent.hpp>
14 //#include <iframe.hpp>
15
16 #include "action.h"
17 #include "agstack.h"
18 #include "agstring.h"
19
20 class AgFrame;
21
22
23 struct WindowRecord {
24 int id;
25 AgString title;
26 AgAction action;
27 AgFrame *window;
28 int isShowing;
29 int isActive;
30 WindowRecord()
31 : id(0), title(), action(), window(0), isShowing(0), isActive(0)
32 {}
33 WindowRecord(int i, const AgString t, const AgAction a, AgFrame *w)
34 : id(i), title(t), action(a), window(w), isShowing(1), isActive(1)
35 {}
36 int operator < (const WindowRecord &w) const { return title < w.title; }
37 };
38
39 class WindowRegistry {
40 private:
41 AgStack<WindowRecord> registry;
42
43 public:
44 int cascadeFlag;
45
46 WindowRegistry()
47 : cascadeFlag(0)
48 {}
49
50 void registerId(AgFrame *window, AgString title, AgAction action);
51 void refresh(AgString title);
52
53 void remove(int id);
54 AgFrame *find(AgString title);
55 AgFrame *find(int id);
56 AgString getTitle(int id);
57
58 //void bubbleUp(int id);
59 void markActive(int id);
60 void clearActive();
61 int action(int id);
62 int action(AgString title);
63 int size() { return registry.size();}
64
65 WindowRecord &operator [] (int k) {
66 return registry[k];
67 }
68 };
69
70
71 #endif /* WINDOWREG_H */