summaryrefslogtreecommitdiffstats
path: root/kcontrol/colors/widgetcanvas.h
blob: e2f9bd057f2075d793b5e0f1ce4371a22f01a702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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