summaryrefslogtreecommitdiffstats
path: root/tdefx/kdrawutil.h
blob: 76d6070c3f99e29ae26bd4d77dfd8a428e75712b (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/* This file is part of the KDE libraries
   Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/
#ifndef __KDRAWUTIL_H
#define __KDRAWUTIL_H

#include <tqnamespace.h>
#include <tqpainter.h>
#include <tqbitmap.h>
#include <tqpalette.h>

#include <kdelibs_export.h>

/*
 * Various drawing routines. Also see Qt's tqdrawutil.h for some more routines
 * contained in Qt.
 *
 * (C) Daniel M. Duley <mosfet@kde.org>
 */

/**
 * @relates KStyle
 * @c \#include @c <kdrawutil.h>
 *
 * Draws a Next-style button (solid black shadow with light and midlight highlight).
 * 
 * @param p       The painter to use for drawing the button.
 * @param r       Specifies the rect in which to draw the button.
 * @param g       Specifies the shading colors.
 * @param sunken  Whether to draw the button as sunken (pressed) or not.
 * @param fill    The brush to use for filling the interior of the button.
 *                Pass @a null to prevent the button from being filled.
 */
TDEFX_EXPORT void kDrawNextButton(TQPainter *p, const TQRect &r, const TQColorGroup &g,
                     bool sunken=false, const TQBrush *fill=0);

/**
 * @relates KStyle
 * @overload
 */
TDEFX_EXPORT void kDrawNextButton(TQPainter *p, int x, int y, int w, int h,
                     const TQColorGroup &g, bool sunken=false, 
                     const TQBrush *fill=0);

/**
 * @relates KStyle
 * @c \#include @c <kdrawutil.h>
 *
 * Draws a Be-style button.
 *
 * @param p       The painter to use for drawing the button.
 * @param r       Specifies the rect in which to draw the button.
 * @param g       Specifies the shading colors.
 * @param sunken  Whether to draw the button as sunken (pressed) or not.
 * @param fill    The brush to use for filling the interior of the button.
 *                Pass @a null to prevent the button from being filled.
 */
TDEFX_EXPORT void kDrawBeButton(TQPainter *p, TQRect &r, const TQColorGroup &g,
                   bool sunken=false, const TQBrush *fill=0);

/**
 * @relates KStyle
 * @c \#include @c <kdrawutil.h>
 * @overload
 */
TDEFX_EXPORT void kDrawBeButton(TQPainter *p, int x, int y, int w, int h,
                   const TQColorGroup &g, bool sunken=false, 
                   const TQBrush *fill=0);

/**
 * @relates KStyle
 * @c \#include @c <kdrawutil.h>
 *
 * Draws a rounded oval button. This function doesn't fill the button.
 * See kRoundMaskRegion() for setting masks for fills.
 *
 * @param p       The painter to use for drawing the button.
 * @param r       Specifies the rect in which to draw the button.
 * @param g       Specifies the shading colors.
 * @param sunken  Whether to draw the button as sunken (pressed) or not.
 */
TDEFX_EXPORT void kDrawRoundButton(TQPainter *p, const TQRect &r, const TQColorGroup &g,
                      bool sunken=false);

/**
 * @relates KStyle
 * @overload
 */
TDEFX_EXPORT void kDrawRoundButton(TQPainter *p, int x, int y, int w, int h,
                      const TQColorGroup &g, bool sunken=false);

/**
 * @relates KStyle
 * @c \#include @c <kdrawutil.h>
 *
 * Sets a region to the pixels covered by a round button of the given
 * size. You can use this to set clipping regions.
 * 
 * @param r  Reference to the region to set.
 * @param x  The X coordinate of the button.
 * @param y  The Y coordinate of the button.
 * @param w  The width of the button.
 * @param h  The height of the button.
 *
 * @see kDrawRoundButton() and kDrawRoundMask()
 */
TDEFX_EXPORT void kRoundMaskRegion(TQRegion &r, int x, int y, int w, int h);

/**
 * @relates KStyle
 * @c \#include @c <kdrawutil.h>
 *
 * Paints the pixels covered by a round button of the given size with
 * Qt::color1. This function is useful in TQStyle::tqdrawControlMask().
 *
 * @param p      The painter to use for drawing the button.
 * @param x      The X coordinate of the button.
 * @param y      The Y coordinate of the button.
 * @param w      The width of the button.
 * @param h      The height of the button.
 * @param clear  Whether to clear the rectangle specified by @p (x, y, w, h) to
 *               Qt::color0 before drawing the mask.
 */
TDEFX_EXPORT void kDrawRoundMask(TQPainter *p, int x, int y, int w, int h, bool clear=false);

/**
 * @relates KStyle
 * @c \#include @c <kdrawutil.h>
 *
 * Paints the provided bitmaps in the painter, using the supplied colorgroup for
 * the foreground colors. There's one bitmap for each color. If you want to skip
 * a color, pass @a null for the corresponding bitmap.
 *
 * @note The bitmaps will be self-masked automatically if not masked
 *       prior to calling this routine.
 *
 * @param p             The painter to use for drawing the bitmaps.
 * @param g             Specifies the shading colors.
 * @param x             The X coordinate at which to draw the bitmaps.
 * @param y             The Y coordinate at which to draw the bitmaps.
 * @param lightColor    The bitmap to use for the light part.
 * @param midColor      The bitmap to use for the mid part.
 * @param midlightColor The bitmap to use for the midlight part.
 * @param darkColor     The bitmap to use for the dark part.
 * @param blackColor    The bitmap to use for the black part.
 * @param whiteColor    The bitmap to use for the white part.
 *
 * @see QColorGroup
 */
TDEFX_EXPORT void kColorBitmaps(TQPainter *p, const TQColorGroup &g, int x, int y,
                   TQBitmap *lightColor=0, TQBitmap *midColor=0,
                   TQBitmap *midlightColor=0, TQBitmap *darkColor=0,
                   TQBitmap *blackColor=0, TQBitmap *whiteColor=0);

/**
 * @relates KStyle
 * @c \#include @c <kdrawutil.h>
 * @overload
 */
 TDEFX_EXPORT void kColorBitmaps(TQPainter *p, const TQColorGroup &g, int x, int y, int w,
                   int h, bool isXBitmaps=true, const uchar *lightColor = 0,
                   const uchar *midColor=0, const uchar *midlightColor=0,
                   const uchar *darkColor=0, const uchar *blackColor=0,
                   const uchar *whiteColor=0);

#endif