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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
/* This file is proposed to be part of the KDE libraries.
* Copyright (C) 2003 Laur Ivan <laurivan@eircom.net>
*
* Many thanks to:
* - Tim Jansen <tim@tjansen.de> for the API updates and fixes.
*
* 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 __FX_DATA
#define __FX_DATA
#include <kdemacros.h>
#define SHADOW_CONFIG_ENTRY TQString("ShadowParameters")
#define SHADOW_TEXT_COLOR TQString("ShadowTextColor")
#define SHADOW_TEXT_BACKGROUND TQString("ShadowTextBackground")
// fallback configuration string
#define DEFAULT_SHADOW_CONFIGURATION TQString("0,0,4.0,120.0,2,1,1,0,0,0")
/**
* This class is the implementation of a structure for the
* various parameters required by the shadow class.
*
* One may afford this implementation since the shadow class is
* designed to be used as singleton for an application.
* @see KShadowEngine
* @author laur.ivan@corvil.com
* @since 3.2
*/
class KDE_EXPORT KShadowSettings
{
public:
/**
* Specifies the order of the options.
* @see fromString
*/
enum ConfigurationOrder
{
OFFSET_X = 0,
OFFSET_Y = OFFSET_X + 1,
MULTIPLICATION_FACTOR = OFFSET_Y + 1,
MAX_OPACITY = MULTIPLICATION_FACTOR + 1,
THICKNESS = MAX_OPACITY + 1,
ALGORITHM = THICKNESS + 1,
SELECTION_TYPE = ALGORITHM + 1
};
public:
/**
* The algorithm used.
*/
enum Algorithm
{
DefaultDecay = 1, ///< the default AXIS/DIAGONAL_FACTOR based alg
DoubleLinearDecay, ///< decay factor is 1/dx+dy
RadialDecay, ///< decay factor is 1/sqrt(dx*dx + dy*dy)
NoDecay ///< decay factor is 1 always
};
/**
* The selected method used.
*/
enum SelectionType
{
InverseVideoOnSelection = 0, ///< when selected, the halo is on I/Video
SelectionColorsOnSelection ///< the halo is made w/ selected colors
};
/**
* The default constructor.
* Creates an object with default settings for all the variabless.
*/
KShadowSettings();
// load/save methods
/**
* Loads the configuration from a string.
* @param the string to load from (comma-separated values)
* @see ConfigurationOrder
*/
virtual void fromString(const TQString &s);
/**
* Saves the configuration to a string.
* @return the configuration (comma-separated values)
* @see ConfigurationOrder
*/
virtual TQString toString() const;
// get methods
/**
* Returns the x offset of the shadow.
* @return the x offset
*/
int offsetX() const;
/**
* Returns the y offset of the shadow.
* @return the y offset
*/
int offsetY() const;
/**
* Returns the multiplication factor.
* @return the multiplication factor
*/
double multiplicationFactor() const;
/**
* Returns the maximum opacity of the shadow.
* @return the maximum opacity
*/
double maxOpacity() const;
/**
* Returns the thickness.
* @return the thickness
*/
int thickness() const;
/**
* Returns the used algorithm.
* @return the algorithm used
*/
Algorithm algorithm() const;
/**
* Returns the selection type used.
* @return the selection type
*/
SelectionType selectionType() const;
// set methods
/**
* Sets default values.
*/
virtual void setDefaults();
/**
* Sets the used algorithm.
* @param a the algorithm used
*/
virtual void setAlgorithm(Algorithm a);
/**
* Sets the multiplication factor.
* @param mf the multiplication factor
*/
virtual void setMultiplicationFactor(double mf);
/**
* Sets the maximum opacity of the shadow.
* @param mo the maximum opacity
*/
virtual void setMaxOpacity(double mo);
/**
* Sets the x offset of the shadow.
* @param x the x offset
*/
virtual void setOffsetX(int x);
/**
* Sets the y offset of the shadow.
* @param y the y offset
*/
virtual void setOffsetY(int y);
/**
* Sets the thickness.
* @param t the thickness
*/
virtual void setThickness(int t);
/**
* Sets the selection type used.
* @param s the selection type
*/
virtual void setSelectionType(SelectionType s);
private:
/*
* The employed algorithm (see fxshadow.h)
*/
Algorithm _algorithm;
/**
* This is the multiplication factor for the resulted shadow
*/
double _multiplicationFactor;
/**
* The maximum permitted opacity for the shadow
*/
double _maxOpacity;
/*
* offsetX and offsetY are the x/y offsets of the shadow with
* the mention that 0,0 is a centered shadow.
*/
int _offsetX;
int _offsetY;
/*
* The shadow thickness:
* shadow is this many pixels thicker than the text.
*/
int _thickness;
/*
* If the value is InverseVideoOnSelection, then the fg/bg
* colours are swapped when the element is selected.
* Otherwise, the selected fg/bg colors are used for text
* as well
*/
SelectionType _selectionType;
void *d;
};
#endif
|