Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

qwavmarker.h

00001 /***************************************************************************
00002                        qwavmarker.h  -  description
00003                              -------------------
00004     begin                : 2003
00005     copyright            : (C) 2003 by Peter Eschler
00006     email                : peschler@t-online
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef Qwav_MARKER_H
00019 #define Qwav_MARKER_H
00020 
00021 #include <iostream>
00022 
00023 #include <qpixmap.h>
00024 
00025 //---------------------------------------------------------------------------
00026 // Includes: project
00027 //---------------------------------------------------------------------------
00028 
00029 #include "qwavdefines.h"
00030 
00031 Qwav_BEGIN_NAMESPACE
00032 
00033 //---------------------------------------------------------------------------
00034 // Class: QwavMarker
00035 //---------------------------------------------------------------------------
00036 
00041 class QWAV_EXPORTIMPORT QwavMarker
00042 {
00043 public:
00044     QwavMarker(unsigned long position = 0,                 
00045                const QColor& color = Qt::blue,
00046                uint          width = 9);
00047     QwavMarker(const QwavMarker& marker);        
00048     
00049     inline QwavMarker& operator= (const QwavMarker& m);
00050     inline bool        operator==(const QwavMarker&);
00051     
00052     inline const unsigned long& position() const;
00053     inline void                 setPosition(unsigned long sample);
00054     inline int                  id() const;
00055     inline const QPixmap&       pixmap() const;
00056     
00057 protected:
00058     QPixmap                     makeMarker(int width, const QColor& color);
00059 
00060 private:
00061     unsigned long   _pos;
00062     int             _id;    
00063     QPixmap         _pixmap;
00064     
00065     static int      _globalId;
00066 
00067 };
00068 
00069 
00070 //---------------------------------------------------------------------------
00071 // Method: position
00072 //---------------------------------------------------------------------------
00073 
00077 const unsigned long& QwavMarker::position() const
00078 {
00079     return _pos;
00080 }
00081 
00082 
00083 //---------------------------------------------------------------------------
00084 // Method: setPosition
00085 //---------------------------------------------------------------------------
00086 
00090 void QwavMarker::setPosition(unsigned long sample)
00091 {
00092     _pos = sample;
00093 }
00094 
00095 
00096 //---------------------------------------------------------------------------
00097 // Method: id
00098 //---------------------------------------------------------------------------
00099 
00104 int QwavMarker::id() const
00105 {
00106     return _id;
00107 }   
00108 
00109 
00110 //---------------------------------------------------------------------------
00111 // Method: operator=
00112 //---------------------------------------------------------------------------
00113  
00117 QwavMarker& QwavMarker::operator=(const QwavMarker& m)
00118 {
00119     _pos = m._pos;
00120     _id  = m._id;
00121     return *this;
00122 }
00123 
00124 
00125 //---------------------------------------------------------------------------
00126 // Method: operator==
00127 //---------------------------------------------------------------------------
00128 
00133 bool QwavMarker::operator==(const QwavMarker& m)
00134 {
00135     if( m._id == _id  &&  m._pos != _pos )
00136         std::cerr << "QwavMarker::operator==: id=" << _id << " == " << m._id
00137              << " && m._pos != pos. Error!\n";
00138     return (_id == m._id) ? true : false;
00139 }
00140 
00141 
00142 //---------------------------------------------------------------------------
00143 // Method: pixmap
00144 //---------------------------------------------------------------------------
00145 
00149 const QPixmap& QwavMarker::pixmap() const
00150 {
00151     return _pixmap;
00152 }
00153 
00154 Qwav_END_NAMESPACE
00155 
00156 
00157 #endif // Qwav_MARKER_H

Generated on Mon Jan 20 00:24:54 2003 for Qwav by doxygen1.2.16