ColorBox.h
Go to the documentation of this file.
/***************************************************************************
File : ColorBox.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2006 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : A combo box to select a standard color
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef COLORBOX_H
#define COLORBOX_H
#include <QComboBox>
class ColorBox : public QComboBox
{
Q_OBJECT
public:
ColorBox(QWidget *parent = 0);
void setColor(const QColor& c);
QColor color() const;
static QList<QColor> colorList();
static QStringList colorNames();
static int colorIndex(const QColor& c);
static QColor color(int colorIndex);
static QColor defaultColor(int colorIndex);
static bool isValidColor(const QColor& color);
static int numPredefinedColors();
static QStringList defaultColorNames();
static QList<QColor> defaultColors();
protected:
void init();
static const int colors_count = 24;
static const QColor colors[];
};
#endif
ColorBox::init
void init()
Internal initialization function.
Definition: ColorBox.cpp:69
ColorBox::ColorBox
ColorBox(QWidget *parent=0)
Constructor.
Definition: ColorBox.cpp:63
ColorBox::colors_count
static const int colors_count
The number of predefined colors.
Definition: ColorBox.h:75
ColorBox::colors
static const QColor colors[]
Array containing the 24 predefined colors.
Definition: ColorBox.h:77
ColorBox::colorIndex
static int colorIndex(const QColor &c)
Return the index for a given color.
Definition: ColorBox.cpp:98
ColorBox::defaultColor
static QColor defaultColor(int colorIndex)
Return the default color at index &#39;colorIndex&#39;.
Definition: ColorBox.cpp:151
ColorBox::defaultColors
static QList< QColor > defaultColors()
Returns the list of predefined colors.
Definition: ColorBox.cpp:198
ColorBox::defaultColorNames
static QStringList defaultColorNames()
Returns the color name for the predefined colors.
Definition: ColorBox.cpp:169
ColorBox::colorList
static QList< QColor > colorList()
Return the list of colors.
Definition: ColorBox.cpp:115
ColorBox
A modified QComboBox used for color selection.
Definition: ColorBox.h:38
ColorBox::colorNames
static QStringList colorNames()
Returns the color names.
Definition: ColorBox.cpp:138
ColorBox::isValidColor
static bool isValidColor(const QColor &color)
Returns TRUE if the color is included in the color box, otherwise returns FALSE.
Definition: ColorBox.cpp:159
ColorBox::setColor
void setColor(const QColor &c)
Set the current color.
Definition: ColorBox.cpp:88
ColorBox::color
QColor color() const
Return the current color.
Definition: ColorBox.cpp:93
ColorBox::numPredefinedColors
static int numPredefinedColors()
Returns the number of predefined colors.
Definition: ColorBox.cpp:164