kalarm/lib

#include <spinbox2.h>

Inheritance diagram for SpinBox2:
TimeSpinBox

Public Slots

virtual void setValue (int val)
 
virtual void setPrefix (const TQString &text)
 
virtual void setSuffix (const TQString &text)
 
virtual void stepUp ()
 
virtual void stepDown ()
 
virtual void pageUp ()
 
virtual void pageDown ()
 
virtual void selectAll ()
 
virtual void setEnabled (bool enabled)
 

Signals

void valueChanged (int value)
 
void valueChanged (const TQString &valueText)
 

Public Member Functions

 SpinBox2 (TQWidget *parent=0, const char *name=0)
 
 SpinBox2 (int minValue, int maxValue, int step=1, int step2=1, TQWidget *parent=0, const char *name=0)
 
virtual void setReadOnly (bool readOnly)
 
bool isReadOnly () const
 
void setSelectOnStep (bool sel)
 
void setReverseWithLayout (bool reverse)
 
bool reverseButtons () const
 
TQString text () const
 
virtual TQString prefix () const
 
virtual TQString suffix () const
 
virtual TQString cleanText () const
 
virtual void setSpecialValueText (const TQString &text)
 
TQString specialValueText () const
 
virtual void setWrapping (bool on)
 
bool wrapping () const
 
void setAlignment (int a)
 
virtual void setButtonSymbols (TQSpinBox::ButtonSymbols)
 
TQSpinBox::ButtonSymbols buttonSymbols () const
 
virtual void setValidator (const TQValidator *v)
 
const TQValidator * validator () const
 
virtual TQSize sizeHint () const
 
virtual TQSize minimumSizeHint () const
 
int minValue () const
 
int maxValue () const
 
virtual void setMinValue (int val)
 
virtual void setMaxValue (int val)
 
void setRange (int minValue, int maxValue)
 
int value () const
 
int bound (int val) const
 
TQRect upRect () const
 
TQRect downRect () const
 
TQRect up2Rect () const
 
TQRect down2Rect () const
 
int lineStep () const
 
int lineShiftStep () const
 
int pageStep () const
 
int pageShiftStep () const
 
void setLineStep (int step)
 
void setSteps (int line, int page)
 
void setShiftSteps (int line, int page)
 
void addPage ()
 
void subtractPage ()
 
void addLine ()
 
void subtractLine ()
 
void addValue (int change)
 

Protected Slots

virtual void valueChange ()
 
virtual void stepPage (int)
 

Protected Member Functions

virtual TQString mapValueToText (int v)
 
virtual int mapTextToValue (bool *ok)
 
virtual void resizeEvent (TQResizeEvent *)
 
virtual void showEvent (TQShowEvent *)
 
virtual void styleChange (TQStyle &)
 
virtual void getMetrics () const
 

Protected Attributes

int wUpdown2
 
int xUpdown2
 
int xSpinbox
 
int wGap
 

Friends

class MainSpinBox
 

Detailed Description

Spin box with a pair of spin buttons on either side.

The SpinBox2 class provides a spin box with two pairs of spin buttons, one on either side.

It is designed as a base class for implementing such facilities as time spin boxes, where the hours and minutes values are separately displayed in the edit field. When the appropriate step increments are configured, the left spin arrows can then be used to change the hours value, while the right spin arrows can be used to change the minutes value.

Rather than using SpinBox2 directly for time entry, use in preference TimeSpinBox or TimeEdit classes which are tailored from SpinBox2 for this purpose.

Separate step increments may optionally be specified for use when the shift key is held down. Typically these would be larger than the normal steps. Then, when the user clicks the spin buttons, he/she can increment or decrement the value faster by holding the shift key down.

The widget may be set as read-only. This has the same effect as disabling it, except that its appearance is unchanged.

Author
David Jarvie softw.nosp@m.are@.nosp@m.astro.nosp@m.jar..nosp@m.org.u.nosp@m.k

Definition at line 56 of file spinbox2.h.

Constructor & Destructor Documentation

◆ SpinBox2() [1/2]

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

