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

tdeui

tdeselect.h
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1997 Martin Jones (mjones@kde.org)
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 //-----------------------------------------------------------------------------
00020 // Selector widgets for KDE Color Selector, but probably useful for other
00021 // stuff also.
00022 
00023 #ifndef __TDESELECT_H__
00024 #define __TDESELECT_H__
00025 
00026 #include <tqwidget.h>
00027 #include <tqrangecontrol.h>
00028 #include <tqpixmap.h>
00029 
00030 #include <tdelibs_export.h>
00031 
00043 class TDEUI_EXPORT KXYSelector : public TQWidget
00044 {
00045   Q_OBJECT
00046   TQ_PROPERTY( int xValue READ xValue WRITE setXValue )
00047   TQ_PROPERTY( int yValue READ yValue WRITE setYValue )
00048   
00049 public:
00054   KXYSelector( TQWidget *parent=0, const char *name=0 );
00058   ~KXYSelector();
00059 
00066   void setValues( int xPos, int yPos );
00067   
00072   void setXValue( int xPos );
00073   
00078   void setYValue( int yPos );
00079   
00083   void setRange( int minX, int minY, int maxX, int maxY );
00084 
00088   int xValue() const {  return xPos; }
00092   int yValue() const {  return yPos; }
00093 
00097   TQRect contentsRect() const;
00098 
00099 signals:
00104   void valueChanged( int x, int y );
00105 
00106 protected:
00113   virtual void drawContents( TQPainter * );
00118   virtual void drawCursor( TQPainter *p, int xp, int yp );
00119 
00120   virtual void paintEvent( TQPaintEvent *e );
00121   virtual void mousePressEvent( TQMouseEvent *e );
00122   virtual void mouseMoveEvent( TQMouseEvent *e );
00123   virtual void wheelEvent( TQWheelEvent * );
00124 
00128   void valuesFromPosition( int x, int y, int& xVal, int& yVal ) const;
00129 
00130 private:
00131   void setPosition( int xp, int yp );
00132   int px;
00133   int py;
00134   int xPos;
00135   int yPos;
00136   int minX;
00137   int maxX;
00138   int minY;
00139   int maxY;
00140   TQPixmap store;
00141 
00142 protected:
00143   virtual void virtual_hook( int id, void* data );
00144 private:
00145   class KXYSelectorPrivate;
00146   KXYSelectorPrivate *d;
00147 };
00148 
00149 
00159 class TDEUI_EXPORT TDESelector : public TQWidget, public TQRangeControl
00160 {
00161   Q_OBJECT
00162   TQ_PROPERTY( int value READ value WRITE setValue )
00163   TQ_PROPERTY( int minValue READ minValue WRITE setMinValue )
00164   TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
00165 public:
00166 
00170   TDESelector( TQWidget *parent=0, const char *name=0 );
00175   TDESelector( Orientation o, TQWidget *parent = 0L, const char *name = 0L );
00176   /*
00177    * Destructs the widget.
00178    */
00179   ~TDESelector();
00180 
00184   Orientation orientation() const
00185   { return _orientation; }
00186 
00190   TQRect contentsRect() const;
00191 
00196   void setIndent( bool i )
00197   { _indent = i; }
00201   bool indent() const
00202   { return _indent; }
00203 
00207   void setValue(int value)
00208   { TQRangeControl::setValue(value); }
00209 
00213   int value() const
00214   { return TQRangeControl::value(); }
00215 
00219   void setMinValue(int value)
00220   { TQRangeControl::setMinValue(value); }
00221 
00225   int minValue() const
00226   { return TQRangeControl::minValue(); }
00227 
00231   void setMaxValue(int value)
00232   { TQRangeControl::setMaxValue(value); }
00233 
00237   int maxValue() const
00238   { return TQRangeControl::maxValue(); }
00239 
00240 signals:
00245   void valueChanged( int value );
00246 
00247 protected:
00254   virtual void drawContents( TQPainter * );
00262   virtual void drawArrow( TQPainter *painter, bool show, const TQPoint &pos );
00263 
00264   virtual void valueChange();
00265   virtual void paintEvent( TQPaintEvent * );
00266   virtual void mousePressEvent( TQMouseEvent *e );
00267   virtual void mouseMoveEvent( TQMouseEvent *e );
00268   virtual void wheelEvent( TQWheelEvent * );
00269 
00270 private:
00271   TQPoint calcArrowPos( int val );
00272   void moveArrow( const TQPoint &pos );
00273 
00274   Orientation _orientation;
00275   bool _indent;
00276 
00277 protected:
00278   virtual void virtual_hook( int id, void* data );
00279 private:
00280   class TDESelectorPrivate;
00281   TDESelectorPrivate *d;
00282 };
00283 
00284 
00293 class TDEUI_EXPORT KGradientSelector : public TDESelector
00294 {
00295   Q_OBJECT
00296 
00297   TQ_PROPERTY( TQColor firstColor READ firstColor WRITE setFirstColor )
00298   TQ_PROPERTY( TQColor secondColor READ secondColor WRITE setSecondColor )
00299   TQ_PROPERTY( TQString firstText READ firstText WRITE setFirstText )
00300   TQ_PROPERTY( TQString secondText READ secondText WRITE setSecondText )
00301 
00302 public:
00307   KGradientSelector( TQWidget *parent=0, const char *name=0 );
00312   KGradientSelector( Orientation o, TQWidget *parent=0, const char *name=0 );
00316   ~KGradientSelector();
00320   void setColors( const TQColor &col1, const TQColor &col2 )
00321   { color1 = col1; color2 = col2; update();}
00322   void setText( const TQString &t1, const TQString &t2 )
00323   { text1 = t1; text2 = t2; update(); }
00324 
00328   void setFirstColor( const TQColor &col )
00329   { color1 = col; update(); }
00330   void setSecondColor( const TQColor &col )
00331   { color2 = col; update(); }
00332 
00336   void setFirstText( const TQString &t )
00337   { text1 = t; update(); }
00338   void setSecondText( const TQString &t )
00339   { text2 = t; update(); }
00340 
00341   const TQColor firstColor() const
00342   { return color1; }
00343   const TQColor secondColor() const
00344   { return color2; }
00345 
00346   const TQString firstText() const
00347   { return text1; }
00348   const TQString secondText() const
00349   { return text2; }
00350 
00351 protected:
00352 
00353   virtual void drawContents( TQPainter * );
00354   virtual TQSize minimumSize() const
00355   { return sizeHint(); }
00356 
00357 private:
00358   void init();
00359   TQColor color1;
00360   TQColor color2;
00361   TQString text1;
00362   TQString text2;
00363 
00364 protected:
00365   virtual void virtual_hook( int id, void* data );
00366 private:
00367   class KGradientSelectorPrivate;
00368   KGradientSelectorPrivate *d;
00369 };
00370 
00371 
00372 #endif      // __TDESELECT_H__
00373 

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