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

kdeui

  • kdeui
kselect.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 __KSELECT_H__
24 #define __KSELECT_H__
25 
26 #include <tqwidget.h>
27 #include <tqrangecontrol.h>
28 #include <tqpixmap.h>
29 
30 #include <kdelibs_export.h>
31 
43 class KDEUI_EXPORT KXYSelector : public TQWidget
44 {
45  Q_OBJECT
46  Q_PROPERTY( int xValue READ xValue WRITE setXValue )
47  Q_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 KDEUI_EXPORT KSelector : public TQWidget, public TQRangeControl
160 {
161  Q_OBJECT
162  Q_PROPERTY( int value READ value WRITE setValue )
163  Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
164  Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
165 public:
166 
170  KSelector( TQWidget *parent=0, const char *name=0 );
175  KSelector( Orientation o, TQWidget *parent = 0L, const char *name = 0L );
176  /*
177  * Destructs the widget.
178  */
179  ~KSelector();
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 KSelectorPrivate;
281  KSelectorPrivate *d;
282 };
283 
284 
293 class KDEUI_EXPORT KGradientSelector : public KSelector
294 {
295  Q_OBJECT
296 
297  Q_PROPERTY( TQColor firstColor READ firstColor WRITE setFirstColor )
298  Q_PROPERTY( TQColor secondColor READ secondColor WRITE setSecondColor )
299  Q_PROPERTY( TQString firstText READ firstText WRITE setFirstText )
300  Q_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 // __KSELECT_H__
373 
KSelector::drawContents
virtual void drawContents(TQPainter *)
Override this function to draw the contents of the control.
Definition: kselect.cpp:367
KGradientSelector::setFirstColor
void setFirstColor(const TQColor &col)
Set each color on its own.
Definition: kselect.h:328
KGradientSelector::setFirstText
void setFirstText(const TQString &t)
Set each description on its own.
Definition: kselect.h:336
KXYSelector::yValue
int yValue() const
Definition: kselect.h:92
KSelector::setValue
void setValue(int value)
Sets the value.
Definition: kselect.h:207
KSelector::orientation
Orientation orientation() const
Definition: kselect.h:184
KSelector::indent
bool indent() const
Definition: kselect.h:201
KGradientSelector
The KGradientSelector widget allows the user to choose from a one-dimensional range of colors which i...
Definition: kselect.h:293
KSelector::setMaxValue
void setMaxValue(int value)
Sets the max value.
Definition: kselect.h:231
KSelector::setIndent
void setIndent(bool i)
Sets the indent option of the widget to i.
Definition: kselect.h:196
KSelector::maxValue
int maxValue() const
Definition: kselect.h:237
KSelector::value
int value() const
Definition: kselect.h:213
KSelector::minValue
int minValue() const
Definition: kselect.h:225
KXYSelector::xValue
int xValue() const
Definition: kselect.h:88
KGradientSelector::setColors
void setColors(const TQColor &col1, const TQColor &col2)
Sets the two colors which span the gradient.
Definition: kselect.h:320
KXYSelector
KXYSelector is the base class for other widgets which provides the ability to choose from a two-dimen...
Definition: kselect.h:43
KSelector::setMinValue
void setMinValue(int value)
Sets the min value.
Definition: kselect.h:219
KSelector
KSelector is the base class for other widgets which provides the ability to choose from a one-dimensi...
Definition: kselect.h:159

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.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |