OSDN Git Service

[denncoCreator] fixed a crash bug.
[dennco/denncoCreator.git] / Source / dccellcode.h
1 //  Copyright (c) 2012 Dennco Project
2 //
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.
7 //
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.
12 //
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/>.
15
16 //
17 //  Created by tkawata on Sep-30, 2012.
18 //
19 #ifndef DCCELLCODE_H
20 #define DCCELLCODE_H
21
22 #include "TKCellCode.h"
23
24 #include <QString>
25
26 class DCVCCellCode;
27 class TKCellCodeInstance;
28 class DCVPageComponent;
29 class DCContainer;
30 class DCVCPage;
31
32 class DCCellCode : public TKCellCode
33 {
34     friend struct DCComponentUtil;
35     friend class DCContainer;
36
37     DCCellCode(DCContainer *container, std::string theName, std::string theCellAPIName);
38     void bindComponent(DCVPageComponent *component) { d_vComponent = component; }
39
40     DCVPageComponent    *d_vComponent;
41     DCContainer         *d_container;
42
43     /**
44       * Change name of this cell code.
45       * DCContainer will call this method.
46       */
47     void                changeName(const QString& newName);
48
49     /**
50       * Change the location path for this cell code.
51       * DCContainer will call this method.
52       */
53     void                changePath(const QString& newPath);
54
55 public:
56     virtual ~DCCellCode();
57     virtual TKCellCodeInstance* createCellCodeInstance(TKCell *owner, const void *data) { (void)owner; (void)data; return 0; }
58
59     DCVPageComponent*   getVComponent() const { return d_vComponent; }
60     DCVCPage*           getPageBelonging() const;
61     QString             getOwnScript() const;
62     DCContainer*        getContainer() const { return d_container; }
63     QString             getWorkFilePathForCellCodeScript() const;
64
65     bool                saveScript(const QString& script);
66
67     /**
68       * Change the API type of this cell.
69       *
70       */
71     void                changeType(const QString& newType);
72 };
73
74 #endif // DCCELLCODE_H