org.kde.koala

Class KRuler

public class KRuler extends QFrame

A ruler widget. The vertical ruler looks similar to this:
    meters                       inches
    ------   <--- end mark  --. ------
        --                            -
        --   <---little mark--.     --
        --                            -
        --                          ---
       ---   <---medium mark          -
        --                           --
        --        tiny mark---.      -
        --                         ----
        --                            -
      ----   <-----big mark          --
        --                            -
      |>--   <--ruler pointer-.   |>--
 
There are tiny marks, little marks, medium marks, and big marks along the ruler. To receive mouse clicks or mouse moves, the class has to be overloaded. For performance reasons, the public methods don't call QWidget.repaint(). (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 QWidget.repaint() call after changing the values. For setting multiple values like minValue(), maxValue(), offset() etc. using the public methods is recommended so the widget will be painted only once when entering the main event loop.

Author: Jorg Habenicht

UNKNOWN: A ruler widget.

Field Summary
static intCentimetres
static intCustom
The types of units used.
static intInch
static intMetres
static intMillimetres
static intPixel
Constructor Summary
protected KRuler(Class dummy)
KRuler(QWidget parent, String name)
Constructs a horizontal ruler.
KRuler(QWidget parent)
KRuler()
KRuler(int orient, QWidget parent, String name, int f)
Constructs a ruler with orientation orient. parent, name and f are passed to QFrame.
KRuler(int orient, QWidget parent, String name)
KRuler(int orient, QWidget parent)
KRuler(int orient)
KRuler(int orient, int widgetWidth, QWidget parent, String name, int f)
Constructs a ruler with orientation orient and initial width widgetWidth. The width sets the fixed width of the widget.
KRuler(int orient, int widgetWidth, QWidget parent, String name)
KRuler(int orient, int widgetWidth, QWidget parent)
KRuler(int orient, int widgetWidth)
Method Summary
intbigMarkDistance()
Returns the distance between big marks.
StringclassName()
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
protected voiddrawContents(QPainter arg1)
StringendLabel()
intendOffset()
protected voidfinalize()
Deletes the wrapped C++ instance
booleanisDisposed()
Has the wrapped C++ instance been deleted?
intlength()
booleanlengthFixed()
intlittleMarkDistance()
Returns the distance between little marks.
intmaxValue()
Returns the maximal value of the ruler pointer.
intmediumMarkDistance()
QMetaObjectmetaObject()
intminValue()
Returns the minimal value of the ruler pointer.
intoffset()
Returns the current ruler offset.
doublepixelPerMark()
Returns the number of pixels between two base marks.
voidsetBigMarkDistance(int arg1)
Sets distance between big marks.
voidsetEndLabel(String arg1)
Sets the label this is drawn at the beginning of the visible part of the ruler to label
voidsetLength(int arg1)
Sets the length of the ruler, i.e. the difference between the begin mark and the end mark of the ruler.
voidsetLengthFixed(boolean fix)
Locks the length of the ruler, i.e. the difference between the two end marks doesn't change when the widget is resized.
voidsetLittleMarkDistance(int arg1)
Sets the distance between little marks.
voidsetMaxValue(int arg1)
Sets the maximum value of the ruler pointer (default is 100).
voidsetMediumMarkDistance(int arg1)
Sets the distance between medium marks.
voidsetMinValue(int arg1)
Sets the minimal value of the ruler pointer (default is 0).
voidsetOffset(int offset)
Sets the ruler slide offset.
voidsetPixelPerMark(double rate)
Sets the number of pixels between two base marks.
voidsetRange(int min, int max)
Sets minimum and maximum values of the ruler pointer.
voidsetRulerMetricStyle(int arg1)
Sets up the necessary tasks for the provided styles.
voidsetShowBigMarks(boolean arg1)
Shows/hides big marks.
voidsetShowEndLabel(boolean arg1)
Show/hide number values of the end marks.
voidsetShowEndMarks(boolean arg1)
Shows/hides end marks.
voidsetShowLittleMarks(boolean arg1)
Shows/hides little marks.
voidsetShowMediumMarks(boolean arg1)
Shows/hides medium marks.
voidsetShowPointer(boolean arg1)
Shows/hides the pointer.
voidsetShowTinyMarks(boolean arg1)
Shows/hides tiny marks.
voidsetTinyMarkDistance(int arg1)
Sets the distance between tiny marks.
voidsetValue(int arg1)
Sets the value of the ruler pointer.
booleanshowBigMarks()
booleanshowEndLabel()
booleanshowEndMarks()
booleanshowLittleMarks()
booleanshowMediumMarks()
booleanshowPointer()
booleanshowTinyMarks()
voidslideDown(int count)
Sets the number of pixels by which the ruler may slide down or right.
voidslideDown()
voidslideUp(int count)
Sets the number of pixels by which the ruler may slide up or left.
voidslideUp()
voidslotEndOffset(int arg1)
voidslotNewOffset(int arg1)
Sets the ruler marks to a new position.
voidslotNewValue(int arg1)
Sets the pointer to a new position.
inttinyMarkDistance()
Returns the distance between tiny marks.
intvalue()

