chalk

kis_layerbox.h
1/*
2 * kis_layerbox.h - part of Chalk aka Krayon aka KimageShop
3 *
4 * Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
5 * Copyright (C) 2006 Gábor Lehel <illissius@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22#ifndef KIS_LAYERBOX_H
23#define KIS_LAYERBOX_H
24
25#include <tqframe.h>
26#include <kdebug.h>
27#include <tqtimer.h>
28
29#include "kis_types.h"
30#include "kis_colorspace.h"
31
32class WdgLayerBox;
33class TQButton;
34class TQPainter;
35class TQWidget;
36class TDEIconLoader;
37class TDEPopupMenu;
38class KoDocumentEntry;
39class KisCompositeOp;
40class KisLayerList;
41class LayerItem;
43
44class KisLayerBox : public TQFrame {
45 typedef TQFrame super;
46 TQ_OBJECT
47
48
49public:
50 KisLayerBox(KisCanvasSubject *subject, TQWidget *parent = 0, const char *name = 0);
51 virtual ~KisLayerBox();
52
53 void clear();
54 void setUpdatesAndSignalsEnabled(bool enable);
55 void setImage(KisImageSP image);
56
57public slots:
58 // connect to KisImage signals
59 void slotLayerActivated(KisLayerSP layer);
60 void slotLayerAdded(KisLayerSP layer);
61 void slotLayerRemoved(KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAboveThis);
62 void slotLayerMoved(KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAboveThis);
63 void slotLayerPropertiesChanged(KisLayerSP layer);
64 void slotLayersChanged(KisGroupLayerSP rootLayer);
65 void slotLayerUpdated(KisLayerSP layer, TQRect rc);
66
67 void slotSetCompositeOp(const KisCompositeOp& compositeOp);
68 void slotSetOpacity(int opacity);
69 void slotSetColorSpace(const KisColorSpace * colorSpace);
70
71signals:
72 void sigRequestLayer(KisGroupLayerSP parent, KisLayerSP above);
73 void sigRequestGroupLayer(KisGroupLayerSP parent, KisLayerSP above);
74 void sigRequestAdjustmentLayer(KisGroupLayerSP parent, KisLayerSP above);
75 void sigRequestPartLayer(KisGroupLayerSP parent, KisLayerSP above, const KoDocumentEntry& entry);
76 void sigRequestLayerProperties(KisLayerSP layer);
77
78 void sigOpacityChanged(int opacity, bool withSlider);
79 void sigOpacityFinishedChanging(int previous, int opacity);
80 void sigItemComposite(const KisCompositeOp&);
81
82private:
83 enum LayerTypes { PAINT_LAYER, GROUP_LAYER, ADJUSTMENT_LAYER, OBJECT_LAYER };
84
85private slots:
86 // connect to LayerList signals
87 void slotLayerActivated(LayerItem* layer);
88 void slotLayerDisplayNameChanged(LayerItem* layer, const TQString& displayName);
89 void slotLayerPropertyChanged(LayerItem* layer, const TQString& name, bool on);
90 void slotLayerMoved(LayerItem* layer, LayerItem* parent, LayerItem* after);
91 void slotRequestNewLayer(LayerItem* parent, LayerItem* after);
92 void slotRequestNewFolder(LayerItem* parent, LayerItem* after);
93 void slotRequestNewAdjustmentLayer(LayerItem* parent, LayerItem* after);
94 void slotRequestNewObjectLayer(LayerItem* parent, LayerItem* item, const KoDocumentEntry& entry);
95 void slotRequestRemoveLayer(LayerItem* layer);
96 void slotRequestLayerProperties(LayerItem* layer);
97
98 void slotAboutToShow();
99 void slotAddMenuActivated(int type = OBJECT_LAYER);
100 void slotRmClicked();
101 void slotRaiseClicked();
102 void slotLowerClicked();
103 void slotPropertiesClicked();
104
105 void updateThumbnails();
106
107private:
108 void updateUI();
109 TQPixmap loadPixmap(const TQString& filename, const TDEIconLoader& il, int size);
110 KisLayerList* list() const;
111 void markModified(KisLayer *layer);
112
113 TDEPopupMenu *m_newLayerMenu;
114 KoPartSelectAction *m_partLayerAction;
115 KisImageSP m_image;
116 TQValueList<int> m_modified;
117 WdgLayerBox *m_lst;
118
119 void printChalkLayers() const;
120 void printLayerboxLayers() const;
121};
122
123#endif // KIS_LAYERBOX_H
124
KisCanvasSubject is part of the Observer pattern.
A colorspace is the definition of a certain color model in Chalk.
Abstract class that represents the concept of a Layer in Chalk.
Definition kis_layer.h:42