.TH "KRuler" 3 "28 Jan 2004" "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
.RI "\fIThe types of units used. \fP"
.in -1c
.SS "Public Slots"

.in +1c
.ti -1c
.RI "void \fBslotNewValue\fP (int)"
.br
.RI "\fISets the pointer to a new position. \fP"
.ti -1c
.RI "void \fBslotNewOffset\fP (int)"
.br
.RI "\fISets the ruler marks to a new position. \fP"
.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
.RI "\fIConstructs a horizontal ruler. \fP"
.ti -1c
.RI "\fBKRuler\fP (Orientation orient, \fBQWidget\fP *parent=0, const  char *name=0, WFlags f=0)"
.br
.RI "\fIConstructs a ruler with orientation \fCorient\fP. \fP"
.ti -1c
.RI "\fBKRuler\fP (Orientation orient, int widgetWidth, \fBQWidget\fP *parent=0, const  char *name=0, WFlags f=0)"
.br
.RI "\fIConstructs a ruler with orientation \fCorient\fP and initial width \fCwidgetWidth\fP. \fP"
.ti -1c
.RI "\fB~KRuler\fP ()"
.br
.RI "\fIDestructor. \fP"
.ti -1c
.RI "void \fBsetMinValue\fP (int)"
.br
.RI "\fISets the minimal value of the ruler pointer (default is 0). \fP"
.ti -1c
.RI "int \fBminValue\fP () const "
.br
.RI "\fIReturns the minimal value of the ruler pointer. \fP"
.ti -1c
.RI "void \fBsetMaxValue\fP (int)"
.br
.RI "\fISets the maximum value of the ruler pointer (default is 100). \fP"
.ti -1c
.RI "int \fBmaxValue\fP () const "
.br
.RI "\fIReturns the maximal value of the ruler pointer. \fP"
.ti -1c
.RI "void \fBsetRange\fP (int min, int max)"
.br
.RI "\fISets minimum and maximum values of the ruler pointer. \fP"
.ti -1c
.RI "void \fBsetValue\fP (int)"
.br
.RI "\fISets the value of the ruler pointer. \fP"
.ti -1c
.RI "int \fBvalue\fP () const "
.br
.ti -1c
.RI "void \fBsetTinyMarkDistance\fP (int)"
.br
.RI "\fISets the distance between tiny marks. \fP"
.ti -1c
.RI "int \fBtinyMarkDistance\fP () const "
.br
.RI "\fIReturns the distance between tiny marks. \fP"
.ti -1c
.RI "void \fBsetLittleMarkDistance\fP (int)"
.br
.RI "\fISets the distance between little marks. \fP"
.ti -1c
.RI "int \fBlittleMarkDistance\fP () const "
.br
.RI "\fIReturns the distance between little marks. \fP"
.ti -1c
.RI "void \fBsetMediumMarkDistance\fP (int)"
.br
.RI "\fISets the distance between medium marks. \fP"
.ti -1c
.RI "int \fBmediumMarkDistance\fP () const "
.br
.ti -1c
.RI "void \fBsetBigMarkDistance\fP (int)"
.br
.RI "\fISets distance between big marks. \fP"
.ti -1c
.RI "int \fBbigMarkDistance\fP () const "
.br
.RI "\fIReturns the distance between big marks. \fP"
.ti -1c
.RI "void \fBsetShowTinyMarks\fP (bool)"
.br
.RI "\fIShows/hides tiny marks. \fP"
.ti -1c
.RI "bool \fBshowTinyMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowLittleMarks\fP (bool)"
.br
.RI "\fIShows/hides little marks. \fP"
.ti -1c
.RI "bool \fBshowLittleMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowMediumMarks\fP (bool)"
.br
.RI "\fIShows/hides medium marks. \fP"
.ti -1c
.RI "bool \fBshowMediumMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowBigMarks\fP (bool)"
.br
.RI "\fIShows/hides big marks. \fP"
.ti -1c
.RI "bool \fBshowBigMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowEndMarks\fP (bool)"
.br
.RI "\fIShows/hides end marks. \fP"
.ti -1c
.RI "bool \fBshowEndMarks\fP () const "
.br
.ti -1c
.RI "void \fBsetShowPointer\fP (bool)"
.br
.RI "\fIShows/hides the pointer. \fP"
.ti -1c
.RI "bool \fBshowPointer\fP () const "
.br
.ti -1c
.RI "void \fBsetValuePerLittleMark\fP (int)"
.br
.RI "\fI\fBThis class or method is obsolete, it is provided for compatibility only.\fP This method has no effect other than an update. \fP"
.ti -1c
.RI "void \fBsetValuePerMediumMark\fP (int)"
.br
.RI "\fI\fBThis class or method is obsolete, it is provided for compatibility only.\fP This method has no effect other than an update. \fP"
.ti -1c
.RI "void \fBsetValuePerBigMark\fP (int)"
.br
.RI "\fI\fBThis class or method is obsolete, it is provided for compatibility only.\fP This method has no effect other than an update. \fP"
.ti -1c
.RI "void \fBsetShowEndLabel\fP (bool)"
.br
.RI "\fIShow/hide number values of the end marks. \fP"
.ti -1c
.RI "bool \fBshowEndLabel\fP () const "
.br
.ti -1c
.RI "void \fBsetEndLabel\fP (const  \fBQString\fP &)"
.br
.RI "\fISets the label this is drawn at the beginning of the visible part of the ruler to \fClabel\fP. \fP"
.ti -1c
.RI "\fBQString\fP \fBendLabel\fP () const "
.br
.ti -1c
.RI "void \fBsetRulerMetricStyle\fP (\fBKRuler::MetricStyle\fP)"
.br
.RI "\fISets up the necessary tasks for the provided styles. \fP"
.ti -1c
.RI "void \fBsetPixelPerMark\fP (double rate)"
.br
.RI "\fISets the number of pixels between two base marks. \fP"
.ti -1c
.RI "double \fBpixelPerMark\fP () const "
.br
.RI "\fIReturns the number of pixels between two base marks. \fP"
.ti -1c
.RI "void \fBsetLength\fP (int)"
.br
.RI "\fISets the length of the ruler, i.e. \fP"
.ti -1c
.RI "int \fBlength\fP () const "
.br
.ti -1c
.RI "void \fBsetLengthFixed\fP (bool fix)"
.br
.RI "\fILocks the length of the ruler, i.e. \fP"
.ti -1c
.RI "bool \fBlengthFixed\fP () const "
.br
.ti -1c
.RI "void \fBslideUp\fP (int count=1)"
.br
.RI "\fISets the number of pixels by which the ruler may slide up or left. \fP"
.ti -1c
.RI "void \fBslideDown\fP (int count=1)"
.br
.RI "\fISets the number of pixels by which the ruler may slide down or right. \fP"
.ti -1c
.RI "void \fBsetOffset\fP (int offset)"
.br
.RI "\fISets the ruler slide offset. \fP"
.ti -1c
.RI "int \fBoffset\fP () const "
.br
.RI "\fIReturns the current ruler offset. \fP"
.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
.SH "Detailed Description"
.PP 
A ruler widget. A ruler widget. 

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

    meters                       inches
