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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
|
/* Domino widget style for KDE 3
Copyright (C) 2006 Michael Lentner <[email protected]>
based on the KDE style "Plastik":
Copyright (C) 2003 Sandro Giessl <[email protected]>
based on the KDE style "dotNET":
Copyright (C) 2001-2002, Chris Lee <[email protected]>
Carsten Pfeiffer <[email protected]>
Karol Szwed <[email protected]>
Drawing routines completely reimplemented from KDE3 HighColor, which was
originally based on some stuff from the KDE2 HighColor.
based on drawing routines of the style "Keramik":
Copyright (c) 2002 Malte Starostik <[email protected]>
(c) 2002,2003 Maksim Orlovich <[email protected]>
based on the KDE3 HighColor Style
Copyright (C) 2001-2002 Karol Szwed <[email protected]>
(C) 2001-2002 Fredrik H�glund <[email protected]>
Drawing routines adapted from the KDE2 HCStyle,
Copyright (C) 2000 Daniel M. Duley <[email protected]>
(C) 2000 Dirk Mueller <[email protected]>
(C) 2001 Martijn Klingens <[email protected]>
Progressbar code based on TDEStyle,
Copyright (C) 2001-2002 Karol Szwed <[email protected]>
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 General Public License
along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __DOMINO_H
#define __DOMINO_H
#include <tdestyle.h>
#include <tqintcache.h>
#include <tdetoolbarbutton.h>
#include "misc.h"
#include "data.h"
#include <tqpixmapcache.h>
// #include <X11/extensions/Xrender.h>
#include <X11/Xft/Xft.h>
class ButtonContour;
class RubberWidget;
class Rubber;
enum ContourType
{
Contour_Sunken = 0,
Contour_Raised = 1,
Contour_Simple = 2
};
enum ContourState
{
Contour_Default = 0,
Contour_Pressed = 1,
Contour_MouseOver = 2,
Contour_DefaultButton = 3
};
enum TextEffect
{
TextEffect_None = 0,
TextEffect_OnlyButton = 1,
TextEffect_Everywhere = 2
};
struct DSurface {
int numGradients;
TQColor g1Color1;
TQColor g1Color2;
TQColor g2Color1;
TQColor g2Color2;
TQColor background;
int g1Top;
int g1Bottom;
int g2Top;
int g2Bottom;
};
class DominoStyle : public TDEStyle
{
Q_OBJECT
friend class DominoStyleConfig;
public:
DominoStyle();
virtual ~DominoStyle();
enum PaletteTyp
{
Palette_Application,
Palette_Parent,
Palette_Widget
};
void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void polish( TQPalette &p );
void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
void drawTDEStylePrimitive(TDEStylePrimitive kpe,
TQPainter* p,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
void drawPrimitive(PrimitiveElement pe,
TQPainter *p,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
const TQStyleOption &opt = TQStyleOption::Default ) const;
void drawControl(ControlElement element,
TQPainter *p,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawControlMask( TQ_ControlElement,
TQPainter *,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &,
const TQStyleOption &,
const TQWidget *) const;
void drawComplexControl(TQ_ComplexControl control,
TQPainter *p,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
SCFlags controls = SC_All,
SCFlags active = SC_None,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
int pixelMetric(PixelMetric m,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQWidget *widget = 0 ) const;
TQRect subRect(SubRect r,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQWidget *widget ) const;
TQRect querySubControlMetrics(ComplexControl control,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
SubControl subcontrol,
const TQStyleOption &opt = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQSize sizeFromContents(TQStyle::ContentsType t,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQSize &s,
const TQStyleOption &o,
const TQWidget *w = 0) const;
int styleHint(TQ_StyleHint,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn * = 0,
const TQWidget * = 0 ) const;
TQPixmap stylePixmap(StylePixmap stylepixmap,
const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
const TQStyleOption& opt,
const TQWidget* widget = 0) const;
void drawItem( TQPainter *p, const TQRect &r,
int flags, const TQColorGroup &g, bool enabled,
const TQPixmap *pixmap, const TQString &text,
int len = -1, const TQColor *penColor = 0) const;
void dominoDrawItem( TQPainter *p, const TQRect &r,
int flags, const TQColorGroup &g, bool enabled,
const TQPixmap *pixmap, const TQString &text,
int len = -1, const TQColor *penColor = 0, bool buttonTextEffect = 0 ) const;
void setDominoButtonPalette(TQWidget* widget, PaletteTyp type);
virtual void drawFocusIndicator(TQPainter *p,
const TQRect &r,
int flags,
const TQColorGroup cg,
bool /*enabled*/,
const TQPixmap* /*pixmap*/,
const TQString & text,
int /*len = -1*/,
const TQColor& highlight = TQColor(0, 0, 0),
bool drawLine = true,
bool isButton = false) const;
TQPixmap renderOutlineIcon(const TQPixmap* icon) const;
void renderSurface(TQPainter *p,
const TQRect &r,
const TQColor &backgroundColor,
const TQColor &buttonColor,
const TQColor &highlightColor,
const uint flags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|
Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight|Is_Horizontal) const;
inline TQWidget::BackgroundOrigin setPixmapOrigin(TQWidget::BackgroundOrigin origin);
mutable Rubber* rubber;
mutable TQRect oldRubberRect;
mutable bool viewPortPressed;
mutable bool ignoreNextFocusRect;
uint _argbRubberBandColor;
mutable bool compositeManagerRunning;
const TQWidget* rubberViewPort;
protected:
enum RubberType
{
ArgbRubber = 1,
LineRubber = 2,
DistRubber = 3
};
RubberType rubberBandType;
enum TabPosition
{
First ,
Middle,
Last,
Single
};
struct TextEffectSettings {
TextEffect mode;
TQColor color;
TQColor buttonColor;
int opacity;
int buttonOpacity;
TQPoint pos;
TQPoint buttonPos;
};
struct GroupBoxSettings {
bool tintBackground;
int brightness;
bool customColor;
TQColor color;
};
struct FocusIndicatorSettings {
TQColor color;
int opacity;
TQColor buttonColor;
int buttonOpacity;
bool drawUnderline;
bool indicateFocus;
};
mutable TextEffectSettings textEffectSettings;
GroupBoxSettings groupBoxSettings;
FocusIndicatorSettings focusIndicatorSettings;
ButtonContour* buttonContour;
enum SurfaceFlags {
Draw_Left = 0x00000001,
Draw_Right = 0x00000002,
Draw_Top = 0x00000004,
Draw_Bottom = 0x00000008,
Is_Horizontal = 0x00000200,
Is_Highlight = 0x00000400,
Is_Default = 0x00000800,
Is_Disabled = 0x00001000,
Round_UpperLeft = 0x00002000,
Round_UpperRight = 0x00004000,
Round_BottomLeft = 0x00008000,
Round_BottomRight = 0x00010000,
Rectangular_UpperLeft = 0x00000010,
Rectangular_UpperRight = 0x10000020,
Rectangular_BottomLeft = 0x00000040,
Rectangular_BottomRight = 0x00000080,
Draw_AlphaBlend = 0x00020000,
Is_ComboBox = 0x00080000,
Is_Button = 0x00100000,
Is_CheckItem = 0x00200000,
Is_RadioButton = 0x00400000,
Is_TabTop = 0x00000100,
Is_TabBottom = 0x01000000,
Is_ActiveTabTop = 0x00040000,
Is_ActiveTabBottom = 0x00800000,
Is_ScrollBarBtn = 0x02000000,
Is_Header = 0x04000000,
Is_ScrollBarGroove = 0x08000000,
Is_Slider = 0x20000000,
Is_Down = 0x40000000
};
enum DominoStyleFlags {
Domino_noCache = 0x80000000
};
enum DominoPrimitiveElement {
PE_ScrollBarSubLine2 = 0xf000001
};
void renderContour(TQPainter *p,
const TQRect &r,
const TQColor &backgroundColor,
const TQColor &contourColor,
const uint flags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|
Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight) const;
void renderButtonShadow(TQPainter *p, const TQRect &r, const uint flags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|
Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight|Is_Horizontal) const;
TQPixmap* renderLineEditShadow(TQWidget* widget, TQRect rect, TQColor bg, uint flags, bool reverse);
inline void renderPixel(TQPainter *p,
const TQPoint &pos,
const int alpha,
const TQColor &color,
const TQColor &background = TQColor(),
bool fullAlphaBlend = true) const;
void renderButton(TQPainter *p,
const TQRect &r,
const TQColorGroup &g,
bool sunken = false,
bool mouseOver = false,
bool horizontal = true,
bool enabled = true,
bool tdehtmlMode = false) const;
void renderHeader(TQPainter *p,
const TQRect &r,
const TQColorGroup &g,
bool sunken = false,
bool mouseOver = false,
bool horizontal = true,
bool enabled = true) const;
void renderGradient(TQPainter *p,
const TQRect &r,
const TQColor &c1,
const TQColor &c2,
bool horizontal = true) const;
void renderTab(TQPainter *p,
const TQRect &r,
const TQColorGroup &g,
bool mouseOver = false,
const bool selected = false,
const bool bottom = false,
const TabPosition pos = Middle,
const bool triangular = false,
const bool cornerWidget = false,
const bool konqTab = false) const;
DSurface btnSurface;
DSurface tabTopSurface;
DSurface activeTabTopSurface;
DSurface tabBottomSurface;
DSurface activeTabBottomSurface;
DSurface scrollBarSurface;
DSurface scrollBarGrooveSurface;
DSurface headerSurface;
DSurface checkItemSurface;
virtual bool objectEventHandler( const TQStyleControlElementData &ceData,
ControlElementFlags elementFlags,
void* source,
TQEvent *ev );
TQString configMode;
void removeCachedSbPix(const TQColor &color) {
TQPixmapCache::remove("sHCap"+TQString::number(color.pixel(), 16)+"1"+configMode);
TQPixmapCache::remove("sHCap"+TQString::number(color.pixel(), 16)+"0"+configMode);
TQPixmapCache::remove("sVCap"+TQString::number(color.pixel(), 16)+"1"+configMode);
TQPixmapCache::remove("sVCap"+TQString::number(color.pixel(), 16)+"0"+configMode);
TQPixmapCache::remove(TQString::number(color.pixel(), 16)+"sh"+configMode);
TQPixmapCache::remove(TQString::number(color.pixel(), 16)+"sv"+configMode);
TQPixmapCache::remove(TQString::number(color.pixel(), 16)+"ah"+configMode);
TQPixmapCache::remove(TQString::number(color.pixel(), 16)+"av"+configMode);
};
TQColor getGroupBoxColor(const TQWidget* w) const;
TQPixmap* createCheckMark(const TQColor color) const;
TQPixmap* createRadioIndicator(const TQColor color) const;
TQPixmap disableIcon(const TQPixmap* icon) const;;
TQWidget* hoverWidget;
TQPixmap* checkMark;
TQPixmap* radioIndicator;
TQPixmap* popupFrame;
TQPixmap* border1;
mutable bool alphaButtonMode;
bool TDEApplicationMode;
TQColor _checkMarkColor;
TQMap<const TQGroupBox*, const TQPixmap*> groupBoxPixmaps;
uint preMultiplyColor(const uint &c) const;
TQToolButton* popupButton;
TQTimer* popupTimer;
TQPoint popupMousePressPos;
protected slots:
void tdehtmlWidgetDestroyed(TQObject* w);
void groupBoxDestroyed(TQObject* w);
//Animation slots.
void updateProgressPos();
void updateScrollPos(); // smoothscroll
void progressBarDestroyed(TQObject* bar);
inline TQColor dGetColor(const TQColor &color, const int value) const;
inline TQColor lightenColor(const TQColor &color, const int value) const;
inline TQColor darkenColor(const TQColor &color, const int value) const;
void updateTabWidgetFrame();
void spinBoxValueChanged(int);
void toolPopupPressed();
void popupToolMenu();
void toolPopupReleased();
private:
// Disable copy constructor and = operator
DominoStyle( const DominoStyle & );
DominoStyle& operator=( const DominoStyle & );
bool kickerMode;
bool konquerorMode;
bool konsoleMode;
mutable bool flatMode;
bool sideRepaint;
bool _animateProgressBar;
bool _drawTriangularExpander;
bool _customCheckMarkColor;
bool _smoothScrolling;
TQColor _toolTipColor;
int _buttonHeightAdjustment;
bool _customPopupMenuColor;
TQColor _popupMenuColor;
bool _customSelMenuItemColor;
TQColor _selMenuItemColor;
bool _drawPopupMenuGradient;
bool _indentPopupMenuItems;
bool _centerTabs;
bool _wheelSwitchesTabs;
bool _customSliderHandleContourColor;
bool _drawButtonSunkenShadow;
bool _toolBtnAsBtn;
bool _highlightToolBtnIcon;
bool konqTab;
int minTabLength;
bool macStyleBar;
int konqTabBarContrast;
bool spinWidgetDown;
mutable int sliderlen;
// smoothscrolling
int scrollDistance;
bool scrollVertical;
TQScrollView* scrollWidget;
TQTimer* scrollTimer;
bool hoveredToolBoxTab;
// track tdehtml widgets.
TQMap<const TQWidget*,bool> tdehtmlWidgets;
//Animation support.
TQMap<TQWidget*, int> progAnimWidgets;
// pixmap cache.
enum CacheEntryType {
cSurface,
cGradientTile,
cAlphaDot
};
struct CacheEntry
{
CacheEntryType type;
int width;
int height;
TQRgb c1Rgb;
TQRgb c2Rgb;
bool horizontal;
TQPixmap* pixmap;
CacheEntry(CacheEntryType t, int w, int h, TQRgb c1, TQRgb c2 = 0,
bool hor = false, TQPixmap* p = 0 ):
type(t), width(w), height(h), c1Rgb(c1), c2Rgb(c2), horizontal(hor), pixmap(p)
{}
~CacheEntry()
{
delete pixmap;
}
int key()
{
// create an int key from the properties which is used to refer to entries in the TQIntCache.
// the result may not be 100% correct as we don't have so much space in one integer -- use
// == operator after find to make sure we got the right one. :)
return horizontal ^ (type<<1) ^ (width<<5) ^ (height<<10) ^ (c1Rgb<<19) ^ (c2Rgb<<22);
}
bool operator == (const CacheEntry& other)
{
bool match = (type == other.type) &&
(width == other.width) &&
(height == other.height) &&
(c1Rgb == other.c1Rgb) &&
(c1Rgb == other.c1Rgb) &&
(horizontal = other.horizontal);
// if(!match) {
// tqDebug("operator ==: CacheEntries don't match!");
// tqDebug("width: %d\t\tother width: %d", width, other.width);
// tqDebug("height: %d\t\tother height: %d", height, other.height);
// tqDebug("fgRgb: %d\t\tother fgRgb: %d", fgRgb, other.fgRgb);
// tqDebug("bgRgb: %d\t\tother bgRgb: %d", bgRgb, other.bgRgb);
// tqDebug("surfaceFlags: %d\t\tother surfaceFlags: %d", surfaceFlags, other.surfaceFlags);
// }
return match;
}
};
TQIntCache<CacheEntry> *pixmapCache;
// For KPE_ListViewBranch
mutable TQBitmap *verticalLine;
mutable TQBitmap *horizontalLine;
// For progress bar animation
TQTimer *animationTimer;
void renderTabSeparator(TQPainter *p, const TQRect &r, const TQColor buttonColor, bool tabAbove) const;
void renderGroupBox(TQObject *obj, TQEvent *ev);
};
class ButtonContour
{
friend class DominoStyleConfig;
friend class DominoStyle;
public:
ButtonContour();
virtual ~ButtonContour();
static const int num_states = 4;
static const int num_types = 3;
ContourType defaultType;
ContourType type;
ContourState state;
bool alpha_mode;
bool drawButtonSunkenShadow;
int created[num_types][num_states];
int shadowCreated[num_states];
TQColor contour[num_states];
uint c1[num_types][num_states]; // top shadow
uint c2[num_types][num_states]; // outer ring
uint c3[num_types][num_states]; // inner ring
uint c4[num_types][num_states]; // bottom first shadow line
uint c5[num_types][num_states]; // bottom second shadow line
uint c6[num_types][num_states]; // first left shadow line
TQPixmap* btnEdges[num_types][num_states];
TQPixmap* btnVLines[num_types][num_states];
TQPixmap* btnHLines[num_types][num_states];
// for sunken type and sunken flat buttons
TQPixmap* buttonShadowRectangular[num_states];
TQPixmap* buttonShadowRound [num_states];
TQPixmap* buttonShadowHlines[num_states];
TQPixmap* buttonShadowVlines[num_states];
bool alphaMode() {
return alpha_mode;
}
uint color1() {
return c1[type][state];
}
uint color2() {
return c2[type][state];
}
uint color3() {
return c3[type][state];
}
uint color4() {
return c4[type][state];
}
uint color5() {
return c5[type][state];
}
uint color6() {
return c6[type][state];
}
TQColor contourColor(int t) {
return contour[t];
}
TQPixmap* buttonEdges() {
return btnEdges[type][state];
}
TQPixmap* buttonVLines() {
return btnVLines[type][state];
}
TQPixmap* buttonHLines() {
return btnHLines[type][state];
}
void setType(ContourType t = Contour_Sunken) {
type = t;
createPixmaps(type, state);
}
void setState(ContourState s = Contour_Default) {
state = s;
if(s == Contour_Pressed && type != Contour_Sunken)
type = Contour_Simple;
createPixmaps(type, state);
}
void setContour(ContourType t = Contour_Sunken, ContourState s = Contour_Default) {
type = t;
state = s;
createPixmaps(type, state);
}
void setColor(ContourState s, TQColor color) {
contour[s] = color;
uint c2_tmp;
uint c3_tmp;
if(defaultType == Contour_Sunken /*|| defaultType == Contour_Simple*/) {
c2_tmp = tqRgba(contour[s].red(), contour[s].green(), contour[s].blue(), 218);
c3_tmp = tqRgba(contour[s].red(), contour[s].green(), contour[s].blue(), 35);
}
else {
c2_tmp = tqRgba(contour[s].red(), contour[s].green(), contour[s].blue(), 203);
TQColor whiteColor(tqRgba(TQt::white.red(), TQt::white.green(), TQt::white.blue(), 34));
TQColor blackColor(tqRgba(contour[s].red(), contour[s].green(), contour[s].blue(), 35));
c3_tmp = blendColors(whiteColor, blackColor).rgb();
}
for(int t = 0; t < num_types; t++) {
c2[t][s] = c2_tmp; // outer ring
c3[t][s] = c3_tmp; // inner ring
}
}
void setDefaultType(ContourType t = Contour_Raised, bool create = true) {
defaultType = t;
type = t;
if(create)
createPixmaps(type, state);
}
void setAlphaMode() {
alpha_mode = true;
}
void reset() {
type = defaultType;
state = Contour_Default;
alpha_mode = false;
}
TQPixmap* shadowRound() {
return buttonShadowRound[state];
}
TQPixmap* shadowRectangular() {
return buttonShadowRectangular[state];
}
TQPixmap* shadowHLines() {
return buttonShadowHlines[state];
}
TQPixmap* shadowVLines() {
return buttonShadowVlines[state];
}
void createPixmaps(ContourType t = Contour_Sunken, ContourState s = Contour_Default) {
type = t;
state = s;
// for pressed sunken buttons + pressed KMultiTabbarTabs
if(drawButtonSunkenShadow && !shadowCreated[state]) {
TQColor shadowColor = alphaBlendColors(TQt::black, contour[state], 120);
buttonShadowRectangular[state] = new TQPixmap(tintImage(qembed_findImage("btnPressedShadowRectangular"), shadowColor));
buttonShadowRound[state] = new TQPixmap(tintImage(qembed_findImage("btnPressedShadowRound"), shadowColor));
buttonShadowHlines[state] = new TQPixmap(tintImage(qembed_findImage("btnPressedShadowHLines"), shadowColor));
buttonShadowVlines[state] = new TQPixmap(tintImage(qembed_findImage("btnPressedShadowVLines"), shadowColor));
shadowCreated[state] = 1;
}
if(created[type][state])
return;
TQImage btnVLines_img;
TQImage btnHLines_img;
TQImage btnShadow_img;
switch(type) {
case Contour_Simple: // now pressed raised!
btnShadow_img = qembed_findImage("btnRSPr"); // the inner white ring
blend(tintImage(qembed_findImage("btn"), contour[state]), btnShadow_img, btnShadow_img);
btnHLines_img = qembed_findImage("btnHRSPr");
blend(tintImage(qembed_findImage("btnH"), contour[state]), btnHLines_img, btnHLines_img);
btnVLines_img = qembed_findImage("btnVRSPr");
blend(tintImage(qembed_findImage("btnV"), contour[state]), btnVLines_img, btnVLines_img);
break;
case Contour_Sunken:
btnShadow_img = qembed_findImage("btnSSh");
blend(tintImage(qembed_findImage("btn"), contour[state]), btnShadow_img, btnShadow_img);
btnHLines_img = qembed_findImage("btnHSSh");
blend(tintImage(qembed_findImage("btnH"), contour[state]), btnHLines_img, btnHLines_img);
btnVLines_img = qembed_findImage("btnVSSh");
blend(tintImage(qembed_findImage("btnV"), contour[state]), btnVLines_img, btnVLines_img);
break;
case Contour_Raised:
btnShadow_img = qembed_findImage("btn17RaisedShadow3"); // the inner white ring + outer shadow
blend(tintImage(qembed_findImage("btn"), contour[state]), btnShadow_img, btnShadow_img);
btnHLines_img = qembed_findImage("btnHRSh");
blend(tintImage(qembed_findImage("btnH"), contour[state]), btnHLines_img, btnHLines_img);
btnVLines_img = qembed_findImage("btnVRSh");
blend(tintImage(qembed_findImage("btnV"), contour[state]), btnVLines_img, btnVLines_img);
default:
break;
}
btnEdges[type][state] = new TQPixmap(btnShadow_img);
btnVLines[type][state] = new TQPixmap(btnVLines_img);
btnHLines[type][state] = new TQPixmap(btnHLines_img);
created[type][state] = 1;
}
};
class RubberWidget : public TQWidget
{
public:
RubberWidget(Window window);
~RubberWidget();
};
class Rubber
{
friend class DominoStyle;
public:
Rubber(uint col);
~Rubber();
Visual* visual;
Colormap colormap;
XSetWindowAttributes wsa;
Window window;
RubberWidget* parent;
RubberWidget* rubber;
TQRegion mask;
uint color;
void destroy() {
if(parent) {
delete rubber;
delete parent;
window = 0;
parent = 0;
rubber = 0;
}
}
void create(TQRect& r, TQRegion& mask);
void updateMask(TQRegion& mask);
};
// DominoXXX classes to access protected (or private...) members
class DominoTQGroupBox : public TQGroupBox
{
friend class DominoStyle;
public:
DominoTQGroupBox( TQWidget* parent=0, const char* name=0 )
: TQGroupBox( parent, name ) {}
};
class DominoTQWidget : public TQWidget
{
friend class DominoStyleConfig;
friend class DominoStyle;
public:
DominoTQWidget( TQWidget* parent=0, const char* name=0 )
: TQWidget( parent, name ) {}
};
class DominoTQFrame : public TQFrame
{
friend class DominoStyle;
public:
DominoTQFrame( TQFrame* parent=0, const char* name=0 )
: TQFrame( parent, name ) {}
};
// TQWhatsThis
class DominoTQWhatsThat : public TQWidget
{
friend class DominoStyle;
public:
DominoTQWhatsThat(): TQWidget() {}
private:
TQString text;
};
class DominoKToolBarButton : public TDEToolBarButton
{
friend class DominoStyle;
public:
DominoKToolBarButton(): TDEToolBarButton() {}
};
class DominoTQListBoxItem : public TQListBoxItem
{
friend class DominoStyle;
public:
DominoTQListBoxItem(): TQListBoxItem() {}
};
class DominoTQTabWidget : public TQTabWidget
{
friend class DominoStyleConfig;
friend class DominoStyle;
public:
DominoTQTabWidget( TQWidget* parent=0, const char* name=0 )
: TQTabWidget( parent, name ) {}
};
class DominoTQSpinBox : public TQSpinBox
{
friend class DominoStyle;
public:
DominoTQSpinBox( TQFrame* parent=0, const char* name=0 )
: TQSpinBox( parent, name ) {}
};
class DominoTQPixmap : public TQPixmap
{
friend class DominoStyle;
public:
DominoTQPixmap( int w, int h, int depth = -1) : TQPixmap(w, h, depth) {}
};
class DominoTQButton : public TQButton
{
friend class DominoStyle;
public:
DominoTQButton(): TQButton() {}
};
#endif // __DOMINO_H
|