Constructor.

Parameters
parentThe parent object of this widget.
nameThe name of this widget.

Definition at line 51 of file spinbox2.cpp.

◆ SpinBox2() [2/2]

SpinBox2::SpinBox2 ( int  minValue,
int  maxValue,
int  step = 1,
int  step2 = 1,
TQWidget *  parent = 0,
const char *  name = 0 
)

Constructor.

Parameters
minValueThe minimum value which the spin box can have.
maxValueThe maximum value which the spin box can have.
stepThe (unshifted) step interval for the right-hand spin buttons.
step2The (unshifted) step interval for the left-hand spin buttons.
parentThe parent object of this widget.
nameThe name of this widget.

Definition at line 63 of file spinbox2.cpp.

Member Function Documentation

◆ addLine()

void SpinBox2::addLine ( )
inline

Increments the current value by adding the unshifted step increment for the right-hand spin buttons.

Definition at line 212 of file spinbox2.h.

◆ addPage()

void SpinBox2::addPage ( )
inline

Increments the current value by adding the unshifted step increment for the left-hand spin buttons.

Definition at line 204 of file spinbox2.h.

◆ addValue()

void SpinBox2::addValue ( int  change)
inline

Adjusts the current value by adding change.

Definition at line 218 of file spinbox2.h.

◆ bound()

int SpinBox2::bound ( int  val) const

Returns the specified value clamped to the range of the spin box.

Definition at line 190 of file spinbox2.cpp.

◆ buttonSymbols()

TQSpinBox::ButtonSymbols SpinBox2::buttonSymbols ( ) const
inline

Returns the button symbols currently in use (arrows or plus/minus).

Definition at line 123 of file spinbox2.h.

◆ cleanText()

virtual TQString SpinBox2::cleanText ( ) const
inlinevirtual

Returns the spin box's text with no prefix(), suffix() or leading or trailing whitespace.

Definition at line 98 of file spinbox2.h.

◆ down2Rect()

TQRect SpinBox2::down2Rect ( ) const

Returns the geometry of the left-hand "down" button.

Definition at line 136 of file spinbox2.cpp.

◆ downRect()

TQRect SpinBox2::downRect ( ) const
inline

Returns the geometry of the right-hand "down" button.

Definition at line 155 of file spinbox2.h.

◆ isReadOnly()

bool SpinBox2::isReadOnly ( ) const
inline

Returns true if the widget is read only.

Definition at line 81 of file spinbox2.h.

◆ lineShiftStep()

int SpinBox2::lineShiftStep ( ) const
inline

Returns the shifted step increment for the right-hand spin buttons, i.e.

the amount by which the spin box value changes when a right-hand spin button is clicked while the shift key is pressed.

Definition at line 170 of file spinbox2.h.

◆ lineStep()

int SpinBox2::lineStep ( ) const
inline

Returns the unshifted step increment for the right-hand spin buttons, i.e.

the amount by which the spin box value changes when a right-hand spin button is clicked without the shift key being pressed.

Definition at line 165 of file spinbox2.h.

◆ maxValue()

int SpinBox2::maxValue ( ) const
inline

Returns the maximum value of the spin box.

Definition at line 140 of file spinbox2.h.

◆ minValue()

int SpinBox2::minValue ( ) const
inline

Returns the minimum value of the spin box.

Definition at line 138 of file spinbox2.h.

◆ pageDown

virtual void SpinBox2::pageDown ( )
inlinevirtualslot

Decrements the current value by subtracting the unshifted step increment for the left-hand spin buttons.

Definition at line 242 of file spinbox2.h.

◆ pageShiftStep()

int SpinBox2::pageShiftStep ( ) const
inline

Returns the shifted step increment for the left-hand spin buttons, i.e.

the amount by which the spin box value changes when a left-hand spin button is clicked while the shift key is pressed.

Definition at line 180 of file spinbox2.h.

◆ pageStep()

int SpinBox2::pageStep ( ) const
inline

Returns the unshifted step increment for the left-hand spin buttons, i.e.

