diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-27 23:57:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-27 23:57:48 +0000 |
commit | f62a335a9aa23c9a10a9768caf5a9c2eae922861 (patch) | |
tree | 9583ca8596d900e6ae91cb4b6d9bd206b63daf7f /krootbacking/krootbacking.h | |
parent | 6009a3e92e25428830047bd4dd8da300135f8c85 (diff) | |
download | tdebase-f62a335a9aa23c9a10a9768caf5a9c2eae922861.tar.gz tdebase-f62a335a9aa23c9a10a9768caf5a9c2eae922861.zip |
Move krootbacking executable from kdeartwork to kdebase
Reenable HAL media manager
Fix system tray with ARGB visuals (again)
Beautify logout process
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1249834 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krootbacking/krootbacking.h')
-rw-r--r-- | krootbacking/krootbacking.h | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/krootbacking/krootbacking.h b/krootbacking/krootbacking.h new file mode 100644 index 000000000..12d6b1bfd --- /dev/null +++ b/krootbacking/krootbacking.h @@ -0,0 +1,179 @@ +/*************************************************************************** + * Copyright (C) 2011 by Timothy Pearson <kb9vqf@pearsoncomputing.net> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + + +#ifndef KROOTBACKING_H +#define KROOTBACKING_H + +#include <stdlib.h> + +#include <tqobject.h> +#include <tqcolor.h> +#include <kdelibs_export.h> + +#ifndef Q_WS_QWS //FIXME + +class TQRect; +class TQWidget; +class TQTimer; +class KSharedPixmap; +class KRootBackingData; + +/** + * Gets the current full shared desktop pixmap and feeds it to xscreensaver + * + * @author Timothy Pearson <kb9vqf@pearsoncomputing.net> + */ +class KRootBacking: public TQObject +{ + Q_OBJECT + +public: + /** + * Constructs a KRootBacking. + */ + KRootBacking(); + + /** + * Destructs the object. + */ + virtual ~KRootBacking(); + + /** + * Checks if pseudo-transparency is available. + * @return @p true if transparency is available, @p false otherwise. + */ + bool isAvailable() const; + + /** + * Returns true if the KRootBacking is active. + */ + bool isActive() const { return m_bActive; } + + /** + * Returns the number of the current desktop. + */ + int currentDesktop() const; + +#ifndef KDE_NO_COMPAT + /** + * Deprecated, use isAvailable() instead. + * @deprecated + */ + KDE_DEPRECATED bool checkAvailable(bool) { return isAvailable(); } +#endif + + /** @since 3.2 + * @return the fade color. + */ + const TQColor &color() const { return m_FadeColor; } + + /** @since 3.2 + * @return the color opacity. + */ + double opacity() const { return m_Fade; } + +public slots: + /** + * Starts background handling. + */ + virtual void start(); + + /** + * Stops background handling. + */ + virtual void stop(); + + /** + * Sets the fade effect. + * + * This effect will fade the background to the + * specified color. + * @param opacity A value between 0 and 1, indicating the opacity + * of the color. A value of 0 will not change the image, a value of 1 + * will use the fade color unchanged. + * @param color The color to fade to. + */ + void setFadeEffect(double opacity, const TQColor &color); + + /** + * Repaints the widget background. Normally, you shouldn't need this + * as it is handled automatically. + * + * @param force Force a tqrepaint, even if the contents did not change. + */ + void tqrepaint( bool force ); + + /** + * Repaints the widget background. Normally, you shouldn't need this + * as it is handled automatically. This is equivalent to calling + * tqrepaint( false ). + */ + void tqrepaint(); + + /** + * Asks KDesktop to export the desktop background as a KSharedPixmap. + * This method uses DCOP to call KBackgroundIface/setExport(int). + */ + void enableExports(); + + /** + * Returns the name of the shared pixmap (only needed for low level access) + */ + static TQString pixmapName(int desk); +signals: + /** + * Emitted when the background needs updating and custom painting + * (see setCustomPainting(bool) ) is enabled. + * + * @param pm A pixmap containing the new background. + */ + void backgroundUpdated( const TQPixmap &pm ); + +protected: + /** + * Called when the pixmap has been updated. The default implementation + * applies the fade effect, then sets the target's background, or emits + * backgroundUpdated(const TQPixmap &) depending on the painting mode. + */ + virtual void updateBackground( KSharedPixmap * ); + +private slots: + void slotBackgroundChanged(int); + void slotDone(bool); + +private: + bool m_bActive, m_bInit; + int m_Desk; + int m_timeout; + + double m_Fade; + TQColor m_FadeColor; + + TQRect m_Rect; + TQTimer *m_pTimer; + KSharedPixmap *m_pPixmap; + KRootBackingData *d; + + void init(); +}; + +#endif // ! Q_WS_QWS + +#endif // KROOTBACKING_H |