# kdeui Library API Documentation

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

# KSelector Class Reference

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

`#include <kselect.h>`

Inheritance diagram for KSelector:

[legend]
Collaboration diagram for KSelector:

[legend]
List of all members.

## Signals

void | valueChanged (int value)
| This signal is emitted whenever the user chooses a value, e.g.

## Public Member Functions

| KSelector (QWidget *parent=0, const char *name=0)
| Constructs a horizontal one-dimensional selection widget.
| KSelector (Orientation o, QWidget *parent=0L, const char *name=0L)
| Constructs a one-dimensional selection widget with a given orientation.
Orientation | orientation () const
QRect | contentsRect () const
void | setIndent (bool i)
| Sets the indent option of the widget to i.
bool | indent () const
void | setValue (int value)
| Sets the value.
int | value () const
void | setMinValue (int value)
| Sets the min value.
int | minValue () const
void | setMaxValue (int value)
| Sets the max value.
int | maxValue () const

## Protected Member Functions

virtual void | drawContents (QPainter *)
| Override this function to draw the contents of the control.
virtual void | drawArrow (QPainter *painter, bool show, const QPoint &pos)
| Override this function to draw the cursor which indicates the current value.
virtual void | valueChange ()
virtual void | paintEvent (QPaintEvent *)
virtual void | mousePressEvent (QMouseEvent *e)
virtual void | mouseMoveEvent (QMouseEvent *e)
virtual void | virtual_hook (int id, void *data)

## Detailed Description

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

An example is the KGradientSelector which allows to choose from a range of colors.

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

Definition at line 142 of file kselect.h.

## Constructor & Destructor Documentation

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

| Constructs a horizontal one-dimensional selection widget. Definition at line 190 of file kselect.cpp. References KStdAccel::name().

KSelector::KSelector | ( | Orientation | o,
|  | QWidget * | parent = 0L,
|  | const char * | name = 0L
| ) |

| Constructs a one-dimensional selection widget with a given orientation. Definition at line 197 of file kselect.cpp. References KStdAccel::name().

## Member Function Documentation

Orientation KSelector::orientation | ( |  | ) | const`[inline]`

Returns:
  the orientation of the widget.

Definition at line 167 of file kselect.h.

Referenced by contentsRect(), drawArrow(), and KGradientSelector::drawContents().

QRect KSelector::contentsRect | ( |  | ) | const

Returns:
  the rectangle on which subclasses should draw.

Definition at line 209 of file kselect.cpp.

References QWidget::height(), orientation(), and QWidget::width().

Referenced by KGradientSelector::drawContents().

void KSelector::setIndent | ( | bool | i | ) | `[inline]`

| Sets the indent option of the widget to i. This determines whether a shaded frame is drawn. Definition at line 179 of file kselect.h.

bool KSelector::indent | ( |  | ) | const`[inline]`

Returns:
  whether the indent option is set.

Definition at line 184 of file kselect.h.

void KSelector::setValue | ( | int | value | ) | `[inline]`

| Sets the value. Reimplemented from QRangeControl. Definition at line 190 of file kselect.h. References QRangeControl::setValue().

int KSelector::value | ( |  | ) | const`[inline]`

Returns:
  the value.

Reimplemented from QRangeControl.

Definition at line 196 of file kselect.h.

References QRangeControl::value().

void KSelector::setMinValue | ( | int | value | ) | `[inline]`

| Sets the min value. Reimplemented from QRangeControl. Definition at line 202 of file kselect.h. References QRangeControl::setMinValue().

int KSelector::minValue | ( |  | ) | const`[inline]`

Returns:
  the min value.

Reimplemented from QRangeControl.

Definition at line 208 of file kselect.h.

References QRangeControl::minValue().

void KSelector::setMaxValue | ( | int | value | ) | `[inline]`

| Sets the max value. Reimplemented from QRangeControl. Definition at line 214 of file kselect.h. References QRangeControl::setMaxValue().

int KSelector::maxValue | ( |  | ) | const`[inline]`

Returns:
  the max value.

Reimplemented from QRangeControl.

Definition at line 220 of file kselect.h.

References QRangeControl::maxValue().

void KSelector::valueChanged | ( | int | value | ) | `[signal]`

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

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

| Override this function to draw the contents of the control. The default implementation does nothing. Draw only within contentsRect(). Reimplemented in KValueSelector, and KGradientSelector. Definition at line 309 of file kselect.cpp.

void KSelector::drawArrow | ( | QPainter * | painter,
|  | bool | show,
|  | const QPoint & | pos
| ) | `[protected, virtual]`

Override this function to draw the cursor which indicates the current value.

This function is always called twice, once with argument show=false to clear the old cursor, once with argument show=true to draw the new one.

Definition at line 312 of file kselect.cpp.

References QWidget::colorGroup(), QPainter::drawPolygon(), orientation(), QWidget::repaint(), QPainter::setBrush(), QPainter::setPen(), QPointArray::setPoint(), QPoint::x(), and QPoint::y().

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:04:50 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001