Updated SWH plugins and added missing hermes_filter plugin
[lmms/mlankhorst.git] / include / embed.h
blob3aa9c8ab2c9be83c92e1521225211892367ce019
1 /*
2 * embed.h - misc. stuff for using embedded data (resources linked into binary)
4 * Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
25 #ifndef _EMBED_H
26 #define _EMBED_H
28 #include <QtGui/QPixmap>
29 #include <QtCore/QString>
31 #include "export.h"
32 #include "lmms_basics.h"
35 namespace embed
38 struct descriptor
40 int size;
41 const unsigned char * data;
42 const char * name;
43 } ;
46 QPixmap EXPORT getIconPixmap( const char * _name, int _w = -1, int _h = -1 );
47 QString EXPORT getText( const char * _name );
52 #ifdef PLUGIN_NAME
53 namespace PLUGIN_NAME
56 QPixmap getIconPixmap( const char * _name, int _w = -1, int _h = -1 );
57 //QString getText( const char * _name );
60 #endif
64 class PixmapLoader
66 public:
67 PixmapLoader( const PixmapLoader * _ref ) :
68 m_name( _ref != NULL ? _ref->m_name : QString::null )
72 PixmapLoader( const QString & _name = QString::null ) :
73 m_name( _name )
77 virtual QPixmap pixmap() const
79 if( !m_name.isEmpty() )
81 return( embed::getIconPixmap(
82 m_name.toAscii().constData() ) );
84 return( QPixmap() );
87 virtual ~PixmapLoader()
91 virtual QString pixmapName() const
93 return m_name;
96 protected:
97 QString m_name;
98 } ;
101 #ifdef PLUGIN_NAME
102 class PluginPixmapLoader : public PixmapLoader
104 public:
105 PluginPixmapLoader( const QString & _name = QString::null ) :
106 PixmapLoader( _name )
110 virtual QPixmap pixmap() const
112 if( !m_name.isEmpty() )
114 return( PLUGIN_NAME::getIconPixmap(
115 m_name.toAscii().constData() ) );
117 return( QPixmap() );
120 virtual QString pixmapName() const
122 return QString( STRINGIFY(PLUGIN_NAME) ) + "::" + m_name;
126 #endif
130 #endif