summaryrefslogtreecommitdiffstats
path: root/kbarcode/gnubarcode.h
blob: afdec8ea0146b9b44cfe5fdd255c149deb6ef806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/***************************************************************************
                          gnubarcode.h  -  description
                             -------------------
    begin                : 
    copyright            : (C) 2005 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 GNU_BARCODE_H
#define GNU_BARCODE_H

// #define _ENABLE_NATIVE_GNU_BARCODE

#ifdef _ENABLE_NATIVE_GNU_BARCODE

#include "barkodeengine.h"

struct Barcode_Item;

class GnuBarcode : public BarkodeEngine {
 public:
    GnuBarcode();
    ~GnuBarcode();

    inline EEngine engine() const;

    const QSize size() const;
    void update( const QPaintDevice* device );
    void drawBarcode( QPainter & painter, int x, int y );

 private:
    /** Draws the barcodes bars if @p painter is not 0.
      * Otherwise only the required width is returned.
      */
    int drawBars( QPainter* painter, int x, int y );

    /** Draws the text if @p painter is not 0.
      * Otherwise only the required width is returned.
      */
    int drawText( QPainter* painter, int x, int y );
    
    /** Fill m_size with the needed space
      */
    void setupSize();
 
 private:
    int m_bar_height;
    int m_barcode_height;
    int m_font_size;
    
    double m_scalex;
    double m_scaley;
    double m_scale_ps_x;
    double m_scale_ps_y;
        
    Barcode_Item* m_item;
    QSize m_size;
};

EEngine GnuBarcode::engine() const
{
    return GNU_BARCODE;
}

#endif // _ENABLE_NATIVE_GNU_BARCODE
#endif /* GNU_BARCODE_H */