# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KColorDrag Class Reference

A drag-and-drop object for colors. More...

`#include <kcolordrag.h>`

Inheritance diagram for KColorDrag:

[legend]
Collaboration diagram for KColorDrag:

[legend]
List of all members.

## Public Member Functions

| KColorDrag (QWidget *dragsource=0, const char *name=0)
| Constructs a color drag with a white color.
| KColorDrag (const QColor &col, QWidget *dragsource=0, const char *name=0)
| Constructs a color drag with the color ``.
void | setColor (const QColor &col)
| Sets the color of the drag to `col`.

## Static Public Member Functions

bool | canDecode (QMimeSource *e)
| Returns true if the MIME source `e` contains a color object.
bool | decode (QMimeSource *e, QColor &col)
| Decodes the MIME source `e` and puts the resulting color into `col`.
KColorDrag * | makeDrag (const QColor &, QWidget *dragsource)
| This class or method is obsolete, it is provided for compatibility only. This is equivalent with "new KColorDrag(color, dragsource)".

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)

## Detailed Description

A drag-and-drop object for colors.

The according MIME type is set to application/x-color.

See the Qt drag'n'drop documentation.

Definition at line 35 of file kcolordrag.h.

## Constructor & Destructor Documentation

KColorDrag::KColorDrag | ( | QWidget * | dragsource = 0,
|  | const char * | name = 0
| ) |

| Constructs a color drag with a white color. Definition at line 68 of file kcolordrag.cpp. References KStdAccel::name(), and setColor(). Referenced by makeDrag().

KColorDrag::KColorDrag | ( | const QColor & | col,
|  | QWidget * | dragsource = 0,
|  | const char * | name = 0
| ) |

| Constructs a color drag with the color ``. Definition at line 61 of file kcolordrag.cpp. References KStdAccel::name(), and setColor().

## Member Function Documentation

void KColorDrag::setColor | ( | const QColor & | col | ) |

| Sets the color of the drag to `col`. Definition at line 75 of file kcolordrag.cpp. References QColor::blue(), QPainter::drawRect(), QPainter::end(), QPixmap::fill(), QColor::green(), QColor::red(), QStoredDrag::setEncodedData(), and QPainter::setPen(). Referenced by KColorDrag().

bool KColorDrag::canDecode | ( | QMimeSource * | e | ) | `[static]`

| Returns true if the MIME source `e` contains a color object. Definition at line 98 of file kcolordrag.cpp. References QMimeSource::provides().

bool KColorDrag::decode | ( | QMimeSource * | e,
|  | QColor & | col
| ) | `[static]`

| Decodes the MIME source `e` and puts the resulting color into `col`. Definition at line 104 of file kcolordrag.cpp. References QMimeSource::encodedData(), and QColor::setRgb().

KColorDrag * KColorDrag::makeDrag | ( | const QColor & | ,
|  | QWidget * | dragsource
| ) | `[static]`

| This class or method is obsolete, it is provided for compatibility only. This is equivalent with "new KColorDrag(color, dragsource)". Definition at line 116 of file kcolordrag.cpp. References KColorDrag().

The documentation for this class was generated from the following files:

- kcolordrag.h
- kcolordrag.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:59:15 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001