/* * QCameraPathDropSite.cpp * $Id: * * Copyright (C) 2001 Thomas Woerner, Michael Meissner, Markus Janich * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * As a special exception to the GPL, the QGLViewer authors (Markus * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas * Woerner) give permission to link this program with Qt (non-)commercial * edition, and distribute the resulting executable, without including * the source code for the Qt (non-)commercial edition in the source * distribution. * */ /* [tw] 2001/05/08 initial version */ // Qt /////// #include #include #include // Own //////// #include "QCameraPathDropSite.h" #include "QCameraPathDrag.h" #include "pictures/dragcamerapath.xpm" // Function : QCameraDropSite // Parameters: CCamera *pCamera, // QWidget *parent, // const char *sName // Purpose : default constructor // Comments : QCameraPathDropSite::QCameraPathDropSite(QWidget *parent, const char *sName) : QLabel(parent, sName) /****************************************************************/ { QPixmap dragCameraPix((const char **) dragcamerapath_xpm); if (!(dragCameraPix.isNull())) setPixmap(dragCameraPix); else setText("Drag and Drop"); setAlignment(Qt::AlignCenter); setFrameStyle(QFrame::Raised + QFrame::WinPanel); setAcceptDrops(TRUE); } // Function : dragEnterEvent // Parameters: QDragEnterEvent *pqEvent // Purpose : handles QDragEnterEvents // Comments : void QCameraPathDropSite::dragEnterEvent(QDragEnterEvent *pqEvent) /****************************************************************/ { if (!isEnabled()) return; if (QCameraPathDrag::canDecode(pqEvent)) { pqEvent->accept(); setFrameStyle(QFrame::Sunken + QFrame::WinPanel); } } // Function : dragLeaveEvent // Parameters: QDragLeaveEvent *pqEvent // Purpose : handles QDragLeaveEvents // Comments : void QCameraPathDropSite::dragLeaveEvent(QDragLeaveEvent *) /****************************************************************/ { setFrameStyle(QFrame::Raised + QFrame::WinPanel); } // Function : dropEvent // Parameters: QDropEvent *pqEvent // Purpose : handles QDropEvents // Comments : void QCameraPathDropSite::dropEvent(QDropEvent *pqEvent) /****************************************************************/ { CList list; if (pqEvent->source() != this) if (QCameraPathDrag::decode(pqEvent, list)) emit(sigCameraPathDropped(list)); setFrameStyle(QFrame::Raised + QFrame::WinPanel); } // Function : mousePressEvent // Parameters: QMouseEvent *pqEvent // Purpose : handles mouse press events // Comments : void QCameraPathDropSite::mousePressEvent(QMouseEvent *) /****************************************************************/ { QDragObject *pqDragObject; if (m_CameraList.getNumObjects() > 0) { setFrameStyle(QFrame::Sunken + QFrame::WinPanel); pqDragObject = new QCameraPathDrag(m_CameraList, this); pqDragObject->setPixmap(QPixmap((const char **) dragcamerapath_xpm), QPoint(13, 10)); pqDragObject->dragCopy(); } } // Function : mouseReleaseEvent // Parameters: QMouseEvent *pqEvent // Purpose : handles mouse release events // Comments : void QCameraPathDropSite::mouseReleaseEvent(QMouseEvent *) /****************************************************************/ { setFrameStyle(QFrame::Raised + QFrame::WinPanel); }