summaryrefslogtreecommitdiffstats
path: root/chalk/core/kis_resource.h
blob: e07763e3650b38126298c202ec52a025f8bf7978 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 *  Copyright (c) 2003 Patrick Julien <[email protected]>
 *
 *  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; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
#ifndef KIS_RESOURCE_H_
#define KIS_RESOURCE_H_

#include <tqimage.h>
#include <tqobject.h>
#include <tqstring.h>


/**
 * The KisResource class provides a representation of Chalk image resources.  This
 * includes, but not limited to, brushes and patterns.
 *
 * This replaces the KisKrayon facility that used to be present in Krayon.
 */
class KisResource : public TQObject {
    typedef TQObject super;
    Q_OBJECT
  TQ_OBJECT

public:

    /**
     * Creates a new KisResource object using @p filename.  No file is opened
     * in the constructor, you have to call load.
     *
     * @param filename the file name to save and load from.
     */
    KisResource(const TQString& filename);
    virtual ~KisResource();

public:
    /**
     * Load this resource.
     */
    virtual bool load() = 0;

    /**
     * Save this resource asynchronously.  The signal saveComplete is emitted when
     * the resource has been saved.
     */
    virtual bool save() = 0;

    /**
     * Returns a TQImage representing this resource.  This image could be null.
     */
    virtual TQImage img() = 0;

public:
    TQString filename() const;
    void setFilename(const TQString& filename);
    TQString name() const;
    void setName(const TQString& name);
    bool valid() const;
    void setValid(bool valid);

private:
    KisResource(const KisResource&);
    KisResource& operator=(const KisResource&);

private:
    TQString m_name;
    TQString m_filename;
    bool m_valid;
};

#endif // KIS_RESOURCE_H_