kalarm/lib

colourlist.cpp
1/*
2 * colourlist.cpp - an ordered list of colours
3 * Program: kalarm
4 * Copyright (C) 2003 by David Jarvie software@astrojar.org.uk
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#include "colourlist.h"
22
23
24ColourList::ColourList(const TQColor* colours)
25{
26 while (colours->isValid())
27 mList.append((*colours++).rgb());
28}
29
30void ColourList::insert(const TQColor& colour)
31{
32 TQRgb rgb = colour.rgb();
33 for (TQValueListIterator<TQRgb> it = mList.begin(); it != mList.end(); ++it)
34 {
35 if (rgb <= *it)
36 {
37 if (rgb != *it) // don't insert duplicates
38 mList.insert(it, rgb);
39 return;
40 }
41 }
42 mList.append(rgb);
43}
ColourList()
Constructs an empty list.
Definition: colourlist.h:46
void insert(const TQColor &c)
Adds the specified colour c to the list.
Definition: colourlist.cpp:30