the amount by which the spin box value changes when a left-hand spin button is clicked without the shift key being pressed.

Definition at line 175 of file spinbox2.h.

◆ pageUp

virtual void SpinBox2::pageUp ( )
inlinevirtualslot

Increments the current value by adding the unshifted step increment for the left-hand spin buttons.

Definition at line 238 of file spinbox2.h.

◆ prefix()

virtual TQString SpinBox2::prefix ( ) const
inlinevirtual

Returns the prefix for the spin box's text.

Definition at line 94 of file spinbox2.h.

◆ reverseButtons()

bool SpinBox2::reverseButtons ( ) const
inline

Returns whether the spin button pairs will be reversed for a right-to-left language.

Definition at line 89 of file spinbox2.h.

◆ selectAll

virtual void SpinBox2::selectAll ( )
inlinevirtualslot

Selects all the text in the spin box's editor.

Definition at line 244 of file spinbox2.h.

◆ setAlignment()

void SpinBox2::setAlignment ( int  a)
inline

Set the text alignment of the widget.

Definition at line 119 of file spinbox2.h.

◆ setButtonSymbols()

void SpinBox2::setButtonSymbols ( TQSpinBox::ButtonSymbols  newSymbols)
virtual

Sets the button symbols to use (arrows or plus/minus).

Definition at line 182 of file spinbox2.cpp.

◆ setEnabled

void SpinBox2::setEnabled ( bool  enabled)
virtualslot

Sets whether the widget is enabled.

Definition at line 119 of file spinbox2.cpp.

◆ setLineStep()

void SpinBox2::setLineStep ( int  step)

Sets the unshifted step increment for the right-hand spin buttons, i.e.

the amount by which the spin box value changes when a right-hand spin button is clicked without the shift key being pressed.

Definition at line 141 of file spinbox2.cpp.

◆ setMaxValue()

void SpinBox2::setMaxValue ( int  val)
virtual

Sets the maximum value of the spin box.

Reimplemented in TimeSpinBox.

Definition at line 202 of file spinbox2.cpp.

◆ setMinValue()

void SpinBox2::setMinValue ( int  val)
virtual

Sets the minimum value of the spin box.

Reimplemented in TimeSpinBox.

Definition at line 195 of file spinbox2.cpp.

◆ setPrefix

virtual void SpinBox2::setPrefix ( const TQString &  text)
inlinevirtualslot

Sets the prefix which is prepended to the start of the displayed text.

Definition at line 224 of file spinbox2.h.

◆ setRange()

void SpinBox2::setRange ( int  minValue,
int  maxValue 
)
inline

Sets the minimum and maximum values of the spin box.

Definition at line 146 of file spinbox2.h.

◆ setReadOnly()

void SpinBox2::setReadOnly ( bool  readOnly)
virtual

Sets whether the spin box can be changed by the user.

Parameters
readOnlyTrue to set the widget read-only, false to set it read-write.

Definition at line 99 of file spinbox2.cpp.

◆ setReverseWithLayout()

void SpinBox2::setReverseWithLayout ( bool  reverse)

Sets whether the spin button pairs should be reversed for a right-to-left language.

The default is for them to be reversed.

Definition at line 109 of file spinbox2.cpp.

◆ setSelectOnStep()

void SpinBox2::setSelectOnStep ( bool  sel)
inline

Sets whether the spin box value text should be selected when its value is stepped.

Definition at line 83 of file spinbox2.h.

◆ setShiftSteps()

void SpinBox2::setShiftSteps ( int  line,
int  page 
)

Sets the shifted step increments for the two pairs of spin buttons, i.e.

the amount by which the spin box value changes when a spin button is clicked while the shift key is pressed.

Parameters
lineThe shift step increment for the right-hand spin buttons.
pageThe shift step increment for the left-hand spin buttons.

Definition at line 166 of file spinbox2.cpp.

◆ setSpecialValueText()

virtual void SpinBox2::setSpecialValueText ( const TQString &  text)
inlinevirtual

Sets the special-value text which, if non-null, is displayed instead of a numeric value when the current value is equal to minValue().

