diff anagram/vaclgui/agrect.hpp @ 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/vaclgui/agrect.hpp	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,68 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * agrect.hpp
+ */
+
+#ifndef AGRECT_HPP
+#define AGRECT_HPP
+
+#include <iwindow.hpp>
+//#include <irect.hpp>
+#include <windows.h>
+
+#include "agstack.h"
+#include "cint.h"
+
+
+enum AgQuadrant {
+  upperLeft, lowerLeft, upperRight, lowerRight
+};
+
+enum AgAlignment {
+  topLeft, topCenter, topRight,
+  centerLeft, centerCenter, centerRight,
+  bottomLeft, bottomCenter, bottomRight
+};
+
+class AgRectangle {
+private:
+  cint pos;
+  cint sz;
+  AgQuadrant anchor;
+
+public:
+  AgRectangle() : anchor(upperLeft) {}
+  AgRectangle(RECT r);
+  AgRectangle(IWindow *w);
+  AgRectangle(cint size_);
+  AgRectangle(cint loc, cint size_, AgQuadrant whichQuadrant = lowerRight);
+  cint position(AgQuadrant whichCorner = upperLeft);
+  AgRectangle &setSize(cint s);
+  cint size() { return sz; }
+  int area() { return sz.x*sz.y; }
+  AgRectangle intersection(AgRectangle &r);
+  AgRectangle &limit(cint size);
+  static AgRectangle desktop();
+  int operator < (const AgRectangle &r) const;
+};
+
+struct LayoutRef {
+  cint corner[4];
+  AgStack<AgRectangle> stack;
+
+  LayoutRef(AgRectangle &r);
+  cint position(AgQuadrant c) {
+    return corner[c%4];
+  }
+  int overlap(AgRectangle &r);
+  void merge(AgRectangle &r);
+};
+
+
+AgQuadrant opposite(AgQuadrant corner);
+
+
+#endif /* AGRECT_HPP */