• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

Public Types | Public Slots | Public Member Functions | Protected Member Functions | List of all members
KRuler Class Reference

#include <kruler.h>

Inherits TQFrame.

Public Types

enum  MetricStyle {
  Custom =0 , Pixel , Inch , Millimetres ,
  Centimetres , Metres
}
 

Public Slots

void slotNewValue (int)
 
void slotNewOffset (int)
 
void slotEndOffset (int)
 

Public Member Functions

 KRuler (TQWidget *parent=0, const char *name=0)
 
 KRuler (Orientation orient, TQWidget *parent=0, const char *name=0, WFlags f=0)
 
 KRuler (Orientation orient, int widgetWidth, TQWidget *parent=0, const char *name=0, WFlags f=0)
 
 ~KRuler ()
 
void setMinValue (int)
 
int minValue () const
 
void setMaxValue (int)
 
int maxValue () const
 
void setRange (int min, int max)
 
void setValue (int)
 
int value () const
 
void setTinyMarkDistance (int)
 
int tinyMarkDistance () const
 
void setLittleMarkDistance (int)
 
int littleMarkDistance () const
 
void setMediumMarkDistance (int)
 
int mediumMarkDistance () const
 
void setBigMarkDistance (int)
 
int bigMarkDistance () const
 
void setShowTinyMarks (bool)
 
bool showTinyMarks () const
 
void setShowLittleMarks (bool)
 
bool showLittleMarks () const
 
void setShowMediumMarks (bool)
 
bool showMediumMarks () const
 
void setShowBigMarks (bool)
 
bool showBigMarks () const
 
void setShowEndMarks (bool)
 
bool showEndMarks () const
 
void setShowPointer (bool)
 
bool showPointer () const
 
void setValuePerLittleMark (int) TDE_DEPRECATED
 
void setValuePerMediumMark (int) TDE_DEPRECATED
 
void setValuePerBigMark (int) TDE_DEPRECATED
 
void setShowEndLabel (bool)
 
bool showEndLabel () const
 
void setEndLabel (const TQString &)
 
TQString endLabel () const
 
void setRulerMetricStyle (KRuler::MetricStyle)
 
void setPixelPerMark (double rate)
 
double pixelPerMark () const
 
void setLength (int)
 
int length () const
 
void setLengthFixed (bool fix)
 
bool lengthFixed () const
 
void slideUp (int count=1)
 
void slideDown (int count=1)
 
void setOffset (int offset)
 
int offset () const
 
int endOffset () const
 

Protected Member Functions

virtual void drawContents (TQPainter *)
 
virtual void virtual_hook (int id, void *data)
 

Detailed Description

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 TQWidget::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 TQWidget::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.

A ruler widget.

Author
Jörg Habenicht

Definition at line 70 of file kruler.h.

Member Enumeration Documentation

◆ MetricStyle

enum KRuler::MetricStyle

The types of units used.

Definition at line 103 of file kruler.h.

Constructor & Destructor Documentation

◆ KRuler() [1/3]

KRuler::KRuler ( TQWidget *  parent = 0,
const char *  name = 0 
)

The style (or look) of the ruler.

Constructs a horizontal ruler.

Definition at line 94 of file kruler.cpp.

◆ KRuler() [2/3]

KRuler::KRuler ( Orientation  orient,
TQWidget *  parent = 0,
const char *  name = 0,
WFlags  f = 0 
)

Constructs a ruler with orientation orient.

parent, name and f are passed to TQFrame. The default look is a raised widget but may be changed with the inherited TQFrame methods.

Parameters
orientOrientation of the ruler.
parentWill be handed over to TQFrame.
nameWill be handed over to TQFrame.
fWill be handed over to TQFrame.

Definition at line 104 of file kruler.cpp.

◆ KRuler() [3/3]

KRuler::KRuler ( Orientation  orient,
int  widgetWidth,
TQWidget *  parent = 0,
const char *  name = 0,
WFlags  f = 0 
)

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 TQFrame.

Parameters
orientOrientation of the ruler.
widgetWidthFixed width of the widget.
parentWill be handed over to TQFrame.
nameWill be handed over to TQFrame.
fWill be handed over to TQFrame.