Field Detail

Centimetres

public static final int Centimetres

Custom

public static final int Custom
The types of units used.

UNKNOWN: The types of units used.

Inch

public static final int Inch

Metres

public static final int Metres

Millimetres

public static final int Millimetres

Pixel

public static final int Pixel

Constructor Detail

KRuler

protected KRuler(Class dummy)

KRuler

public KRuler(QWidget parent, String name)
Constructs a horizontal ruler.

UNKNOWN: Constructs a horizontal ruler.

KRuler

public KRuler(QWidget parent)

KRuler

public KRuler()

KRuler

public KRuler(int orient, QWidget parent, String name, int f)
Constructs a ruler with orientation orient. parent, name and f are passed to QFrame. The default look is a raised widget but may be changed with the inherited QFrame methods.

Parameters: orient Orientation of the ruler. parent Will be handed over to QFrame. name Will be handed over to QFrame. f Will be handed over to QFrame.

UNKNOWN: Constructs a ruler with orientation orient.

KRuler

public KRuler(int orient, QWidget parent, String name)

KRuler

public KRuler(int orient, QWidget parent)

KRuler

public KRuler(int orient)

KRuler

public KRuler(int orient, int widgetWidth, QWidget parent, String name, int f)
Constructs a ruler with orientation orient and initial width widgetWidth. 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. parent, name and f are passed to QFrame.

Parameters: orient Orientation of the ruler. widgetWidth Fixed width of the widget. parent Will be handed over to QFrame. name Will be handed over to QFrame. f Will be handed over to QFrame.

UNKNOWN: Constructs a ruler with orientation orient and initial width widgetWidth.

KRuler

public KRuler(int orient, int widgetWidth, QWidget parent, String name)

KRuler

public KRuler(int orient, int widgetWidth, QWidget parent)

KRuler

public KRuler(int orient, int widgetWidth)

Method Detail

bigMarkDistance

public int bigMarkDistance()
Returns the distance between big marks.

UNKNOWN: Returns the distance between big marks.

className

public String className()

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

drawContents

protected void drawContents(QPainter arg1)

endLabel

public String endLabel()

endOffset

public int endOffset()

finalize

protected void finalize()
Deletes the wrapped C++ instance

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

length

public int length()

lengthFixed

public boolean lengthFixed()

littleMarkDistance

public int littleMarkDistance()
Returns the distance between little marks.

UNKNOWN: Returns the distance between little marks.

maxValue

public int maxValue()
Returns the maximal value of the ruler pointer.

UNKNOWN: Returns the maximal value of the ruler pointer.

mediumMarkDistance

public int mediumMarkDistance()

metaObject

public QMetaObject metaObject()

minValue

public int minValue()
Returns the minimal value of the ruler pointer.

UNKNOWN: Returns the minimal value of the ruler pointer.

offset

public int offset()
Returns the current ruler offset.

UNKNOWN: Returns the current ruler offset.

pixelPerMark

public double pixelPerMark()
Returns the number of pixels between two base marks.

UNKNOWN: Returns the number of pixels between two base marks.

setBigMarkDistance

public void setBigMarkDistance(int arg1)
Sets distance between big marks. For English (inches) or metric styles it is twice the medium mark distance.

UNKNOWN: Sets distance between big marks.

setEndLabel

public void setEndLabel(String arg1)
Sets the label this is drawn at the beginning of the visible part of the ruler to label

UNKNOWN: Sets the label this is drawn at the beginning of the visible part of the ruler to label

setLength

public void setLength(int arg1)
Sets the length of the ruler, i.e. the difference between the begin mark and the end mark of the ruler. Same as (width() - offset()) when the length is not locked, it gets adjusted with the length of the widget.

UNKNOWN: Sets the length of the ruler, i.

setLengthFixed

public void setLengthFixed(boolean fix)
Locks the length of the ruler, i.e. the difference between the two end marks doesn't change when the widget is resized.

Parameters: fix fixes the length, if true

UNKNOWN: Locks the length of the ruler, i.

setLittleMarkDistance

public void setLittleMarkDistance(int arg1)
Sets the distance between little marks. The default value is 1 in the metric system and 2 in the English (inches) system.

UNKNOWN: Sets the distance between little marks.

setMaxValue

