You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
2.8 KiB
133 lines
2.8 KiB
15 years ago
|
// $Id$
|
||
|
//
|
||
|
// kclock - Clock screen saver for KDE
|
||
|
// Copyright (c) 2003 Melchior FRANZ
|
||
|
//
|
||
|
// License: GPL v2
|
||
|
// Author: Melchior FRANZ <mfranz@kde.org>
|
||
|
// Dependencies: libart_lgpl_2 http://www.levien.com/libart/
|
||
|
//
|
||
|
#ifndef __KCLOCK_H__
|
||
|
#define __KCLOCK_H__
|
||
|
|
||
15 years ago
|
#include <tqtimer.h>
|
||
15 years ago
|
#include <kdialogbase.h>
|
||
12 years ago
|
#include <tdescreensaver.h>
|
||
15 years ago
|
|
||
|
|
||
|
class KClockPainter
|
||
|
{
|
||
|
int m_width;
|
||
|
int m_height;
|
||
14 years ago
|
TQ_UINT8 *m_buf;
|
||
15 years ago
|
double m_matrix[6];
|
||
14 years ago
|
TQ_UINT32 m_color;
|
||
|
TQ_UINT32 m_shadow;
|
||
15 years ago
|
|
||
|
public:
|
||
|
KClockPainter(int width, int height);
|
||
|
~KClockPainter();
|
||
|
void copy(KClockPainter *p);
|
||
15 years ago
|
void drawToImage(TQImage *q, int x, int y);
|
||
15 years ago
|
inline int width() { return m_width; }
|
||
|
inline int height() { return m_height; }
|
||
|
inline void *image() { return (void *)m_buf; }
|
||
15 years ago
|
void setColor(const TQColor &color);
|
||
|
void setShadowColor(const TQColor &color);
|
||
|
void fill(const TQColor &color);
|
||
15 years ago
|
void drawRadial(double alpha, double r0, double r1, double width);
|
||
|
void drawDisc(double radius);
|
||
15 years ago
|
void drawHand(const TQColor &color, double angle, double length,
|
||
15 years ago
|
double width, bool disc);
|
||
|
};
|
||
|
|
||
|
|
||
|
class KClockSaver : public KScreenSaver
|
||
|
{
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
public:
|
||
|
KClockSaver(WId id);
|
||
|
virtual ~KClockSaver();
|
||
15 years ago
|
inline void setBgndColor(const TQColor &c) { m_bgndColor = c; drawScale(); setBackgroundColor(c); };
|
||
|
inline void setScaleColor(const TQColor &c) { m_scaleColor = c; drawScale(); };
|
||
|
inline void setHourColor(const TQColor &c) { m_hourColor = c; forceRedraw(); };
|
||
|
inline void setMinColor(const TQColor &c) { m_minColor = c; forceRedraw(); };
|
||
|
inline void setSecColor(const TQColor &c) { m_secColor = c; forceRedraw(); };
|
||
15 years ago
|
void setKeepCentered(bool b);
|
||
|
void restart(int siz);
|
||
|
inline void forceRedraw() { m_second = -1; }
|
||
|
|
||
|
private:
|
||
|
void readSettings();
|
||
|
void drawScale();
|
||
|
void drawClock();
|
||
|
void start(int size);
|
||
|
void stop();
|
||
|
|
||
|
protected slots:
|
||
|
void slotTimeout();
|
||
|
|
||
|
protected:
|
||
15 years ago
|
TQTimer m_timer;
|
||
|
TQImage *m_image;
|
||
15 years ago
|
KClockPainter *m_scale;
|
||
|
KClockPainter *m_clock;
|
||
|
|
||
|
int m_x;
|
||
|
int m_y;
|
||
|
int m_diameter;
|
||
|
int m_size;
|
||
|
bool m_showSecond;
|
||
|
bool m_keepCentered;
|
||
|
int m_hour;
|
||
|
int m_minute;
|
||
|
int m_second;
|
||
|
|
||
15 years ago
|
TQColor m_bgndColor;
|
||
|
TQColor m_scaleColor;
|
||
|
TQColor m_hourColor;
|
||
|
TQColor m_minColor;
|
||
|
TQColor m_secColor;
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
class KClockSetup : public KDialogBase
|
||
|
{
|
||
|
Q_OBJECT
|
||
13 years ago
|
|
||
15 years ago
|
public:
|
||
15 years ago
|
KClockSetup(TQWidget *parent = 0, const char *name = 0);
|
||
15 years ago
|
~KClockSetup();
|
||
|
protected:
|
||
|
void readSettings();
|
||
|
|
||
|
private slots:
|
||
|
void slotOk();
|
||
|
void slotHelp();
|
||
|
|
||
15 years ago
|
void slotBgndColor(const TQColor &);
|
||
|
void slotScaleColor(const TQColor &);
|
||
|
void slotHourColor(const TQColor &);
|
||
|
void slotMinColor(const TQColor &);
|
||
|
void slotSecColor(const TQColor &);
|
||
15 years ago
|
void slotSliderMoved(int);
|
||
|
void slotKeepCenteredChanged(int);
|
||
|
|
||
|
private:
|
||
|
KClockSaver *m_saver;
|
||
|
|
||
15 years ago
|
TQColor m_bgndColor;
|
||
|
TQColor m_scaleColor;
|
||
|
TQColor m_hourColor;
|
||
|
TQColor m_minColor;
|
||
|
TQColor m_secColor;
|
||
15 years ago
|
|
||
|
int m_size;
|
||
|
bool m_keepCentered;
|
||
|
};
|
||
|
|
||
|
#endif
|
||
|
|
||
|
|