• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

qtcolorpicker.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** 
00003 ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 ** 
00007 ** This file is part of a Qt Solutions component.
00008 **
00009 ** Commercial Usage  
00010 ** Licensees holding valid Qt Commercial licenses may use this file in
00011 ** accordance with the Qt Solutions Commercial License Agreement provided
00012 ** with the Software or, alternatively, in accordance with the terms
00013 ** contained in a written agreement between you and Nokia.
00014 ** 
00015 ** GNU Lesser General Public License Usage
00016 ** Alternatively, this file may be used under the terms of the GNU Lesser
00017 ** General Public License version 2.1 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.LGPL included in the
00019 ** packaging of this file.  Please review the following information to
00020 ** ensure the GNU Lesser General Public License version 2.1 requirements
00021 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00022 ** 
00023 ** In addition, as a special exception, Nokia gives you certain
00024 ** additional rights. These rights are described in the Nokia Qt LGPL
00025 ** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
00026 ** package.
00027 ** 
00028 ** GNU General Public License Usage 
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 ** 
00036 ** Please note Third Party Software included with Qt Solutions may impose
00037 ** additional restrictions and it is the user's responsibility to ensure
00038 ** that they have met the licensing requirements of the GPL, LGPL, or Qt
00039 ** Solutions Commercial license and the relevant license of the Third
00040 ** Party Software they are using.
00041 ** 
00042 ** If you are unsure which license is appropriate for your use, please
00043 ** contact Nokia at qt-info@nokia.com.
00044 ** 
00045 ****************************************************************************/
00046 
00047 #ifndef QTCOLORPICKER_H
00048 #define QTCOLORPICKER_H
00049 #include <QtGui/QPushButton>
00050 #include <QtCore/QString>
00051 #include <QtGui/QColor>
00052 
00053 #include <QtGui/QLabel>
00054 #include <QtCore/QEvent>
00055 #include <QtGui/QFocusEvent>
00056 
00057 #if defined(Q_WS_WIN)
00058 #  if !defined(QT_QTCOLORPICKER_EXPORT) && !defined(QT_QTCOLORPICKER_IMPORT)
00059 #    define QT_QTCOLORPICKER_EXPORT
00060 #  elif defined(QT_QTCOLORPICKER_IMPORT)
00061 #    if defined(QT_QTCOLORPICKER_EXPORT)
00062 #      undef QT_QTCOLORPICKER_EXPORT
00063 #    endif
00064 #    define QT_QTCOLORPICKER_EXPORT __declspec(dllimport)
00065 #  elif defined(QT_QTCOLORPICKER_EXPORT)
00066 #    undef QT_QTCOLORPICKER_EXPORT
00067 #    define QT_QTCOLORPICKER_EXPORT __declspec(dllexport)
00068 #  endif
00069 #else
00070 #  define QT_QTCOLORPICKER_EXPORT
00071 #endif
00072 
00073 class ColorPickerPopup;
00074 
00075 class QT_QTCOLORPICKER_EXPORT QtColorPicker : public QPushButton
00076 {
00077     Q_OBJECT
00078 
00079     Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled)
00080 
00081 public:
00082     QtColorPicker(QWidget *parent = 0,
00083                   int columns = -1, bool enableColorDialog = true);
00084 
00085     ~QtColorPicker();
00086 
00087     void insertColor(const QColor &color, const QString &text = QString::null, int index = -1);
00088 
00089     QColor currentColor() const;
00090 
00091     QColor color(int index) const;
00092 
00093     void setColorDialogEnabled(bool enabled);
00094     bool colorDialogEnabled() const;
00095 
00096     void setStandardColors();
00097 
00098     static QColor getColor(const QPoint &pos, bool allowCustomColors = true);
00099 
00100 public Q_SLOTS:
00101     void setCurrentColor(const QColor &col);
00102 
00103 Q_SIGNALS:
00104     void colorChanged(const QColor &);
00105 
00106 protected:
00107     void paintEvent(QPaintEvent *e);
00108 
00109 private Q_SLOTS:
00110     void buttonPressed(bool toggled);
00111     void popupClosed();
00112 
00113 private:
00114     ColorPickerPopup *popup;
00115     QColor col;
00116     bool withColorDialog;
00117     bool dirty;
00118     bool firstInserted;
00119 };
00120 
00121 #endif

Generated on Tue Aug 24 2010 15:58:55 for Smartlet by  doxygen 1.7.1