krita

kis_layerbox.h

00001 /*
00002  *  kis_layerbox.h - part of Krita aka Krayon aka KimageShop
00003  *
00004  *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
00005  *  Copyright (C) 2006 Gábor Lehel <illissius@gmail.com>
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef KIS_LAYERBOX_H
00023 #define KIS_LAYERBOX_H
00024 
00025 #include <qframe.h>
00026 #include <kdebug.h>
00027 #include <qtimer.h>
00028 
00029 #include "kis_types.h"
00030 #include "kis_colorspace.h"
00031 
00032 class WdgLayerBox;
00033 class QButton;
00034 class QPainter;
00035 class QWidget;
00036 class KIconLoader;
00037 class KPopupMenu;
00038 class KoDocumentEntry;
00039 class KisCompositeOp;
00040 class KisLayerList;
00041 class LayerItem;
00042 class KisCanvasSubject;
00043 
00044 class KisLayerBox : public QFrame {
00045         typedef QFrame super;
00046         Q_OBJECT
00047 
00048 public:
00049     KisLayerBox(KisCanvasSubject *subject, QWidget *parent = 0, const char *name = 0);
00050     virtual ~KisLayerBox();
00051 
00052     void clear();
00053     void setUpdatesAndSignalsEnabled(bool enable);
00054     void setImage(KisImageSP image);
00055 
00056 public slots:
00057     // connect to KisImage signals
00058     void slotLayerActivated(KisLayerSP layer);
00059     void slotLayerAdded(KisLayerSP layer);
00060     void slotLayerRemoved(KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAboveThis);
00061     void slotLayerMoved(KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAboveThis);
00062     void slotLayerPropertiesChanged(KisLayerSP layer);
00063     void slotLayersChanged(KisGroupLayerSP rootLayer);
00064     void slotLayerUpdated(KisLayerSP layer, QRect rc);
00065 
00066     void slotSetCompositeOp(const KisCompositeOp& compositeOp);
00067     void slotSetOpacity(int opacity);
00068     void slotSetColorSpace(const KisColorSpace * colorSpace);
00069 
00070 signals:
00071     void sigRequestLayer(KisGroupLayerSP parent, KisLayerSP above);
00072     void sigRequestGroupLayer(KisGroupLayerSP parent, KisLayerSP above);
00073     void sigRequestAdjustmentLayer(KisGroupLayerSP parent, KisLayerSP above);
00074     void sigRequestPartLayer(KisGroupLayerSP parent, KisLayerSP above, const KoDocumentEntry& entry);
00075     void sigRequestLayerProperties(KisLayerSP layer);
00076 
00077     void sigOpacityChanged(int opacity, bool withSlider);
00078     void sigOpacityFinishedChanging(int previous, int opacity);
00079     void sigItemComposite(const KisCompositeOp&);
00080 
00081 private:
00082     enum LayerTypes { PAINT_LAYER, GROUP_LAYER, ADJUSTMENT_LAYER, OBJECT_LAYER };
00083 
00084 private slots:
00085     // connect to LayerList signals
00086     void slotLayerActivated(LayerItem* layer);
00087     void slotLayerDisplayNameChanged(LayerItem* layer, const QString& displayName);
00088     void slotLayerPropertyChanged(LayerItem* layer, const QString& name, bool on);
00089     void slotLayerMoved(LayerItem* layer, LayerItem* parent, LayerItem* after);
00090     void slotRequestNewLayer(LayerItem* parent, LayerItem* after);
00091     void slotRequestNewFolder(LayerItem* parent, LayerItem* after);
00092     void slotRequestNewAdjustmentLayer(LayerItem* parent, LayerItem* after);
00093     void slotRequestNewObjectLayer(LayerItem* parent, LayerItem* item, const KoDocumentEntry& entry);
00094     void slotRequestRemoveLayer(LayerItem* layer);
00095     void slotRequestLayerProperties(LayerItem* layer);
00096 
00097     void slotAboutToShow();
00098     void slotAddMenuActivated(int type = OBJECT_LAYER);
00099     void slotRmClicked();
00100     void slotRaiseClicked();
00101     void slotLowerClicked();
00102     void slotPropertiesClicked();
00103 
00104     void updateThumbnails();
00105 
00106 private:
00107     void updateUI();
00108     QPixmap loadPixmap(const QString& filename, const KIconLoader& il, int size);
00109     KisLayerList* list() const;
00110     void markModified(KisLayer *layer);
00111 
00112     KPopupMenu *m_newLayerMenu;
00113     KoPartSelectAction *m_partLayerAction;
00114     KisImageSP m_image;
00115     QValueList<int> m_modified;
00116     WdgLayerBox *m_lst;
00117 
00118     void printKritaLayers() const;
00119     void printLayerboxLayers() const;
00120 };
00121 
00122 #endif // KIS_LAYERBOX_H
00123 
KDE Home | KDE Accessibility Home | Description of Access Keys