2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
17 #include "welcomescreen.h"
18 #include "animation.h"
20 class ButtonAnimation
;
26 virtual ~EditorFactory()
30 virtual QWidget
* createEditor(QWidget
* parent
) = 0;
34 class Button
: public QObject
, public KGameCanvasPixmap
38 BRIGHTNESS_NORMAL
= 0,
39 BRIGHTNESS_HOVER
= 120,
52 QPointer
<ButtonAnimation
> m_animation
;
56 QPoint
textPos() const;
60 Button(WelcomeScreen
* parent
, const QIcon
& icon
,
61 const QFont
& font
, const QString
& text
);
64 virtual void repaint();
67 QWidget
* editor() { return m_editor
; }
69 void onMousePress(const QPoint
& p
);
70 void onMouseRelease(const QPoint
& p
);
71 void onMouseMove(const QPoint
& p
);
75 void setText(const QString
& text
);
76 void setBrightness(double value
);
77 double brightness() const;
79 KGameCanvasPixmap
* extractIcon();
80 void setEditor(EditorFactory
& factory
);
82 void setWidth(int width
);
88 class ButtonAnimation
: public Animation
94 static double m_speed
;
98 ButtonAnimation(Button
* button
, int brightness
);
100 virtual void start(int t
);
101 virtual bool step(int t
);
102 virtual void abort();
104 void setBrightness(int value
);