Ananas Library  0.9.5
wgrouptree.h
1 /****************************************************************************
2 ** $Id: wgrouptree.h,v 1.9 2008/04/12 18:05:35 app Exp $
3 **
4 ** Header file of the document plugin of Ananas
5 ** Designer and Engine applications
6 **
7 ** Created : 20031201
8 **
9 ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10 **
11 ** This file is part of the Ananas Plugins of the Ananas
12 ** automation accounting system.
13 **
14 ** This file may be distributed and/or modified under the terms of the
15 ** GNU General Public License version 2 as published by the Free Software
16 ** Foundation and appearing in the file LICENSE.GPL included in the
17 ** packaging of this file.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
23 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
24 **
25 ** Contact org@leaderit.ru if any conditions of this licensing are
26 ** not clear to you.
27 **
28 **********************************************************************/
29 
30 #ifndef WGROUPTREE_H
31 #define WGROUPTREE_H
32 
33 #include <qlistview.h>
34 #include <qwidgetplugin.h>
35 #include <qwidget.h>
36 #include "awidget.h"
37 
38 class wGroupTreeItem;
39 class wTreeView;
40 
41 class QT_WIDGET_PLUGIN_EXPORT wGroupTree : public aWidget
42 {
43  Q_OBJECT
44 public:
45  wTreeView *tree;
46  wGroupTreeItem *root;
47 
48  wGroupTree( QWidget *parent = 0, WFlags fl = 0 );
49  virtual ~wGroupTree();
50 
51  virtual void initObject( aDatabase *adb );
52  virtual QDialog* createEditor( QWidget *parent );
53  virtual QToolBar* createToolBar( QMainWindow *parent );
54  virtual aObject *createDBObject( aCfgItem obj, aDatabase *adb );
55  void buildGroupTree( aCfgItem obj, aCatGroup * cg1, wGroupTreeItem * wG );
56  wGroupTreeItem *findItem( ANANAS_UID id );
57 public slots:
58  void findGroupTree();
59  void NewGroup();
60  void DeleteGroup();
61  void EditGroup();
62  virtual QString Uid() { return QString("%1").arg(currentId); };
63 // void UpdateItem( aCatGroup *g );
64 private slots:
65  void on_selected( ANANAS_UID element );
66 // void updateItem( ANANAS_UID element );
67  void updateItem( ANANAS_UID element );
68  void on_selectionChanged( QListViewItem *);
69  void dropped(QDropEvent*);
70 signals:
71  virtual void selected( ANANAS_UID group );
72  virtual void selectionChanged( const Q_ULLONG );
73 protected:
74  virtual void keyPressEvent ( QKeyEvent *e );
75 private:
76  Q_ULLONG currentId;
77 };
78 
79 
80 
81 class wGroupTreeItem : public QListViewItem
82 {
83 public:
84  ANANAS_UID id;
85  int level;
86  wGroupTreeItem( QListView *parent, const QString &name = QString::null );
87  wGroupTreeItem( wGroupTreeItem *parent, wGroupTreeItem *after, const QString &name = QString::null, int newlevel = 0, ANANAS_UID newid = 0 );
88  wGroupTreeItem( wGroupTreeItem *parent, wGroupTreeItem *after, aCatGroup *g = 0 );
89  virtual ~wGroupTreeItem();
90  wGroupTreeItem *parentItem();
91 private:
92 };
93 
94 class wTreeView : public QListView
95 {
96  Q_OBJECT
97 public:
98  wTreeView(QWidget * parent);
99 protected:
100  virtual void dragEnterEvent(QDragEnterEvent *);
101  virtual void dragMoveEvent(QDragMoveEvent *);
102  virtual void dropEvent(QDropEvent *);
103 };
104 
105 #endif // WGROUPTREE_H
virtual QToolBar * createToolBar(QMainWindow *parent)
Definition: awidget.cpp:152
Definition: wgrouptree.h:81
Definition: wgrouptree.h:94
virtual void initObject(aDatabase *adb)
Definition: awidget.cpp:187
virtual aObject * createDBObject(aCfgItem obj, aDatabase *)
Definition: awidget.cpp:135
Definition: acatalogue.h:154
Definition: adatabase.h:77
Definition: awidget.h:52
Definition: aobject.h:63
Definition: wgrouptree.h:41