| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KXYSelector Class Reference

KXYSelector is the base class for other widgets which provides the ability to choose from a two-dimensional range of values. More...

`#include <kselect.h>`

Inheritance diagram for KXYSelector:

[legend]
Collaboration diagram for KXYSelector:

[legend]
List of all members.

## Signals
void | valueChanged (int x, int y)
| This signal is emitted whenever the user chooses a value, e.g.
## Public Member Functions
| KXYSelector (QWidget *parent=0, const char *name=0)
| Constructs a two-dimensional selector widget which has a value range of [0..100] in both directions.
| ~KXYSelector ()
| Destructs the widget.
void | setValues (int xPos, int yPos)
| Sets the current values in horizontal and vertical direction.
void | setRange (int minX, int minY, int maxX, int maxY)
| Sets the range of possible values.
int | xValue () const
int | yValue () const
QRect | contentsRect () const
## Protected Member Functions
virtual void | drawContents (QPainter *)
| Override this function to draw the contents of the widget.
virtual void | drawCursor (QPainter *p, int xp, int yp)
| Override this function to draw the cursor which indicates the currently selected value pair.
virtual void | paintEvent (QPaintEvent *e)
virtual void | mousePressEvent (QMouseEvent *e)
virtual void | mouseMoveEvent (QMouseEvent *e)
virtual void | virtual_hook (int id, void *data)

## Detailed Description

KXYSelector is the base class for other widgets which provides the ability to choose from a two-dimensional range of values.

The currently chosen value is indicated by a cross. An example is the KHSSelector which allows to choose from a range of colors, and which is used in KColorDialog.

A custom drawing routine for the widget surface has to be provided by the subclass.

Definition at line 41 of file kselect.h.

## Constructor & Destructor Documentation

KXYSelector::KXYSelector | ( | QWidget * | parent = 0,
|  | const char * | name = 0
| ) |

| Constructs a two-dimensional selector widget which has a value range of [0..100] in both directions. Definition at line 35 of file kselect.cpp. References KStdAccel::name(), QPixmap::resize(), and QPixmap::setOptimization().

KXYSelector::~KXYSelector | ( |  | ) |

| Destructs the widget. Definition at line 49 of file kselect.cpp.

## Member Function Documentation

void KXYSelector::setValues | ( | int | xPos,
|  | int | yPos
| ) |

| Sets the current values in horizontal and vertical direction. Definition at line 63 of file kselect.cpp. References QWidget::height(), and QWidget::width().

void KXYSelector::setRange | ( | int | minX,
|  | int | minY,
|  | int | maxX,
|  | int | maxY
| ) |

| Sets the range of possible values. Definition at line 53 of file kselect.cpp.

int KXYSelector::xValue | ( |  | ) | const`[inline]`

| Returns: the current value in horizontal direction. Definition at line 69 of file kselect.h.

int KXYSelector::yValue | ( |  | ) | const`[inline]`

| Returns: the current value in vertical direction. Definition at line 73 of file kselect.h.

QRect KXYSelector::contentsRect | ( |  | ) | const

| Returns: the rectangle on which subclasses should draw. Definition at line 84 of file kselect.cpp. References QWidget::height(), and QWidget::width().

void KXYSelector::valueChanged | ( | int | x,
|  | int | y
| ) | `[signal]`

| This signal is emitted whenever the user chooses a value, e.g. by clicking with the mouse on the widget.

void KXYSelector::drawContents | ( | QPainter * |  | ) | `[protected, virtual]`

| Override this function to draw the contents of the widget. The default implementation does nothing. Draw within contentsRect() only. Reimplemented in KHSSelector. Definition at line 169 of file kselect.cpp.

void KXYSelector::drawCursor | ( | QPainter * | p,
|  | int | xp,
|  | int | yp
| ) | `[protected, virtual]`

| Override this function to draw the cursor which indicates the currently selected value pair. Definition at line 173 of file kselect.cpp. References QPainter::drawLine(), and QPainter::setPen().

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

- kselect.h
- kselect.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 13:05:28 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001