From f62a335a9aa23c9a10a9768caf5a9c2eae922861 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 27 Aug 2011 23:57:48 +0000 Subject: 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 --- krootbacking/krootbacking.h | 179 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 krootbacking/krootbacking.h (limited to 'krootbacking/krootbacking.h') 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 * + * * + * 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 + +#include +#include +#include + +#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 + */ +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 -- cgit v1.2.3