summaryrefslogtreecommitdiffstats
path: root/kugar/lib/mreportobject.h
blob: ce28cf75387cd567541e74519b0af4d72e5f92a3 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/***************************************************************************
             mreportobject.h  -  Kugar report object baseclass
             -------------------
   begin     : Wed Aug 11 1999
   copyright : (C) 1999 by Mutiny Bay Software
   email     : info@mutinybaysoftware.com
   copyright : (C) 2004 Alexander Dymo
   email     : cloudtemple@mksat.net
***************************************************************************/

#ifndef MREPORTOBJECT_H
#define MREPORTOBJECT_H

#include <qobject.h>
#include <qpainter.h>
#include <qpaintdevice.h>
#include <qcolor.h>

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

namespace Kugar
{

class MReportObject : public QObject
{

public:
    /** Border style constants */
    enum BorderStyle { NoPen = 0, SolidLine, DashLine,
                       DotLine, DashDotLine, DashDotDotLine };

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

protected:
    /** Object's x position */
    int xpos;
    /** Object's y postition */
    int ypos;
    /** Object's width */
    int width;
    /** Object's height */
    int height;

    /** Object's background color */
    QColor backgroundColor;
    /** Object's foreground color */
    QColor foregroundColor;

    /** Object's border color */
    QColor borderColor;
    /** Object's border width */
    int borderWidth;
    /** Object's border style */
    int borderStyle;
    /** Draw left border */
    bool drawLeft;
    /** Draw right border */
    bool drawRight;
    /** Draw top border */
    bool drawTop;
    /** Draw bottom border */
    bool drawBottom;

public:
    /** Draws the object to the specified painter & x/y offsets */
    virtual void draw( QPainter* p, int xoffset, int yoffset );
    /** Sets the object's position and size */
    void setGeometry( int x, int y, int w, int h );
    /** Sets the object's position */
    void move( int x, int y );
    /** Gets the object's x position */
    int getX();
    /** Gets the object's y position */
    int getY();
    /** Sets the object's background color - default is white*/
    void setBackgroundColor( int r, int g, int b );
    /** Sets the object's foreground color - default is black*/
    void setForegroundColor( int r, int g, int b );
    /** Sets the object's border color - default is black*/
    void setBorderColor( int r, int g, int b );
    /** Sets the object's border width - default is 1*/
    void setBorderWidth( int width );
    /** Sets the object's border style - default is SolidLine*/
    void setBorderStyle( int style );

    /** Gets the draw left border flag */
    bool getDrawLeft();
    /** Gets the draw right border flag */
    bool getDrawRight();
    /** Gets the draw top border flag */
    bool getDrawTop();
    /** Gets the draw bottom border flag */
    bool getDrawBottom();

    /** Sets the draw left border flag */
    void setDrawLeft( bool d );
    /** Sets the draw right border flag */
    void setDrawRight( bool d );
    /** Sets the draw top border flag */
    void setDrawTop( bool d );
    /** Sets the draw bottom border flag */
    void setDrawBottom( bool d );

protected:
    /** Draws the base object to the specified painter & x/y offsets */
    void drawBase( QPainter* 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 MReportObject* mReportObject );

};

}

#endif