Files
lmms/include/ResourceTreeItem.h
Tobias Doerffel 372ff79f96 Dropped ResourceItem type "TypeSoundFont"
Dropped separate ResourceItem type "TypeSoundFont" as theres no benefit
from distinguishing it from other plugin-specific files. Soundfonts now
are treated as TypePluginSpecificResource.

Furthermore some minor coding style cleanups.

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
2009-07-05 16:05:38 +02:00

139 lines
2.8 KiB
C++

/*
* ResourceTreeItem.h - header file for ResourceTreeItem
*
* Copyright (c) 2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#ifndef _RESOURCE_TREE_ITEM_H
#define _RESOURCE_TREE_ITEM_H
#include <QtCore/QList>
#include "ResourceItem.h"
#define foreachResourceTreeItem(list) \
for(ResourceTreeItemList::Iterator it=list.begin(); \
it!=list.end();++it)
#define foreachConstResourceTreeItem(list) \
for(ResourceTreeItemList::ConstIterator it=list.begin();\
it!=list.end();++it)
class ResourceTreeItem;
typedef QList<ResourceTreeItem *> ResourceTreeItemList;
class ResourceTreeItem
{
public:
ResourceTreeItem( ResourceTreeItem * _parent = NULL,
ResourceItem * _item = NULL );
~ResourceTreeItem();
inline void setHidden( bool _h )
{
m_hidden = _h;
}
inline bool isHidden() const
{
return m_hidden;
}
int rowCount() const;
ResourceTreeItem * getChild( int _row );
int row() const;
inline void addChild( ResourceTreeItem * _it )
{
m_children.push_back( _it );
}
inline void removeChild( ResourceTreeItem * _it )
{
m_children.removeAll( _it );
}
inline ResourceTreeItemList & children()
{
return m_children;
}
inline const ResourceTreeItemList & children() const
{
return m_children;
}
ResourceTreeItem * findChild( const QString & _name,
ResourceItem::BaseDirectory _base_dir );
inline ResourceItem * item()
{
return m_item;
}
inline const ResourceItem * item() const
{
return m_item;
}
inline ResourceTreeItem * parent()
{
return m_parent;
}
inline void setParent( ResourceTreeItem * _parent )
{
m_parent = _parent;
}
inline bool temporaryMarker() const
{
return m_temporaryMarker;
}
inline void setTemporaryMarker( bool _on )
{
m_temporaryMarker = _on;
}
private:
// hide copy-ctor
ResourceTreeItem( const ResourceTreeItem & ) { }
ResourceTreeItem * m_parent;
ResourceTreeItemList m_children;
bool m_hidden;
bool m_temporaryMarker;
ResourceItem * m_item;
} ;
#endif