1 // Copyright (c) 2012 Dennco Project
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // Created by tkawata on Sep-30, 2012.
22 #include "TKContainer.h"
31 class DCUIGraphicsScene;
33 #include "dcvcomponent.h"
38 class DCContainer : public TKContainer
43 std::string d_factoryCachedLocation;
44 DCVCRefHolder d_factoryCachedPageObject;
46 QString d_workDirRoot;
47 QString d_workDirCellRoot;
48 QString d_workDirCellCodeRoot;
52 virtual ~DCContainer();
54 virtual TKCell* addCell(std::string theLocation, std::string theName, std::string type, std::string customScript);
55 virtual TKCell* addCell(std::string theLocation, std::string theName, TKCellCode *cellCode, std::string customScript);
56 virtual TKCellCode* addCellCode(std::string theName, std::string theAPIType, std::string code);
58 virtual TKCell* cellFactory(std::string location, std::string name, std::string type, bool canInterface = true);
59 virtual TKAxon* axonFactory(TKCell *theOwner);
60 virtual TKReceptor* receptorFactory(TKCell *theOwner);
61 virtual TKAxonTerminal* axonTerminalFactory(TKAxon *theOwner);
62 virtual TKCellCode* cellCodeFactory(std::string name, std::string cellapi, std::string code);
65 * remove cell code from container and the page (DCVCPage) belonging.
66 * The cells which use the deleting cell code will have empty cell code after this.
67 * This expected to only be called from command classes which are defined in dceditcommands.h
69 bool removeCellCode(DCCellCode *cellcode);
72 * remove cell from container and the page (DCVCPage) belonging.
73 * All the axon terminals connected to this cell will also be removed after this.
74 * This expected to only be called from command classes which are defined in dceditcommands.h
76 bool removeCell(DCCell *cell);
78 DCContent* getContent() const { return d_content; }
79 DCScene* getScene() const { return d_scene; }
80 QList<DCVComponent*> getSelectedCellObjects() const;
81 virtual float getValue(std::string key) const { return 0; }
83 TKCellCode* getEmptyCellCodeClass() const { return mEmptyCellClass; }
84 bool isScriptableCell(DCCell *cell);
87 void setContent(DCContent *content);
89 void unselectCellObjectAll();
91 virtual void setValue(std::string key, float value) {}
93 virtual void beganParsePage(const char *docRoot, const char *path);
94 virtual void endedParsePage(const char *docRoot, const char *path);
96 void beganBuildContainer();
97 void endedBuildContainer();
99 bool saveCustomScriptToWorkFile(TKCell *cell, std::string customScript);
100 bool saveClassScriptToWorkFile(TKCellCode *cellCode, std::string code);
102 QString readCustomScriptFromWorkFile(const DCCell *cell);
103 QString readCellCodeScriptFromFile(const DCCellCode *cellcode);
107 #endif // DCCONTAINER_H