TDE core libraries
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.

139 lines
3.5KB

  1. /* This file is part of the KDE libraries
  2. Copyright (c) 2001 Martin R. Jones <mjones@kde.org>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License as published by the Free Software Foundation; either
  6. version 2 of the License, or (at your option) any later version.
  7. This library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public License
  12. along with this library; see the file COPYING.LIB. If not, write to
  13. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  14. Boston, MA 02110-1301, USA.
  15. */
  16. #ifndef TDESCREENSAVER_H
  17. #define TDESCREENSAVER_H
  18. #include <tqwidget.h>
  19. #include <tdelibs_export.h>
  20. class TQTimer;
  21. class KScreenSaverPrivate;
  22. class KBlankEffectPrivate;
  23. /**
  24. * Provides a TQWidget for a screensaver to draw into.
  25. *
  26. * You should derive from this widget and implement your screensaver's
  27. * functionality. To use libkss, provide the following constants and
  28. * functions:
  29. *
  30. * extern "C"
  31. * {
  32. * const char *kss_applicationName = "yourappname";
  33. * const char *kss_description = I18N_NOOP( "Your screensaver" );
  34. * const char *kss_version = "1.0";
  35. *
  36. * KScreenSaver *kss_create( WId d )
  37. * {
  38. * // return your KScreenSaver derived screensaver
  39. * }
  40. *
  41. * TQDialog *kss_setup()
  42. * {
  43. * // return your modal setup dialog
  44. * }
  45. * }
  46. *
  47. * @short Provides a TQWidget for a screensaver to draw into.
  48. * @author Martin R. Jones <mjones@kde.org>
  49. */
  50. class KDE_EXPORT KScreenSaver : public TQWidget
  51. {
  52. Q_OBJECT
  53. public:
  54. /**
  55. * @param id The winId() of the widget to draw the screensaver into.
  56. */
  57. KScreenSaver( WId id=0 );
  58. ~KScreenSaver();
  59. protected:
  60. /**
  61. * You cannot create a new widget with this widget as parent, since this
  62. * widget may not be owned by your application. In order to create
  63. * widgets with a KScreenSaver as parent, create the widget with no parent,
  64. * call embed(), and then show() the widget.
  65. *
  66. * @param widget The widget to embed in the screensaver widget.
  67. */
  68. void embed( TQWidget *widget );
  69. bool eventFilter( TQObject *o, TQEvent * );
  70. private:
  71. KScreenSaverPrivate *d;
  72. };
  73. /**
  74. *
  75. * Blanks a widget using various effects.
  76. *
  77. * @short Blanks a widget using various effects.
  78. * @author Martin R. Jones <mjones@kde.org>
  79. */
  80. class KBlankEffect : public TQObject
  81. {
  82. Q_OBJECT
  83. public:
  84. KBlankEffect( TQObject *parent=0 );
  85. ~KBlankEffect();
  86. enum Effect { Random=-1, Blank=0, SweepRight, SweepDown, Blocks,
  87. MaximumEffects };
  88. /**
  89. * Blank a widget using the specified effect.
  90. * Some blanking effects take some time, so you should connect to
  91. * doneBlank() to know when the blanking is complete.
  92. *
  93. * @param w The widget to blank.
  94. * @param effect The type of effect to use.
  95. */
  96. void blank( TQWidget *w, Effect effect=Random );
  97. typedef void (KBlankEffect::*BlankEffect)();
  98. signals:
  99. /**
  100. * emitted when a blanking effect has completed.
  101. */
  102. void doneBlank();
  103. protected slots:
  104. void timeout();
  105. protected:
  106. void finished();
  107. void blankNormal();
  108. void blankSweepRight();
  109. void blankSweepDown();
  110. void blankBlocks();
  111. protected:
  112. static BlankEffect effects[];
  113. KBlankEffectPrivate *d;
  114. };
  115. #endif