comparison 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
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 * agrect.hpp
7 */
8
9 #ifndef AGRECT_HPP
10 #define AGRECT_HPP
11
12 #include <iwindow.hpp>
13 //#include <irect.hpp>
14 #include <windows.h>
15
16 #include "agstack.h"
17 #include "cint.h"
18
19
20 enum AgQuadrant {
21 upperLeft, lowerLeft, upperRight, lowerRight
22 };
23
24 enum AgAlignment {
25 topLeft, topCenter, topRight,
26 centerLeft, centerCenter, centerRight,
27 bottomLeft, bottomCenter, bottomRight
28 };
29
30 class AgRectangle {
31 private:
32 cint pos;
33 cint sz;
34 AgQuadrant anchor;
35
36 public:
37 AgRectangle() : anchor(upperLeft) {}
38 AgRectangle(RECT r);
39 AgRectangle(IWindow *w);
40 AgRectangle(cint size_);
41 AgRectangle(cint loc, cint size_, AgQuadrant whichQuadrant = lowerRight);
42 cint position(AgQuadrant whichCorner = upperLeft);
43 AgRectangle &setSize(cint s);
44 cint size() { return sz; }
45 int area() { return sz.x*sz.y; }
46 AgRectangle intersection(AgRectangle &r);
47 AgRectangle &limit(cint size);
48 static AgRectangle desktop();
49 int operator < (const AgRectangle &r) const;
50 };
51
52 struct LayoutRef {
53 cint corner[4];
54 AgStack<AgRectangle> stack;
55
56 LayoutRef(AgRectangle &r);
57 cint position(AgQuadrant c) {
58 return corner[c%4];
59 }
60 int overlap(AgRectangle &r);
61 void merge(AgRectangle &r);
62 };
63
64
65 AgQuadrant opposite(AgQuadrant corner);
66
67
68 #endif /* AGRECT_HPP */