You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
codeine/src/app/analyzer.h

76 lines
1.6 KiB

// (c) 2004 Max Howell (max.howell@methylblue.com)
// See COPYING file for licensing information
#ifndef ANALYZER_H
#define ANALYZER_H
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <ntqpixmap.h> //stack allocated and convenience
#include <ntqtimer.h> //stack allocated
#include <ntqwidget.h> //baseclass
#include <vector> //included for convenience
namespace Analyzer
{
typedef std::vector<float> Scope;
template<class W> class Base : public W
{
public:
uint timeout() const { return m_timeout; }
protected:
Base( TQWidget*, uint );
virtual void transform( Scope& ) = 0;
virtual void analyze( const Scope& ) = 0;
private:
virtual bool event( TQEvent* );
protected:
TQTimer m_timer;
uint m_timeout;
};
class Base2D : public Base<TQWidget>
{
Q_OBJECT
public:
const TQPixmap *canvas() const { return &m_canvas; }
private slots:
void draw();
protected:
Base2D( TQWidget*, uint timeout );
TQPixmap *canvas() { return &m_canvas; }
void paintEvent( TQPaintEvent* ) { if( !m_canvas.isNull() ) bitBlt( this, 0, 0, canvas() ); }
void resizeEvent( TQResizeEvent* );
private:
TQPixmap m_canvas;
};
class Block : public Analyzer::Base2D
{
public:
Block( TQWidget* );
protected:
virtual void transform( Analyzer::Scope& );
virtual void analyze( const Analyzer::Scope& );
virtual int heightForWidth( int ) const;
virtual void show() {} //TODO temporary as the scope plugin causes freezes
};
}
#endif