Changeset View
Changeset View
Standalone View
Standalone View
libkwineffects/kwineffects.h
Show All 23 Lines | |||||
24 | #ifndef KWINEFFECTS_H | 24 | #ifndef KWINEFFECTS_H | ||
25 | #define KWINEFFECTS_H | 25 | #define KWINEFFECTS_H | ||
26 | 26 | | |||
27 | #include <kwinconfig.h> | 27 | #include <kwinconfig.h> | ||
28 | #include <kwineffects_export.h> | 28 | #include <kwineffects_export.h> | ||
29 | #include <kwinglobals.h> | 29 | #include <kwinglobals.h> | ||
30 | 30 | | |||
31 | #include <QEasingCurve> | 31 | #include <QEasingCurve> | ||
32 | #include <QFont> | ||||
32 | #include <QIcon> | 33 | #include <QIcon> | ||
33 | #include <QPair> | 34 | #include <QPair> | ||
34 | #include <QSet> | 35 | #include <QSet> | ||
35 | #include <QRect> | 36 | #include <QRect> | ||
36 | #include <QRegion> | 37 | #include <QRegion> | ||
37 | #include <QVector2D> | 38 | #include <QVector2D> | ||
38 | #include <QVector3D> | 39 | #include <QVector3D> | ||
39 | 40 | | |||
40 | #include <QVector> | 41 | #include <QVector> | ||
41 | #include <QLoggingCategory> | 42 | #include <QLoggingCategory> | ||
42 | #include <QList> | 43 | #include <QList> | ||
43 | #include <QHash> | 44 | #include <QHash> | ||
44 | #include <QStack> | 45 | #include <QStack> | ||
45 | #include <QScopedPointer> | 46 | #include <QScopedPointer> | ||
46 | 47 | | |||
47 | #include <KPluginFactory> | 48 | #include <KPluginFactory> | ||
48 | #include <KSharedConfig> | 49 | #include <KSharedConfig> | ||
49 | 50 | | |||
50 | #include <netwm.h> | 51 | #include <netwm.h> | ||
51 | 52 | | |||
52 | #include <climits> | 53 | #include <climits> | ||
53 | #include <functional> | 54 | #include <functional> | ||
54 | 55 | | |||
56 | #include "kwineffectquickview.h" | ||||
57 | | ||||
55 | class KConfigGroup; | 58 | class KConfigGroup; | ||
56 | class QFont; | 59 | class QFont; | ||
57 | class QGraphicsScale; | 60 | class QGraphicsScale; | ||
58 | class QKeyEvent; | 61 | class QKeyEvent; | ||
59 | class QMatrix4x4; | 62 | class QMatrix4x4; | ||
60 | class QAction; | 63 | class QAction; | ||
61 | 64 | | |||
62 | /** | 65 | /** | ||
Show All 15 Lines | |||||
78 | class PaintDataPrivate; | 81 | class PaintDataPrivate; | ||
79 | class WindowPaintDataPrivate; | 82 | class WindowPaintDataPrivate; | ||
80 | 83 | | |||
81 | class EffectWindow; | 84 | class EffectWindow; | ||
82 | class EffectWindowGroup; | 85 | class EffectWindowGroup; | ||
83 | class EffectFrame; | 86 | class EffectFrame; | ||
84 | class EffectFramePrivate; | 87 | class EffectFramePrivate; | ||
85 | class EffectQuickView; | 88 | class EffectQuickView; | ||
89 | class EffectQuickScene; | ||||
86 | class Effect; | 90 | class Effect; | ||
87 | class WindowQuad; | 91 | class WindowQuad; | ||
88 | class GLShader; | 92 | class GLShader; | ||
89 | class XRenderPicture; | 93 | class XRenderPicture; | ||
90 | class WindowQuadList; | 94 | class WindowQuadList; | ||
91 | class WindowPrePaintData; | 95 | class WindowPrePaintData; | ||
92 | class WindowPaintData; | 96 | class WindowPaintData; | ||
93 | class ScreenPrePaintData; | 97 | class ScreenPrePaintData; | ||
▲ Show 20 Lines • Show All 1107 Lines • ▼ Show 20 Line(s) | 841 | public: | |||
1201 | /** | 1205 | /** | ||
1202 | * Creates a new frame object. If the frame does not have a static size | 1206 | * Creates a new frame object. If the frame does not have a static size | ||
1203 | * then it will be located at @a position with @a alignment. A | 1207 | * then it will be located at @a position with @a alignment. A | ||
1204 | * non-static frame will automatically adjust its size to fit the contents. | 1208 | * non-static frame will automatically adjust its size to fit the contents. | ||
1205 | * @returns A new @ref EffectFrame. It is the responsibility of the caller to delete the | 1209 | * @returns A new @ref EffectFrame. It is the responsibility of the caller to delete the | ||
1206 | * EffectFrame. | 1210 | * EffectFrame. | ||
1207 | * @since 4.6 | 1211 | * @since 4.6 | ||
1208 | */ | 1212 | */ | ||
1209 | virtual EffectFrame* effectFrame(EffectFrameStyle style, bool staticSize = true, | 1213 | virtual EffectFrame *effectFrame(EffectFrameStyle style, bool staticSize = true, | ||
1210 | const QPoint& position = QPoint(-1, -1), Qt::Alignment alignment = Qt::AlignCenter) const = 0; | 1214 | const QPoint& position = QPoint(-1, -1), Qt::Alignment alignment = Qt::AlignCenter) const; | ||
1211 | 1215 | | |||
1212 | /** | 1216 | /** | ||
1213 | * Allows an effect to trigger a reload of itself. | 1217 | * Allows an effect to trigger a reload of itself. | ||
1214 | * This can be used by an effect which needs to be reloaded when screen geometry changes. | 1218 | * This can be used by an effect which needs to be reloaded when screen geometry changes. | ||
1215 | * It is possible that the effect cannot be loaded again as it's supported method does no longer | 1219 | * It is possible that the effect cannot be loaded again as it's supported method does no longer | ||
1216 | * hold. | 1220 | * hold. | ||
1217 | * @param effect The effect to reload | 1221 | * @param effect The effect to reload | ||
1218 | * @since 4.8 | 1222 | * @since 4.8 | ||
▲ Show 20 Lines • Show All 2180 Lines • ▼ Show 20 Line(s) | |||||
3399 | /** | 3403 | /** | ||
3400 | * @short Helper class for displaying text and icons in frames. | 3404 | * @short Helper class for displaying text and icons in frames. | ||
3401 | * | 3405 | * | ||
3402 | * Paints text and/or and icon with an optional frame around them. The | 3406 | * Paints text and/or and icon with an optional frame around them. The | ||
3403 | * available frames includes one that follows the default Plasma theme and | 3407 | * available frames includes one that follows the default Plasma theme and | ||
3404 | * another that doesn't. | 3408 | * another that doesn't. | ||
3405 | * It is recommended to use this class whenever displaying text. | 3409 | * It is recommended to use this class whenever displaying text. | ||
3406 | */ | 3410 | */ | ||
3407 | class KWINEFFECTS_EXPORT EffectFrame | 3411 | class KWINEFFECTS_EXPORT EffectFrame: public EffectQuickScene | ||
3408 | { | 3412 | { | ||
3409 | public: | 3413 | Q_OBJECT | ||
3410 | EffectFrame(); | 3414 | Q_PROPERTY(QString text READ text NOTIFY textChanged) | ||
3411 | virtual ~EffectFrame(); | 3415 | Q_PROPERTY(QFont font READ font NOTIFY fontChanged) | ||
3416 | Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged) | ||||
3417 | Q_PROPERTY(QSize iconSize READ iconSize NOTIFY iconSizeChanged) | ||||
3418 | Q_PROPERTY(bool crossFadeEnabled READ isCrossFade NOTIFY crossFadeEnabledChanged) | ||||
3419 | public: | ||||
3420 | EffectFrame(EffectFrameStyle style, bool staticSize = true, | ||||
3421 | const QPoint& position = QPoint(-1, -1), Qt::Alignment alignment = Qt::AlignCenter); | ||||
3422 | ~EffectFrame() override; | ||||
3412 | 3423 | | |||
3413 | /** | 3424 | /** | ||
3414 | * Delete any existing textures to free up graphics memory. They will | 3425 | * @deprecated | ||
3415 | * be automatically recreated the next time they are required. | 3426 | * Analogous to hide | ||
3416 | */ | 3427 | */ | ||
3417 | virtual void free() = 0; | 3428 | void free(); | ||
3418 | 3429 | | |||
3419 | /** | 3430 | /** | ||
3420 | * Render the frame. | 3431 | * Render the frame. | ||
3421 | */ | 3432 | */ | ||
3422 | virtual void render(const QRegion ®ion = infiniteRegion(), double opacity = 1.0, double frameOpacity = 1.0) = 0; | 3433 | void render(const QRegion ®ion = infiniteRegion(), double opacity = 1.0, double frameOpacity = 1.0); | ||
3423 | 3434 | | |||
3424 | virtual void setPosition(const QPoint& point) = 0; | 3435 | void setPosition(const QPoint& point); | ||
3425 | /** | 3436 | /** | ||
3426 | * Set the text alignment for static frames and the position alignment | 3437 | * Set the text alignment for static frames and the position alignment | ||
3427 | * for non-static. | 3438 | * for non-static. | ||
3428 | */ | 3439 | */ | ||
3429 | virtual void setAlignment(Qt::Alignment alignment) = 0; | 3440 | void setAlignment(Qt::Alignment alignment); | ||
3430 | virtual Qt::Alignment alignment() const = 0; | 3441 | Qt::Alignment alignment() const; | ||
3431 | virtual void setGeometry(const QRect& geometry, bool force = false) = 0; | 3442 | | ||
3432 | virtual const QRect& geometry() const = 0; | 3443 | //just for compat with a pointless bool argument | ||
3433 | 3444 | void setGeometry(const QRect& geometry, bool force = false); | |||
3434 | virtual void setText(const QString& text) = 0; | 3445 | | ||
3435 | virtual const QString& text() const = 0; | 3446 | void setText(const QString& text); | ||
3436 | virtual void setFont(const QFont& font) = 0; | 3447 | QString text() const; | ||
3437 | virtual const QFont& font() const = 0; | 3448 | void setFont(const QFont& font); | ||
3449 | QFont font() const; | ||||
3438 | /** | 3450 | /** | ||
3439 | * Set the icon that will appear on the left-hand size of the frame. | 3451 | * Set the icon that will appear on the left-hand size of the frame. | ||
3440 | */ | 3452 | */ | ||
3441 | virtual void setIcon(const QIcon& icon) = 0; | 3453 | void setIcon(const QIcon& icon); | ||
3442 | virtual const QIcon& icon() const = 0; | 3454 | QIcon icon() const; | ||
3443 | virtual void setIconSize(const QSize& size) = 0; | 3455 | void setIconSize(const QSize& size); | ||
3444 | virtual const QSize& iconSize() const = 0; | 3456 | QSize iconSize() const; | ||
3445 | 3457 | | |||
3446 | /** | 3458 | /** | ||
3447 | * Sets the geometry of a selection. | 3459 | * Sets the geometry of a selection. | ||
3448 | * To remove the selection set a null rect. | 3460 | * To remove the selection set a null rect. | ||
3449 | * @param selection The geometry of the selection in screen coordinates. | 3461 | * @param selection The geometry of the selection in screen coordinates. | ||
3462 | * | ||||
3463 | * @deprecated | ||||
3450 | */ | 3464 | */ | ||
3451 | virtual void setSelection(const QRect& selection) = 0; | 3465 | void setSelection(const QRect& selection); | ||
3452 | 3466 | | |||
3453 | /** | 3467 | /** | ||
3454 | * @param shader The GLShader for rendering. | 3468 | * @param shader The GLShader for rendering. | ||
3455 | */ | 3469 | */ | ||
3456 | virtual void setShader(GLShader* shader) = 0; | 3470 | void setShader(GLShader* shader); | ||
3457 | /** | 3471 | /** | ||
3458 | * @returns The GLShader used for rendering or null if none. | 3472 | * @returns The GLShader used for rendering or null if none. | ||
3459 | */ | 3473 | */ | ||
3460 | virtual GLShader* shader() const = 0; | 3474 | GLShader *shader() const; | ||
3461 | 3475 | | |||
3462 | /** | 3476 | /** | ||
3463 | * @returns The style of this EffectFrame. | 3477 | * @returns The style of this EffectFrame. | ||
3464 | */ | 3478 | */ | ||
3465 | virtual EffectFrameStyle style() const = 0; | 3479 | virtual EffectFrameStyle style() const; | ||
3466 | 3480 | | |||
3467 | /** | 3481 | /** | ||
3468 | * If @p enable is @c true cross fading between icons and text is enabled | 3482 | * If @p enable is @c true cross fading between icons and text is enabled | ||
3469 | * By default disabled. Use setCrossFadeProgress to cross fade. | 3483 | * By default disabled. Use setCrossFadeProgress to cross fade. | ||
3470 | * Cross Fading is currently only available if OpenGL is used. | | |||
3471 | * @param enable @c true enables cross fading, @c false disables it again | 3484 | * @param enable @c true enables cross fading, @c false disables it again | ||
3472 | * @see isCrossFade | 3485 | * @see isCrossFade | ||
3473 | * @see setCrossFadeProgress | 3486 | * @see setCrossFadeProgress | ||
3474 | * @since 4.6 | 3487 | * @since 4.6 | ||
3475 | */ | 3488 | */ | ||
3476 | void enableCrossFade(bool enable); | 3489 | void enableCrossFade(bool enable); | ||
3477 | /** | 3490 | /** | ||
3478 | * @returns @c true if cross fading is enabled, @c false otherwise | 3491 | * @returns @c true if cross fading is enabled, @c false otherwise | ||
3479 | * @see enableCrossFade | 3492 | * @see enableCrossFade | ||
3480 | * @since 4.6 | 3493 | * @since 4.6 | ||
3481 | */ | 3494 | */ | ||
3482 | bool isCrossFade() const; | 3495 | bool isCrossFade() const; | ||
3496 | | ||||
3483 | /** | 3497 | /** | ||
3484 | * Sets the current progress for cross fading the last used icon/text | 3498 | * @deprecated | ||
3485 | * with current icon/text to @p progress. | 3499 | * This is now handled automatically | ||
3486 | * A value of 0.0 means completely old icon/text, a value of 1.0 means | | |||
3487 | * completely current icon/text. | | |||
3488 | * Default value is 1.0. You have to enable cross fade before using it. | | |||
3489 | * Cross Fading is currently only available if OpenGL is used. | | |||
3490 | * @see enableCrossFade | | |||
3491 | * @see isCrossFade | | |||
3492 | * @see crossFadeProgress | | |||
3493 | * @since 4.6 | | |||
3494 | */ | 3500 | */ | ||
3495 | void setCrossFadeProgress(qreal progress); | 3501 | void setCrossFadeProgress(qreal) {} | ||
3496 | /** | 3502 | /** | ||
3497 | * @returns The current progress for cross fading | 3503 | * @deprecated | ||
3498 | * @see setCrossFadeProgress | 3504 | * This is now handled automatically | ||
3499 | * @see enableCrossFade | | |||
3500 | * @see isCrossFade | | |||
3501 | * @since 4.6 | | |||
3502 | */ | 3505 | */ | ||
3503 | qreal crossFadeProgress() const; | 3506 | qreal crossFadeProgress() const {return 1;} | ||
3504 | 3507 | | |||
3505 | /** | 3508 | /** | ||
3506 | * Returns The projection matrix as used by the current screen painting pass | 3509 | * Returns The projection matrix as used by the current screen painting pass | ||
3507 | * including screen transformations. | 3510 | * including screen transformations. | ||
3508 | * | 3511 | * | ||
3509 | * This matrix is only valid during a rendering pass started by render. | 3512 | * This matrix is only valid during a rendering pass started by render. | ||
3510 | * | 3513 | * | ||
3511 | * @since 5.6 | 3514 | * @since 5.6 | ||
3512 | * @see render | 3515 | * @see render | ||
3513 | * @see EffectsHandler::paintEffectFrame | 3516 | * @see EffectsHandler::paintEffectFrame | ||
3514 | * @see Effect::paintEffectFrame | 3517 | * @see Effect::paintEffectFrame | ||
3515 | */ | 3518 | */ | ||
3516 | QMatrix4x4 screenProjectionMatrix() const; | 3519 | QMatrix4x4 screenProjectionMatrix() const; | ||
3517 | 3520 | | |||
3521 | Q_SIGNALS: | ||||
3522 | void textChanged(); | ||||
3523 | void fontChanged(); | ||||
3524 | void iconChanged(); | ||||
3525 | void iconSizeChanged(); | ||||
3526 | void crossFadeEnabledChanged(); | ||||
3527 | | ||||
3518 | protected: | 3528 | protected: | ||
3519 | void setScreenProjectionMatrix(const QMatrix4x4 &projection); | 3529 | void setScreenProjectionMatrix(const QMatrix4x4 &projection); | ||
3520 | 3530 | | |||
3521 | private: | 3531 | private: | ||
3522 | EffectFramePrivate* const d; | 3532 | void reposition(); | ||
3533 | QScopedPointer<EffectFramePrivate> const d; | ||||
3523 | }; | 3534 | }; | ||
3524 | 3535 | | |||
3525 | /** | 3536 | /** | ||
3526 | * The TimeLine class is a helper for controlling animations. | 3537 | * The TimeLine class is a helper for controlling animations. | ||
3527 | */ | 3538 | */ | ||
3528 | class KWINEFFECTS_EXPORT TimeLine | 3539 | class KWINEFFECTS_EXPORT TimeLine | ||
3529 | { | 3540 | { | ||
3530 | public: | 3541 | public: | ||
▲ Show 20 Lines • Show All 482 Lines • Show Last 20 Lines |