.PP
.PP
.PP
.nf
    ------   <--- end mark  ---> ------
        --                            -
        --   <---little mark--->     --
        --                            -
        --                          ---
       ---   <---medium mark          -
        --                           --
        --        tiny mark---->      -
        --                         ----
        --                            -
      ----   <-----big mark          --
        --                            -
      |>--   <--ruler pointer-->   |>--
.PP
.PP
.PP
.nf
 
.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 70 of file kruler.h.
.SH "Member Enumeration Documentation"
.PP 
.SS "\fBenum\fP \fBKRuler::MetricStyle\fP"
.PP
The types of units used. Definition at line 103 of file kruler.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KRuler::KRuler (\fBQWidget\fP * parent = 0, const char * name = 0)"
.PP
Constructs a horizontal ruler. Definition at line 146 of file kruler.cpp.
.PP
References KStdAccel::name().
.SS "KRuler::KRuler (Orientation orient, \fBQWidget\fP * parent = 0, const char * name = 0, WFlags f = 0)"
.PP
Constructs a ruler with orientation \fCorient\fP. \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. 
.br
\fIallowLines\fP Will be handed over to \fBQFrame\fP. 
.RE
.PP
Definition at line 156 of file kruler.cpp.
.PP
References KStdAccel::name().
.SS "KRuler::KRuler (Orientation orient, int widgetWidth, \fBQWidget\fP * parent = 0, const char * name = 0, WFlags f = 0)"
.PP
Constructs a ruler with orientation \fCorient\fP and initial width \fCwidgetWidth\fP. 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. 
.br
\fIallowLines\fP Will be handed over to \fBQFrame\fP. 
.RE
.PP
Definition at line 170 of file kruler.cpp.
.PP
References KStdAccel::name().
.SS "KRuler::~\fBKRuler\fP ()"
.PP
Destructor. Definition at line 209 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). This method calls \fBupdate\fP() so that the widget is painted after leaving to the main event loop. Definition at line 215 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. Definition at line 490 of file kruler.h.
.PP
References QRangeControl::minValue().
.SS "void KRuler::setMaxValue (int)"
.PP
Sets the maximum value of the ruler pointer (default is 100). This method calls \fBupdate\fP() so that the widget is painted after leaving to the main event loop. Definition at line 224 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. Definition at line 494 of file kruler.h.
.PP
References QRangeControl::maxValue().
.SS "void KRuler::setRange (int min, int max)"
.PP
Sets minimum and maximum values of the ruler pointer. This method calls \fBupdate\fP() so that the widget is painted after leaving to the main event loop. Definition at line 233 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. The value is indicated by painting the ruler pointer at the corresponding position. This method calls \fBupdate\fP() so that the widget is painted after leaving to the main event loop. Definition at line 242 of file kruler.cpp.
.PP
References QFrame::contentsRect(), and QRangeControl::setValue().
.SS "void KRuler::setTinyMarkDistance (int)"
.PP
Sets the distance between tiny marks. This is mostly used in the English system (inches) with distance of 1. Definition at line 249 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. Definition at line 502 of file kruler.h.
.SS "void KRuler::setLittleMarkDistance (int)"
.PP
Sets the distance between little marks. The default value is 1 in the metric system and 2 in the English (inches) system. Definition at line 258 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. Definition at line 506 of file kruler.h.
.SS "void KRuler::setMediumMarkDistance (int)"
.PP
Sets the distance between medium marks. For English (inches) styles it defaults to twice the little mark distance. For metric styles it defaults to five times the little mark distance. Definition at line 267 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setBigMarkDistance (int)"
.PP
Sets distance between big marks. For English (inches) or metric styles it is twice the medium mark distance. Definition at line 276 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. Definition at line 514 of file kruler.h.
.SS "void KRuler::setShowTinyMarks (bool)"
.PP
Shows/hides tiny marks. Definition at line 285 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowLittleMarks (bool)"
.PP
Shows/hides little marks. Definition at line 300 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowMediumMarks (bool)"
.PP
Shows/hides medium marks. Definition at line 315 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowBigMarks (bool)"
.PP
Shows/hides big marks. Definition at line 330 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowEndMarks (bool)"
.PP
Shows/hides end marks. Definition at line 346 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowPointer (bool)"
.PP
Shows/hides the pointer. Definition at line 361 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setValuePerLittleMark (int)"
.PP
\fBThis class or method is obsolete, it is provided for compatibility only.\fP This method has no effect other than an update. Do not use. Definition at line 377 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setValuePerMediumMark (int)"
.PP
\fBThis class or method is obsolete, it is provided for compatibility only.\fP This method has no effect other than an update. Do not use. Definition at line 383 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setValuePerBigMark (int)"
.PP
\fBThis class or method is obsolete, it is provided for compatibility only.\fP This method has no effect other than an update. Do not use. Definition at line 389 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.PP
Referenced by setRulerMetricStyle().
.SS "void KRuler::setShowEndLabel (bool)"
.PP
Show/hide number values of the end marks. Default is \fCfalse\fP. Definition at line 395 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. Definition at line 412 of file kruler.cpp.
.PP
References QFrame::contentsRect(), KStdAccel::label(), 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. A convenience method. Definition at line 432 of file kruler.cpp.
.PP
References QString::fromLatin1(), setBigMarkDistance(), setEndLabel(), setLittleMarkDistance(), setMediumMarkDistance(), setPixelPerMark(), setShowBigMarks(), setShowEndMarks(), setShowLittleMarks(), setShowMediumMarks(), setShowTinyMarks(), setTinyMarkDistance(), setValuePerBigMark(), and setValuePerMediumMark().
.SS "void KRuler::setPixelPerMark (double rate)"
.PP
Sets the number of pixels between two base marks. Calling this method stretches or shrinks your ruler.
.PP
For pixel display (\fBMetricStyle\fP) 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 Definition at line 509 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. Definition at line 518 of file kruler.h.
.SS "void KRuler::setLength (int)"
.PP
Sets the length of the ruler, i.e. 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. Definition at line 517 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setLengthFixed (bool fix)"
.PP
Locks the length of the ruler, i.e. 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
Definition at line 543 of file kruler.cpp.
.SS "void KRuler::slideUp (int count = 1)"
.PP
Sets the number of pixels by which the ruler may slide up or left. 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
Definition at line 574 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::slideDown (int count = 1)"
.PP
Sets the number of pixels by which the ruler may slide down or right. 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
Definition at line 583 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "void KRuler::setOffset (int offset)"
.PP
Sets the ruler slide offset. This is like \fBslideup\fP() or \fBslidedown\fP() 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
Definition at line 555 of file kruler.cpp.
.PP
References QFrame::contentsRect().
.SS "int KRuler::offset () const\fC [inline]\fP"
.PP
Returns the current ruler offset. Definition at line 522 of file kruler.h.
.SS "void KRuler::slotNewValue (int)\fC [slot]\fP"
.PP
Sets the pointer to a new position. The offset is NOT updated. \fBQWidget::repaint\fP() is called afterwards. Definition at line 593 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. The pointer is NOT updated. \fBQWidget::repaint\fP() is called afterwards. Definition at line 619 of file kruler.cpp.
.PP
References QFrame::contentsRect().

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