Definition at line 118 of file kruler.cpp.

◆ ~KRuler()

KRuler::~KRuler ( )

Destructor.

Definition at line 157 of file kruler.cpp.

Member Function Documentation

◆ bigMarkDistance()

int KRuler::bigMarkDistance ( ) const
inline

Returns the distance between big marks.

Definition at line 509 of file kruler.h.

◆ drawContents()

void KRuler::drawContents ( TQPainter *  p)
protectedvirtual

Definition at line 594 of file kruler.cpp.

◆ endLabel()

TQString KRuler::endLabel ( ) const

Definition at line 374 of file kruler.cpp.

◆ endOffset()

int KRuler::endOffset ( ) const

Definition at line 512 of file kruler.cpp.

◆ length()

int KRuler::length ( ) const

Definition at line 481 of file kruler.cpp.

◆ lengthFixed()

bool KRuler::lengthFixed ( ) const

Definition at line 497 of file kruler.cpp.

◆ littleMarkDistance()

int KRuler::littleMarkDistance ( ) const
inline

Returns the distance between little marks.

Definition at line 501 of file kruler.h.

◆ maxValue()

int KRuler::maxValue ( ) const
inline

Returns the maximal value of the ruler pointer.

Definition at line 489 of file kruler.h.

◆ mediumMarkDistance()

int KRuler::mediumMarkDistance ( ) const
inline

Definition at line 505 of file kruler.h.

◆ minValue()

int KRuler::minValue ( ) const
inline

Returns the minimal value of the ruler pointer.

Definition at line 485 of file kruler.h.

◆ offset()

int KRuler::offset ( ) const
inline

Returns the current ruler offset.

Definition at line 517 of file kruler.h.

◆ pixelPerMark()

double KRuler::pixelPerMark ( ) const
inline

Returns the number of pixels between two base marks.

Definition at line 513 of file kruler.h.

◆ setBigMarkDistance()

void KRuler::setBigMarkDistance ( int  dist)

Sets distance between big marks.

For English (inches) or metric styles it is twice the medium mark distance.

Definition at line 224 of file kruler.cpp.

◆ setEndLabel()

void KRuler::setEndLabel ( const TQString &  label)

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

Definition at line 360 of file kruler.cpp.

◆ setLength()

void KRuler::setLength ( int  length)

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.

Definition at line 465 of file kruler.cpp.

◆ setLengthFixed()

