karbon

vdocumentdocker.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, 2002, 2003 The Karbon Developers
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef __VDOCUMENTDOCKER_H__
21#define __VDOCUMENTDOCKER_H__
22
23#include <tqlistview.h>
24#include <tqptrdict.h>
25
26class TQHButtonGroup;
27class TQPoint;
28class TQLabel;
29class TQPixmap;
30class TQCheckBox;
31
32class VDocument;
33class VLayer;
34class KarbonView;
35
36/*************************************************************************
37 * Document Tab *
38 *************************************************************************/
39
40class VDocumentPreview : public TQWidget
41{
42 TQ_OBJECT
43
44
45 public:
46 VDocumentPreview( KarbonView* view, TQWidget* parent = 0 );
47 ~VDocumentPreview();
48
49 void reset();
50
51 protected:
52 void paintEvent( TQPaintEvent* e );
53 virtual bool eventFilter( TQObject* object, TQEvent* event );
54
55 private:
56 VDocument *m_document;
57 KarbonView *m_view;
58 KoPoint m_firstPoint;
59 KoPoint m_lastPoint;
60 bool m_dragging;
61 TQPixmap *m_docpixmap;
62}; // VDocumentPreview
63
64class VDocumentTab : public TQWidget
65{
66 TQ_OBJECT
67
68
69 public:
70 VDocumentTab( KarbonView* view, TQWidget* parent );
71 ~VDocumentTab();
72
73 public slots:
74 void updateDocumentInfo();
75 void slotCommandAdded( VCommand* command );
76 void slotZoomChanged( double );
77 void slotViewportChanged();
78 void slotCommandExecuted();
79
80 private:
81 VDocumentPreview* m_documentPreview;
82 TQLabel* m_height;
83 TQLabel* m_width;
84 TQLabel* m_layers;
85 TQLabel* m_format;
86
87 KarbonView* m_view;
88}; // VDocumentTab
89
90/*************************************************************************
91 * Layers Tab *
92 *************************************************************************/
93
94class VLayerListViewItem : public TQCheckListItem
95{
96public:
97 VLayerListViewItem( TQListView* parent, VLayer* layer, VDocument *doc, TQPtrDict<VLayerListViewItem> *map );
98 virtual ~VLayerListViewItem();
99
100 VLayer* layer() { return m_layer; }
101 int pos();
102 void update();
103 virtual TQString key( int column, bool ascending ) const;
104 virtual int compare( TQListViewItem *i, int col, bool ascending ) const;
105 void setKey( uint key ) { m_key = key; }
106
107protected:
108 virtual void stateChange( bool on );
109
110private:
111 VLayer *m_layer;
112 VDocument *m_document;
113 uint m_key;
114 TQPtrDict<VLayerListViewItem> *m_map;
115}; // VLayerListViewItem
116
117class VObjectListViewItem : public TQListViewItem
118{
119public:
120 VObjectListViewItem( TQListViewItem* parent, VObject* object, VDocument *doc, uint key, TQPtrDict<VObjectListViewItem> *map );
121 virtual ~VObjectListViewItem();
122
123 VObject* object() { return m_object; }
124 void update();
125 virtual TQString key( int column, bool ascending ) const;
126 virtual int compare( TQListViewItem *i, int col, bool ascending ) const;
127 void setKey( uint key ) { m_key = key; }
128private:
129 VObject *m_object;
130 VDocument *m_document;
131 uint m_key;
132 TQPtrDict<VObjectListViewItem> *m_map;
133};
134
135class VLayersTab : public TQWidget
136{
137TQ_OBJECT
138
139
140public:
141 VLayersTab( KarbonView* view, TQWidget* parent = 0 );
142 ~VLayersTab();
143
144public slots:
145 void updatePreviews();
146 void updateLayers();
147
148 void itemClicked( TQListViewItem* item, const TQPoint&, int col );
149 void selectionChangedFromList();
150 void selectionChangedFromTool();
151 void renameItem( TQListViewItem* item, const TQPoint&, int col );
152 void addLayer();
153 void raiseItem();
154 void lowerItem();
155 void deleteItem();
156 void slotCommandExecuted( VCommand* command );
157
158private slots:
159 void slotButtonClicked( int ID );
160 void removeDeletedObjectsFromList();
161 void updateChildItems( TQListViewItem *item );
162 void toggleState( VObject *obj, int col );
163
164protected:
165 VLayerListViewItem* listItem( int pos );
166 void updateObjects( VObject *object, TQListViewItem *item );
167 void resetSelection();
168 void selectActiveLayer();
169
170private:
171 TQListView *m_layersListView;
172 TQHButtonGroup *m_buttonGroup;
173 KarbonView *m_view;
174 VDocument *m_document;
175 TQPtrDict<VLayerListViewItem> m_layers;
176 TQPtrDict<VObjectListViewItem> m_objects;
177}; // VLayersTab
178
179/*************************************************************************
180 * History Tab *
181 *************************************************************************/
182
183class VHistoryItem;
184
185class VHistoryGroupItem : public TQListViewItem
186{
187 public:
188 VHistoryGroupItem( VHistoryItem* item, TQListView* parent, TQListViewItem* after );
189 ~VHistoryGroupItem();
190
191 void paintCell( TQPainter* p, const TQColorGroup& cg, int column, int width, int align );
192 void paintFocus( TQPainter*, const TQColorGroup&, const TQRect& );
193
194 virtual TQString key( int, bool ) const { return m_key; }
195 virtual int rtti() const { return 1001; }
196
197 private:
198 TQString m_key;
199}; // VHistoryGroupItem
200
201class VHistoryItem : public TQListViewItem
202{
203 public:
204 VHistoryItem( VCommand* command, TQListView* parent, TQListViewItem* after );
205 VHistoryItem( VCommand* command, VHistoryGroupItem* parent, TQListViewItem* after );
206 ~VHistoryItem();
207
208 VCommand* command() { return m_command; }
209
210 void paintCell( TQPainter* p, const TQColorGroup& cg, int column, int width, int align );
211 void paintFocus( TQPainter*, const TQColorGroup&, const TQRect& );
212
213 virtual TQString key( int, bool ) const { return m_key; }
214 virtual int rtti() const { return 1002; }
215
216 private:
217 void init();
218
219 TQString m_key;
220 VCommand* m_command;
221}; // VHistoryItem
222
223class VHistoryTab : public TQWidget
224{
225 TQ_OBJECT
226
227
228 public:
229 VHistoryTab( KarbonPart* part, TQWidget* parent );
230 ~VHistoryTab();
231
232 bool groupingEnabled();
233
234 public slots:
235 void historyCleared();
236 void commandExecuted( VCommand* command );
237 void slotCommandAdded( VCommand* command );
238 void removeFirstCommand();
239 void removeLastCommand();
240
241 void commandClicked( int button, TQListViewItem* item, const TQPoint& point, int col );
242 void groupingChanged( int );
243
244 signals:
245 void undoCommand( VCommand* command );
246 void redoCommand( VCommand* command );
247 void undoCommandsTo( VCommand* command );
248 void redoCommandsTo( VCommand* command );
249
250 private:
251 TQListView* m_history;
252 TQListViewItem* m_lastCommand;
253 TQCheckBox* m_groupCommands;
254 long m_lastCommandIndex;
255
256 KarbonPart* m_part;
257}; // VHistoryTab
258
259#endif
260
Keeps track of visual per document properties.
Definition karbon_part.h:46
The base class for all karbon commands.
Definition vcommand.h:42
All non-visual, static doc info is in here.
Definition vdocument.h:53
VLayer manages a set of vobjects.
Definition vlayer.h:37
The base class for all karbon objects.
Definition vobject.h:50