class KRootPixmap

# class KRootPixmap | Creates pseudo-transparent widgets. More...
Definition | `#include <krootpixmap.h>`
Inherits | QObject (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- 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
- bool checkAvailable (bool)

#### Public Slots

- virtual void start ()
- virtual void stop ()
- void setFadeEffect (double strength, const QColor &color)
- void repaint ( bool force )
- void repaint ()
- void setCustomPainting ( bool enable )
- void enableExports ()

#### Signals

- void backgroundUpdated ( const QPixmap &pm )

#### Protected Methods

- 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 behaviour, 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 behaviour.

KRootPixmap ( QWidget *target, const char *name=0 ) | ### KRootPixmap

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.

KRootPixmap ( QWidget *target, QObject *parent, const char *name=0 ) | ### KRootPixmap

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

~KRootPixmap () | ### ~KRootPixmap

[virtual]

Destructs the object.

bool isAvailable () | ### isAvailable

[const]

Checks if pseudo-transparency is available.

Returns: `true` if transparency is available, `false` otherwise.

bool isActive () | ### isActive

[const]

Returns true if the KRootPixmap is active.

int currentDesktop () | ### currentDesktop

[const]

Returns the number of the current desktop.

bool customPainting () | ### customPainting

[const]

Returns true if custom painting is enabled, false otherwise.

See also: setCustomPainting(bool)

bool checkAvailable (bool) | ### checkAvailable

Deprecated, use isAvailable() instead.

void start () | ### start

[virtual slot]

Starts background handling.

void stop () | ### stop

[virtual slot]

Stops background handling.

void setFadeEffect (double strength, const QColor &color) | ### setFadeEffect

[slot]

Sets the fade effect.

This effect will fade the background to the specified color.

Parameters:

strength | A value between 0 and 1, indicating the strength of the fade. A value of 0 will not change the image, a value of 1 will make it the fade color everywhere, and in between.
color | The color to fade to.

void repaint ( bool force ) | ### repaint

[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.

void repaint () | ### repaint

[slot]

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

void setCustomPainting ( bool enable ) | ### setCustomPainting

[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.

void enableExports () | ### enableExports

[slot]

Asks KDesktop to export the desktop background as a KSharedPixmap. This method uses DCOP to call KBackgroundIface/setExport(int).

void backgroundUpdated ( const QPixmap &pm ) | ### backgroundUpdated

[signal]

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

Parameters:

pm | A pixmap containing the new background.

bool eventFilter (QObject *, QEvent *) | ### eventFilter

[protected virtual]

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

void updateBackground ( KSharedPixmap * ) | ### updateBackground

[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.

- Version: $Id: krootpixmap.h,v 1.14 2002/03/08 18:01:07 rich Exp $
- Author: Geert Jansen
- Generated: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:37 2003, using kdoc 2.0a54.