diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 4aed2c8219774f5d797760606b8489a92ddc5163 (patch) | |
tree | 3f8c130f7d269626bf6a9447407ef6c35954426a /kcontrol/colors/widgetcanvas.h | |
download | tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/colors/widgetcanvas.h')
-rw-r--r-- | kcontrol/colors/widgetcanvas.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/kcontrol/colors/widgetcanvas.h b/kcontrol/colors/widgetcanvas.h new file mode 100644 index 000000000..e2f9bd057 --- /dev/null +++ b/kcontrol/colors/widgetcanvas.h @@ -0,0 +1,121 @@ +// +// A special widget which draws a sample of KDE widgets +// It is used to preview color schemes +// +// Copyright (c) Mark Donohoe 1998 +// + +#ifndef __WIDGETCANVAS_H__ +#define __WIDGETCANVAS_H__ + +#include <qmap.h> +#include <kapplication.h> + +#define MAX_HOTSPOTS 28 +#define SCROLLBAR_SIZE 16 + +// These defines define the order of the colors in the combo box. +#define CSM_Standard_background 0 +#define CSM_Standard_text 1 +#define CSM_Select_background 2 +#define CSM_Select_text 3 +#define CSM_Link 4 +#define CSM_Followed_Link 5 +#define CSM_Background 6 +#define CSM_Text 7 +#define CSM_Button_background 8 +#define CSM_Button_text 9 +#define CSM_Active_title_bar 10 +#define CSM_Active_title_text 11 +#define CSM_Active_title_blend 12 +#define CSM_Active_title_button 13 +#define CSM_Inactive_title_bar 14 +#define CSM_Inactive_title_text 15 +#define CSM_Inactive_title_blend 16 +#define CSM_Inactive_title_button 17 +#define CSM_Active_frame 18 +#define CSM_Active_handle 19 +#define CSM_Inactive_frame 20 +#define CSM_Inactive_handle 21 +#define CSM_Alternate_background 22 +#define CSM_LAST 23 + +class QPixmap; +class QColor; +class QPainter; +class QEvent; + +class KPixmap; + +class HotSpot +{ +public: + HotSpot() {} + HotSpot( const QRect &r, int num ) + : rect(r), number(num) {} + + QRect rect; + int number; +}; + +class WidgetCanvas : public QWidget +{ + Q_OBJECT + +public: + WidgetCanvas( QWidget *parent=0, const char *name=0 ); + void drawSampleWidgets(); + void resetTitlebarPixmaps(const QColor &active, + const QColor &inactive); + void addToolTip( int area, const QString & ); + QPixmap smplw; + + QColor iaTitle; + QColor iaTxt; + QColor iaBlend; + QColor iaFrame; + QColor iaHandle; + QColor aTitle; + QColor aTxt; + QColor aBlend; + QColor aFrame; + QColor aHandle; + QColor back; + QColor txt; + QColor select; + QColor selectTxt; + QColor window; + QColor windowTxt; + QColor button; + QColor buttonTxt; + QColor aTitleBtn; + QColor iTitleBtn; + QColor link; + QColor visitedLink; + QColor alternateBackground; + + int contrast; + bool shadeSortColumn; + +signals: + void widgetSelected( int ); + void colorDropped( int, const QColor&); + +protected: + void redrawPopup(const QColorGroup &cg); + + virtual void paintEvent( QPaintEvent * ); + virtual void mousePressEvent( QMouseEvent * ); + virtual void mouseMoveEvent( QMouseEvent * ); + virtual void resizeEvent( QResizeEvent * ); + virtual void showEvent( QShowEvent * ); + virtual void dropEvent( QDropEvent *); + virtual void dragEnterEvent( QDragEnterEvent *); + void paletteChange( const QPalette & ); + + QMap<int,QString> tips; + HotSpot hotspots[MAX_HOTSPOTS]; + int currentHotspot; +}; + +#endif |