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

tdeui

  • tdeui
tdeselect.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 //-----------------------------------------------------------------------------
20 // Selector widgets for KDE Color Selector, but probably useful for other
21 // stuff also.
22 
23 #ifndef __TDESELECT_H__
24 #define __TDESELECT_H__
25 
26 #include <tqwidget.h>
27 #include <tqrangecontrol.h>
28 #include <tqpixmap.h>
29 
30 #include <tdelibs_export.h>
31 
43 class TDEUI_EXPORT KXYSelector : public TQWidget
44 {
45  TQ_OBJECT
46  TQ_PROPERTY( int xValue READ xValue WRITE setXValue )
47  TQ_PROPERTY( int yValue READ yValue WRITE setYValue )
48 
49 public:
54  KXYSelector( TQWidget *parent=0, const char *name=0 );
58  ~KXYSelector();
59 
66  void setValues( int xPos, int yPos );
67 
72  void setXValue( int xPos );
73 
78  void setYValue( int yPos );
79 
83  void setRange( int minX, int minY, int maxX, int maxY );
84 
88  int xValue() const { return xPos; }
92  int yValue() const { return yPos; }
93 
97  TQRect contentsRect() const;
98 
99 signals:
104  void valueChanged( int x, int y );
105 
106 protected:
113  virtual void drawContents( TQPainter * );
118  virtual void drawCursor( TQPainter *p, int xp, int yp );
119 
120  virtual void paintEvent( TQPaintEvent *e );
121  virtual void mousePressEvent( TQMouseEvent *e );
122  virtual void mouseMoveEvent( TQMouseEvent *e );
123  virtual void wheelEvent( TQWheelEvent * );
124 
128  void valuesFromPosition( int x, int y, int& xVal, int& yVal ) const;
129 
130 private:
131  void setPosition( int xp, int yp );
132  int px;
133  int py;
134  int xPos;
135  int yPos;
136  int minX;
137  int maxX;
138  int minY;
139  int maxY;
140  TQPixmap store;
141 
142 protected:
143  virtual void virtual_hook( int id, void* data );
144 private:
145  class KXYSelectorPrivate;
146  KXYSelectorPrivate *d;
147 };
148 
149 
159 class TDEUI_EXPORT TDESelector : public TQWidget, public TQRangeControl
160 {
161  TQ_OBJECT
162  TQ_PROPERTY( int value READ value WRITE setValue )
163  TQ_PROPERTY( int minValue READ minValue WRITE setMinValue )
164  TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
165 public:
166 
170  TDESelector( TQWidget *parent=0, const char *name=0 );
175  TDESelector( Orientation o, TQWidget *parent = 0L, const char *name = 0L );
176  /*
177  * Destructs the widget.
178  */
179  ~TDESelector();
180 
184  Orientation orientation() const
185  { return _orientation; }
186 
190  TQRect contentsRect() const;
191 
196  void setIndent( bool i )
197  { _indent = i; }
201  bool indent() const
202  { return _indent; }
203 
207  void setValue(int value)
208  { TQRangeControl::setValue(value); }
209 
213  int value() const
214  { return TQRangeControl::value(); }
215 
219  void setMinValue(int value)
220  { TQRangeControl::setMinValue(value); }
221 
225  int minValue() const
226  { return TQRangeControl::minValue(); }
227 
231  void setMaxValue(int value)
232  { TQRangeControl::setMaxValue(value); }
233 
237  int maxValue() const
238  { return TQRangeControl::maxValue(); }
239 
240 signals:
245  void valueChanged( int value );
246 
247 protected:
254  virtual void drawContents( TQPainter * );
262  virtual void drawArrow( TQPainter *painter, bool show, const TQPoint &pos );
263 
264  virtual void valueChange();
265  virtual void paintEvent( TQPaintEvent * );
266  virtual void mousePressEvent( TQMouseEvent *e );
267  virtual void mouseMoveEvent( TQMouseEvent *e );
268  virtual void wheelEvent( TQWheelEvent * );
269 
270 private:
271  TQPoint calcArrowPos( int val );
272  void moveArrow( const TQPoint &pos );
273 
274  Orientation _orientation;
275  bool _indent;
276 
277 protected:
278  virtual void virtual_hook( int id, void* data );
279 private:
280  class TDESelectorPrivate;
281  TDESelectorPrivate *d;
282 };
283 
284 
293 class TDEUI_EXPORT KGradientSelector : public TDESelector
294 {
295  TQ_OBJECT
296 
297  TQ_PROPERTY( TQColor firstColor READ firstColor WRITE setFirstColor )
298  TQ_PROPERTY( TQColor secondColor READ secondColor WRITE setSecondColor )
299  TQ_PROPERTY( TQString firstText READ firstText WRITE setFirstText )
300  TQ_PROPERTY( TQString secondText READ secondText WRITE setSecondText )
301 
302 public:
307  KGradientSelector( TQWidget *parent=0, const char *name=0 );
312  KGradientSelector( Orientation o, TQWidget *parent=0, const char *name=0 );
316  ~KGradientSelector();
320  void setColors( const TQColor &col1, const TQColor &col2 )
321  { color1 = col1; color2 = col2; update();}
322  void setText( const TQString &t1, const TQString &t2 )
323  { text1 = t1; text2 = t2; update(); }
324 
328  void setFirstColor( const TQColor &col )
329  { color1 = col; update(); }
330  void setSecondColor( const TQColor &col )
331  { color2 = col; update(); }
332 
336  void setFirstText( const TQString &t )
337  { text1 = t; update(); }
338  void setSecondText( const TQString &t )
339  { text2 = t; update(); }
340 
341  const TQColor firstColor() const
342  { return color1; }
343  const TQColor secondColor() const
344  { return color2; }
345 
346  const TQString firstText() const
347  { return text1; }
348  const TQString secondText() const
349  { return text2; }
350 
351 protected:
352 
353  virtual void drawContents( TQPainter * );
354  virtual TQSize minimumSize() const
355  { return sizeHint(); }
356 
357 private:
358  void init();
359  TQColor color1;
360  TQColor color2;
361  TQString text1;
362  TQString text2;
363 
364 protected:
365  virtual void virtual_hook( int id, void* data );
366 private:
367  class KGradientSelectorPrivate;
368  KGradientSelectorPrivate *d;
369 };
370 
371 
372 #endif // __TDESELECT_H__
373 
KGradientSelector
The KGradientSelector widget allows the user to choose from a one-dimensional range of colors which i...
Definition: tdeselect.h:294
KGradientSelector::setFirstColor
void setFirstColor(const TQColor &col)
Set each color on its own.
Definition: tdeselect.h:328
KGradientSelector::setFirstText
void setFirstText(const TQString &t)
Set each description on its own.
Definition: tdeselect.h:336
KGradientSelector::setColors
void setColors(const TQColor &col1, const TQColor &col2)
Sets the two colors which span the gradient.
Definition: tdeselect.h:320
KXYSelector
KXYSelector is the base class for other widgets which provides the ability to choose from a two-dimen...
Definition: tdeselect.h:44
KXYSelector::xValue
int xValue() const
Definition: tdeselect.h:88
KXYSelector::yValue
int yValue() const
Definition: tdeselect.h:92
KXYSelector::valueChanged
void valueChanged(int x, int y)
This signal is emitted whenever the user chooses a value, e.g.
TDESelector
TDESelector is the base class for other widgets which provides the ability to choose from a one-dimen...
Definition: tdeselect.h:160
TDESelector::orientation
Orientation orientation() const
Definition: tdeselect.h:184
TDESelector::valueChanged
void valueChanged(int value)
This signal is emitted whenever the user chooses a value, e.g.
TDESelector::setMinValue
void setMinValue(int value)
Sets the min value.
Definition: tdeselect.h:219
TDESelector::value
int value() const
Definition: tdeselect.h:213
TDESelector::setValue
void setValue(int value)
Sets the value.
Definition: tdeselect.h:207
TDESelector::setIndent
void setIndent(bool i)
Sets the indent option of the widget to i.
Definition: tdeselect.h:196
TDESelector::indent
bool indent() const
Definition: tdeselect.h:201
TDESelector::setMaxValue
void setMaxValue(int value)
Sets the max value.
Definition: tdeselect.h:231
TDESelector::maxValue
int maxValue() const
Definition: tdeselect.h:237
TDESelector::minValue
int minValue() const
Definition: tdeselect.h:225

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