File indexing completed on 2025-02-02 09:10:33
0001 /*************************************************************************** 0002 * Copyright (C) 2003-2005 by David Saxton * 0003 * david@bluehaze.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #ifndef LIBRARYITEM_H 0012 #define LIBRARYITEM_H 0013 0014 #include "item.h" 0015 0016 #include <QIcon> 0017 0018 class QStringList; 0019 0020 /** 0021 This holds details of an item - id, name, category it is displayed in in its 0022 respective item selector, icon, function pointers to creating the item, etc. 0023 Normally each item will only pass one id, but some items have had their IDs 0024 changed during the history of ktl, so passing a stringlist will take the first 0025 ID as the "active" id, and the rest as IDs that will also be recognized, but 0026 never displayed to the user. 0027 @short Details of an Item 0028 @author David Saxton 0029 */ 0030 class LibraryItem 0031 { 0032 public: 0033 ~LibraryItem(); 0034 0035 enum Type { lit_flowpart, lit_component, lit_mechanical, lit_drawpart, lit_subcircuit, lit_other }; 0036 LibraryItem(QStringList idList, const QString &name, const QString &category, QIcon icon, Type type, createItemPtr createItem); 0037 LibraryItem(QStringList idList, const QString &name, const QString &category, const QString &iconName, Type type, createItemPtr createItem); 0038 LibraryItem(QStringList idList, const QString &name, const QString &category, Type type, createItemPtr createItem); 0039 0040 QString activeID() const; 0041 QStringList allIDs() const 0042 { 0043 return m_idList; 0044 } 0045 QString name() const 0046 { 0047 return m_name; 0048 } 0049 QString category() const 0050 { 0051 return m_category; 0052 } 0053 QIcon icon() const 0054 { 0055 return m_icon; 0056 } 0057 createItemPtr createItemFnPtr() const 0058 { 0059 return createItem; 0060 } 0061 int type() const 0062 { 0063 return m_type; 0064 } 0065 0066 private: 0067 QStringList m_idList; 0068 QString m_name; 0069 QString m_category; 0070 QIcon m_icon; 0071 createItemPtr createItem; 0072 int m_type; 0073 }; 0074 typedef QList<LibraryItem *> LibraryItemList; 0075 0076 #endif