]> Shamusworld >> Repos - architektonas/blob - src/widgets/qg_blockwidget.h
In the middle of major refactoring...
[architektonas] / src / widgets / qg_blockwidget.h
1 /****************************************************************************
2 ** $Id: qg_blockwidget.h 1563 2004-04-04 22:51:54Z andrew $
3 **
4 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
5 **
6 ** This file is part of the qcadlib Library project.
7 **
8 ** This file may be distributed and/or modified under the terms of the
9 ** GNU General Public License version 2 as published by the Free Software
10 ** Foundation and appearing in the file LICENSE.GPL included in the
11 ** packaging of this file.
12 **
13 ** Licensees holding valid qcadlib Professional Edition licenses may use
14 ** this file in accordance with the qcadlib Commercial License
15 ** Agreement provided with the Software.
16 **
17 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 **
20 ** See http://www.ribbonsoft.com for further details.
21 **
22 ** Contact info@ribbonsoft.com if any conditions of this licensing are
23 ** not clear to you.
24 **
25 **********************************************************************/
26
27 #ifndef QG_BLOCKWIDGET_H
28 #define QG_BLOCKWIDGET_H
29
30 #include <QtGui>
31 #include "rs_blocklist.h"
32 #include "rs_blocklistlistener.h"
33 #include "qg_actionhandler.h"
34
35 /**
36  * This is the Qt implementation of a widget which can view a
37  * block list.
38  */
39 class QG_BlockWidget: public QWidget, public RS_BlockListListener
40 {
41     Q_OBJECT
42
43         public:
44                 QG_BlockWidget(QG_ActionHandler * ah, QWidget * parent,
45                         const char * name = 0, Qt::WFlags f = 0);
46                 ~QG_BlockWidget();
47
48                 void setBlockList(RS_BlockList * blockList);
49                 RS_BlockList * getBlockList();
50                 void update();
51                 void highlightBlock(RS_Block * block);
52
53                 virtual void blockAdded(RS_Block *);
54                 virtual void blockEdited(RS_Block *);
55                 virtual void blockRemoved(RS_Block *);
56                 virtual void blockToggled(RS_Block *);
57
58         signals:
59                 void escape();
60
61         public slots:
62                 //void slotToggleView(QListBoxItem* item);
63 //              void slotActivated(const QString & blockName);
64                 void slotActivated(void);
65 //              void slotMouseButtonClicked(int button, Q3ListBoxItem * item, const QPoint & pos);
66                 void slotMouseButtonClicked(QListWidgetItem * item);
67
68         protected:
69                 void contextMenuEvent(QContextMenuEvent * e);
70                 virtual void keyPressEvent(QKeyEvent * e);
71
72         private:
73                 RS_BlockList * blockList;
74 //              Q3ListBox * listBox;
75                 QListWidget * listBox;
76                 RS_Block * lastBlock;
77                 QPixmap pxmVisible;
78                 QPixmap pxmHidden;
79                 QPixmap pxmAdd;
80                 QPixmap pxmRemove;
81                 QPixmap pxmAttributes;
82                 QPixmap pxmEdit;
83                 QPixmap pxmInsert;
84                 QPixmap pxmDefreezeAll;
85                 QPixmap pxmFreezeAll;
86                 QG_ActionHandler * actionHandler;
87 };
88
89 #endif