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

tdeui

  • tdeui
knuminput.h
1/*
2 * knuminput.h
3 *
4 * Copyright (c) 1997 Patrick Dowler <dowler@morgul.fsh.uvic.ca>
5 * Copyright (c) 2000 Dirk A. Mueller <mueller@kde.org>
6 * Copyright (c) 2002 Marc Mutz <mutz@kde.org>
7 *
8 * Requires the Qt widget libraries, available at no cost at
9 * http://www.troll.no/
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
25 */
26
27#ifndef K_NUMINPUT_H
28#define K_NUMINPUT_H
29
30#include <tqwidget.h>
31#include <tqspinbox.h>
32#include <tdelibs_export.h>
33
34class TQLabel;
35class TQSlider;
36class TQLineEdit;
37class TQLayout;
38class TQValidator;
39
40class KIntSpinBox;
41
42/* ------------------------------------------------------------------------ */
43
49class TDEUI_EXPORT KNumInput : public TQWidget
50{
51 TQ_OBJECT
52
53 TQ_PROPERTY( TQString label READ label WRITE setLabel )
54public:
60 KNumInput(TQWidget* parent=0, const char* name=0);
61
67 KNumInput(KNumInput* below, TQWidget* parent=0, const char* name=0);
68 ~KNumInput();
69
88 virtual void setLabel(const TQString & label, int a = AlignLeft | AlignTop);
89
93 TQString label() const;
94
99 bool showSlider() const { return m_slider; }
100
107 void setSteps(int minor, int major);
108
113 TQSizePolicy sizePolicy() const;
114
120 virtual TQSize sizeHint() const;
121
122protected:
128 void layout(bool deep);
129
138 virtual void doLayout() = 0;
139
140 KNumInput* m_prev, *m_next;
141 int m_colw1, m_colw2;
142
143 TQLabel* m_label;
144 TQSlider* m_slider;
145 TQSize m_sizeSlider, m_sizeLabel;
146
147 int m_alignment;
148
149private:
150 void init();
151
152protected:
153 virtual void virtual_hook( int id, void* data );
154private:
155 class KNumInputPrivate;
156 KNumInputPrivate *d;
157};
158
159/* ------------------------------------------------------------------------ */
160
187
188class TDEUI_EXPORT KIntNumInput : public KNumInput
189{
190 TQ_OBJECT
191
192 TQ_PROPERTY( int value READ value WRITE setValue )
193 TQ_PROPERTY( int minValue READ minValue WRITE setMinValue )
194 TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
195 TQ_PROPERTY( int referencePoint READ referencePoint WRITE setReferencePoint )
196 TQ_PROPERTY( double relativeValue READ relativeValue WRITE setRelativeValue )
197 TQ_PROPERTY( TQString suffix READ suffix WRITE setSuffix )
198 TQ_PROPERTY( TQString prefix READ prefix WRITE setPrefix )
199 TQ_PROPERTY( TQString specialValueText READ specialValueText WRITE setSpecialValueText )
200
201public:
206 KIntNumInput(TQWidget *parent=0, const char *name=0);
219 KIntNumInput(int value, TQWidget* parent=0, int base = 10, const char *name=0);
220
238 KIntNumInput(KNumInput* below, int value, TQWidget* parent=0, int base = 10, const char *name=0);
239
245 virtual ~KIntNumInput();
246
250 int value() const;
251
256 double relativeValue() const;
257
262 int referencePoint() const;
263
268 TQString suffix() const;
273 TQString prefix() const;
278 TQString specialValueText() const;
279
286 void setRange(int min, int max, int step=1, bool slider=true);
290 void setMinValue(int min);
294 int minValue() const;
298 void setMaxValue(int max);
302 int maxValue() const;
303
310 void setSpecialValueText(const TQString& text);
311
312 virtual void setLabel(const TQString & label, int a = AlignLeft | AlignTop);
313
321 virtual TQSize minimumSizeHint() const;
322
323public slots:
327 void setValue(int);
328
333 void setRelativeValue(double);
334
339 void setReferencePoint(int);
340
350 void setSuffix(const TQString &suffix);
351
359 void setPrefix(const TQString &prefix);
360
365 void setEditFocus( bool mark = true );
366
367signals:
372 void valueChanged(int);
373
379 void relativeValueChanged(double);
380
381private slots:
382 void spinValueChanged(int);
383 void slotEmitRelativeValueChanged(int);
384
385protected:
386 virtual void doLayout();
387 void resizeEvent ( TQResizeEvent * );
388
389 KIntSpinBox* m_spin;
390 TQSize m_sizeSpin;
391
392private:
393 void init(int value, int _base);
394
395protected:
396 virtual void virtual_hook( int id, void* data );
397private:
398 class KIntNumInputPrivate;
399 KIntNumInputPrivate *d;
400};
401
402
403/* ------------------------------------------------------------------------ */
404
405class KDoubleLine;
406
433
434class TDEUI_EXPORT KDoubleNumInput : public KNumInput
435{
436 TQ_OBJECT
437
438 TQ_PROPERTY( double value READ value WRITE setValue )
439 TQ_PROPERTY( double minValue READ minValue WRITE setMinValue )
440 TQ_PROPERTY( double maxValue READ maxValue WRITE setMaxValue )
441 TQ_PROPERTY( TQString suffix READ suffix WRITE setSuffix )
442 TQ_PROPERTY( TQString prefix READ prefix WRITE setPrefix )
443 TQ_PROPERTY( TQString specialValueText READ specialValueText WRITE setSpecialValueText )
444 TQ_PROPERTY( int precision READ precision WRITE setPrecision )
445 TQ_PROPERTY( double referencePoint READ referencePoint WRITE setReferencePoint )
446 TQ_PROPERTY( double relativeValue READ relativeValue WRITE setRelativeValue )
447
448public:
453 KDoubleNumInput(TQWidget *parent=0, const char *name=0);
454
463 KDoubleNumInput(double value, TQWidget *parent=0, const char *name=0) TDE_DEPRECATED;
464
477 KDoubleNumInput(double lower, double upper, double value, double step=0.01,
478 int precision=2, TQWidget *parent=0, const char *name=0);
479
483 virtual ~KDoubleNumInput();
484
496 KDoubleNumInput(KNumInput* below, double value, TQWidget* parent=0, const char* name=0) TDE_DEPRECATED;
497
519 KDoubleNumInput(KNumInput* below,
520 double lower, double upper, double value, double step=0.02,
521 int precision=2, TQWidget *parent=0, const char *name=0);
522
526 double value() const;
527
532 TQString suffix() const;
533
538 TQString prefix() const;
539
544 int precision() const;
545
550 TQString specialValueText() const { return m_specialvalue; }
551
558 void setRange(double min, double max, double step=1, bool slider=true);
562 void setMinValue(double min);
566 double minValue() const;
570 void setMaxValue(double max);
574 double maxValue() const;
575
579 void setPrecision(int precision);
580
585 double referencePoint() const;
586
591 double relativeValue() const;
592
599 void setSpecialValueText(const TQString& text);
600
601 virtual void setLabel(const TQString & label, int a = AlignLeft | AlignTop);
602 virtual TQSize minimumSizeHint() const;
603 virtual bool eventFilter(TQObject*, TQEvent*);
604
605public slots:
609 void setValue(double);
610
615 void setRelativeValue(double);
616
623 void setReferencePoint(double ref);
624
632 void setSuffix(const TQString &suffix);
633
640 void setPrefix(const TQString &prefix);
641
642signals:
647 void valueChanged(double);
655 void relativeValueChanged(double);
656
657private slots:
658 void sliderMoved(int);
659 void slotEmitRelativeValueChanged(double);
660
661protected:
662 virtual void doLayout();
663 void resizeEvent ( TQResizeEvent * );
664
665 virtual void resetEditBox();
666
667 // ### no longer used, remove when BIC allowed
668 KDoubleLine* edit;
669
670 bool m_range;
671 double m_lower, m_upper, m_step;
672 // ### end no longer used
673
674 TQSize m_sizeEdit;
675
676 friend class KDoubleLine;
677private:
678 void init(double value, double lower, double upper,
679 double step, int precision);
680 double mapSliderToSpin(int) const;
681 void updateLegacyMembers();
682 // ### no longer used, remove when BIC allowed:
683 TQString m_specialvalue, m_prefix, m_suffix;
684 double m_value;
685 short m_precision;
686 // ### end remove when BIC allowed
687
688protected:
689 virtual void virtual_hook( int id, void* data );
690private:
691 class KDoubleNumInputPrivate;
692 KDoubleNumInputPrivate *d;
693};
694
695
696/* ------------------------------------------------------------------------ */
697
707class TDEUI_EXPORT KIntSpinBox : public TQSpinBox
708{
709 TQ_OBJECT
710
711 TQ_PROPERTY( int base READ base WRITE setBase )
712
713public:
714
722 KIntSpinBox( TQWidget *parent=0, const char *name=0);
723
738 KIntSpinBox(int lower, int upper, int step, int value, int base = 10,
739 TQWidget* parent = 0, const char* name = 0);
740
744 virtual ~KIntSpinBox();
745
749 void setBase(int base);
753 int base() const;
758 void setEditFocus(bool mark);
759
760protected:
761
766 virtual TQString mapValueToText(int);
767
772 virtual int mapTextToValue(bool*);
773
774private:
775 int val_base;
776protected:
777 virtual void virtual_hook( int id, void* data );
778private:
779 class KIntSpinBoxPrivate;
780 KIntSpinBoxPrivate *d;
781};
782
783
784/* --------------------------------------------------------------------------- */
785
837
838class TDEUI_EXPORT KDoubleSpinBox : public TQSpinBox {
839 TQ_OBJECT
840
841 TQ_PROPERTY( bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers )
842 TQ_OVERRIDE( double maxValue READ maxValue WRITE setMaxValue )
843 TQ_OVERRIDE( double minValue READ minValue WRITE setMinValue )
844 TQ_OVERRIDE( double lineStep READ lineStep WRITE setLineStep )
845 TQ_OVERRIDE( double value READ value WRITE setValue )
846 TQ_PROPERTY( int precision READ precision WRITE setPrecision )
847
848public:
852 KDoubleSpinBox( TQWidget * parent=0, const char * name=0 );
853
857 KDoubleSpinBox( double lower, double upper, double step, double value,
858 int precision=2, TQWidget * parent=0, const char * name=0 );
859
860 virtual ~KDoubleSpinBox();
861
863 bool acceptLocalizedNumbers() const;
864
867 virtual void setAcceptLocalizedNumbers( bool accept );
868
872 void setRange( double lower, double upper, double step=0.01, int precision=2 );
873
876 int precision() const;
877
881 void setPrecision( int precision );
882
895 virtual void setPrecision( int precision, bool force );
896
898 double value() const;
899
901 double minValue() const;
902
909 void setMinValue( double value );
910
912 double maxValue() const;
913
920 void setMaxValue( double value );
921
923 double lineStep() const;
924
929 void setLineStep( double step );
930
932 void setValidator( const TQValidator * );
933
934signals:
936 void valueChanged( double value );
937
938public slots:
942 virtual void setValue( double value );
943
944protected:
945 virtual TQString mapValueToText(int);
946 virtual int mapTextToValue(bool*);
947
948protected slots:
949 void slotValueChanged( int value );
950
951protected:
952 virtual void virtual_hook( int id, void* data );
953private:
954 typedef TQSpinBox base;
955 void updateValidator();
956 int maxPrecision() const;
957
958 class Private;
959 Private * d;
960};
961
962#endif // K_NUMINPUT_H
KDoubleNumInput::KDoubleNumInput
KDoubleNumInput(TQWidget *parent=0, const char *name=0)
Constructs an input control for double values with initial value 0.00.
Definition knuminput.cpp:549
KDoubleNumInput::referencePoint
double referencePoint() const
Definition knuminput.cpp:829
KDoubleNumInput::relativeValueChanged
void relativeValueChanged(double)
This is an overloaded member function, provided for convenience.
KDoubleNumInput::relativeValue
double relativeValue() const
Definition knuminput.cpp:823
KDoubleNumInput::setSpecialValueText
void setSpecialValueText(const TQString &text)
Sets the special value text.
Definition knuminput.cpp:880
KDoubleNumInput::setValue
void setValue(double)
Sets the value of the control.
Definition knuminput.cpp:731
KDoubleNumInput::doLayout
virtual void doLayout()
You need to overwrite this method and implement your layout calculations there.
Definition knuminput.cpp:725
KDoubleNumInput::value
double value() const
Definition knuminput.cpp:818
KDoubleNumInput::prefix
TQString prefix() const
Definition knuminput.cpp:839
KDoubleNumInput::setPrefix
void setPrefix(const TQString &prefix)
Sets the prefix to be displayed to prefix.
Definition knuminput.cpp:851
KDoubleNumInput::precision
int precision() const
Definition knuminput.cpp:875
KDoubleNumInput::specialValueText
TQString specialValueText() const
Definition knuminput.h:550
KDoubleNumInput::suffix
TQString suffix() const
Definition knuminput.cpp:834
KDoubleNumInput::setReferencePoint
void setReferencePoint(double ref)
Sets the reference Point to ref.
Definition knuminput.cpp:744
KDoubleNumInput::maxValue
double maxValue() const
Definition knuminput.cpp:813
KDoubleNumInput::setRelativeValue
void setRelativeValue(double)
Sets the value in units of referencePoint.
Definition knuminput.cpp:736
KDoubleNumInput::setSuffix
void setSuffix(const TQString &suffix)
Sets the suffix to be displayed to suffix.
Definition knuminput.cpp:844
KDoubleNumInput::setPrecision
void setPrecision(int precision)
Specifies the number of digits to use.
Definition knuminput.cpp:858
KDoubleNumInput::setMaxValue
void setMaxValue(double max)
Sets the maximum value.
Definition knuminput.cpp:808
KDoubleNumInput::setMinValue
void setMinValue(double min)
Sets the minimum value.
Definition knuminput.cpp:798
KDoubleNumInput::minValue
double minValue() const
Definition knuminput.cpp:803
KDoubleNumInput::valueChanged
void valueChanged(double)
Emitted every time the value changes (by calling setValue() or by user interaction).
KDoubleSpinBox::KDoubleSpinBox
KDoubleSpinBox(TQWidget *parent=0, const char *name=0)
Constructs a KDoubleSpinBox with parent parent and default values for range and value (whatever QRang...
Definition knuminput.cpp:1011
KDoubleSpinBox::setPrecision
void setPrecision(int precision)
Equivalent to setPrecision( precision, false ); Needed since Qt's moc doesn't ignore trailing paramet...
Definition knuminput.cpp:1061
KDoubleSpinBox::precision
int precision() const
Definition knuminput.cpp:1057
KDoubleSpinBox::setRange
void setRange(double lower, double upper, double step=0.01, int precision=2)
Sets a new range for the spin box values.
Definition knuminput.cpp:1047
KDoubleSpinBox::setValidator
void setValidator(const TQValidator *)
Overridden to ignore any setValidator() calls.
Definition knuminput.cpp:1176
KDoubleSpinBox::setValue
virtual void setValue(double value)
Sets the current value to value, subject to the constraints that value is first rounded to the curren...
Definition knuminput.cpp:1106
KDoubleSpinBox::lineStep
double lineStep() const
Definition knuminput.cpp:1142
KDoubleSpinBox::minValue
double minValue() const
Definition knuminput.cpp:1119
KDoubleSpinBox::maxValue
double maxValue() const
Definition knuminput.cpp:1131
KDoubleSpinBox::setMaxValue
void setMaxValue(double value)
Sets the upper bound of the range to value, subject to the contraints that value is first rounded to ...
Definition knuminput.cpp:1135
KDoubleSpinBox::setMinValue
void setMinValue(double value)
Sets the lower bound of the range to value, subject to the contraints that value is first rounded to ...
Definition knuminput.cpp:1123
KDoubleSpinBox::setLineStep
void setLineStep(double step)
Sets the step size for clicking the up/down buttons to step, subject to the constraints that step is ...
Definition knuminput.cpp:1146
KDoubleSpinBox::setAcceptLocalizedNumbers
virtual void setAcceptLocalizedNumbers(bool accept)
Sets whether to use and accept localized numbers as returned by TDELocale::formatNumber().
Definition knuminput.cpp:1042
KDoubleSpinBox::valueChanged
void valueChanged(double value)
Emitted whenever TQSpinBox::valueChanged( int ) is emitted.
KDoubleSpinBox::value
double value() const
Definition knuminput.cpp:1102
KDoubleSpinBox::acceptLocalizedNumbers
bool acceptLocalizedNumbers() const
Definition knuminput.cpp:1036
KIntNumInput::setEditFocus
void setEditFocus(bool mark=true)
sets focus to the edit widget and marks all text in if mark == true
Definition knuminput.cpp:415
KIntNumInput::referencePoint
int referencePoint() const
Definition knuminput.cpp:315
KIntNumInput::value
int value() const
Definition knuminput.cpp:512
KIntNumInput::setRelativeValue
void setRelativeValue(double)
Sets the value in units of the referencePoint.
Definition knuminput.cpp:500
KIntNumInput::setSpecialValueText
void setSpecialValueText(const TQString &text)
Sets the special value text.
Definition knuminput.cpp:517
KIntNumInput::KIntNumInput
KIntNumInput(TQWidget *parent=0, const char *name=0)
Constructs an input control for integer values with base 10 and initial value 0.
Definition knuminput.cpp:278
KIntNumInput::doLayout
virtual void doLayout()
You need to overwrite this method and implement your layout calculations there.
Definition knuminput.cpp:445
KIntNumInput::setMaxValue
void setMaxValue(int max)
Sets the maximum value.
Definition knuminput.cpp:381
KIntNumInput::prefix
TQString prefix() const
Definition knuminput.cpp:410
KIntNumInput::maxValue
int maxValue() const
Definition knuminput.cpp:386
KIntNumInput::minValue
int minValue() const
Definition knuminput.cpp:376
KIntNumInput::setPrefix
void setPrefix(const TQString &prefix)
Sets the prefix to prefix.
Definition knuminput.cpp:403
KIntNumInput::setMinValue
void setMinValue(int min)
Sets the minimum value.
Definition knuminput.cpp:371
KIntNumInput::setValue
void setValue(int)
Sets the value of the control.
Definition knuminput.cpp:494
KIntNumInput::setRange
void setRange(int min, int max, int step=1, bool slider=true)
Definition knuminput.cpp:332
KIntNumInput::relativeValue
double relativeValue() const
Definition knuminput.cpp:507
KIntNumInput::relativeValueChanged
void relativeValueChanged(double)
Emitted whenever valueChanged is.
KIntNumInput::setLabel
virtual void setLabel(const TQString &label, int a=AlignLeft|AlignTop)
Sets the text and alignment of the main description label.
Definition knuminput.cpp:528
KIntNumInput::setSuffix
void setSuffix(const TQString &suffix)
Sets the suffix to suffix.
Definition knuminput.cpp:391
KIntNumInput::specialValueText
TQString specialValueText() const
Definition knuminput.cpp:523
KIntNumInput::setReferencePoint
void setReferencePoint(int)
Sets the reference point for relativeValue.
Definition knuminput.cpp:309
KIntNumInput::minimumSizeHint
virtual TQSize minimumSizeHint() const
This method returns the minimum size necessary to display the control.
Definition knuminput.cpp:420
KIntNumInput::valueChanged
void valueChanged(int)
Emitted every time the value changes (by calling setValue() or by user interaction).
KIntNumInput::suffix
TQString suffix() const
Definition knuminput.cpp:398
KIntSpinBox
A TQSpinBox with support for arbitrary base numbers.
Definition knuminput.h:708
KIntSpinBox::setBase
void setBase(int base)
Sets the base in which the numbers in the spin box are represented.
Definition knuminput.cpp:226
KIntSpinBox::mapValueToText
virtual TQString mapValueToText(int)
Overloaded the method in QSpinBox to make use of the base given in the constructor.
Definition knuminput.cpp:241
KIntSpinBox::base
int base() const
Definition knuminput.cpp:236
KIntSpinBox::setEditFocus
void setEditFocus(bool mark)
sets focus and optionally marks all text
Definition knuminput.cpp:251
KIntSpinBox::mapTextToValue
virtual int mapTextToValue(bool *)
Overloaded the method in QSpinBox to make use of the base given in the constructor.
Definition knuminput.cpp:246
KIntSpinBox::KIntSpinBox
KIntSpinBox(TQWidget *parent=0, const char *name=0)
Constructor.
Definition knuminput.cpp:203
KNumInput::KNumInput
KNumInput(TQWidget *parent=0, const char *name=0)
Default constructor.
Definition knuminput.cpp:61
KNumInput::doLayout
virtual void doLayout()=0
You need to overwrite this method and implement your layout calculations there.
KNumInput::label
TQString label() const
Definition knuminput.cpp:121
KNumInput::setLabel
virtual void setLabel(const TQString &label, int a=AlignLeft|AlignTop)
Sets the text and alignment of the main description label.
Definition knuminput.cpp:100
KNumInput::showSlider
bool showSlider() const
Definition knuminput.h:99

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.15.0
This website is maintained by Timothy Pearson.