Subversion Repositories Scribus

Rev

Rev 14389 | Rev 18247 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4690 mrdocs 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
7
/*
8
 *  colorcombo.h
9
 *  ScribusCVS
10
 *
11
 *  Created by Jean Ghali on 18.02.06.
12
 *  Copyright 2006 under GPL2. All rights reserved.
13
 *
14
 */
15
 
16
#ifndef COLORCOMBO_H
17
#define COLORCOMBO_H
18
 
9874 avox 19
#include <QComboBox>
4690 mrdocs 20
 
18204 fschmid 21
#ifdef Q_OS_MAC
10223 cbradney 22
#include <QMacStyle>
4690 mrdocs 23
#endif
24
 
12671 jghali 25
#include "scribusapi.h"
10223 cbradney 26
#include "colorlistbox.h"
27
 
4690 mrdocs 28
/*!
29
    \class ColorCombo colorcombo.h
30
    \brief The ColorCombo widget is a combo box for displaying list of colors.
31
*/
12671 jghali 32
class SCRIBUS_API ColorCombo : public QComboBox
4690 mrdocs 33
{
34
        Q_OBJECT
35
 
36
private:
37
 
18204 fschmid 38
#ifdef Q_OS_MAC
4690 mrdocs 39
        /// use listbox instead of popupmenu for combo boxes
40
        class ScMacStyle : public QMacStyle
41
        {
13062 cbradney 42
                virtual int styleHint(StyleHint sh,
10531 avox 43
                                          const QStyleOption * so,
44
                                          const QWidget * w,
4690 mrdocs 45
                                          QStyleHintReturn * r) const
46
                {
10531 avox 47
                return sh != QStyle::SH_ComboBox_Popup && QMacStyle::styleHint(sh, so, w, r);
4690 mrdocs 48
                }
49
        };
50
#endif
51
 
52
public:
53
 
54
        enum PixmapType
55
        {
56
                smallPixmaps,
57
                widePixmaps,
58
                fancyPixmaps
59
        };
60
 
10469 cbradney 61
        ColorCombo( QWidget* parent=0 );
62
        ColorCombo( bool rw, QWidget* parent=0 );
4690 mrdocs 63
 
9874 avox 64
        QString currentColor() const;
65
 
4690 mrdocs 66
        void updateBox(ColorList& list, ColorCombo::PixmapType pixType, bool insertNone = true);
67
 
7850 jghali 68
        void insertItems(ColorList& list, ColorCombo::PixmapType type);
7478 jghali 69
        void insertSmallItem( const ScColor& col, ScribusDoc* doc, const QString& colName );
70
        void insertWideItem ( const ScColor& col, ScribusDoc* doc, const QString& colName );
71
        void insertFancyItem( const ScColor& col, ScribusDoc* doc, const QString& colName );
14389 cbradney 72
        void initColorList(ColorList* colorList, ScribusDoc* doc, QString colorValue);
4690 mrdocs 73
};
74
 
75
#endif