1 /*
2  * Hydrogen
3  * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4  *
5  * http://www.hydrogen-music.org
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY, without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  *
21  */
22 
23 #include "SoundLibraryTree.h"
24 #include <QMimeData>
25 
26 const char* SoundLibraryTree::__class_name = "SoundLibraryTree";
27 
SoundLibraryTree(QWidget * pParent)28 SoundLibraryTree::SoundLibraryTree( QWidget *pParent )
29  : QTreeWidget( pParent )
30  , Object( __class_name )
31 {
32 	setHeaderLabels( QStringList( tr( "Sound library" ) ) );
33 	setAlternatingRowColors( true );
34 	setRootIsDecorated( false );
35 
36 	headerItem()->setHidden( true ); // hides the header
37 
38 }
39 
40 
mousePressEvent(QMouseEvent * event)41 void SoundLibraryTree::mousePressEvent(QMouseEvent *event)
42 {
43 //	INFOLOG( "[mousePressEvent]" );
44 	QTreeWidget::mousePressEvent( event );
45 
46 	if ( event->button() == Qt::RightButton ) {
47 		emit rightClicked( QPoint( event->globalX(), event->globalY() ) );
48 
49 	}
50 	else if (event->button() == Qt::LeftButton ) {
51 		emit leftClicked( QPoint( event->globalX(), event->globalY() ) );
52 	}
53 }
54 
55 
56 
mouseMoveEvent(QMouseEvent * event)57 void SoundLibraryTree::mouseMoveEvent(QMouseEvent *event)
58 {
59 	emit onMouseMove( event );
60 }
61 
62 
63 
64