lib Library API Documentation

kcoloractions.h

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
00003     Copyright (C) 2002 Werner Trobin <trobin@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License version 2 as published by the Free Software Foundation.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017     Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef kcoloractions_h
00021 #define kcoloractions_h
00022 
00023 #include <kaction.h>
00024 
00029 class KColorAction : public KAction
00030 {
00031     Q_OBJECT
00032 
00033 public:
00034     enum Type {
00035     TextColor,
00036     FrameColor,
00037     BackgroundColor
00038     };
00039 
00040     // Create default (text) color action
00041     KColorAction( const QString& text, int accel = 0, QObject* parent = 0, const char* name = 0 );
00042     KColorAction( const QString& text, int accel,
00043           QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
00044     KColorAction( QObject* parent = 0, const char* name = 0 );
00045 
00046     // Create a color action of a given type
00047     KColorAction( const QString& text, Type type, int accel = 0,
00048           QObject* parent = 0, const char* name = 0 );
00049     KColorAction( const QString& text, Type type, int accel,
00050           QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
00051 
00052     virtual void setColor( const QColor &c );
00053     QColor color() const;
00054 
00055     virtual void setType( Type type );
00056     Type type() const;
00057 
00058 private:
00059     void init();
00060     void createPixmap();
00061 
00062     QColor col;
00063     Type typ;
00064 };
00065 
00066 
00067 class KSelectColorAction : public KAction
00068 {
00069     Q_OBJECT
00070 public:
00071     enum Type {
00072         TextColor,
00073         LineColor,
00074         FillColor
00075     };
00076 
00077     KSelectColorAction( const QString& text, Type type,
00078                         const QObject* receiver, const char* slot,
00079                         KActionCollection* parent, const char* name );
00080     virtual ~KSelectColorAction();
00081 
00082     virtual int plug( QWidget* w, int index = -1 );
00083 
00084     QColor color() const;
00085     Type type() const;
00086 
00087 public slots:
00088     virtual void setColor( const QColor &c );
00089     virtual void setType( Type t );
00090 
00091 signals:
00092     void colorSelected( const QColor& color );
00093 
00094 private:
00095     QString whatsThisWithIcon() const; // duplicated, as it's private in kaction
00096 
00097     Type m_type;
00098     QColor m_color;
00099 };
00100 
00101 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:21 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003