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

kdeui

knuminput.h
00001 /*
00002  * knuminput.h
00003  *
00004  *  Copyright (c) 1997 Patrick Dowler <dowler@morgul.fsh.uvic.ca>
00005  *  Copyright (c) 2000 Dirk A. Mueller <mueller@kde.org>
00006  *  Copyright (c) 2002 Marc Mutz <mutz@kde.org>
00007  *
00008  *  Requires the Qt widget libraries, available at no cost at
00009  *  http://www.troll.no/
00010  *
00011  *  This library is free software; you can redistribute it and/or
00012  *  modify it under the terms of the GNU Library General Public
00013  *  License as published by the Free Software Foundation; either
00014  *  version 2 of the License, or (at your option) any later version.
00015  *
00016  *  This library is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  *  Library General Public License for more details.
00020  *
00021  *  You should have received a copy of the GNU Library General Public License
00022  *  along with this library; see the file COPYING.LIB.  If not, write to
00023  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00024  *  Boston, MA 02110-1301, USA.
00025  */
00026 
00027 #ifndef K_NUMINPUT_H
00028 #define K_NUMINPUT_H
00029 
00030 #include <tqwidget.h>
00031 #include <tqspinbox.h>
00032 #include <kdelibs_export.h>
00033 
00034 class TQLabel;
00035 class TQSlider;
00036 class TQLineEdit;
00037 class TQLayout;
00038 class TQValidator;
00039 
00040 class KIntSpinBox;
00041 
00042 /* ------------------------------------------------------------------------ */
00043 
00049 class KDEUI_EXPORT KNumInput : public TQWidget
00050 {
00051     Q_OBJECT
00052     TQ_OBJECT
00053     Q_PROPERTY( TQString label READ label WRITE setLabel )
00054 public:
00060     KNumInput(TQWidget* parent=0, const char* name=0);
00061 
00067     KNumInput(KNumInput* below, TQWidget* parent=0, const char* name=0);
00068     ~KNumInput();
00069 
00088     virtual void setLabel(const TQString & label, int a = AlignLeft | AlignTop);
00089 
00093     TQString label() const;
00094 
00099     bool showSlider() const { return m_slider; }
00100 
00107     void setSteps(int minor, int major);
00108 
00113     TQSizePolicy sizePolicy() const;
00114 
00120     virtual TQSize sizeHint() const;
00121 
00122 protected:
00128     void layout(bool deep);
00129 
00138     virtual void doLayout() = 0;
00139 
00140     KNumInput* m_prev, *m_next;
00141     int m_colw1, m_colw2;
00142 
00143     TQLabel*  m_label;
00144     TQSlider* m_slider;
00145     TQSize    m_sizeSlider, m_sizeLabel;
00146 
00147     int      m_alignment;
00148 
00149 private:
00150     void init();
00151 
00152 protected:
00153     virtual void virtual_hook( int id, void* data );
00154 private:
00155     class KNumInputPrivate;
00156     KNumInputPrivate *d;
00157 };
00158 
00159 /* ------------------------------------------------------------------------ */
00160 
00188 class KDEUI_EXPORT KIntNumInput : public KNumInput
00189 {
00190     Q_OBJECT
00191     TQ_OBJECT
00192     Q_PROPERTY( int value READ value WRITE setValue )
00193     Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
00194     Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
00195     Q_PROPERTY( int referencePoint READ referencePoint WRITE setReferencePoint )
00196     Q_PROPERTY( double relativeValue READ relativeValue WRITE setRelativeValue )
00197     Q_PROPERTY( TQString suffix READ suffix WRITE setSuffix )
00198     Q_PROPERTY( TQString prefix READ prefix WRITE setPrefix )
00199     Q_PROPERTY( TQString specialValueText READ specialValueText WRITE setSpecialValueText )
00200 
00201 public:
00206     KIntNumInput(TQWidget *parent=0, const char *name=0);
00219     KIntNumInput(int value, TQWidget* parent=0, int base = 10, const char *name=0);
00220 
00238     KIntNumInput(KNumInput* below, int value, TQWidget* parent=0, int base = 10, const char *name=0);
00239 
00245     virtual ~KIntNumInput();
00246 
00250     int value() const;
00251 
00256     double relativeValue() const;
00257 
00262     int referencePoint() const;
00263 
00268     TQString suffix() const;
00273     TQString prefix() const;
00278     TQString specialValueText() const;
00279 
00286     void setRange(int min, int max, int step=1, bool slider=true);
00290     void setMinValue(int min);
00294     int minValue() const;
00298     void setMaxValue(int max);
00302     int maxValue() const;
00303 
00310     void setSpecialValueText(const TQString& text);
00311 
00312     virtual void setLabel(const TQString & label, int a = AlignLeft | AlignTop);
00313 
00321     virtual TQSize minimumSizeHint() const;
00322 
00323 public slots:
00327     void setValue(int);
00328 
00333     void setRelativeValue(double);
00334 
00339     void setReferencePoint(int);
00340 
00350     void setSuffix(const TQString &suffix);
00351 
00359     void setPrefix(const TQString &prefix);
00360 
00365     void setEditFocus( bool mark = true );
00366 
00367 signals:
00372     void valueChanged(int);
00373 
00379     void relativeValueChanged(double);
00380 
00381 private slots:
00382     void spinValueChanged(int);
00383     void slotEmitRelativeValueChanged(int);
00384 
00385 protected:
00386     virtual void doLayout();
00387     void resizeEvent ( TQResizeEvent * );
00388 
00389     KIntSpinBox* m_spin;
00390     TQSize        m_sizeSpin;
00391 
00392 private:
00393     void init(int value, int _base);
00394 
00395 protected:
00396     virtual void virtual_hook( int id, void* data );
00397 private:
00398     class KIntNumInputPrivate;
00399     KIntNumInputPrivate *d;
00400 };
00401 
00402 
00403 /* ------------------------------------------------------------------------ */
00404 
00405 class KDoubleLine;
00406 
00434 class KDEUI_EXPORT KDoubleNumInput : public KNumInput
00435 {
00436     Q_OBJECT
00437     TQ_OBJECT
00438     Q_PROPERTY( double value READ value WRITE setValue )
00439     Q_PROPERTY( double minValue READ minValue WRITE setMinValue )
00440     Q_PROPERTY( double maxValue READ maxValue WRITE setMaxValue )
00441     Q_PROPERTY( TQString suffix READ suffix WRITE setSuffix )
00442     Q_PROPERTY( TQString prefix READ prefix WRITE setPrefix )
00443     Q_PROPERTY( TQString specialValueText READ specialValueText WRITE setSpecialValueText )
00444     Q_PROPERTY( int precision READ precision WRITE setPrecision )
00445     Q_PROPERTY( double referencePoint READ referencePoint WRITE setReferencePoint )
00446     Q_PROPERTY( double relativeValue READ relativeValue  WRITE setRelativeValue )
00447 
00448 public:
00453     KDoubleNumInput(TQWidget *parent=0, const char *name=0);
00454 
00463     KDoubleNumInput(double value, TQWidget *parent=0, const char *name=0) KDE_DEPRECATED;
00464 
00477     KDoubleNumInput(double lower, double upper, double value, double step=0.01,
00478             int precision=2, TQWidget *parent=0, const char *name=0);
00479 
00483     virtual ~KDoubleNumInput();
00484 
00496     KDoubleNumInput(KNumInput* below, double value, TQWidget* parent=0, const char* name=0) KDE_DEPRECATED;
00497 
00519     KDoubleNumInput(KNumInput* below,
00520             double lower, double upper, double value, double step=0.02,
00521             int precision=2, TQWidget *parent=0, const char *name=0);
00522 
00526     double value() const;
00527 
00532     TQString suffix() const;
00533 
00538     TQString prefix() const;
00539 
00544     int precision() const;
00545 
00550     TQString specialValueText() const { return m_specialvalue; }
00551 
00558     void setRange(double min, double max, double step=1, bool slider=true);
00562     void setMinValue(double min);
00566     double minValue() const;
00570     void setMaxValue(double max);
00574     double maxValue() const;
00575 
00579     void setPrecision(int precision);
00580 
00585     double referencePoint() const;
00586 
00591     double relativeValue() const;
00592 
00599     void setSpecialValueText(const TQString& text);
00600 
00601     virtual void setLabel(const TQString & label, int a = AlignLeft | AlignTop);
00602     virtual TQSize minimumSizeHint() const;
00603     virtual bool eventFilter(TQObject*, TQEvent*);
00604 
00605 public slots:
00609     void setValue(double);
00610 
00615     void setRelativeValue(double);
00616 
00623     void setReferencePoint(double ref);
00624 
00632     void setSuffix(const TQString &suffix);
00633 
00640     void setPrefix(const TQString &prefix);
00641 
00642 signals:
00647     void valueChanged(double);
00655     void relativeValueChanged(double);
00656 
00657 private slots:
00658     void sliderMoved(int);
00659     void slotEmitRelativeValueChanged(double);
00660 
00661 protected:
00662     virtual void doLayout();
00663     void resizeEvent ( TQResizeEvent * );
00664 
00665     virtual void resetEditBox();
00666 
00667     // ### no longer used, remove when BIC allowed
00668     KDoubleLine*   edit;
00669 
00670     bool     m_range;
00671     double   m_lower, m_upper, m_step;
00672     // ### end no longer used
00673 
00674     TQSize    m_sizeEdit;
00675 
00676     friend class KDoubleLine;
00677 private:
00678     void init(double value, double lower, double upper,
00679           double step, int precision);
00680     double mapSliderToSpin(int) const;
00681     void updateLegacyMembers();
00682     // ### no longer used, remove when BIC allowed:
00683     TQString  m_specialvalue, m_prefix, m_suffix;
00684     double   m_value;
00685     short    m_precision;
00686     // ### end remove when BIC allowed
00687 
00688 protected:
00689     virtual void virtual_hook( int id, void* data );
00690 private:
00691     class KDoubleNumInputPrivate;
00692     KDoubleNumInputPrivate *d;
00693 };
00694 
00695 
00696 /* ------------------------------------------------------------------------ */
00697 
00707 class KDEUI_EXPORT KIntSpinBox : public TQSpinBox
00708 {
00709     Q_OBJECT
00710     TQ_OBJECT
00711     Q_PROPERTY( int base READ base WRITE setBase )
00712 
00713 public:
00714 
00722     KIntSpinBox( TQWidget *parent=0, const char *name=0);
00723 
00738     KIntSpinBox(int lower, int upper, int step, int value, int base = 10,
00739                 TQWidget* parent = 0, const char* name = 0);
00740 
00744     virtual ~KIntSpinBox();
00745 
00749     void setBase(int base);
00753     int base() const;
00758     void setEditFocus(bool mark);
00759 
00760 protected:
00761 
00766     virtual TQString mapValueToText(int);
00767 
00772     virtual int mapTextToValue(bool*);
00773 
00774 private:
00775     int val_base;
00776 protected:
00777     virtual void virtual_hook( int id, void* data );
00778 private:
00779     class KIntSpinBoxPrivate;
00780     KIntSpinBoxPrivate *d;
00781 };
00782 
00783 
00784 /* --------------------------------------------------------------------------- */
00785 
00838 class KDEUI_EXPORT KDoubleSpinBox : public TQSpinBox {
00839   Q_OBJECT
00840   TQ_OBJECT
00841   Q_PROPERTY( bool acceptLocalizedNumbers READ acceptLocalizedNumbers WRITE setAcceptLocalizedNumbers )
00842   Q_OVERRIDE( double maxValue READ maxValue WRITE setMaxValue )
00843   Q_OVERRIDE( double minValue READ minValue WRITE setMinValue )
00844   Q_OVERRIDE( double lineStep READ lineStep WRITE setLineStep )
00845   Q_OVERRIDE( double value READ value WRITE setValue )
00846   Q_PROPERTY( int precision READ precision WRITE setPrecision )
00847 
00848 public:
00852   KDoubleSpinBox( TQWidget * parent=0, const char * name=0 );
00853 
00857   KDoubleSpinBox( double lower, double upper, double step, double value,
00858           int precision=2, TQWidget * parent=0, const char * name=0 );
00859 
00860   virtual ~KDoubleSpinBox();
00861 
00863   bool acceptLocalizedNumbers() const;
00864 
00867   virtual void setAcceptLocalizedNumbers( bool accept );
00868 
00872   void setRange( double lower, double upper, double step=0.01, int precision=2 );
00873 
00876   int precision() const;
00877 
00881   void setPrecision( int precision );
00882 
00895   virtual void setPrecision( int precision, bool force );
00896 
00898   double value() const;
00899 
00901   double minValue() const;
00902 
00909   void setMinValue( double value );
00910 
00912   double maxValue() const;
00913 
00920   void setMaxValue( double value );
00921 
00923   double lineStep() const;
00924 
00929   void setLineStep( double step );
00930 
00932   void setValidator( const TQValidator * );
00933 
00934 signals:
00936   void valueChanged( double value );
00937 
00938 public slots:
00942   virtual void setValue( double value );
00943 
00944 protected:
00945   virtual TQString mapValueToText(int);
00946   virtual int mapTextToValue(bool*);
00947 
00948 protected slots:
00949   void slotValueChanged( int value );
00950 
00951 protected:
00952  virtual void virtual_hook( int id, void* data );
00953 private:
00954   typedef TQSpinBox base;
00955   void updateValidator();
00956   int maxPrecision() const;
00957 
00958   class Private;
00959   Private * d;
00960 };
00961 
00962 #endif // K_NUMINPUT_H

kdeui

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

kdeui

Skip menu "kdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeui by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |