summaryrefslogtreecommitdiffstats
path: root/kbarcode/labelutils.h
blob: 88e352ea229892c777e673b4661dbe3d23f57953 (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
/***************************************************************************
                          labelutils.h  -  description
                             -------------------
    begin                : Sam Okt 26 2002
    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 LABELUTILS_H
#define LABELUTILS_H

class Definition;
class KPrinter;
class TQDomElement;
class TQFont;
class TQImage;
class TQPainter;
class TQPixmap;
class TQPaintDevice;
class TQPoint;
class TQRect;
class TQSize;
class TQString;
class TQStringList;
class TQSqlQuery;
class LabelUtils {
    public:
        LabelUtils();
        ~LabelUtils();

        enum _dpixy {
            DpiX,
            DpiY
        };

        double pixelToMm( double pixel, const TQPaintDevice* device, int mode = DpiX );
        double mmToPixel( double mm, const TQPaintDevice* device, int mode = DpiX );

        double pixelToPixelX( double unit, const TQPaintDevice* src, const TQPaintDevice* dest );
        double pixelToPixelY( double unit, const TQPaintDevice* src, const TQPaintDevice* dest );
        static TQSize stringSize( const TQString & t );
        static TQPixmap* drawString( const TQString & t, int w, int h, double rot = 0 );
        static TQPixmap* drawString( const TQString & t ) {
            return LabelUtils::drawString( t, 0, 0, 0 );
        }

        const TQString getTypeFromCaption( const TQString & cap );
        const TQString getModeFromCaption( const TQString & cap );
};

#endif