Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 4689 → Rev 4690

/branches/Version13x/Scribus/scribus/colorcombo.h
0,0 → 1,68
/*
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.h>
#include "colorm.h"
 
#ifdef QT_MAC
#include <qmacstyle_mac.h>
#endif
 
/*!
\class ColorCombo colorcombo.h
\brief The ColorCombo widget is a combo box for displaying list of colors.
*/
class ColorCombo : public QComboBox
{
Q_OBJECT
 
private:
 
#ifdef QT_MAC
/// use listbox instead of popupmenu for combo boxes
class ScMacStyle : public QMacStyle
{
virtual int ScMacStyle::styleHint(StyleHint sh, const QWidget * w,
const QStyleOption & so,
QStyleHintReturn * r) const
{
return sh != QStyle::SH_ComboBox_Popup && QMacStyle::styleHint(sh, w, so, r);
}
};
#endif
 
public:
 
enum PixmapType
{
smallPixmaps,
widePixmaps,
fancyPixmaps
};
 
ColorCombo( QWidget* parent=0, const char* name=0 );
ColorCombo( bool rw, QWidget* parent=0, const char* name=0 );
 
void updateBox(ColorList& list, ColorCombo::PixmapType pixType, bool insertNone = true);
 
void insertSmallItem( const ScColor& col, const QString& colName );
void insertWideItem ( const ScColor& col, const QString& colName );
void insertFancyItem( const ScColor& col, const QString& colName );
};
 
#endif
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/scpixmapcache.h
===================================================================
--- branches/Version13x/Scribus/scribus/scpixmapcache.h (nonexistent)
+++ branches/Version13x/Scribus/scribus/scpixmapcache.h (revision 4690)
@@ -0,0 +1,33 @@
+/*
+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.
+*/
+
+#ifndef SCPIXMAPCACHE_H
+#define SCPIXMAPCACHE_H
+
+#include <qmap.h>
+#include <qpixmap.h>
+
+template <typename T>
+class ScPixmapCache : public QMap<T, QPixmap*>
+{
+public:
+ ScPixmapCache() {};
+ ~ScPixmapCache();
+};
+
+template <typename T>
+ScPixmapCache<T>::~ScPixmapCache()
+{
+ QMap<typename T, QPixmap*>::iterator it;
+ QMap<typename T, QPixmap*>::iterator itEnd;
+
+ itEnd = end();
+ for (it = begin(); it != itEnd; it++)
+ delete (*it);
+};
+
+#endif
/branches/Version13x/Scribus/scribus/scpixmapcache.h
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/colorcombo.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/colorcombo.cpp (nonexistent)
+++ branches/Version13x/Scribus/scribus/colorcombo.cpp (revision 4690)
@@ -0,0 +1,73 @@
+/*
+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.
+*/
+/*
+ * sccombobox.h
+ * ScribusCVS
+ *
+ * Created by Andreas Vox on 01.10.05.
+ * Copyright 2005 under GPL2. All rights reserved.
+ *
+ */
+
+#include <qlistbox.h>
+#include "colorcombo.h"
+#include "colorcombo.moc"
+
+ColorCombo::ColorCombo( QWidget* parent, const char* name ) : QComboBox(false, parent, name)
+{
+#ifdef QT_MAC
+ setStyle( new ColorCombo::ScMacStyle() );
+#endif
+ setListBox( new ColorListBox( this, "in-combo", WType_Popup ) );
+}
+
+ColorCombo::ColorCombo( bool rw, QWidget* parent, const char* name ) : QComboBox(rw, parent, name)
+{
+#ifdef QT_MAC
+ setStyle( new ColorCombo::ScMacStyle() );
+#endif
+ setListBox( new ColorListBox( this, "in-combo", WType_Popup ) );
+}
+
+void ColorCombo::updateBox(ColorList& list, ColorCombo::PixmapType pixType , bool insertNone)
+{
+ ColorListBox* clb = (ColorListBox*) listBox();
+ if ( clb )
+ {
+ clb->clear();
+ if ( insertNone )
+ clb->insertItem( tr("None") );
+ if ( pixType == ColorCombo::fancyPixmaps )
+ clb->updateBox(list, ColorListBox::fancyPixmap, false);
+ else if ( pixType == ColorCombo::widePixmaps )
+ clb->updateBox(list, ColorListBox::widePixmap, false);
+ else if ( pixType == ColorCombo::smallPixmaps )
+ clb->updateBox(list, ColorListBox::smallPixmap, false);
+ }
+}
+
+void ColorCombo::insertSmallItem( const ScColor& col, const QString& colName )
+{
+ ColorListBox* clb = (ColorListBox*) listBox();
+ if ( clb )
+ clb->insertItem( new ColorSmallPixmapItem(col, colName) );
+}
+
+void ColorCombo::insertWideItem ( const ScColor& col, const QString& colName )
+{
+ ColorListBox* clb = (ColorListBox*) listBox();
+ if ( clb )
+ clb->insertItem( new ColorWidePixmapItem(col, colName) );
+}
+
+void ColorCombo::insertFancyItem( const ScColor& col, const QString& colName )
+{
+ ColorListBox* clb = (ColorListBox*) listBox();
+ if ( clb )
+ clb->insertItem( new ColorFancyPixmapItem(col, colName) );
+}
+
/branches/Version13x/Scribus/scribus/colorcombo.cpp
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property