summaryrefslogtreecommitdiffstats
path: root/kugar/lib/mlabelobject.h
blob: 3526552e317e0850e532ce91179b826b51a63e61 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/***************************************************************************
             mlabelobject.h  -  Kugar report label object
             -------------------
   begin     : Wed Aug 11 1999
   copyright : (C) 1999 by Mutiny Bay Software
   email     : [email protected]
***************************************************************************/

#ifndef MLABELOBJECT_H
#define MLABELOBJECT_H

#include <tqstring.h>
#include <tqfontmetrics.h>

#include "mreportobject.h"

/**Kugar report label object
  *@author Mutiny Bay Software
  */

namespace Kugar
{

class MLabelObject : public MReportObject
{

public:
    /** Font weight constants */
    enum FontWeight { Light = 25, Normal = 50, DemiBold = 63, Bold = 75, Black = 87 };
    /**Qt::Horizontal alignment constants */
    enum HAlignment { Left = 0, Center, Right };
    /** Vertial alignment constants */
    enum VAlignment { Top = 0, Middle, Bottom };

    /** Constructor */
    MLabelObject();
    /** Copy constructor */
    MLabelObject( const MLabelObject& mLabelObject );
    /** Assignment operator */
    MLabelObject operator=( const MLabelObject& mLabelObject );
    /** Destructor */
    virtual ~MLabelObject();

protected:
    /** Label text */
    TQString text;
    /** Label text font family  */
    TQString fontFamily;
    /** Label text font size in points */
    int fontSize;
    /** Label text font weight */
    int fontWeight;
    /** Label text font italic flag */
    bool fontItalic;
    /** Lable text horizontal alignment */
    int hAlignment;
    /** Label text vertical alignment  */
    int vAlignment;
    /** Label text word wrap flag  */
    bool wordWrap;

private:
    /** Label text horizontal margin spacing */
    const int xMargin;
    /** Label text vertical margin spacing */
    const int yMargin;

public:
    /** Sets the label's text string - default is an empty string*/
    virtual void setText( const TQString txt );
    /** Sets the label's text font - default is Times,10,Normal,false */
    void setFont( const TQString family, int size, int weight, bool italic );
    /** Sets the label's horizontal alignment -default is Left */
    void setHorizontalAlignment( int a );
    /** Sets the label's vertical alignment - default is Top */
    void setVerticalAlignment( int a );
    /** Sets the label's word wrap flag - default is false */
    void setWordWrap( bool state );
    /** Draws the label using the specificed painter & x/y-offsets */
    void draw( TQPainter* p, int xoffset, int yoffset );

private:
    /** Copies member data from one object to another.
      * Used by the copy constructor and assignment operator
      */
    void copy( const MLabelObject* mLabelObject );

};

}

#endif