summaryrefslogtreecommitdiffstats
path: root/scribus/colorcombo.h
blob: 5887b009a88dec7fc42e1a13e0f73d460eac5341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/*
 *  colorcombo.h
 *  ScribusCVS
 *
 *  Created by Jean Ghali on 18.02.06.
 *  Copyright 2006 under GPL2. All rights reserved.
 *
 */

#ifndef COLORCOMBO_H
#define COLORCOMBO_H

#include <QComboBox>

#ifdef Q_WS_MAC
#include <QMacStyle>
#endif

#include "scribusapi.h"
#include "colorlistbox.h"

/*!
    \class ColorCombo colorcombo.h
    \brief The ColorCombo widget is a combo box for displaying list of colors.
*/
class SCRIBUS_API ColorCombo : public QComboBox 
{
	Q_OBJECT

private:

#ifdef Q_WS_MAC
	/// use listbox instead of popupmenu for combo boxes
	class ScMacStyle : public QMacStyle 
	{
		virtual int styleHint(StyleHint sh, 
	                                  const QStyleOption * so, 
					  const QWidget * w, 
	                                  QStyleHintReturn * r) const
		{
        	return sh != QStyle::SH_ComboBox_Popup && QMacStyle::styleHint(sh, so, w, r); 
		}
	};
#endif

public:

	enum PixmapType
	{
		smallPixmaps,
		widePixmaps,
		fancyPixmaps
	};

	ColorCombo( QWidget* parent=0 );
	ColorCombo( bool rw, QWidget* parent=0 );

	QString currentColor() const; 
	
	void updateBox(ColorList& list, ColorCombo::PixmapType pixType, bool insertNone = true);

	void insertItems(ColorList& list, ColorCombo::PixmapType type);
	void insertSmallItem( const ScColor& col, ScribusDoc* doc, const QString& colName );
	void insertWideItem ( const ScColor& col, ScribusDoc* doc, const QString& colName );
	void insertFancyItem( const ScColor& col, ScribusDoc* doc, const QString& colName );
};

#endif