void KRuler::setLengthFixed ( bool  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
fixfixes the length, if true

Definition at line 491 of file kruler.cpp.

◆ setLittleMarkDistance()

void KRuler::setLittleMarkDistance ( int  dist)

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 206 of file kruler.cpp.

◆ setMaxValue()

void KRuler::setMaxValue ( int  value)

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.

Definition at line 172 of file kruler.cpp.

◆ setMediumMarkDistance()

void KRuler::setMediumMarkDistance ( int  dist)

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 215 of file kruler.cpp.

◆ setMinValue()

void KRuler::setMinValue ( int  value)

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.

Definition at line 163 of file kruler.cpp.

◆ setOffset()

void KRuler::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
offsetNumber of pixel to move the ruler up or left from the beginning

Definition at line 503 of file kruler.cpp.

◆ setPixelPerMark()

void KRuler::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

Definition at line 457 of file kruler.cpp.

◆ setRange()

void KRuler::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.

Definition at line 181 of file kruler.cpp.

◆ setRulerMetricStyle()

void KRuler::setRulerMetricStyle ( KRuler::MetricStyle  style)

Sets up the necessary tasks for the provided styles.

A convenience method.

Definition at line 380 of file kruler.cpp.

◆ setShowBigMarks()

void KRuler::setShowBigMarks ( bool  show)

Shows/hides big marks.

Definition at line 278 of file kruler.cpp.

◆ setShowEndLabel()

void KRuler::setShowEndLabel ( bool  show)

Show/hide number values of the little marks.

Default is false. Show/hide number values of the medium marks.

Default is false. Show/hide number values of the big marks.

Default is false. Show/hide number values of the end marks.

Default is false.

Definition at line 343 of file kruler.cpp.

◆ setShowEndMarks()

void KRuler::setShowEndMarks ( bool  show)

Shows/hides end marks.

Definition at line 294 of file kruler.cpp.

◆ setShowLittleMarks()

void KRuler::setShowLittleMarks ( bool  show)

Shows/hides little marks.

Definition at line 248 of file kruler.cpp.

◆ setShowMediumMarks()

void KRuler::setShowMediumMarks ( bool  show)

Shows/hides medium marks.

Definition at line 263 of file kruler.cpp.

◆ setShowPointer()

void KRuler::setShowPointer ( bool  show)

Shows/hides the pointer.

Definition at line 309 of file kruler.cpp.

◆ setShowTinyMarks()

void KRuler::setShowTinyMarks ( bool  show)

Shows/hides tiny marks.

Definition at line 233 of file kruler.cpp.

◆ setTinyMarkDistance()

void KRuler::setTinyMarkDistance ( int  dist)

Sets the distance between tiny marks.

This is mostly used in the English system (inches) with distance of 1.

Definition at line 197 of file kruler.cpp.

◆ setValue()

void KRuler::setValue ( int  value)

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.

Definition at line 190 of file kruler.cpp.

◆ setValuePerBigMark()

void KRuler::setValuePerBigMark ( int  )
Deprecated:
This method has no effect other than an update. Do not use.

Definition at line 337 of file kruler.cpp.

◆ setValuePerLittleMark()

void KRuler::setValuePerLittleMark ( int  )
Deprecated:
This method has no effect other than an update. Do not use.

Definition at line 325 of file kruler.cpp.

◆ setValuePerMediumMark()

void KRuler::setValuePerMediumMark ( int  )
Deprecated:
This method has no effect other than an update. Do not use.

Definition at line 331 of file kruler.cpp.

◆ showBigMarks()

bool KRuler::showBigMarks ( ) const

Definition at line 288 of file kruler.cpp.

◆ showEndLabel()

bool KRuler::showEndLabel ( ) const

Definition at line 353 of file kruler.cpp.

◆ showEndMarks()

bool KRuler::showEndMarks ( ) const

Definition at line 303 of file kruler.cpp.

◆ showLittleMarks()

bool KRuler::showLittleMarks ( ) const

Definition at line 257 of file kruler.cpp.

◆ showMediumMarks()

bool KRuler::showMediumMarks ( ) const

Definition at line 272 of file kruler.cpp.

◆ showPointer()

bool KRuler::showPointer ( ) const

Definition at line 319 of file kruler.cpp.

◆ showTinyMarks()

bool KRuler::showTinyMarks ( ) const

Definition at line 242 of file kruler.cpp.

◆ slideDown()

void KRuler::slideDown ( int  count = 1)

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
countNumber of pixel moving up or left relative to the previous position

Definition at line 531 of file kruler.cpp.

◆ slideUp()

void KRuler::slideUp ( int  count = 1)

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
countNumber of pixel moving up or left relative to the previous position

Definition at line 522 of file kruler.cpp.

◆ slotEndOffset

void KRuler::slotEndOffset ( int  offset)
slot

Definition at line 578 of file kruler.cpp.

◆ slotNewOffset

void KRuler::slotNewOffset ( int  _offset)
slot

Sets the ruler marks to a new position.

The pointer is NOT updated. TQWidget::repaint() is called afterwards.

Definition at line 567 of file kruler.cpp.

◆ slotNewValue

void KRuler::slotNewValue ( int  _value)
slot

Sets the pointer to a new position.

The offset is NOT updated. TQWidget::repaint() is called afterwards.

Definition at line 541 of file kruler.cpp.

◆ tinyMarkDistance()

int KRuler::tinyMarkDistance ( ) const
inline

Returns the distance between tiny marks.

Definition at line 497 of file kruler.h.

◆ value()

int KRuler::value ( ) const
inline

Definition at line 493 of file kruler.h.

◆ virtual_hook()

void KRuler::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 739 of file kruler.cpp.


The documentation for this class was generated from the following files:
  • kruler.h
  • kruler.cpp

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.