BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: genericControl.h,v 1.14.16.1 2007/03/25 21:26:20 oliver Exp $ 00005 00006 #ifndef BALL_VIEW_WIDGETS_GENERICCONTROL_H 00007 #define BALL_VIEW_WIDGETS_GENERICCONTROL_H 00008 00009 #ifndef BALL_VIEW_WIDGETS_DOCKWIDGET_H 00010 # include <BALL/VIEW/WIDGETS/dockWidget.h> 00011 #endif 00012 00013 #include <QtGui/QKeyEvent> 00014 #include <QtGui/QTreeWidget> 00015 #include <QtGui/QTreeWidgetItem> 00016 #include <QtCore/QList> 00017 00018 namespace BALL 00019 { 00020 namespace VIEW 00021 { 00025 class TreeWidget 00026 : public QTreeWidget 00027 { 00028 public: 00029 00031 TreeWidget(QWidget* parent = 0); 00032 00034 void selectItems(const list<QTreeWidgetItem*>& items); 00035 }; 00036 00050 class BALL_VIEW_EXPORT GenericControl 00051 : public DockWidget 00052 { 00053 Q_OBJECT 00054 00055 public: 00056 00058 typedef QList<QTreeWidgetItem*> ItemList; 00059 00063 00066 BALL_EMBEDDABLE(GenericControl,DockWidget) 00067 00068 //@} 00072 00081 GenericControl(QWidget* parent = 0, const char* name = 0); 00082 00085 virtual ~GenericControl(); 00086 00087 ItemList getSelectedItems(); 00088 00090 QTreeWidgetItem* addRow(const QStringList& entries); 00091 00098 virtual void onNotify(Message *message); 00099 00107 virtual void initializeWidget(MainControl& main_control); 00108 00110 00111 public slots: 00112 00114 virtual void deleteCurrentItems(){}; 00115 00116 protected slots: 00117 00118 virtual void deselectOtherControls_(); 00119 00120 /*_ Call deselectOtherControls_ if a selection exists. 00121 Call this Method in the derived Classes in their updateSelection() 00122 */ 00123 virtual void updateSelection(); 00124 00125 virtual void onItemClicked(QTreeWidgetItem*, int) {}; 00126 00127 protected: 00128 00129 virtual void removeItem_(QTreeWidgetItem* item); 00130 00131 QTreeWidgetItem* context_item_; 00132 TreeWidget* listview; 00133 bool checkable_; 00134 }; 00135 00136 } } // namespaces 00137 #endif // BALL_VIEW_WIDGETS_GENERICCONTROL_H