Cleanup a little CMakeLists.txt
[kdeartwork.git] / kscreensaver / kdesavers / science.h
blob4bc81bba2743b282a68b8ea835a809e684bfe45b
1 // ----------------------------------------------------------------
2 //
3 // kscience - screen saver for KDE
4 //
5 // copyright (c) Rene Beutler 1998
6 //
8 #ifndef __SCIENCE_H__
9 #define __SCIENCE_H__
11 #include <qrect.h>
12 #include <qtimer.h>
13 //Added by qt3to4:
14 #include <QPaintEvent>
15 #include <kdialog.h>
16 #include <kscreensaver.h>
18 class QSlider;
19 class QCheckBox;
21 #define MAX_MODES 6
23 typedef signed int T32bit;
25 class KScienceSaver;
27 class KPreviewWidget : public QWidget
29 Q_OBJECT
30 public:
31 KPreviewWidget( QWidget *parent );
32 void paintEvent( QPaintEvent *event );
33 void notifySaver( KScienceSaver *s = 0 );
34 private:
35 KScienceSaver *saver;
38 struct KScienceData;
40 class KScienceSaver : public KScreenSaver
42 Q_OBJECT
43 public:
44 KScienceSaver( WId id, bool setup=false, bool gP=false);
45 virtual ~KScienceSaver();
47 void do_refresh( const QRect & rect );
48 void setMode ( int mode );
49 void setMoveX ( signed int s );
50 void setMoveY ( signed int s );
51 void setMove ( bool s );
52 void setSize ( signed int s );
53 void setIntensity ( signed int s );
54 void setSpeed ( signed int s );
55 void setInverse ( bool b );
56 void setGravity ( bool b );
57 void setHideBG ( bool b );
59 void myAssert( bool term, const char *sMsg );
61 private:
62 void readSettings();
63 void initLens();
64 void initialize();
65 void releaseLens();
66 void (KScienceSaver::*applyLens)(int xs, int ys, int xd, int yd, int w, int h);
68 protected slots:
69 void slotTimeout();
71 protected:
72 void grabRootWindow();
73 void grabPreviewWidget();
74 void initWhirlLens();
75 void initSphereLens();
76 void initExponentialLens();
77 void initWaveLens();
78 void initCurvatureLens();
79 void blackPixel( int x, int y );
80 void blackPixelUndo( int x, int y);
81 void applyLens8bpp( int xs, int ys, int xd, int yd, int w, int h);
82 void applyLens16bpp(int xs, int ys, int xd, int yd, int w, int h);
83 void applyLens24bpp(int xs, int ys, int xd, int yd, int w, int h);
84 void applyLens32bpp(int xs, int ys, int xd, int yd, int w, int h);
85 QTimer timer;
86 bool moveOn;
87 bool setup;
88 bool grabPixmap;
89 int mode;
90 bool inverse[MAX_MODES];
91 bool gravity[MAX_MODES];
92 bool hideBG[MAX_MODES];
93 signed int size[MAX_MODES];
94 signed int moveX[MAX_MODES];
95 signed int moveY[MAX_MODES];
96 signed int speed[MAX_MODES];
97 signed int intensity[MAX_MODES];
98 int xcoord, ycoord;
99 double x, y, vx, vy;
100 signed int bpp, side;
101 int border, radius, diam, origin;
102 int imgnext;
103 char blackRestore[4];
104 KScienceData *d;
108 class KScienceSetup : public KDialog
110 Q_OBJECT
111 public:
112 KScienceSetup(QWidget *parent=0, const char *name=0);
113 ~KScienceSetup();
114 protected:
115 void updateSettings();
116 void readSettings();
118 private slots:
119 void slotMode( int );
120 void slotInverse();
121 void slotGravity();
122 void slotHideBG();
123 void slotMoveX( int );
124 void slotMoveY( int );
125 void slotSize( int );
126 void slotIntensity( int );
127 void slotSliderPressed();
128 void slotSliderReleased();
129 void slotSpeed( int );
130 void slotOk();
131 void slotHelp();
133 private:
134 KPreviewWidget *preview;
135 KScienceSaver *saver;
136 QSlider *slideSize, *slideSpeed, *slideIntensity;
137 QSlider *slideMoveX, *slideMoveY;
138 QCheckBox *checkInverse, *checkGravity, *checkHideBG;
140 int mode;
141 bool inverse [MAX_MODES];
142 bool gravity [MAX_MODES];
143 bool hideBG [MAX_MODES];
144 int moveX [MAX_MODES];
145 int moveY [MAX_MODES];
146 int size [MAX_MODES];
147 int intensity[MAX_MODES];
148 int speed [MAX_MODES];
150 #endif