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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
|
/*
Copyright (c) 2000 Stefan Schimanski (1Stein@gmx.de)
1999-2000 Christian Esken (esken@kde.org)
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, or (at your option)
any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KaimanStyle_H
#define KaimanStyle_H
#include <tqstring.h>
#include <tqwidget.h>
#include <tqpixmap.h>
#include <tqbitmap.h>
#include <tqimage.h>
#include <tqevent.h>
#include <tqptrvector.h>
class KaimanStyleElement : public TQWidget
{
TQ_OBJECT
public:
KaimanStyleElement(TQWidget *parent, const char *name=0);
~KaimanStyleElement();
virtual void loadPixmaps(TQString &val_s_filename);
TQString element;
TQString filename;
TQPoint upperLeft;
TQSize dimension;
bool options[3];
int digits;
bool optionPrelight;
bool optionStatuslight;
int pixmapLines;
int pixmapColumns;
TQPtrVector<TQPixmap> pixmaps;
public slots:
void setPixmap( int num );
protected:
void paintEvent(TQPaintEvent *qpe);
void dropEvent( TQDropEvent *event );
void dragEnterEvent( TQDragEnterEvent *event );
int pixmapNum;
private:
int _currentPixmap;
};
class KaimanStyleMasked : public KaimanStyleElement
{
TQ_OBJECT
public:
KaimanStyleMasked(TQWidget *parent, const char *name=0)
: KaimanStyleElement( parent, name ) {};
virtual void loadPixmaps(TQString &val_s_filename)
{
KaimanStyleElement::loadPixmaps( val_s_filename );
if(pixmaps[0]->mask())
setMask(*pixmaps[0]->mask());
};
};
class KaimanStyleButton : public KaimanStyleMasked
{
TQ_OBJECT
public:
KaimanStyleButton(TQWidget *parent, const char *name=0);
~KaimanStyleButton();
// Button states.
enum { NormalUp=0, NormalDown, LitUp, LitDown, PrelightUp, PrelightLitUp, StateListEND };
TQPtrVector<int> I_pmIndex;
void setLit(bool);
void setPrelight(bool);
void setDown(bool);
bool lit();
bool prelit();
bool down();
void updateButtonState();
signals:
void clicked();
protected:
void mousePressEvent(TQMouseEvent *qme);
void mouseReleaseEvent(TQMouseEvent *qme);
void enterEvent(TQEvent * );
void leaveEvent ( TQEvent * );
private:
int i_i_currentState;
bool i_b_lit;
bool i_b_prelit;
bool i_b_down;
};
class KaimanStyleSlider : public KaimanStyleMasked
{
TQ_OBJECT
public:
KaimanStyleSlider(int min, int max, TQWidget *parent, const char *name=0);
~KaimanStyleSlider();
int value() { return _value; };
static const bool optionVertical;
static const bool optionReversed;
public slots:
void setValue( int value );
void setValue( int value, int min, int max );
signals:
void newValue( int value );
void newValueDrag( int value );
void newValueDrop( int value );
protected:
void mouseMoveEvent(TQMouseEvent *qme);
void mousePressEvent(TQMouseEvent *qme);
void mouseReleaseEvent(TQMouseEvent *qme);
void paintEvent(TQPaintEvent *qpe);
void enterEvent(TQEvent * );
void leaveEvent ( TQEvent * );
int pos2value( int x, int y );
bool _down;
bool _lit;
int _value;
int _min, _max;
};
class KaimanStyleBackground : public KaimanStyleMasked
{
TQ_OBJECT
public:
KaimanStyleBackground(TQWidget *parent, const char *name=0);
~KaimanStyleBackground();
protected:
void mousePressEvent(TQMouseEvent *qme);
void mouseReleaseEvent(TQMouseEvent *qme);
void mouseMoveEvent(TQMouseEvent *qme);
private:
bool i_b_move;
TQPoint i_point_dragStart;
TQPoint i_point_lastPos;
};
class KaimanStyleValue : public KaimanStyleMasked
{
TQ_OBJECT
public:
KaimanStyleValue(int min, int max, TQWidget *parent, const char *name=0);
~KaimanStyleValue();
int value() { return _value; };
public slots:
void setValue( int value );
void setValue( int value, int min, int max );
private:
int _min, _max, _value;
};
class KaimanStyleState : public KaimanStyleMasked
{
TQ_OBJECT
public:
KaimanStyleState(TQWidget *parent, const char *name=0);
~KaimanStyleState();
int value() { return _value; };
public slots:
void setValue( int value );
signals:
void clicked();
protected:
void mousePressEvent(TQMouseEvent *qme);
private:
int _value;
};
class KaimanStyleNumber : public KaimanStyleElement
{
TQ_OBJECT
public:
KaimanStyleNumber(TQWidget *parent, const char *name=0);
~KaimanStyleNumber();
virtual void loadPixmaps(TQString &val_s_filename);
static const bool optionCentered = 1;
int value() { return _value; };
public slots:
void setValue( int value );
protected:
void paintEvent(TQPaintEvent *qpe);
private:
int _value;
};
class KaimanStyleText : public KaimanStyleElement
{
TQ_OBJECT
public:
KaimanStyleText(TQWidget *parent, const char *name=0);
~KaimanStyleText();
virtual void loadPixmaps(TQString &val_s_filename);
static const bool optionExtended;
TQString value() { return _value; };
void startAnimation( int delay );
void stopAnimation();
public slots:
void setValue( TQString value );
protected:
void paintEvent(TQPaintEvent *qpe);
protected slots:
void timeout();
private:
TQString _value;
int _pos;
int _direction;
int _delay;
TQTimer *_timer;
};
class KaimanStyleAnimation : public KaimanStyleMasked
{
TQ_OBJECT
public:
KaimanStyleAnimation(int delay, TQWidget *parent, const char *name=0);
~KaimanStyleAnimation();
public slots:
void start();
void pause();
void stop();
protected:
void timeout();
private:
int _delay,_frame;
TQTimer *_timer;
};
class KaimanStyle : public TQWidget
{
TQ_OBJECT
public:
KaimanStyle(TQWidget *parent, const char *name=0);
~KaimanStyle();
enum { background, mask, play_Button, stop_Button, pause_Button, prev_Button, next_Button, repeat_Button, shuffle_Button, playlist_Button, mixer_Button, exit_Button, Iconify_Button, Config_Button, Alt_Skin_Button, Minute_Number, Second_Number, in_Rate_Number, in_Hz_Number, song_Number, status_Item, cPU_Number, digit_Large, digit_Small_Default, title, volume_Item, volume_Slider, position_Item, position_Slider };
enum { ParsingError=1, FileNotFound };
/// Finds a style element, according to it's name. Returns 0 when element is not available.
KaimanStyleElement* find(const char* val_s_elemName);
/// Tries to load the given style and returns success (true) or failure (false)
bool loadStyle(const TQString &styleName, const TQString &descFile="skindata" );
TQString skinName() { return i_skinName; };
/// Returns the mask
TQBitmap* Mask();
virtual bool eventFilter( TQObject *o, TQEvent *e );
private:
// Parses the "skindata" file and returns success (true) or failure (false)
int parseStyleFile(TQString &l_s_tmpName);
TQString getToken(TQString &val_s_string, char val_c_separator);
void interpretTokens(TQStringList& ref_s_tokens);
bool loadPixmaps();
/// The name of the style, e.g. "k9"
TQString i_s_styleName;
/// The base directory, where the style is found. For example
/// "/opt/kde/share/apps/kaiman/Skins/k9/" or "/opt/kde/share/apps/kaiman/Skins/k9.tgz"
TQString i_s_styleBase;
// The mask of the complete style. Used for doing shaped windows
TQBitmap i_bitmap_Mask;
/// All style elements are stored here.
TQPtrVector<KaimanStyleElement> I_styleElem;
// The parent window. In other words: The container that holds all the KaimanStyleElement's
TQWidget* i_qw_parent;
TQPtrList<TQWidget> i_sliders;
bool i_eventSemaphore;
TQString i_smallFont;
TQString i_largeFont;
TQString i_skinName;
};
#endif
|