~ubuntu-branches/ubuntu/gutsy/kdebase-workspace/gutsy-backports

« back to all changes in this revision

Viewing changes to kcontrol/colors/widgetcanvas.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-09-05 20:45:14 UTC
  • Revision ID: james.westby@ubuntu.com-20070905204514-632hhspl0nvrc84i
Tags: upstream-3.93.0
ImportĀ upstreamĀ versionĀ 3.93.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// A special widget which draws a sample of KDE widgets
 
3
// It is used to preview color schemes
 
4
//
 
5
// Copyright (c)  Mark Donohoe 1998
 
6
//
 
7
 
 
8
#ifndef __WIDGETCANVAS_H__
 
9
#define __WIDGETCANVAS_H__
 
10
 
 
11
#include <QMap>
 
12
#include <kapplication.h>
 
13
 
 
14
#define MAX_HOTSPOTS   28
 
15
#define SCROLLBAR_SIZE 16
 
16
 
 
17
// These defines define the order of the colors in the combo box.
 
18
#define CSM_Standard_background         0
 
19
#define CSM_Standard_text               1
 
20
#define CSM_Select_background           2
 
21
#define CSM_Select_text                 3
 
22
#define CSM_Link                        4
 
23
#define CSM_Followed_Link               5
 
24
#define CSM_Background                  6
 
25
#define CSM_Text                        7
 
26
#define CSM_Button_background           8
 
27
#define CSM_Button_text                 9
 
28
#define CSM_Active_title_bar            10
 
29
#define CSM_Active_title_text           11
 
30
#define CSM_Active_title_blend          12
 
31
#define CSM_Active_title_button         13
 
32
#define CSM_Inactive_title_bar          14
 
33
#define CSM_Inactive_title_text         15
 
34
#define CSM_Inactive_title_blend        16
 
35
#define CSM_Inactive_title_button       17
 
36
#define CSM_Active_frame                18
 
37
#define CSM_Active_handle               19
 
38
#define CSM_Inactive_frame              20
 
39
#define CSM_Inactive_handle             21
 
40
#define CSM_Alternate_background        22
 
41
#define CSM_LAST                        23
 
42
 
 
43
class QPixmap;
 
44
class QColor;
 
45
 
 
46
class QPixmap;
 
47
 
 
48
class HotSpot
 
49
{
 
50
public:
 
51
    HotSpot() {}
 
52
    HotSpot( const QRect &r, int num )
 
53
        : rect(r), number(num) {}
 
54
 
 
55
    QRect rect;
 
56
    int number;
 
57
};
 
58
 
 
59
class WidgetCanvas : public QWidget
 
60
{
 
61
    Q_OBJECT
 
62
 
 
63
public:
 
64
    WidgetCanvas( QWidget *parent=0 );
 
65
    void drawSampleWidgets();
 
66
    void resetTitlebarPixmaps(const QColor &active,
 
67
                              const QColor &inactive);
 
68
    void addToolTip( int area, const QString & );
 
69
    QPixmap smplw;
 
70
    
 
71
    QColor iaTitle;
 
72
    QColor iaTxt;
 
73
    QColor iaBlend;
 
74
    QColor iaFrame;
 
75
    QColor iaHandle;
 
76
    QColor aTitle;
 
77
    QColor aTxt;
 
78
    QColor aBlend;
 
79
    QColor aFrame;
 
80
    QColor aHandle;
 
81
    QColor back;
 
82
    QColor txt;
 
83
    QColor select;
 
84
    QColor selectTxt;
 
85
    QColor window;
 
86
    QColor windowTxt;
 
87
    QColor button;
 
88
    QColor buttonTxt;
 
89
    QColor aTitleBtn;
 
90
    QColor iTitleBtn;
 
91
    QColor link;
 
92
    QColor visitedLink;
 
93
    QColor alternateBackground;
 
94
 
 
95
    int contrast;
 
96
    bool shadeSortColumn;
 
97
 
 
98
Q_SIGNALS:
 
99
    void widgetSelected( int );
 
100
    void colorDropped( int, const QColor&);
 
101
        
 
102
protected:
 
103
        void redrawPopup(const QColorGroup &cg);
 
104
        
 
105
    virtual void paintEvent( QPaintEvent * );
 
106
    virtual void mousePressEvent( QMouseEvent * );
 
107
    virtual void mouseMoveEvent( QMouseEvent * );
 
108
    virtual void resizeEvent( QResizeEvent * );
 
109
    virtual void showEvent( QShowEvent * );
 
110
    virtual void dropEvent( QDropEvent *);
 
111
    virtual void dragEnterEvent( QDragEnterEvent *);
 
112
    void paletteChange( const QPalette & );
 
113
 
 
114
    QMap<int,QString> tips;
 
115
    HotSpot hotspots[MAX_HOTSPOTS];
 
116
    int currentHotspot;
 
117
};
 
118
 
 
119
#endif