diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anagram/guisupport/windowreg.h	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,71 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * windowreg.h
+ */
+
+#ifndef WINDOWREG_H
+#define WINDOWREG_H
+
+//#include <icmdevt.hpp>
+//#include <ievent.hpp>
+//#include <iframe.hpp>
+
+#include "action.h"
+#include "agstack.h"
+#include "agstring.h"
+
+class AgFrame;
+
+
+struct WindowRecord {
+  int id;
+  AgString title;
+  AgAction action;
+  AgFrame *window;
+  int isShowing;
+  int isActive;
+  WindowRecord()
+    : id(0), title(), action(), window(0), isShowing(0), isActive(0)
+  {}
+  WindowRecord(int i, const AgString t, const AgAction a, AgFrame *w)
+    : id(i), title(t), action(a), window(w), isShowing(1), isActive(1)
+  {}
+  int operator < (const WindowRecord &w) const { return title < w.title; }
+};
+
+class WindowRegistry {
+private:
+  AgStack<WindowRecord> registry;
+
+public:
+  int cascadeFlag;
+
+  WindowRegistry()
+    : cascadeFlag(0)
+  {}
+
+  void registerId(AgFrame *window, AgString title, AgAction action);
+  void refresh(AgString title);
+
+  void remove(int id);
+  AgFrame *find(AgString title);
+  AgFrame *find(int id);
+  AgString getTitle(int id);
+
+  //void bubbleUp(int id);
+  void markActive(int id);
+  void clearActive();
+  int action(int id);
+  int action(AgString title);
+  int size() { return registry.size();}
+
+  WindowRecord &operator [] (int k) {
+    return registry[k];
+  }
+};
+
+
+#endif /* WINDOWREG_H */