/* * kis_layerbox.h - part of Chalk aka Krayon aka KimageShop * * Copyright (c) 2002 Patrick Julien * Copyright (C) 2006 Gábor Lehel * * 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_LAYERBOX_H #define KIS_LAYERBOX_H #include #include #include #include "kis_types.h" #include "kis_colorspace.h" class WdgLayerBox; class TQButton; class TQPainter; class TQWidget; class KIconLoader; class KPopupMenu; class KoDocumentEntry; class KisCompositeOp; class KisLayerList; class LayerItem; class KisCanvasSubject; class KisLayerBox : public TQFrame { typedef TQFrame super; Q_OBJECT TQ_OBJECT public: KisLayerBox(KisCanvasSubject *subject, TQWidget *tqparent = 0, const char *name = 0); virtual ~KisLayerBox(); void clear(); void setUpdatesAndSignalsEnabled(bool enable); void setImage(KisImageSP image); public slots: // connect to KisImage signals void slotLayerActivated(KisLayerSP layer); void slotLayerAdded(KisLayerSP layer); void slotLayerRemoved(KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAboveThis); void slotLayerMoved(KisLayerSP layer, KisGroupLayerSP wasParent, KisLayerSP wasAboveThis); void slotLayerPropertiesChanged(KisLayerSP layer); void slotLayersChanged(KisGroupLayerSP rootLayer); void slotLayerUpdated(KisLayerSP layer, TQRect rc); void slotSetCompositeOp(const KisCompositeOp& compositeOp); void slotSetOpacity(int opacity); void slotSetColorSpace(const KisColorSpace * colorSpace); signals: void sigRequestLayer(KisGroupLayerSP tqparent, KisLayerSP above); void sigRequestGroupLayer(KisGroupLayerSP tqparent, KisLayerSP above); void sigRequestAdjustmentLayer(KisGroupLayerSP tqparent, KisLayerSP above); void sigRequestPartLayer(KisGroupLayerSP tqparent, KisLayerSP above, const KoDocumentEntry& entry); void sigRequestLayerProperties(KisLayerSP layer); void sigOpacityChanged(int opacity, bool withSlider); void sigOpacityFinishedChanging(int previous, int opacity); void sigItemComposite(const KisCompositeOp&); private: enum LayerTypes { PAINT_LAYER, GROUP_LAYER, ADJUSTMENT_LAYER, OBJECT_LAYER }; private slots: // connect to LayerList signals void slotLayerActivated(LayerItem* layer); void slotLayerDisplayNameChanged(LayerItem* layer, const TQString& displayName); void slotLayerPropertyChanged(LayerItem* layer, const TQString& name, bool on); void slotLayerMoved(LayerItem* layer, LayerItem* tqparent, LayerItem* after); void slotRequestNewLayer(LayerItem* tqparent, LayerItem* after); void slotRequestNewFolder(LayerItem* tqparent, LayerItem* after); void slotRequestNewAdjustmentLayer(LayerItem* tqparent, LayerItem* after); void slotRequestNewObjectLayer(LayerItem* tqparent, LayerItem* item, const KoDocumentEntry& entry); void slotRequestRemoveLayer(LayerItem* layer); void slotRequestLayerProperties(LayerItem* layer); void slotAboutToShow(); void slotAddMenuActivated(int type = OBJECT_LAYER); void slotRmClicked(); void slotRaiseClicked(); void slotLowerClicked(); void slotPropertiesClicked(); void updateThumbnails(); private: void updateUI(); TQPixmap loadPixmap(const TQString& filename, const KIconLoader& il, int size); KisLayerList* list() const; void markModified(KisLayer *layer); KPopupMenu *m_newLayerMenu; KoPartSelectAction *m_partLayerAction; KisImageSP m_image; TQValueList m_modified; WdgLayerBox *m_lst; void printChalkLayers() const; void printLayerboxLayers() const; }; #endif // KIS_LAYERBOX_H