25#include <tdelistview.h>
32template< class T> class TQPtrList;
34class LayerList: public TDEListView
40 LayerList( TQWidget *parent = 0, const char *name = 0 );
43 void addProperty( const TQString &name, const TQString &displayName, const TQIconSet &icon = TQIconSet(),
44 bool defaultValue = false, bool validForFolders = true );
45 void addProperty( const TQString &name, const TQString &displayName, TQPixmap enabled, TQPixmap disabled,
46 bool defaultValue = false, bool validForFolders = true );
48 bool foldersCanBeActive() const;
49 bool previewsShown() const;
50 int itemHeight() const;
53 LayerItem *layer( int id ) const;
54 LayerItem *folder( int id ) const;
56 LayerItem *activeLayer() const;
57 int activeLayerID() const;
59 TQValueList<LayerItem*> selectedLayers() const;
60 TQValueList<int> selectedLayerIDs() const;
62 void makeFolder( int id );
63 bool isFolder( int id ) const;
64 TQString displayName( int id ) const;
65 bool property( int id, const TQString &name ) const;
69 enum { NewLayer = 0, NewFolder, RemoveLayer, LayerProperties, COUNT };
71 TDEPopupMenu *contextMenu() const;
74 void setFoldersCanBeActive( bool can );
75 void setPreviewsShown( bool show );
76 void setItemHeight( int height );
77 void setNumRows( int rows );
79 void setActiveLayer( LayerItem *layer );
80 void setActiveLayer( int id );
82 void setLayerDisplayName( LayerItem *layer, const TQString &displayName );
83 void setLayerDisplayName( int id, const TQString &displayName );
85 void setLayerProperty( LayerItem *layer, const TQString &name, bool on );
86 void setLayerProperty( int id, const TQString &name, bool on );
88 void toggleLayerProperty( LayerItem *layer, const TQString &name );
89 void toggleLayerProperty( int id, const TQString &name );
91 void setLayerPreviewImage( LayerItem *layer, TQImage *image );
92 void setLayerPreviewImage( int id, TQImage *image );
94 void layerPreviewChanged( LayerItem *layer );
95 void layerPreviewChanged( int id );
97 LayerItem *addLayer( const TQString &displayName, LayerItem *after = 0, int id = -1 );
98 LayerItem *addLayer( const TQString &displayName, int afterID, int id = -1 );
100 LayerItem *addLayerToParent( const TQString &displayName, LayerItem *parent, LayerItem *after = 0, int id = -1 );
101 LayerItem *addLayerToParent( const TQString &displayName, int parentID, int afterID = -1, int id = -1 );
103 void moveLayer( LayerItem *layer, LayerItem *parent, LayerItem *after );
104 void moveLayer( int id, int parentID, int afterID );
106 void removeLayer( LayerItem *layer );
107 void removeLayer( int id );
110 void activated( LayerItem *layer );
111 void activated( int id );
113 void displayNameChanged( LayerItem *layer, const TQString &displayName );
114 void displayNameChanged( int id, const TQString &displayName );
116 void propertyChanged( LayerItem *layer, const TQString &name, bool on );
117 void propertyChanged( int id, const TQString &name, bool on );
119 void layerMoved( LayerItem *layer, LayerItem *parent, LayerItem *after );
120 void layerMoved( int id, int parentID, int afterID );
122 void requestNewLayer( LayerItem *parent, LayerItem *after );
123 void requestNewLayer( int parentID, int afterID );
125 void requestNewFolder( LayerItem *parent, LayerItem *after );
126 void requestNewFolder( int parentID, int afterID );
128 void requestRemoveLayer( LayerItem *layer );
129 void requestRemoveLayer( int id );
131 void requestRemoveLayers( TQValueList<LayerItem*> layers );
132 void requestRemoveLayers( TQValueList<int> ids );
134 void requestLayerProperties( LayerItem *layer );
135 void requestLayerProperties( int id );
138 LayerItem *firstChild() const;
139 LayerItem *lastChild() const;
142 virtual void constructMenu( LayerItem *layer );
143 virtual void menuActivated( int id, LayerItem *layer );
146 typedef TDEListView super;
147 friend class LayerItem;
148 friend class LayerToolTIp;
154 void slotItemRenamed( TQListViewItem *item, const TQString &text, int col );
155 void slotItemMoved( TQPtrList<TQListViewItem>&, TQPtrList<TQListViewItem>&, TQPtrList<TQListViewItem>& );
156 void showContextMenu();
161 virtual void setCurrentItem( TQListViewItem *i );
164 virtual void contentsMousePressEvent( TQMouseEvent *e );
165 virtual void contentsMouseDoubleClickEvent ( TQMouseEvent *e );
166 virtual void findDrop( const TQPoint &pos, TQListViewItem *&parent, TQListViewItem *&after );
169class LayerItem: public TDEListViewItem
172 LayerItem( const TQString &displayName, LayerList *parent, LayerItem *after = 0, int id = -1 );
173 LayerItem( const TQString &displayName, LayerItem *parent, LayerItem *after = 0, int id = -1 );
174 virtual ~LayerItem();
177 bool isFolder() const;
181 bool contains( const LayerItem *item);
185 TQString displayName() const;
186 void setDisplayName( const TQString &displayName );
188 bool isActive() const;
191 bool property( const TQString &name ) const;
192 void setProperty( const TQString &name, bool on );
193 void toggleProperty( const TQString &name );
195 void setPreviewImage( TQImage *image );
196 void previewChanged();
198 LayerItem *addLayer( const TQString &displayName, LayerItem *after = 0, int id = -1 );
200 LayerItem *prevSibling() const;
203 LayerItem *nextSibling() const;
204 LayerList *listView() const;
205 LayerItem *firstChild() const;
206 LayerItem *parent() const;
210 virtual TQRect rect() const;
212 int mapXFromListView( int x ) const;
213 int mapYFromListView( int y ) const;
214 TQPoint mapFromListView( const TQPoint &point ) const;
215 TQRect mapFromListView( const TQRect &rect ) const;
217 int mapXToListView( int x ) const;
218 int mapYToListView( int y ) const;
219 TQPoint mapToListView( const TQPoint &point ) const;
220 TQRect mapToListView( const TQRect &rect ) const;
222 virtual TQRect textRect() const;
223 virtual TQRect iconsRect() const;
224 virtual TQRect previewRect() const;
226 virtual void drawText( TQPainter *p, const TQColorGroup &cg, const TQRect &r );
227 virtual void drawIcons( TQPainter *p, const TQColorGroup &cg, const TQRect &r );
228 virtual void drawPreview( TQPainter *p, const TQColorGroup &cg, const TQRect &r );
230 bool multiline() const;
231 bool showPreview() const;
232 virtual TQFont font() const;
233 TQFontMetrics fontMetrics() const;
235 virtual bool mousePressEvent( TQMouseEvent *e );
237 virtual TQString tooltip() const;
239 virtual TQImage *previewImage() const;
240 virtual TQImage tooltipPreview() const;
243 typedef TDEListViewItem super;
244 friend class LayerList;
245 friend class LayerToolTip;
253 virtual int width( const TQFontMetrics &fm, const TQListView *lv, int c ) const;
254 virtual void paintCell( TQPainter *p, const TQColorGroup &cg, int column, int width, int align );
255 virtual void setup();
256 virtual void setSelected( bool selected );
259class LayerFolder: public LayerItem
262 LayerFolder( const TQString &displayName, LayerList *parent, LayerItem *after = 0, int id = -1 )
263 : LayerItem( displayName, parent, after, id ) { makeFolder(); }
264 LayerFolder( const TQString &displayName, LayerItem *parent, LayerItem *after = 0, int id = -1 )
265 : LayerItem( displayName, parent, after, id ) { makeFolder(); }
|