Definition at line 103 of file spinbox2.h.

◆ setSteps()

void SpinBox2::setSteps ( int  line,
int  page 
)

Sets the unshifted step increments for the two pairs of spin buttons, i.e.

the amount by which the spin box value changes when a spin button is clicked without the shift key being pressed.

Parameters
lineThe step increment for the right-hand spin buttons.
pageThe step increment for the left-hand spin buttons.

Definition at line 150 of file spinbox2.cpp.

◆ setSuffix

virtual void SpinBox2::setSuffix ( const TQString &  text)
inlinevirtualslot

Sets the suffix which is prepended to the start of the displayed text.

Definition at line 226 of file spinbox2.h.

◆ setValidator()

virtual void SpinBox2::setValidator ( const TQValidator *  v)
inlinevirtual

Sets the validator to v.

The validator controls what keyboard input is accepted when the user is editing the value field.

Definition at line 128 of file spinbox2.h.

◆ setValue

virtual void SpinBox2::setValue ( int  val)
inlinevirtualslot

Sets the current value to val.

Definition at line 222 of file spinbox2.h.

◆ setWrapping()

void SpinBox2::setWrapping ( bool  on)
virtual

Sets whether it is possible to step the value from the highest value to the lowest value and vice versa.

Definition at line 125 of file spinbox2.cpp.

◆ specialValueText()

TQString SpinBox2::specialValueText ( ) const
inline

Returns the special-value text which, if non-null, is displayed instead of a numeric value when the current value is equal to minValue().

Definition at line 107 of file spinbox2.h.

◆ stepDown

virtual void SpinBox2::stepDown ( )
inlinevirtualslot

Decrements the current value by subtracting the unshifted step increment for the right-hand spin buttons.

Definition at line 234 of file spinbox2.h.

◆ stepUp

virtual void SpinBox2::stepUp ( )
inlinevirtualslot

Increments the current value by adding the unshifted step increment for the right-hand spin buttons.

Definition at line 230 of file spinbox2.h.

◆ subtractLine()

void SpinBox2::subtractLine ( )
inline

Decrements the current value by subtracting the unshifted step increment for the right-hand spin buttons.

Definition at line 216 of file spinbox2.h.

◆ subtractPage()

void SpinBox2::subtractPage ( )
inline

Decrements the current value by subtracting the unshifted step increment for the left-hand spin buttons.

Definition at line 208 of file spinbox2.h.

◆ suffix()

virtual TQString SpinBox2::suffix ( ) const
inlinevirtual

Returns the suffix for the spin box's text.

Definition at line 96 of file spinbox2.h.

◆ text()

TQString SpinBox2::text ( ) const
inline

Returns the spin box's text, including any prefix() and suffix().

Definition at line 92 of file spinbox2.h.

◆ up2Rect()

TQRect SpinBox2::up2Rect ( ) const

Returns the geometry of the left-hand "up" button.

Definition at line 131 of file spinbox2.cpp.

◆ upRect()

TQRect SpinBox2::upRect ( ) const
inline

Returns the geometry of the right-hand "up" button.

Definition at line 153 of file spinbox2.h.

◆ validator()

const TQValidator* SpinBox2::validator ( ) const
inline

Returns the current validator.

The validator controls what keyboard input is accepted when the user is editing the value field.

Definition at line 132 of file spinbox2.h.

◆ value()

int SpinBox2::value ( ) const
inline

Returns the current value of the spin box.

Definition at line 148 of file spinbox2.h.

◆ valueChanged [1/2]

void SpinBox2::valueChanged ( const TQString &  valueText)
signal

Signal which is emitted whenever the value of the spin box changes.

◆ valueChanged [2/2]

void SpinBox2::valueChanged ( int  value)
signal

Signal which is emitted whenever the value of the spin box changes.

◆ wrapping()

bool SpinBox2::wrapping ( ) const
inline

Returns whether it is possible to step the value from the highest value to the lowest value and vice versa.

Definition at line 116 of file spinbox2.h.


The documentation for this class was generated from the following files: