.TH "KRuler" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KRuler \- A ruler widget. A ruler widget.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kruler.h>\fP
.PP
Inherits \fBQFrame\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBMetricStyle\fP { \fBCustom\fP = 0, \fBPixel\fP, \fBInch\fP, \fBMillimetres\fP, \fBCentimetres\fP, \fBMetres\fP }"
.br
.in -1c
.SS "Public Slots"

.in +1c
.ti -1c
.RI "void \fBslotNewValue\fP (int)"
.br
.ti -1c
.RI "void \fBslotNewOffset\fP (int)"
.br
.ti -1c
.RI "void \fBslotEndOffset\fP (int)"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKRuler\fP (\fBQWidget\fP *parent=0, const char *name=0)"
.br
.ti -1c
.RI "\fBKRuler\fP (Orientation orient, \fBQWidget\fP *parent=0, const char *name=0, WFlags f=0)"
.br
.ti -1c
.RI "\fBKRuler\fP (Orientation orient, int widgetWidth, \fBQWidget\fP *parent=0, const char *name=0, WFlags f=0)"
.br
.ti -1c
.RI "\fB~KRuler\fP ()"
.br
.ti -1c
.RI "void \fBsetMinValue\fP (int)"
.br
.ti -1c
.RI "int \fBminValue\fP () const "
.br
.ti -1c
.RI "void \fBsetMaxValue\fP (int)"
.br
.ti -1c
.RI "int \fBmaxValue\fP () const "
.br
.ti -1c
.RI "void \fBsetRange\fP (int min, int max)"
.br
.ti -1c
.RI "void \fBsetValue\fP (int)"
.br
.ti -1c
.RI "int \fBvalue\fP () const "
.br
.ti -1c
.RI "void \fBsetTinyMarkDistance\fP (int)"
.br
.ti -1c
.RI "int \fBtinyMarkDistance\fP () const "
.br
.ti -1c
.RI "void \fBsetLittleMarkDistance\fP (int)"
.br
.ti -1c
.RI "int \fBlittleMarkDistance\fP () const "
.br
.ti -1c
.RI "void \fBsetMediumMarkDistance\fP (int)"
.br
.ti -1c
.RI "int \fBmediumMarkDistance\fP () const "
.br
.ti -1c
.RI "void \fBsetBigMarkDistance\fP (int)"
.br
.ti -1c
.RI "int \fBbigMarkDistance\fP () const "
.br
.ti -1c
.RI "void \fBsetShowTinyMarks\fP (bool)"
.br
.ti -1c
.RI "bool \fBshowTinyMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowLittleMarks\fP (bool)"
.br
.ti -1c
.RI "bool \fBshowLittleMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowMediumMarks\fP (bool)"
.br
.ti -1c
.RI "bool \fBshowMediumMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowBigMarks\fP (bool)"
.br
.ti -1c
.RI "bool \fBshowBigMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowEndMarks\fP (bool)"
.br
.ti -1c
.RI "bool \fBshowEndMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowPointer\fP (bool)"
.br
.ti -1c
.RI "bool \fBshowPointer\fP () const "
.br
.ti -1c
.RI "void \fBsetValuePerLittleMark\fP (int) KDE_DEPRECATED"
.br
.ti -1c
.RI "void \fBsetValuePerMediumMark\fP (int) KDE_DEPRECATED"
.br
.ti -1c
.RI "void \fBsetValuePerBigMark\fP (int) KDE_DEPRECATED"
.br
.ti -1c
.RI "void \fBsetShowEndLabel\fP (bool)"
.br
.ti -1c
.RI "bool \fBshowEndLabel\fP () const "
.br
.ti -1c
.RI "void \fBsetEndLabel\fP (const \fBQString\fP &)"
.br
.ti -1c
.RI "\fBQString\fP \fBendLabel\fP () const "
.br
.ti -1c
.RI "void \fBsetRulerMetricStyle\fP (\fBKRuler::MetricStyle\fP)"
.br
.ti -1c
.RI "void \fBsetPixelPerMark\fP (double rate)"
.br
.ti -1c
.RI "double \fBpixelPerMark\fP () const "
.br
.ti -1c
.RI "void \fBsetLength\fP (int)"
.br
.ti -1c
.RI "int \fBlength\fP () const "
.br
.ti -1c
.RI "void \fBsetLengthFixed\fP (bool fix)"
.br
.ti -1c
.RI "bool \fBlengthFixed\fP () const "
.br
.ti -1c
.RI "void \fBslideUp\fP (int count=1)"
.br
.ti -1c
.RI "void \fBslideDown\fP (int count=1)"
.br
.ti -1c
.RI "void \fBsetOffset\fP (int offset)"
.br
.ti -1c
.RI "int \fBoffset\fP () const "
.br
.ti -1c
.RI "int \fBendOffset\fP () const "
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBdrawContents\fP (\fBQPainter\fP *)"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Properties"

.in +1c
.ti -1c
.RI "int \fBminValue\fP"
.br
.ti -1c
.RI "int \fBmaxValue\fP"
.br
.ti -1c
.RI "int \fBvalue\fP"
.br
.ti -1c
.RI "bool \fBshowTinyMarks\fP"
.br
.ti -1c
.RI "bool \fBshowLittleMarks\fP"
.br
.ti -1c
.RI "bool \fBshowMediumMarks\fP"
.br
.ti -1c
.RI "bool \fBshowBigMarks\fP"
.br
.ti -1c
.RI "bool \fBshowPointer\fP"
.br
.ti -1c
.RI "bool \fBshowEndLabel\fP"
.br
.ti -1c
.RI "int \fBtinyMarkDistance\fP"
.br
.ti -1c
.RI "int \fBlittleMarkDistance\fP"
.br
.ti -1c
.RI "int \fBmediumMarkDistance\fP"
.br
.ti -1c
.RI "int \fBbigMarkDistance\fP"
.br
.ti -1c
.RI "double \fBpixelPerMark\fP"
.br
.ti -1c
.RI "bool \fBlengthFixed\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
A ruler widget. A ruler widget. 

The vertical ruler looks similar to this:
.PP
.PP
.nf
    meters                       inches

    ------   <--- end mark  ---> ------
        --                            -
        --   <---little mark--->     --
        --                            -
        --                          ---
       ---   <---medium mark          -
        --                           --
        --        tiny mark---->      -
        --                         ----
        --                            -
      ----   <-----big mark          --
        --                            -
      |>--   <--ruler pointer-->   |>--
.fi
.PP
.PP
There are tiny marks, little marks, medium marks, and big marks along the ruler.
.PP
To receive mouse clicks or mouse moves, the class has to be overloaded.
.PP
For performance reasons, the public methods don't call \fBQWidget::repaint()\fP. (Slots do, see documentation below.) All the changed settings will be painted once after leaving to the main event loop. For performance painting the slot methods should be used, they do a fast \fBQWidget::repaint()\fP call after changing the values. For setting multiple values like \fBminValue()\fP, \fBmaxValue()\fP, \fBoffset()\fP etc. using the public methods is recommended so the widget will be painted only once when entering the main event loop.
.PP
\fBAuthor:\fP
.RS 4
Jörg Habenicht 
.RE
.PP

.PP
Definition at line 71 of file kruler.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "\fBenum\fP \fBKRuler::MetricStyle\fP"
.PP
The types of units used. 
.PP
Definition at line 104 of file kruler.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KRuler::KRuler (\fBQWidget\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
Constructs a horizontal ruler. 
.PP
Definition at line 94 of file kruler.cpp.
.SS "KRuler::KRuler (Orientation orient, \fBQWidget\fP * parent = \fC0\fP, const char * name = \fC0\fP, WFlags f = \fC0\fP)"
.PP
Constructs a ruler with orientation \fCorient\fP. 
.PP
\fCparent\fP, \fCname\fP and \fCf\fP are passed to \fBQFrame\fP. The default look is a raised widget but may be changed with the inherited \fBQFrame\fP methods.
.PP
\fBParameters:\fP
.RS 4
\fIorient\fP Orientation of the ruler. 
.br
\fIparent\fP Will be handed over to \fBQFrame\fP. 
.br
\fIname\fP Will be handed over to \fBQFrame\fP. 
.br
\fIf\fP Will be handed over to \fBQFrame\fP. 
.RE
.PP

.PP
Definition at line 104 of file kruler.cpp.
.SS "KRuler::KRuler (Orientation orient, int widgetWidth, \fBQWidget\fP * parent = \fC0\fP, const char * name = \fC0\fP, WFlags f = \fC0\fP)"
.PP
Constructs a ruler with orientation \fCorient\fP and initial width \fCwidgetWidth\fP. 
.PP
The width sets the fixed width of the widget. This is useful if you want to draw the ruler bigger or smaller than the default size. Note: The size of the marks doesn't change. \fCparent\fP, \fCname\fP and \fCf\fP are passed to \fBQFrame\fP.
.PP
\fBParameters:\fP
.RS 4
\fIorient\fP Orientation of the ruler. 
.br
\fIwidgetWidth\fP Fixed width of the widget. 
.br
\fIparent\fP Will be handed over to \fBQFrame\fP. 
.br
\fIname\fP Will be handed over to \fBQFrame\fP. 
.br
\fIf\fP Will be handed over to \fBQFrame\fP. 
.RE
.PP

.PP
Definition at line 118 of file kruler.cpp.
.SS "KRuler::~\fBKRuler\fP ()"
.PP
Destructor. 
.PP
Definition at line 157 of file kruler.cpp.
.SH "Member Function Documentation"
.PP 
.SS "void KRuler::setMinValue (int)"
.PP
Sets the minimal value of the ruler pointer (default is 0). 
.PP
This method calls update() so that the widget is painted after leaving to the main event loop. 
.PP
Definition at line 163 of file kruler.cpp.
.PP
References QFrame::contentsRect(), QRangeControl::maxValue(), QRangeControl::minValue(), and QRangeControl::setRange().
.SS "int KRuler::minValue () const\fC [inline]\fP"
.PP
Returns the minimal value of the ruler pointer. 
.PP
.SS "void KRuler::setMaxValue (int)"
.PP
Sets the maximum value of the ruler pointer (default is 100). 
.PP
This method calls update() so that the widget is painted after leaving to the main event loop. 
.PP
Definition at line 172 of file kruler.cpp.
.PP
References QFrame::contentsRect(), QRangeControl::maxValue(), QRangeControl::minValue(), and QRangeControl::setRange().
.SS "int KRuler::maxValue () const\fC [inline]\fP"
.PP
Returns the maximal value of the ruler pointer. 
.PP
.SS "void KRuler::setRange (int min, int max)"
.PP
Sets minimum and maximum values of the ruler pointer. 
.PP
This method calls update() so that the widget is painted after leaving to the main event loop. 
.PP
Definition at line 181 of file kruler.cpp.
.PP
References QFrame::contentsRect(), QRangeControl::maxValue(), QRangeControl::minValue(), and QRangeControl::setRange().
.SS "void KRuler::setValue (int)"
.PP
Sets the value of the ruler pointer. 
.PP
The value is indicated by painting the ruler pointer at the corresponding position. This method calls update() so that the widget is painted after leaving to the main event loop. 
.PP
Definition at line 190 of file kruler.cpp.
.PP
References QFrame::contentsRect(), and QRangeControl::setValue().
.SS "void KRuler::setTinyMarkDistance (int)"
.PP
Sets the distance between tiny marks. 
.PP
This is mostly used in the English system (inches) with distance of 1. 
.PP
Definition at line 197 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "int KRuler::tinyMarkDistance () const\fC [inline]\fP"
.PP
Returns the distance between tiny marks. 
.PP
.SS "void KRuler::setLittleMarkDistance (int)"
.PP
Sets the distance between little marks. 
.PP
The default value is 1 in the metric system and 2 in the English (inches) system. 
.PP
Definition at line 206 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "int KRuler::littleMarkDistance () const\fC [inline]\fP"
.PP
Returns the distance between little marks. 
.PP
.SS "void KRuler::setMediumMarkDistance (int)"
.PP
Sets the distance between medium marks. 
.PP
For English (inches) styles it defaults to twice the little mark distance. For metric styles it defaults to five times the little mark distance. 
.PP
Definition at line 215 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setBigMarkDistance (int)"
.PP
Sets distance between big marks. 
.PP
For English (inches) or metric styles it is twice the medium mark distance. 
.PP
Definition at line 224 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "int KRuler::bigMarkDistance () const\fC [inline]\fP"
.PP
Returns the distance between big marks. 
.PP
.SS "void KRuler::setShowTinyMarks (bool)"
.PP
Shows/hides tiny marks. 
.PP
Definition at line 233 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowLittleMarks (bool)"
.PP
Shows/hides little marks. 
.PP
Definition at line 248 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowMediumMarks (bool)"
.PP
Shows/hides medium marks. 
.PP
Definition at line 263 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowBigMarks (bool)"
.PP
Shows/hides big marks. 
.PP
Definition at line 278 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowEndMarks (bool)"
.PP
Shows/hides end marks. 
.PP
Definition at line 294 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowPointer (bool)"
.PP
Shows/hides the pointer. 
.PP
Definition at line 309 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setValuePerLittleMark (int)"
.PP
\fBDeprecated\fP
.RS 4
This method has no effect other than an update. Do not use. 
.RE
.PP

.PP
Definition at line 325 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setValuePerMediumMark (int)"
.PP
\fBDeprecated\fP
.RS 4
This method has no effect other than an update. Do not use. 
.RE
.PP

.PP
Definition at line 331 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setValuePerBigMark (int)"
.PP
\fBDeprecated\fP
.RS 4
This method has no effect other than an update. Do not use. 
.RE
.PP

.PP
Definition at line 337 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setShowEndLabel (bool)"
.PP
Show/hide number values of the end marks. 
.PP
Default is \fCfalse\fP. 
.PP
Definition at line 343 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setEndLabel (const \fBQString\fP &)"
.PP
Sets the label this is drawn at the beginning of the visible part of the ruler to \fClabel\fP. 
.PP
Definition at line 360 of file kruler.cpp.
.PP
References QFrame::contentsRect(), QFont::setPointSize(), and QFontMetrics::width().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setRulerMetricStyle (\fBKRuler::MetricStyle\fP)"
.PP
Sets up the necessary tasks for the provided styles. 
.PP
A convenience method. 
.PP
Definition at line 380 of file kruler.cpp.
.PP
References QFrame::contentsRect(), setBigMarkDistance(), setEndLabel(), setLittleMarkDistance(), setMediumMarkDistance(), setPixelPerMark(), setShowBigMarks(), setShowEndMarks(), setShowLittleMarks(), setShowMediumMarks(), setShowTinyMarks(), and setTinyMarkDistance().
.SS "void KRuler::setPixelPerMark (double rate)"
.PP
Sets the number of pixels between two base marks. 
.PP
Calling this method stretches or shrinks your ruler.
.PP
For pixel display ( MetricStyle) the value is 10.0 marks per pixel ;-) For English (inches) it is 9.0, and for centimetres ~2.835 -> 3.0 . If you want to magnify your part of display, you have to adjust the mark distance \fChere\fP. Notice: The double type is only supported to give the possibility of having some double values. It should be used with care. Using values below 10.0 shows visible jumps of markpositions (e.g. 2.345). Using whole numbers is highly recommended. To use \fCint\fP values use setPixelPerMark((int)your_int_value); default: 1 mark per 10 pixels 
.PP
Definition at line 457 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "double KRuler::pixelPerMark () const\fC [inline]\fP"
.PP
Returns the number of pixels between two base marks. 
.PP
.SS "void KRuler::setLength (int)"
.PP
Sets the length of the ruler, i.e. 
.PP
the difference between the begin mark and the end mark of the ruler.
.PP
Same as (width() - \fBoffset()\fP)
.PP
when the length is not locked, it gets adjusted with the length of the widget. 
.PP
Definition at line 465 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setLengthFixed (bool fix)"
.PP
Locks the length of the ruler, i.e. 
.PP
the difference between the two end marks doesn't change when the widget is resized.
.PP
\fBParameters:\fP
.RS 4
\fIfix\fP fixes the length, if true 
.RE
.PP

.PP
Definition at line 491 of file kruler.cpp.
.SS "void KRuler::slideUp (int count = \fC1\fP)"
.PP
Sets the number of pixels by which the ruler may slide up or left. 
.PP
The number of pixels moved is realive to the previous position. The Method makes sense for updating a ruler, which is working with a scrollbar.
.PP
This doesn't affect the position of the ruler pointer. Only the visible part of the ruler is moved.
.PP
\fBParameters:\fP
.RS 4
\fIcount\fP Number of pixel moving up or left relative to the previous position 
.RE
.PP

.PP
Definition at line 522 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::slideDown (int count = \fC1\fP)"
.PP
Sets the number of pixels by which the ruler may slide down or right. 
.PP
The number of pixels moved is realive to the previous position. The Method makes sense for updating a ruler, which is working with a scrollbar.
.PP
This doesn't affect the position of the ruler pointer. Only the visible part of the ruler is moved.
.PP
\fBParameters:\fP
.RS 4
\fIcount\fP Number of pixel moving up or left relative to the previous position 
.RE
.PP

.PP
Definition at line 531 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setOffset (int offset)"
.PP
Sets the ruler slide offset. 
.PP
This is like slideup() or slidedown() with an absolute offset from the start of the ruler.
.PP
\fBParameters:\fP
.RS 4
\fIoffset\fP Number of pixel to move the ruler up or left from the beginning 
.RE
.PP

.PP
Definition at line 503 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "int KRuler::offset () const\fC [inline]\fP"
.PP
Returns the current ruler offset. 
.PP
Definition at line 518 of file kruler.h.
.SS "void KRuler::slotNewValue (int)\fC [slot]\fP"
.PP
Sets the pointer to a new position. 
.PP
The offset is NOT updated. \fBQWidget::repaint()\fP is called afterwards. 
.PP
Definition at line 541 of file kruler.cpp.
.PP
References QRangeControl::setValue(), QRect::unite(), and QRangeControl::value().
.SS "void KRuler::slotNewOffset (int)\fC [slot]\fP"
.PP
Sets the ruler marks to a new position. 
.PP
The pointer is NOT updated. \fBQWidget::repaint()\fP is called afterwards. 
.PP
Definition at line 567 of file kruler.cpp.
.PP
References QFrame::contentsRect().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
