/*************************************************************************** CTree.h - description ------------------- begin : Mon Mar 27 2000 copyright : (C) 2000 by Alexander Theel email : alex.theel@gmx.net ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef CTREE_H #define CTREE_H #include "../information/IView.h" #include #include #include #include "./dialogs/propertyDialog/CPropertyDialog.h" #include "./dialogs/searchDialog/searchdialog.h" #include #include #include #include #include #include #include "../information/CInformationCollection.h" #include "../information/CTreeInformationElement.h" #include "CTreeElement.h" #include "../fontsettings.h" #include "../CTuxCardsConfiguration.h" #include #include "../information/Path.h" class CTree : public QListView, public IView { Q_OBJECT private: CInformationCollection* mpCollection; QPopupMenu mContextMenu; CPropertyDialog mPropertyDialog; SearchDialog mSearchDialog; //CTreeElement* draggedElement; QPoint mPressPos; bool mbMousePressed; QTimer mAutoOpenTimer; CTreeElement* mpOldCurrent; CTreeElement* mpDropElement; const int miAutoOpenTime; CInformationElement* getCurrentActive( void ); CTreeElement* getCurrentActiveTreeElement( void ); CTreeElement* getTreeElement(Path path); CTreeElement* findChildWithName(const QString name); void clearTree( void ); void setDefaultTreeContents( void ); void settingUpContextMenu( void ); void addInformationElementsToTreeItem( CTreeElement&, CTreeInformationElement& ); protected: // virtual void startDrag(); void contentsMousePressEvent( QMouseEvent* pE ); void contentsMouseMoveEvent( QMouseEvent* pE ); void contentsMouseReleaseEvent( QMouseEvent* pE ); void contentsDragEnterEvent( QDragEnterEvent* pE ); void contentsDragMoveEvent( QDragMoveEvent* pE ); void contentsDragLeaveEvent( QDragLeaveEvent* pE ); void contentsDropEvent( QDropEvent* pE ); void resizeEvent( QResizeEvent* pE ); protected slots: void elementOpenedEvent( QListViewItem* pItem ); void elementClosedEvent( QListViewItem* pItem ); void rightButtonPressed( QListViewItem* pItem ); void timeoutEvent( void ); void addEntryToBookmarks( void ); void inPlaceRenaming( QListViewItem* pItem , int iCol, const QString& sText ); void moveElementUp(); void moveElementDown(); public: CTree( QWidget* pParent, CTuxCardsConfiguration& refTuxConfiguration ); ~CTree( void ); void setColumnText( QString text ); void createTreeFromCollection( CInformationCollection& collection ); void deleteElement( CTreeElement* ); // ************** IView ********************************** virtual void aboutToRemoveElement( CInformationElement* pIE ); public slots: // "contextmenu" void addElement( void ); void changeActiveElementProperties( void ); void askForDeletion( void ); // "mousecalls" void selectionChanged( QListViewItem* pItem ); void currentChanged( QListViewItem* pItem ); virtual void keyPressEvent( QKeyEvent* pK ); // void removeAll( void ); void search( void ); // void makeVisible(Knoten*, int, int, int); void activeInformationElementChanged( CInformationElement* ); signals: void showMessage(QString, int time); void makeVisible( SearchPosition* ); void addEntryToBookmarksSignal( void ); }; #endif