-rw-r--r-- | libopie2/opieui/oselector.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libopie2/opieui/oselector.h b/libopie2/opieui/oselector.h index f832239..fe75a46 100644 --- a/libopie2/opieui/oselector.h +++ b/libopie2/opieui/oselector.h | |||
@@ -1,77 +1,80 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 | Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 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 | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | //----------------------------------------------------------------------------- | 19 | //----------------------------------------------------------------------------- |
20 | // Selector widgets for KDE Color Selector, but probably useful for other | 20 | // Selector widgets for KDE Color Selector, but probably useful for other |
21 | // stuff also. | 21 | // stuff also. |
22 | 22 | ||
23 | #ifndef __OSELECT_H__ | 23 | #ifndef __OSELECT_H__ |
24 | #define __OSELECT_H__ | 24 | #define __OSELECT_H__ |
25 | 25 | ||
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | #include <qrangecontrol.h> | 27 | #include <qrangecontrol.h> |
28 | #include <qpixmap.h> | 28 | #include <qpixmap.h> |
29 | 29 | ||
30 | |||
31 | namespace Opie { | ||
32 | namespace Ui { | ||
30 | /** | 33 | /** |
31 | * OXYSelector is the base class for other widgets which | 34 | * OXYSelector is the base class for other widgets which |
32 | * provides the ability to choose from a two-dimensional | 35 | * provides the ability to choose from a two-dimensional |
33 | * range of values. The currently chosen value is indicated | 36 | * range of values. The currently chosen value is indicated |
34 | * by a cross. An example is the @ref OHSSelector which | 37 | * by a cross. An example is the @ref OHSSelector which |
35 | * allows to choose from a range of colors, and which is | 38 | * allows to choose from a range of colors, and which is |
36 | * used in OColorDialog. | 39 | * used in OColorDialog. |
37 | * | 40 | * |
38 | * A custom drawing routine for the widget surface has | 41 | * A custom drawing routine for the widget surface has |
39 | * to be provided by the subclass. | 42 | * to be provided by the subclass. |
40 | */ | 43 | */ |
41 | class OXYSelector : public QWidget | 44 | class OXYSelector : public QWidget |
42 | { | 45 | { |
43 | Q_OBJECT | 46 | Q_OBJECT |
44 | 47 | ||
45 | public: | 48 | public: |
46 | /** | 49 | /** |
47 | * Constructs a two-dimensional selector widget which | 50 | * Constructs a two-dimensional selector widget which |
48 | * has a value range of [0..100] in both directions. | 51 | * has a value range of [0..100] in both directions. |
49 | */ | 52 | */ |
50 | OXYSelector( QWidget *parent=0, const char *name=0 ); | 53 | OXYSelector( QWidget *parent=0, const char *name=0 ); |
51 | /** | 54 | /** |
52 | * Destructs the widget. | 55 | * Destructs the widget. |
53 | */ | 56 | */ |
54 | ~OXYSelector(); | 57 | ~OXYSelector(); |
55 | 58 | ||
56 | /** | 59 | /** |
57 | * Sets the current values in horizontal and | 60 | * Sets the current values in horizontal and |
58 | * vertical direction. | 61 | * vertical direction. |
59 | */ | 62 | */ |
60 | void setValues( int xPos, int yPos ); | 63 | void setValues( int xPos, int yPos ); |
61 | /** | 64 | /** |
62 | * Sets the range of possible values. | 65 | * Sets the range of possible values. |
63 | */ | 66 | */ |
64 | void setRange( int minX, int minY, int maxX, int maxY ); | 67 | void setRange( int minX, int minY, int maxX, int maxY ); |
65 | 68 | ||
66 | /** | 69 | /** |
67 | * @return the current value in horizontal direction. | 70 | * @return the current value in horizontal direction. |
68 | */ | 71 | */ |
69 | int xValue() const {return xPos; } | 72 | int xValue() const {return xPos; } |
70 | /** | 73 | /** |
71 | * @return the current value in vertical direction. | 74 | * @return the current value in vertical direction. |
72 | */ | 75 | */ |
73 | int yValue() const {return yPos; } | 76 | int yValue() const {return yPos; } |
74 | 77 | ||
75 | /** | 78 | /** |
76 | * @return the rectangle on which subclasses should draw. | 79 | * @return the rectangle on which subclasses should draw. |
77 | */ | 80 | */ |
@@ -467,52 +470,54 @@ protected: | |||
467 | virtual void resizeEvent( QResizeEvent * ); | 470 | virtual void resizeEvent( QResizeEvent * ); |
468 | /** | 471 | /** |
469 | * Reimplemented from OSelector. The drawing is | 472 | * Reimplemented from OSelector. The drawing is |
470 | * buffered in a pixmap here. As real drawing | 473 | * buffered in a pixmap here. As real drawing |
471 | * routine, drawPalette() is used. | 474 | * routine, drawPalette() is used. |
472 | */ | 475 | */ |
473 | virtual void drawContents( QPainter *painter ); | 476 | virtual void drawContents( QPainter *painter ); |
474 | 477 | ||
475 | private: | 478 | private: |
476 | int _hue; | 479 | int _hue; |
477 | int _sat; | 480 | int _sat; |
478 | QPixmap pixmap; | 481 | QPixmap pixmap; |
479 | 482 | ||
480 | private: | 483 | private: |
481 | class OValueSelectorPrivate; | 484 | class OValueSelectorPrivate; |
482 | OValueSelectorPrivate *d; | 485 | OValueSelectorPrivate *d; |
483 | }; | 486 | }; |
484 | 487 | ||
485 | 488 | ||
486 | class OColor : public QColor | 489 | class OColor : public QColor |
487 | { | 490 | { |
488 | public: | 491 | public: |
489 | OColor(); | 492 | OColor(); |
490 | OColor( const OColor &col); | 493 | OColor( const OColor &col); |
491 | OColor( const QColor &col); | 494 | OColor( const QColor &col); |
492 | 495 | ||
493 | OColor& operator=( const OColor& col); | 496 | OColor& operator=( const OColor& col); |
494 | 497 | ||
495 | bool operator==( const OColor& col) const; | 498 | bool operator==( const OColor& col) const; |
496 | 499 | ||
497 | void setHsv(int _h, int _s, int _v); | 500 | void setHsv(int _h, int _s, int _v); |
498 | void setRgb(int _r, int _g, int _b); | 501 | void setRgb(int _r, int _g, int _b); |
499 | 502 | ||
500 | void rgb(int *_r, int *_g, int *_b) const; | 503 | void rgb(int *_r, int *_g, int *_b) const; |
501 | void hsv(int *_h, int *_s, int *_v) const; | 504 | void hsv(int *_h, int *_s, int *_v) const; |
502 | protected: | 505 | protected: |
503 | int h; | 506 | int h; |
504 | int s; | 507 | int s; |
505 | int v; | 508 | int v; |
506 | int r; | 509 | int r; |
507 | int g; | 510 | int g; |
508 | int b; | 511 | int b; |
509 | 512 | ||
510 | private: | 513 | private: |
511 | class OColorPrivate; | 514 | class OColorPrivate; |
512 | OColorPrivate *d; | 515 | OColorPrivate *d; |
513 | }; | 516 | }; |
514 | 517 | ||
518 | } | ||
519 | } | ||
515 | 520 | ||
516 | 521 | ||
517 | #endif // __OSELECT_H__ | 522 | #endif // __OSELECT_H__ |
518 | 523 | ||