kcoloractions.h
1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
3 Copyright (C) 2002 Werner Trobin <trobin@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
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#ifndef kcoloractions_h
21#define kcoloractions_h
22
23#include <tdeaction.h>
24
29class KColorAction : public TDEAction
30{
31 TQ_OBJECT
32
33
34public:
35 enum Type {
36 TextColor,
37 FrameColor,
38 BackgroundColor
39 };
40
41 // Create default (text) color action
42 KColorAction( const TQString& text, int accel = 0, TQObject* parent = 0, const char* name = 0 );
43 KColorAction( const TQString& text, int accel,
44 TQObject* receiver, const char* slot, TQObject* parent, const char* name = 0 );
45 KColorAction( TQObject* parent = 0, const char* name = 0 );
46
47 // Create a color action of a given type
48 KColorAction( const TQString& text, Type type, int accel = 0,
49 TQObject* parent = 0, const char* name = 0 );
50 KColorAction( const TQString& text, Type type, int accel,
51 TQObject* receiver, const char* slot, TQObject* parent, const char* name = 0 );
52
53 virtual void setColor( const TQColor &c );
54 TQColor color() const;
55
56 virtual void setType( Type type );
57 Type type() const;
58
59private:
60 void init();
61 void createPixmap();
62
63 TQColor col;
64 Type typ;
65};
66
67
68class TDESelectColorAction : public TDEAction
69{
70 TQ_OBJECT
71
72public:
73 enum Type {
74 TextColor,
75 LineColor,
76 FillColor
77 };
78
79 TDESelectColorAction( const TQString& text, Type type,
80 const TQObject* receiver, const char* slot,
81 TDEActionCollection* parent, const char* name );
82 virtual ~TDESelectColorAction();
83
84 virtual int plug( TQWidget* w, int index = -1 );
85
86 TQColor color() const;
87 Type type() const;
88
89public slots:
90 virtual void setColor( const TQColor &c );
91 virtual void setType( Type t );
92
93signals:
94 void colorSelected( const TQColor& color );
95
96private:
97 TQString whatsThisWithIcon() const; // duplicated, as it's private in tdeaction
98
99 Type m_type;
100 TQColor m_color;
101};
102
103#endif
An action whose pixmap is automatically generated from a color.
int accel() const TDE_DEPRECATED
virtual TQString text() const
virtual int plug(TQWidget *widget, int index=-1)