krita
kis_layerbox.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
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
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
|