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.
kbarcode/kbarcode/barkodeengine.h

104 lines
3.2 KiB

/***************************************************************************
barkodeengine.h - description
-------------------
begin : Fri Nov 05 2004
copyright : (C) 2002 by Dominik Seichter
email : domseichter@web.de
***************************************************************************/
/***************************************************************************
* *
* 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 BARKODEENGINE_H
#define BARKODEENGINE_H
/**
* The different generator backends / engines
*/
typedef enum { GNU_BARCODE, PDF417, TBARCODE, TBARCODE2, PIXMAP, PURE_POSTSCRIPT, NONE } EEngine;
class Barkode;
class TQDomElement;
class TQPainter;
/** An interface for additional special options
* supported by a BarkodeEngine
*/
class BarkodeEngineOptions {
public:
BarkodeEngineOptions() {};
virtual ~BarkodeEngineOptions() {};
virtual void defaults() = 0;
virtual void load( const TQDomElement* tag ) = 0;
virtual void save( TQDomElement* tag ) = 0;
};
#include <tqsize.h>
/**
* Inherit from this class if you want to create a
* (barkode engine) for use with KBarcode.
* @author Dominik Seichter
*/
class BarkodeEngine{
public:
BarkodeEngine();
virtual ~BarkodeEngine();
virtual const BarkodeEngine & operator=( const BarkodeEngine & rhs ) = 0;
virtual EEngine engine() const = 0;
virtual void update( const TQPaintDevice* device ) = 0;
virtual const TQSize size() const = 0;
void setBarkode( Barkode* b ) { barkode = b; }
virtual void drawBarcode( TQPainter & painter, int x, int y ) = 0;
/** @returns a pointer to a BarkodeEngineOptions object
* if this BarkodeEngine has one. Otherwise null is returned.
* The returned object has to be casted down to the concrete object
* you want to use, before setting any of the options.
*/
virtual BarkodeEngineOptions* options();
protected:
Barkode* barkode;
TQSize m_size;
bool m_valid;
};
/** A barcode engine with implemented empty and does
* nothing
*/
class EmptyEngine : public BarkodeEngine {
public:
EmptyEngine();
virtual inline const BarkodeEngine & operator=( const BarkodeEngine & rhs );
virtual inline EEngine engine() const;
virtual void update( const TQPaintDevice* device );
virtual const TQSize size() const;
virtual void drawBarcode( TQPainter & painter, int x, int y );
};
const BarkodeEngine & EmptyEngine::operator=( const BarkodeEngine & )
{
return *this;
}
EEngine EmptyEngine::engine() const
{
return NONE;
}
#endif