kdeui Library API Documentation

KRootPixmap Class Reference

Creates pseudo-transparent widgets. More...

#include <krootpixmap.h>

Inheritance diagram for KRootPixmap:

QObject List of all members.

Public Slots

virtual void start ()
virtual void stop ()
void setFadeEffect (double opacity, const QColor &color)
void repaint (bool force)
void repaint ()
void setCustomPainting (bool enable)
void enableExports ()
QString pixmapName (int desk)

Signals

void backgroundUpdated (const QPixmap &pm)

Public Member Functions

 KRootPixmap (QWidget *target, const char *name=0)
 KRootPixmap (QWidget *target, QObject *parent, const char *name=0)
virtual ~KRootPixmap ()
bool isAvailable () const
bool isActive () const
int currentDesktop () const
bool customPainting () const
KDE_DEPRECATED bool checkAvailable (bool)
const QColorcolor () const
double opacity () const

Protected Member Functions

virtual bool eventFilter (QObject *, QEvent *)
virtual void updateBackground (KSharedPixmap *)

Detailed Description

Creates pseudo-transparent widgets.

A pseudo-transparent widget is a widget with its background pixmap set to that part of the desktop background that it is currently obscuring. This gives a transparency effect.

To create a transparent widget, construct a KRootPixmap and pass it a pointer to your widget. That's it! Moving, resizing and background changes are handled automatically.

Instead of using the default behavior, you can ask KRootPixmap to emit a backgroundUpdated(const QPixmap &) signal whenever the background needs updating by using setCustomPainting(bool). Alternatively by reimplementing updateBackground(KSharedPixmap*) you can take complete control of the behavior.

Author:
Geert Jansen <jansen@kde.org>
Version:
Id
krootpixmap.h,v 1.30 2004/06/28 22:50:04 wheeler Exp

Definition at line 46 of file krootpixmap.h.


Constructor & Destructor Documentation

KRootPixmap::KRootPixmap QWidget target,
const char *  name = 0
 

Constructs a KRootPixmap.

The KRootPixmap will be created as a child of the target widget so it will be deleted automatically when the widget is destroyed.

Parameters:
target A pointer to the widget that you want to make pseudo transparent.
name The internal name of the pixmap

Definition at line 45 of file krootpixmap.cpp.

KRootPixmap::KRootPixmap QWidget target,
QObject parent,
const char *  name = 0
 

Constructs a KRootPixmap where the parent QObject and target QWidget are different.

Definition at line 51 of file krootpixmap.cpp.

KRootPixmap::~KRootPixmap  )  [virtual]
 

Destructs the object.

Definition at line 80 of file krootpixmap.cpp.


Member Function Documentation

bool KRootPixmap::isAvailable  )  const
 

Checks if pseudo-transparency is available.

Returns:
true if transparency is available, false otherwise.

Definition at line 224 of file krootpixmap.cpp.

References KSharedPixmap::isAvailable(), and pixmapName().

Referenced by checkAvailable(), and start().

bool KRootPixmap::isActive  )  const [inline]
 

Returns true if the KRootPixmap is active.

Definition at line 82 of file krootpixmap.h.

int KRootPixmap::currentDesktop  )  const
 

Returns the number of the current desktop.

Definition at line 87 of file krootpixmap.cpp.

References NETRootInfo::activate(), and NETRootInfo::currentDesktop().

Referenced by eventFilter(), and repaint().

bool KRootPixmap::customPainting  )  const [inline]
 

Returns true if custom painting is enabled, false otherwise.

See also:
setCustomPainting(bool)

Definition at line 93 of file krootpixmap.h.

KDE_DEPRECATED bool KRootPixmap::checkAvailable bool   )  [inline]
 

Deprecated, use isAvailable() instead.

Deprecated:

Definition at line 100 of file krootpixmap.h.

References isAvailable().

const QColor& KRootPixmap::color  )  const [inline]
 

Since:
3.2

Returns:
the fade color.

Definition at line 106 of file krootpixmap.h.

double KRootPixmap::opacity  )  const [inline]
 

Since:
3.2

Returns:
the color opacity.

Definition at line 111 of file krootpixmap.h.

void KRootPixmap::start  )  [virtual, slot]
 

Starts background handling.

Definition at line 95 of file krootpixmap.cpp.

References enableExports(), isAvailable(), and repaint().

void KRootPixmap::stop  )  [virtual, slot]
 

Stops background handling.

Definition at line 112 of file krootpixmap.cpp.

void KRootPixmap::setFadeEffect double  opacity,
const QColor color
[slot]
 

Sets the fade effect.

This effect will fade the background to the specified color.

Parameters:
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.
color The color to fade to.

Definition at line 119 of file krootpixmap.cpp.

References repaint().

void KRootPixmap::repaint bool  force  )  [slot]
 

Repaints the widget background.

Normally, you shouldn't need this as it is handled automatically.

Parameters:
force Force a repaint, even if the contents did not change.

Definition at line 196 of file krootpixmap.cpp.

References currentDesktop(), KSharedPixmap::loadFromShared(), pixmapName(), updateBackground(), and KWin::windowInfo().

void KRootPixmap::repaint  )  [slot]
 

Repaints the widget background.

Normally, you shouldn't need this as it is handled automatically. This is equivalent to calling repaint( false ).

Definition at line 190 of file krootpixmap.cpp.

Referenced by setFadeEffect(), and start().

void KRootPixmap::setCustomPainting bool  enable  )  [inline, slot]
 

Enables custom handling of the background painting.

If custom painting is enabled then KRootPixmap will emit a backgroundUpdated() signal when the background for the target widget changes, instead of applying the new background.

Definition at line 157 of file krootpixmap.h.

void KRootPixmap::enableExports  )  [slot]
 

Asks KDesktop to export the desktop background as a KSharedPixmap.

This method uses DCOP to call KBackgroundIface/setExport(int).

Definition at line 239 of file krootpixmap.cpp.

References DCOPClient::attach(), DCOPClient::isAttached(), k_lineinfo, kdDebug(), and DCOPClient::send().

Referenced by start().

QString KRootPixmap::pixmapName int  desk  )  [static, slot]
 

Returns the name of the shared pixmap (only needed for low level access).

Definition at line 229 of file krootpixmap.cpp.

Referenced by isAvailable(), and repaint().

void KRootPixmap::backgroundUpdated const QPixmap pm  )  [signal]
 

Emitted when the background needs updating and custom painting (see setCustomPainting(bool) ) is enabled.

Parameters:
pm A pixmap containing the new background.

Referenced by updateBackground().

bool KRootPixmap::eventFilter QObject ,
QEvent
[protected, virtual]
 

Reimplemented to filter the events from the target widget and track its movements.

Definition at line 133 of file krootpixmap.cpp.

References currentDesktop().

void KRootPixmap::updateBackground KSharedPixmap  )  [protected, virtual]
 

Called when the pixmap has been updated.

The default implementation applies the fade effect, then sets the target's background, or emits backgroundUpdated(const QPixmap &) depending on the painting mode.

Definition at line 272 of file krootpixmap.cpp.

References backgroundUpdated(), KPixmapIO::convertToImage(), KPixmapIO::convertToPixmap(), and KImageEffect::fade().

Referenced by repaint().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdeui Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Feb 18 15:10:23 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003