public void setMaxValue(int arg1)
Sets the maximum value of the ruler pointer (default is 100). This method calls update() so that the widget is painted after leaving to the main event loop.

UNKNOWN: Sets the maximum value of the ruler pointer (default is 100).

setMediumMarkDistance

public void setMediumMarkDistance(int arg1)
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.

UNKNOWN: Sets the distance between medium marks.

setMinValue

public void setMinValue(int arg1)
Sets the minimal value of the ruler pointer (default is 0). This method calls update() so that the widget is painted after leaving to the main event loop.

UNKNOWN: Sets the minimal value of the ruler pointer (default is 0).

setOffset

public void setOffset(int offset)
Sets the ruler slide offset. This is like slideup() or slidedown() with an absolute offset from the start of the ruler.

Parameters: offset Number of pixel to move the ruler up or left from the beginning

UNKNOWN: Sets the ruler slide offset.

setPixelPerMark

public void setPixelPerMark(double rate)
Sets the number of pixels between two base marks. Calling this method stretches or shrinks your ruler. 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 here. 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 int values use setPixelPerMark((int)your_int_value); default: 1 mark per 10 pixels

UNKNOWN: Sets the number of pixels between two base marks.

setRange

public void setRange(int min, int max)
Sets minimum and maximum values of the ruler pointer. This method calls update() so that the widget is painted after leaving to the main event loop.

UNKNOWN: Sets minimum and maximum values of the ruler pointer.

setRulerMetricStyle

public void setRulerMetricStyle(int arg1)
Sets up the necessary tasks for the provided styles. A convenience method.

UNKNOWN: Sets up the necessary tasks for the provided styles.

setShowBigMarks

public void setShowBigMarks(boolean arg1)
Shows/hides big marks.

UNKNOWN: Shows/hides big marks.

setShowEndLabel

public void setShowEndLabel(boolean arg1)
Show/hide number values of the end marks. Default is false.

UNKNOWN: Show/hide number values of the end marks.

setShowEndMarks

public void setShowEndMarks(boolean arg1)
Shows/hides end marks.

UNKNOWN: Shows/hides end marks.

setShowLittleMarks

public void setShowLittleMarks(boolean arg1)
Shows/hides little marks.

UNKNOWN: Shows/hides little marks.

setShowMediumMarks

public void setShowMediumMarks(boolean arg1)
Shows/hides medium marks.

UNKNOWN: Shows/hides medium marks.

setShowPointer

public void setShowPointer(boolean arg1)
Shows/hides the pointer.

UNKNOWN: Shows/hides the pointer.

setShowTinyMarks

public void setShowTinyMarks(boolean arg1)
Shows/hides tiny marks.

UNKNOWN: Shows/hides tiny marks.

setTinyMarkDistance

public void setTinyMarkDistance(int arg1)
Sets the distance between tiny marks. This is mostly used in the English system (inches) with distance of 1.

UNKNOWN: Sets the distance between tiny marks.

setValue

public void setValue(int arg1)
Sets the value of the ruler pointer. 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.

UNKNOWN: Sets the value of the ruler pointer.

showBigMarks

public boolean showBigMarks()

showEndLabel

public boolean showEndLabel()

showEndMarks

public boolean showEndMarks()

showLittleMarks

public boolean showLittleMarks()

showMediumMarks

public boolean showMediumMarks()

showPointer

public boolean showPointer()

showTinyMarks

public boolean showTinyMarks()

slideDown

public void slideDown(int count)
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. This doesn't affect the position of the ruler pointer. Only the visible part of the ruler is moved.

Parameters: count Number of pixel moving up or left relative to the previous position

UNKNOWN: Sets the number of pixels by which the ruler may slide down or right.

slideDown

public void slideDown()

slideUp

public void slideUp(int count)
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. This doesn't affect the position of the ruler pointer. Only the visible part of the ruler is moved.

Parameters: count Number of pixel moving up or left relative to the previous position

UNKNOWN: Sets the number of pixels by which the ruler may slide up or left.

slideUp

public void slideUp()

slotEndOffset

public void slotEndOffset(int arg1)

slotNewOffset

public void slotNewOffset(int arg1)
Sets the ruler marks to a new position. The pointer is NOT updated. QWidget.repaint() is called afterwards.

UNKNOWN: Sets the ruler marks to a new position.

slotNewValue

public void slotNewValue(int arg1)
Sets the pointer to a new position. The offset is NOT updated. QWidget.repaint() is called afterwards.

UNKNOWN: Sets the pointer to a new position.

tinyMarkDistance

public int tinyMarkDistance()
Returns the distance between tiny marks.

UNKNOWN: Returns the distance between tiny marks.

value

public int value()