diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | c90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch) | |
tree | 6d8391395bce9eaea4ad78958617edb20c6a7573 /kolf/slope.h | |
download | tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kolf/slope.h')
-rw-r--r-- | kolf/slope.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/kolf/slope.h b/kolf/slope.h new file mode 100644 index 00000000..d638354f --- /dev/null +++ b/kolf/slope.h @@ -0,0 +1,98 @@ +#ifndef SLOPE_H +#define SLOPE_H + +#include <kimageeffect.h> + +#include "game.h" + +class Slope; +class SlopeConfig : public Config +{ + Q_OBJECT + +public: + SlopeConfig(Slope *slope, QWidget *parent); + +private slots: + void setGradient(const QString &text); + void setReversed(bool); + void setStuckOnGround(bool); + void gradeChanged(double); + +private: + Slope *slope; +}; + +class Slope : public QCanvasRectangle, public CanvasItem, public RectItem +{ +public: + Slope(QRect rect, QCanvas *canvas); + virtual void aboutToDie(); + virtual int rtti() const { return 1031; } + + virtual void showInfo(); + virtual void hideInfo(); + virtual void editModeChanged(bool changed); + virtual bool canBeMovedByOthers() const { return !stuckOnGround; } + virtual QPtrList<QCanvasItem> moveableItems() const; + virtual Config *config(QWidget *parent) { return new SlopeConfig(this, parent); } + void setSize(int, int); + virtual void newSize(int width, int height); + + virtual void moveBy(double dx, double dy); + + virtual void draw(QPainter &painter); + virtual QPointArray areaPoints() const; + + void setGradient(QString text); + KImageEffect::GradientType curType() const { return type; } + void setGrade(double grade); + + double curGrade() const { return grade; } + void setColor(QColor color) { this->color = color; updatePixmap(); } + void setReversed(bool reversed) { this->reversed = reversed; updatePixmap(); } + bool isReversed() const { return reversed; } + + bool isStuckOnGround() const { return stuckOnGround; } + void setStuckOnGround(bool yes) { stuckOnGround = yes; updateZ(); } + + virtual void load(KConfig *cfg); + virtual void save(KConfig *cfg); + + virtual bool collision(Ball *ball, long int id); + virtual bool terrainCollisions() const; + + QMap<KImageEffect::GradientType, QString> gradientI18nKeys; + QMap<KImageEffect::GradientType, QString> gradientKeys; + + virtual void updateZ(QCanvasRectangle *vStrut = 0); + + void moveArrow(); + +private: + KImageEffect::GradientType type; + inline void setType(KImageEffect::GradientType type); + bool showingInfo; + double grade; + bool reversed; + QColor color; + QPixmap pixmap; + void updatePixmap(); + bool stuckOnGround; + QPixmap grass; + + void clearArrows(); + + QPtrList<Arrow> arrows; + QCanvasText *text; + RectPoint *point; +}; + +class SlopeObj : public Object +{ +public: + SlopeObj() { m_name = i18n("Slope"); m__name = "slope"; } + virtual QCanvasItem *newObject(QCanvas *canvas) { return new Slope(QRect(0, 0, 40, 40), canvas); } +}; + +#endif |