chalk

kis_resource_mediator.h
1/*
2 * Copyright (c) 2003 Patrick Julien <freak@codepimps.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18#ifndef KIS_RESOURCE_MEDIATOR_H_
19#define KIS_RESOURCE_MEDIATOR_H_
20
21#include <tqobject.h>
22#include <tqmap.h>
23#include <tqwidget.h>
24
25class KoIconItem;
26class KisItemChooser;
27class KisIconItem;
28class KisResource;
29class KisResourceServerBase;
30
37class KisResourceMediator : public TQObject {
38 TQ_OBJECT
39
40 typedef TQObject super;
41
42public:
43 KisResourceMediator(KisItemChooser *chooser,
44 TQObject *parent = 0,
45 const char *name = 0);
46 virtual ~KisResourceMediator();
47
48public:
49 void connectServer(KisResourceServerBase* rServer);
50 KisResource *currentResource() const;
51 KisIconItem *itemFor(KisResource *r) const;
52 KisResource *resourceFor(KoIconItem *item) const;
53 KisResource *resourceFor(KisIconItem *item) const;
54 TQWidget *chooserWidget() const;
55
56public slots:
57
58 void setActiveItem(KoIconItem *item);
59
60signals:
61 void activatedResource(KisResource *r);
62
63private slots:
64 void rServerAddedResource(KisResource *resource);
65
66private:
67 KisItemChooser *m_chooser;
68 TQMap<KisResource*, KisIconItem*> m_items;
69 KoIconItem *m_activeItem;
70};
71
72#endif // KIS_RESOURCE_MEDIATOR_H_
73
A resource mediator manages access to resources like gradients.
The KisResource class provides a representation of Chalk image resources.