We now have a current svn snapshot of libqxt in our contrib dir, and
[quassel.git] / src / contrib / libqxt-2007-10-24 / tests / QxtCurses / cursestest.cpp
1 /****************************************************************************
2 **
3 ** Copyright (C) Qxt Foundation. Some rights reserved.
4 **
5 ** This file is part of the QxtCore module of the Qt eXTension library
6 **
7 ** This library is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU Lesser General Public
9 ** License as published by the Free Software Foundation; either
10 ** version 2.1 of the License, or any later version.
11 **
12 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14 **
15 ** There is aditional information in the LICENSE file of libqxt.
16 ** If you did not receive a copy of the file try to download it or
17 ** contact the libqxt Management
18 ** 
19 ** <http://libqxt.sourceforge.net>  <aep@exys.org>
20 **
21 ****************************************************************************/
22 #include <QTimer>
23 #include <QxtCursesApplication.h>
24 #include <QxtCFrame.h>
25 #include "cursestest.h"
26
27 QxtCFrame *_f, *_g, *_h;
28
29 void Test::moveWindows() {
30     static int step = 0;
31     if(step<2)
32         _f->move(_f->x()+1, _f->y());
33     else if(step<4)
34         _g->move(_g->x()+1, _g->y());
35     else if(step<6)
36         _h->resize(_h->width()+1, _h->height());
37     else if(step<8)
38         _f->move(_f->x(), _f->y()+1);
39     else if(step<10)
40         _g->move(_g->x(), _g->y()+1);
41     else if(step<12)
42         _h->resize(_h->width(), _h->height()+1);
43     else if(step<14)
44         _f->move(_f->x()-1, _f->y());
45     else if(step<16)
46         _g->move(_g->x()-1, _g->y());
47     else if(step<18)
48         _h->resize(_h->width()-1, _h->height());
49     else if(step<20)
50         _f->move(_f->x(), _f->y()-1);
51     else if(step<22)
52         _g->move(_g->x(), _g->y()-1);
53     else
54         _h->resize(_h->width(), _h->height()-1);
55
56     step = (step+1)%24;
57 }
58
59 int main(int argc, char** argv) {
60     QxtCursesApplication app(argc, argv);
61     QxtCFrame f;
62     f.move(20,10);
63     f.resize(60,60);
64     QxtCFrame* g = new QxtCFrame(&f);
65     QxtCFrame* h = new QxtCFrame(g);
66     g->move(10,10);
67     g->resize(60,20);
68     h->move(5,5);
69     h->resize(5,5);
70     f.update();
71     g->update();
72     h->update();
73     _f = &f;
74     _g = g;
75     _h = h;
76     QTimer t;
77     Test test;
78     QObject::connect(&t, SIGNAL(timeout()), &test, SLOT(moveWindows()));
79     t.start(100);
80     app.exec();
81 }