summaryrefslogtreecommitdiffstats
path: root/tdestyles
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2013-08-18 10:14:48 -0500
committerDarrell Anderson <humanreadable@yahoo.com>2013-08-18 10:14:48 -0500
commitdad42352f4ad47d34caf50040367dc2a95772baa (patch)
tree6d2887d13f9b1403b8ce15be48a6ea7cec32fd96 /tdestyles
parent365f03061337a81bcffb4a45c4ad637edad27019 (diff)
downloadtdelibs-dad42352f4ad47d34caf50040367dc2a95772baa.tar.gz
tdelibs-dad42352f4ad47d34caf50040367dc2a95772baa.zip
Rename KStyle to TDEStyle to avoid conflicts with KDE4.
Diffstat (limited to 'tdestyles')
-rw-r--r--tdestyles/CMakeLists.txt21
-rw-r--r--tdestyles/Makefile.am4
-rw-r--r--tdestyles/asteroid/CMakeLists.txt46
-rw-r--r--tdestyles/asteroid/Makefile.am18
-rw-r--r--tdestyles/asteroid/asteroid.cpp2639
-rw-r--r--tdestyles/asteroid/asteroid.h133
-rw-r--r--tdestyles/asteroid/asteroid.themerc8
-rw-r--r--tdestyles/highcolor/CMakeLists.txt41
-rw-r--r--tdestyles/highcolor/Makefile.am29
-rw-r--r--tdestyles/highcolor/bitmaps.h84
-rw-r--r--tdestyles/highcolor/highcolor.cpp2173
-rw-r--r--tdestyles/highcolor/highcolor.h190
-rw-r--r--tdestyles/highcontrast/CMakeLists.txt49
-rw-r--r--tdestyles/highcontrast/Makefile.am41
-rw-r--r--tdestyles/highcontrast/TODO5
-rw-r--r--tdestyles/highcontrast/config/CMakeLists.txt37
-rw-r--r--tdestyles/highcontrast/config/Makefile.am12
-rw-r--r--tdestyles/highcontrast/config/highcontrastconfig.cpp94
-rw-r--r--tdestyles/highcontrast/config/highcontrastconfig.h61
-rw-r--r--tdestyles/highcontrast/highcontrast.cpp1867
-rw-r--r--tdestyles/highcontrast/highcontrast.h180
-rw-r--r--tdestyles/highcontrast/highcontrast.themerc127
-rw-r--r--tdestyles/keramik/CMakeLists.txt70
-rw-r--r--tdestyles/keramik/Makefile.am90
-rw-r--r--tdestyles/keramik/bitmaps.h83
-rw-r--r--tdestyles/keramik/colorutil.cpp65
-rw-r--r--tdestyles/keramik/colorutil.h37
-rw-r--r--tdestyles/keramik/genembed.cpp387
-rw-r--r--tdestyles/keramik/gradients.cpp179
-rw-r--r--tdestyles/keramik/gradients.h41
-rw-r--r--tdestyles/keramik/keramik.cpp3004
-rw-r--r--tdestyles/keramik/keramik.h226
-rw-r--r--tdestyles/keramik/keramikimage.h69
-rw-r--r--tdestyles/keramik/pics/checkbox-off.pngbin0 -> 486 bytes
-rw-r--r--tdestyles/keramik/pics/checkbox-on.pngbin0 -> 523 bytes
-rw-r--r--tdestyles/keramik/pics/checkbox-tri.pngbin0 -> 552 bytes
-rw-r--r--tdestyles/keramik/pics/combobox-list-bc.pngbin0 -> 174 bytes
-rw-r--r--tdestyles/keramik/pics/combobox-list-bl.pngbin0 -> 225 bytes
-rw-r--r--tdestyles/keramik/pics/combobox-list-br.pngbin0 -> 223 bytes
-rw-r--r--tdestyles/keramik/pics/combobox-list-cl.pngbin0 -> 146 bytes
-rw-r--r--tdestyles/keramik/pics/combobox-list-cr.pngbin0 -> 155 bytes
-rw-r--r--tdestyles/keramik/pics/combobox-list-tc.pngbin0 -> 146 bytes
-rw-r--r--tdestyles/keramik/pics/combobox-list-tl.pngbin0 -> 161 bytes
-rw-r--r--tdestyles/keramik/pics/combobox-list-tr.pngbin0 -> 188 bytes
-rw-r--r--tdestyles/keramik/pics/frame-shadow-cl.pngbin0 -> 159 bytes
-rw-r--r--tdestyles/keramik/pics/frame-shadow-tc.pngbin0 -> 158 bytes
-rw-r--r--tdestyles/keramik/pics/frame-shadow-tl.pngbin0 -> 166 bytes
-rw-r--r--tdestyles/keramik/pics/listview-bc.pngbin0 -> 157 bytes
-rw-r--r--tdestyles/keramik/pics/listview-bl.pngbin0 -> 147 bytes
-rw-r--r--tdestyles/keramik/pics/listview-br.pngbin0 -> 147 bytes
-rw-r--r--tdestyles/keramik/pics/listview-cc.pngbin0 -> 235 bytes
-rw-r--r--tdestyles/keramik/pics/listview-cl.pngbin0 -> 171 bytes
-rw-r--r--tdestyles/keramik/pics/listview-cr.pngbin0 -> 180 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-bc.pngbin0 -> 167 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-bl.pngbin0 -> 193 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-br.pngbin0 -> 199 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-cc.pngbin0 -> 205 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-cl.pngbin0 -> 264 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-cr.pngbin0 -> 266 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-tc.pngbin0 -> 167 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-tl.pngbin0 -> 190 bytes
-rw-r--r--tdestyles/keramik/pics/listview-pressed-tr.pngbin0 -> 192 bytes
-rw-r--r--tdestyles/keramik/pics/listview-tc.pngbin0 -> 157 bytes
-rw-r--r--tdestyles/keramik/pics/listview-tl.pngbin0 -> 147 bytes
-rw-r--r--tdestyles/keramik/pics/listview-tr.pngbin0 -> 147 bytes
-rw-r--r--tdestyles/keramik/pics/menuitem-cc.pngbin0 -> 296 bytes
-rw-r--r--tdestyles/keramik/pics/menuitem-cl.pngbin0 -> 195 bytes
-rw-r--r--tdestyles/keramik/pics/menuitem-cr.pngbin0 -> 195 bytes
-rw-r--r--tdestyles/keramik/pics/progressbar-cc.pngbin0 -> 356 bytes
-rw-r--r--tdestyles/keramik/pics/progressbar-cl.pngbin0 -> 480 bytes
-rw-r--r--tdestyles/keramik/pics/progressbar-cr.pngbin0 -> 428 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-bc.pngbin0 -> 186 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-bl.pngbin0 -> 302 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-br.pngbin0 -> 328 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-cc.pngbin0 -> 235 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-cl.pngbin0 -> 560 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-cr.pngbin0 -> 600 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-bc.pngbin0 -> 176 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-bl.pngbin0 -> 265 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-br.pngbin0 -> 267 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-cc.pngbin0 -> 251 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-cl.pngbin0 -> 637 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-cr.pngbin0 -> 680 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-bc.pngbin0 -> 175 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-bl.pngbin0 -> 265 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-br.pngbin0 -> 264 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-cc.pngbin0 -> 258 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-cl.pngbin0 -> 636 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-cr.pngbin0 -> 657 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-tc.pngbin0 -> 176 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-tl.pngbin0 -> 262 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-hov-tr.pngbin0 -> 290 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-bc.pngbin0 -> 175 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-bl.pngbin0 -> 270 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-br.pngbin0 -> 262 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-cc.pngbin0 -> 250 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-cl.pngbin0 -> 568 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-cr.pngbin0 -> 599 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-tc.pngbin0 -> 176 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-tl.pngbin0 -> 258 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-pressed-tr.pngbin0 -> 281 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-tc.pngbin0 -> 176 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-tl.pngbin0 -> 261 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-default-tr.pngbin0 -> 287 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-bc.pngbin0 -> 186 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-bl.pngbin0 -> 314 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-br.pngbin0 -> 325 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-cc.pngbin0 -> 239 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-cl.pngbin0 -> 589 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-cr.pngbin0 -> 584 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-tc.pngbin0 -> 183 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-tl.pngbin0 -> 270 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-hov-tr.pngbin0 -> 282 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-bc.pngbin0 -> 184 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-bl.pngbin0 -> 291 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-br.pngbin0 -> 305 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-cc.pngbin0 -> 230 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-cl.pngbin0 -> 519 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-cr.pngbin0 -> 545 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-tc.pngbin0 -> 182 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-tl.pngbin0 -> 243 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-pressed-tr.pngbin0 -> 259 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-bc.pngbin0 -> 161 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-bl.pngbin0 -> 217 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-br.pngbin0 -> 217 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-cc.pngbin0 -> 230 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-cl.pngbin0 -> 374 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-cr.pngbin0 -> 370 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-bc.pngbin0 -> 161 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-bl.pngbin0 -> 224 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-br.pngbin0 -> 217 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-cc.pngbin0 -> 206 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-cl.pngbin0 -> 370 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-cr.pngbin0 -> 368 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-tc.pngbin0 -> 161 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-tl.pngbin0 -> 212 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-pressed-tr.pngbin0 -> 205 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-tc.pngbin0 -> 161 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-tl.pngbin0 -> 203 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-small-tr.pngbin0 -> 202 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-tc.pngbin0 -> 183 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-tl.pngbin0 -> 265 bytes
-rw-r--r--tdestyles/keramik/pics/pushbutton-tr.pngbin0 -> 273 bytes
-rw-r--r--tdestyles/keramik/pics/radiobutton-off.pngbin0 -> 880 bytes
-rw-r--r--tdestyles/keramik/pics/radiobutton-on.pngbin0 -> 884 bytes
-rw-r--r--tdestyles/keramik/pics/ripple.pngbin0 -> 211 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-hbar-arrow1.pngbin0 -> 323 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-hbar-arrow2.pngbin0 -> 332 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-hbar-groove1.pngbin0 -> 138 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-hbar-groove2.pngbin0 -> 177 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-hbar-slider1.pngbin0 -> 319 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-hbar-slider2.pngbin0 -> 260 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-hbar-slider3.pngbin0 -> 337 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-hbar-slider4.pngbin0 -> 290 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-vbar-arrow1.pngbin0 -> 439 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-vbar-arrow2.pngbin0 -> 516 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-vbar-groove1.pngbin0 -> 170 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-vbar-groove2.pngbin0 -> 706 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-vbar-slider1.pngbin0 -> 280 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-vbar-slider2.pngbin0 -> 374 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-vbar-slider3.pngbin0 -> 305 bytes
-rw-r--r--tdestyles/keramik/pics/scrollbar-vbar-slider4.pngbin0 -> 335 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-bc.pngbin0 -> 165 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-bl.pngbin0 -> 212 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-br.pngbin0 -> 247 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-cc.pngbin0 -> 180 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-cl.pngbin0 -> 240 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-cr.pngbin0 -> 243 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-tc.pngbin0 -> 162 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-tl.pngbin0 -> 187 bytes
-rw-r--r--tdestyles/keramik/pics/slider-hgroove-tr.pngbin0 -> 198 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-bc.pngbin0 -> 241 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-bl.pngbin0 -> 217 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-br.pngbin0 -> 239 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-cc.pngbin0 -> 260 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-cl.pngbin0 -> 257 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-cr.pngbin0 -> 258 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-tc.pngbin0 -> 226 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-tl.pngbin0 -> 186 bytes
-rw-r--r--tdestyles/keramik/pics/slider-vgroove-tr.pngbin0 -> 214 bytes
-rw-r--r--tdestyles/keramik/pics/slider.pngbin0 -> 636 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-1.pngbin0 -> 277 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-2.pngbin0 -> 403 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-3.pngbin0 -> 271 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-arrow-down.pngbin0 -> 240 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-arrow-up.pngbin0 -> 250 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-pressed-arrow-down.pngbin0 -> 285 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-pressed-arrow-up.pngbin0 -> 289 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-pressed-down.pngbin0 -> 787 bytes
-rw-r--r--tdestyles/keramik/pics/spinbox-pressed-up.pngbin0 -> 784 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-active-bc.pngbin0 -> 152 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-active-bl.pngbin0 -> 227 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-active-br.pngbin0 -> 228 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-active-cc.pngbin0 -> 271 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-active-cl.pngbin0 -> 360 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-active-cr.pngbin0 -> 370 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-inactive-bc.pngbin0 -> 143 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-inactive-bl.pngbin0 -> 175 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-inactive-br.pngbin0 -> 166 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-inactive-cc.pngbin0 -> 195 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-inactive-cl.pngbin0 -> 235 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-inactive-cr.pngbin0 -> 254 bytes
-rw-r--r--tdestyles/keramik/pics/tab-bottom-inactive-separator.pngbin0 -> 154 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-active-cc.pngbin0 -> 269 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-active-cl.pngbin0 -> 365 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-active-cr.pngbin0 -> 366 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-active-tc.pngbin0 -> 147 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-active-tl.pngbin0 -> 226 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-active-tr.pngbin0 -> 226 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-inactive-cc.pngbin0 -> 190 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-inactive-cl.pngbin0 -> 239 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-inactive-cr.pngbin0 -> 254 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-inactive-separator.pngbin0 -> 154 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-inactive-tc.pngbin0 -> 145 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-inactive-tl.pngbin0 -> 169 bytes
-rw-r--r--tdestyles/keramik/pics/tab-top-inactive-tr.pngbin0 -> 159 bytes
-rw-r--r--tdestyles/keramik/pics/title-close-tiny.pngbin0 -> 181 bytes
-rw-r--r--tdestyles/keramik/pics/title-close.pngbin0 -> 147 bytes
-rw-r--r--tdestyles/keramik/pics/title-iconify.pngbin0 -> 104 bytes
-rw-r--r--tdestyles/keramik/pics/title-maximize.pngbin0 -> 134 bytes
-rw-r--r--tdestyles/keramik/pics/title-restore.pngbin0 -> 133 bytes
-rw-r--r--tdestyles/keramik/pics/titlebutton-pressed.pngbin0 -> 469 bytes
-rw-r--r--tdestyles/keramik/pics/titlebutton.pngbin0 -> 545 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-bc.pngbin0 -> 137 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-bl.pngbin0 -> 138 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-br.pngbin0 -> 136 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-cc.pngbin0 -> 228 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-cl.pngbin0 -> 223 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-cr.pngbin0 -> 218 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-tc.pngbin0 -> 136 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-tl.pngbin0 -> 136 bytes
-rw-r--r--tdestyles/keramik/pics/toolbar-clk-tr.pngbin0 -> 136 bytes
-rw-r--r--tdestyles/keramik/pics/vslider.pngbin0 -> 526 bytes
-rw-r--r--tdestyles/keramik/pixmaploader.cpp629
-rw-r--r--tdestyles/keramik/pixmaploader.h367
-rw-r--r--tdestyles/klegacy/Makefile.am8
-rw-r--r--tdestyles/klegacy/klegacystyle.cpp3366
-rw-r--r--tdestyles/klegacy/klegacystyle.h148
-rw-r--r--tdestyles/klegacy/plugin.cpp29
-rw-r--r--tdestyles/kthemestyle/CMakeLists.txt41
-rw-r--r--tdestyles/kthemestyle/Makefile.am29
-rw-r--r--tdestyles/kthemestyle/kthemebase.cpp1828
-rw-r--r--tdestyles/kthemestyle/kthemebase.h865
-rw-r--r--tdestyles/kthemestyle/kthemestyle.cpp2459
-rw-r--r--tdestyles/kthemestyle/kthemestyle.h242
-rw-r--r--tdestyles/kthemestyle/tdestyledirs.cpp48
-rw-r--r--tdestyles/kthemestyle/tdestyledirs.h82
-rw-r--r--tdestyles/light/CMakeLists.txt41
-rw-r--r--tdestyles/light/Makefile.am29
-rw-r--r--tdestyles/light/light.cpp61
-rw-r--r--tdestyles/light/lightstyle-v2.cpp1679
-rw-r--r--tdestyles/light/lightstyle-v2.h87
-rw-r--r--tdestyles/light/lightstyle-v3.cpp1912
-rw-r--r--tdestyles/light/lightstyle-v3.h92
-rw-r--r--tdestyles/plastik/CMakeLists.txt48
-rw-r--r--tdestyles/plastik/Makefile.am22
-rw-r--r--tdestyles/plastik/config/CMakeLists.txt37
-rw-r--r--tdestyles/plastik/config/Makefile.am12
-rw-r--r--tdestyles/plastik/config/plastikconf.cpp223
-rw-r--r--tdestyles/plastik/config/plastikconf.h85
-rw-r--r--tdestyles/plastik/misc.cpp38
-rw-r--r--tdestyles/plastik/misc.h24
-rw-r--r--tdestyles/plastik/plastik.cpp3593
-rw-r--r--tdestyles/plastik/plastik.h373
-rw-r--r--tdestyles/plastik/plastik.themerc101
-rw-r--r--tdestyles/riscos/CMakeLists.txt30
-rw-r--r--tdestyles/riscos/Makefile.am40
-rw-r--r--tdestyles/riscos/README5
-rw-r--r--tdestyles/riscos/arrowdown.pngbin0 -> 469 bytes
-rw-r--r--tdestyles/riscos/arrowdown_down.pngbin0 -> 542 bytes
-rw-r--r--tdestyles/riscos/arrowleft.pngbin0 -> 478 bytes
-rw-r--r--tdestyles/riscos/arrowleft_down.pngbin0 -> 529 bytes
-rw-r--r--tdestyles/riscos/arrowright.pngbin0 -> 495 bytes
-rw-r--r--tdestyles/riscos/arrowright_down.pngbin0 -> 559 bytes
-rw-r--r--tdestyles/riscos/arrowup.pngbin0 -> 451 bytes
-rw-r--r--tdestyles/riscos/arrowup_down.pngbin0 -> 458 bytes
-rw-r--r--tdestyles/riscos/background.pngbin0 -> 32086 bytes
-rw-r--r--tdestyles/riscos/check.pngbin0 -> 706 bytes
-rw-r--r--tdestyles/riscos/check_checked.pngbin0 -> 1089 bytes
-rw-r--r--tdestyles/riscos/checkmark.pngbin0 -> 388 bytes
-rw-r--r--tdestyles/riscos/combo.pngbin0 -> 359 bytes
-rw-r--r--tdestyles/riscos/combo_down.pngbin0 -> 688 bytes
-rw-r--r--tdestyles/riscos/hscrollback.pngbin0 -> 3639 bytes
-rw-r--r--tdestyles/riscos/hscrollbar.pngbin0 -> 4253 bytes
-rw-r--r--tdestyles/riscos/hscrollbar_down.pngbin0 -> 4185 bytes
-rw-r--r--tdestyles/riscos/hscrollborder.pngbin0 -> 938 bytes
-rw-r--r--tdestyles/riscos/htab.pngbin0 -> 365 bytes
-rw-r--r--tdestyles/riscos/menu_back.pngbin0 -> 144 bytes
-rw-r--r--tdestyles/riscos/radio.pngbin0 -> 1015 bytes
-rw-r--r--tdestyles/riscos/radio_down.pngbin0 -> 1063 bytes
-rw-r--r--tdestyles/riscos/raised_border.pngbin0 -> 1094 bytes
-rw-r--r--tdestyles/riscos/riscos.themerc344
-rw-r--r--tdestyles/riscos/scrollborder.pngbin0 -> 1069 bytes
-rw-r--r--tdestyles/riscos/slider.pngbin0 -> 316 bytes
-rw-r--r--tdestyles/riscos/sunk_border.pngbin0 -> 1090 bytes
-rw-r--r--tdestyles/riscos/tab_up.pngbin0 -> 1094 bytes
-rw-r--r--tdestyles/riscos/vscrollback.pngbin0 -> 3782 bytes
-rw-r--r--tdestyles/riscos/vscrollbar.pngbin0 -> 4131 bytes
-rw-r--r--tdestyles/riscos/vscrollbar_down.pngbin0 -> 3962 bytes
-rw-r--r--tdestyles/riscos/vscrollborder.pngbin0 -> 966 bytes
-rw-r--r--tdestyles/riscos/vtab.pngbin0 -> 328 bytes
-rw-r--r--tdestyles/themes/CMakeLists.txt23
-rw-r--r--tdestyles/themes/Makefile.am12
-rw-r--r--tdestyles/themes/b3.themerc90
-rw-r--r--tdestyles/themes/beos.themerc83
-rw-r--r--tdestyles/themes/default.themerc152
-rw-r--r--tdestyles/themes/highcolor.themerc150
-rw-r--r--tdestyles/themes/keramik.themerc99
-rw-r--r--tdestyles/themes/kstep.themerc108
-rw-r--r--tdestyles/themes/kthemestylerc2
-rw-r--r--tdestyles/themes/light-v2.themerc160
-rw-r--r--tdestyles/themes/light-v3.themerc161
-rw-r--r--tdestyles/themes/mega.themerc76
-rw-r--r--tdestyles/themes/qtcde.themerc88
-rw-r--r--tdestyles/themes/qtmotif.themerc94
-rw-r--r--tdestyles/themes/qtmotifplus.themerc104
-rw-r--r--tdestyles/themes/qtplatinum.themerc109
-rw-r--r--tdestyles/themes/qtsgi.themerc90
-rw-r--r--tdestyles/themes/qtwindows.themerc96
-rw-r--r--tdestyles/utils/CMakeLists.txt12
-rw-r--r--tdestyles/utils/Makefile.am2
-rw-r--r--tdestyles/utils/installtheme/CMakeLists.txt34
-rw-r--r--tdestyles/utils/installtheme/Makefile.am18
-rw-r--r--tdestyles/utils/installtheme/main.cpp90
-rw-r--r--tdestyles/web/Makefile.am10
-rw-r--r--tdestyles/web/README7
-rw-r--r--tdestyles/web/plugin.cpp11
-rw-r--r--tdestyles/web/web.themerc163
-rw-r--r--tdestyles/web/webstyle.cpp1690
-rw-r--r--tdestyles/web/webstyle.h414
330 files changed, 35275 insertions, 0 deletions
diff --git a/tdestyles/CMakeLists.txt b/tdestyles/CMakeLists.txt
new file mode 100644
index 000000000..a0a138422
--- /dev/null
+++ b/tdestyles/CMakeLists.txt
@@ -0,0 +1,21 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_subdirectory( plastik )
+add_subdirectory( asteroid )
+add_subdirectory( highcolor )
+add_subdirectory( highcontrast )
+add_subdirectory( themes )
+add_subdirectory( light )
+add_subdirectory( kthemestyle )
+add_subdirectory( riscos )
+add_subdirectory( utils )
+add_subdirectory( keramik )
diff --git a/tdestyles/Makefile.am b/tdestyles/Makefile.am
new file mode 100644
index 000000000..1f0a19b49
--- /dev/null
+++ b/tdestyles/Makefile.am
@@ -0,0 +1,4 @@
+SUBDIRS = asteroid plastik highcolor highcontrast themes light kthemestyle riscos utils keramik
+
+#tdestyles should not be included in the apidocs
+#include $(top_srcdir)/admin/Doxyfile.am
diff --git a/tdestyles/asteroid/CMakeLists.txt b/tdestyles/asteroid/CMakeLists.txt
new file mode 100644
index 000000000..906c844ab
--- /dev/null
+++ b/tdestyles/asteroid/CMakeLists.txt
@@ -0,0 +1,46 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions(
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdefx
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES asteroid.themerc DESTINATION ${DATA_INSTALL_DIR}/tdestyle/themes )
+
+
+##### asteroid ###################################
+
+set( target asteroid )
+
+set( ${target}_SRCS
+ asteroid.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdefx-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
+)
diff --git a/tdestyles/asteroid/Makefile.am b/tdestyles/asteroid/Makefile.am
new file mode 100644
index 000000000..4a23a37a4
--- /dev/null
+++ b/tdestyles/asteroid/Makefile.am
@@ -0,0 +1,18 @@
+# Yaaay poorly-documented hackish magical software!
+# (re: autoconf and automake and friends,
+# not my own software, of course) -clee
+
+AM_CPPFLAGS = -DQT_PLUGIN
+METASOURCES = AUTO
+
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = asteroid.h
+kde_style_LTLIBRARIES = asteroid.la
+
+asteroid_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+asteroid_la_LIBADD = -ltdefx -ltdeutils
+asteroid_la_SOURCES = asteroid.cpp
+
+themercdir = $(kde_datadir)/tdestyle/themes
+themerc_DATA = asteroid.themerc
diff --git a/tdestyles/asteroid/asteroid.cpp b/tdestyles/asteroid/asteroid.cpp
new file mode 100644
index 000000000..7119af5a8
--- /dev/null
+++ b/tdestyles/asteroid/asteroid.cpp
@@ -0,0 +1,2639 @@
+/*
+ * KDE3 asteroid style (version 1.0)
+ *
+ * Copyright (C) 2003, Chris Lee <clee@kde.org>
+ * Modified by David Chester in 2004 for Munjoy Linux
+ *
+ * See LICENSE for details about copying.
+ */
+
+/* Required. Period. */
+#include <tqstyleplugin.h>
+#include <tqstylefactory.h>
+#include <tqpainter.h>
+#include <tqapplication.h>
+
+#include <tqpopupmenu.h>
+#include <tqmenubar.h>
+#include <tqheader.h>
+#include <tqcombobox.h>
+#include <tqlistbox.h>
+#include <tqslider.h>
+#include <tqpushbutton.h>
+#include <tqtextedit.h>
+#include <tqlineedit.h>
+#include <tqtoolbar.h>
+#include <tqcheckbox.h>
+#include <tqradiobutton.h>
+#include <tqprogressbar.h>
+#include <tqtabwidget.h>
+#include <tqtabbar.h>
+#include <tqgroupbox.h>
+#include <tqtoolbutton.h>
+#include <tqdockwindow.h>
+#include <tqtooltip.h>
+#include <tqdrawutil.h>
+#include <tqlistview.h>
+#include <tqcleanuphandler.h>
+
+#include <kpixmap.h>
+
+#include <tqbitmap.h>
+#define u_arrow -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2
+#define d_arrow -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1
+#define l_arrow 0,-3, 0,3, -1,-2, -1,2, -2,-1, -2,1, -3,0
+#define r_arrow -2,-3, -2,3, -1,-2, -1,2, 0,-1, 0,1, 1,0
+
+#include "asteroid.h"
+
+// #define MINIMUM_PUSHBUTTON_WIDTH 75;
+// #define MINIMUM_PUSHBUTTON_HEIGHT 23;
+#define MINIMUM_PUSHBUTTON_WIDTH 73;
+#define MINIMUM_PUSHBUTTON_HEIGHT 21;
+
+#define ETCH_X_OFFSET 1
+#define ETCH_Y_OFFSET 1
+
+#define SPINBOX_BUTTON_WIDTH 12
+
+//#define POPUPMENUITEM_TEXT_ETCH_CONDITIONS ( etchtext && !enabled && !active )
+#define POPUPMENUITEM_TEXT_ETCH_CONDITIONS ( etchtext && !enabled )
+
+#define PUSHBUTTON_TEXT_ETCH_CONDITIONS ( etchtext && !enabled )
+#define HEADER_TEXT_ETCH_CONDITIONS ( etchtext && !enabled )
+#define TABBAR_TEXT_ETCH_CONDITIONS ( etchtext && !enabled )
+#define CHECKBOX_TEXT_ETCH_CONDITIONS ( etchtext && !enabled )
+#define RADIOBUTTON_TEXT_ETCH_CONDITIONS ( etchtext && !enabled )
+
+/* Hackery to make metasources work */
+#include "asteroid.moc"
+
+/* TQStyleFactory stuff. Required. */
+class AsteroidStylePlugin : public TQStylePlugin
+{
+public:
+ AsteroidStylePlugin() {}
+ ~AsteroidStylePlugin() {}
+
+ TQStringList keys() const {
+ return TQStringList() << "Asteroid";
+ }
+
+ TQStyle *create(const TQString &key) {
+ if (key == "asteroid") {
+ return new AsteroidStyle;
+ }
+ return 0;
+ }
+};
+
+TQ_EXPORT_PLUGIN(AsteroidStylePlugin);
+
+/* Ok, now we get to the good stuff. */
+
+AsteroidStyle::AsteroidStyle() : TDEStyle(AllowMenuTransparency)
+{
+ if (tqApp->inherits("TDEApplication")) {
+ connect(tqApp, TQT_SIGNAL(tdedisplayPaletteChanged()), TQT_SLOT(paletteChanged()));
+ }
+
+ backwards = TQApplication::reverseLayout();
+}
+
+AsteroidStyle::~AsteroidStyle()
+{
+/* The destructor is empty for now, but any member pointers should
+ * get deleted here. */
+}
+
+void AsteroidStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
+/* Screwing with the palette is fun! and required in order to make it feel
+ authentic. -clee */
+ TQPalette wp = w->palette();
+ //wp.setColor(TQColorGroup::Dark, wp.active().color(TQColorGroup::Button).dark(350));
+ wp.setColor(TQColorGroup::Dark, TQColor(128, 128, 128));
+ wp.setColor(TQColorGroup::Mid, wp.active().color(TQColorGroup::Button).dark(150)); // Which GUI element(s) does this correspond to?
+
+ bool isProtectedObject = false;
+ TQObject *curparent = TQT_TQOBJECT(w);
+ while (curparent) {
+ if (curparent->inherits("KonqFileTip") || curparent->inherits("AppletItem")
+ || curparent->inherits("KJanusWidget")
+ ) {
+ isProtectedObject = true;
+ }
+ curparent = curparent->parent();
+ }
+ if ((w->parent()) && (!w->ownPalette())) {
+ isProtectedObject = true;
+ }
+ if (!isProtectedObject) {
+ w->setPalette(wp);
+ }
+ }
+
+ if (ceData.widgetObjectTypes.contains(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else {
+ TDEStyle::polish(ceData, elementFlags, ptr);
+ }
+}
+
+void AsteroidStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ TDEStyle::unPolish(ceData, elementFlags, ptr);
+}
+
+/*!
+ \reimp
+
+ Changes some application-wide settings
+*/
+void
+AsteroidStyle::applicationPolish(const TQStyleControlElementData&, ControlElementFlags, void *)
+{
+ TQPalette wp = TQApplication::palette();
+ wp.setColor(TQColorGroup::Dark, TQColor(128, 128, 128));
+ wp.setColor(TQColorGroup::Mid, wp.active().color(TQColorGroup::Button).dark(150)); // Which GUI element(s) does this correspond to?
+ TQApplication::setPalette( wp, TRUE );
+}
+
+/*! \reimp
+*/
+void
+AsteroidStyle::applicationUnPolish(const TQStyleControlElementData&, ControlElementFlags, void *)
+{
+
+}
+
+void AsteroidStyle::renderMenuBlendPixmap(KPixmap &pix,
+ const TQColorGroup &cg,
+ const TQPopupMenu *) const
+{
+ TQPainter p(&pix);
+
+ p.fillRect(0, 0, pix.width(), pix.height(), cg.background());
+}
+
+void AsteroidStyle::drawTDEStylePrimitive(TDEStylePrimitive ksp,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags sf,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ switch (ksp) {
+
+ case KPE_SliderGroove: {
+ int x, y, v, h;
+ r.rect(&x, &y, &v, &h);
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+ int gcenter = (horizontal ? h : v) / 2;
+ int pad = 3;
+
+ /*p->setPen(cg.background());
+ p->setBrush(cg.background());
+ p->drawRect(r);*/
+
+ if (horizontal) {
+ gcenter += y;
+ p->setPen (cg.background().dark());
+ p->drawLine(x+pad, gcenter-1, x+v-pad, gcenter-1);
+ p->drawPoint(x+pad, gcenter);
+ p->setPen (cg.background().light());
+ p->drawLine(x+pad, gcenter+1, x+v-pad, gcenter+1);
+ p->drawLine(x+v-pad, gcenter, x+v-pad, gcenter-1);
+ } else {
+ gcenter += x;
+ p->setPen (cg.background().dark());
+ p->drawLine(gcenter-1, y+pad, gcenter-1, y+h-pad);
+ p->drawPoint(gcenter, y+pad);
+ p->setPen (cg.background().light());
+ p->drawLine(gcenter+1, y+pad, gcenter+1, y+h-pad);
+ p->drawLine(gcenter, y+h-pad, gcenter-1, y+h-pad);
+ }
+ break;
+ }
+
+ case KPE_SliderHandle: {
+
+ int x, y, x2, y2, xmin, xmax, ymin, ymax, v, h;
+ int pcenter;
+ r.coords(&xmin, &ymin, &xmax, &ymax);
+ r.rect(&x, &y, &v, &h);
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+
+ if (horizontal) {
+ x = v / 5 + xmin;
+ x2 = v * 4 / 5 + xmin;
+ if (((x2 - x) % 2)) x2--;
+ y2 = ymax - (x2 - x - 1) / 2;
+ y = ymax - y2 + ymin;
+ pcenter = (x2 - x) / 2 + x;
+
+ p->setPen(cg.background());
+ p->setBrush(cg.background());
+ TQRect hr(x-1, y, x2-x+2, y2-y);
+ p->drawRect(hr);
+
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2);
+ p->drawLine(x, y2, pcenter-1, ymax);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y+1, x2-1, y2);
+ p->drawLine(x2-1, y2, pcenter, ymax);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y, x2, y2);
+ p->drawLine(x2, y2, pcenter+1, ymax);
+
+ }
+ else {
+ y = h / 5 + ymin;
+ y2 = h * 4 / 5 + ymin;
+ if (((y2 - y) % 2)) y2--;
+ x2 = xmax - (y2 - y - 1) / 2;
+ x = (xmax-x2) + xmin;
+ pcenter = (y2 - y)/2 + y;
+
+ p->setPen(cg.background());
+ p->setBrush(cg.background());
+ TQRect hr(x, y-1, x2-x, y2-y+2);
+ p->drawRect(hr);
+
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+ p->drawLine(x2, y, xmax, pcenter-1);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2, y2-1, xmax, pcenter);
+
+ p->setPen(cg.dark());
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y2, xmax, pcenter+1);
+
+ }
+
+ break;
+ }
+
+ default: {
+ TDEStyle::drawTDEStylePrimitive(ksp, p, ceData, elementFlags, r, cg, sf, o, w);
+ }
+ }
+}
+
+int AsteroidStyle::styleHint( TQ_StyleHint stylehint,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption &option,
+ TQStyleHintReturn* returnData,
+ const TQWidget *widget ) const
+{
+ switch (stylehint) {
+ case SH_EtchDisabledText:
+// case SH_Slider_SnapToValue:
+// case SH_PrintDialog_RightAlignButtons:
+// case SH_MainWindow_SpaceBelowMenuBar:
+// case SH_FontDialog_SelectAssociatedText:
+// case SH_PopupMenu_AllowActiveAndDisabled:
+// case SH_MenuBar_AltKeyNavigation:
+// case SH_MenuBar_MouseTracking:
+// case SH_PopupMenu_MouseTracking:
+// case SH_ComboBox_ListMouseTracking:
+// case SH_ScrollBar_StopMouseOverSlider:
+ return 1;
+
+ case SH_MenuIndicatorColumnWidth: {
+ return TQMAX(option.maxIconWidth(), 12);
+ }
+
+ default:
+ return TDEStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
+ }
+}
+
+void AsteroidStyle::drawPrimitive(TQ_PrimitiveElement pe,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags sf,
+ const TQStyleOption &o) const
+{
+ int x, y, x2, y2, w, h;
+ r.coords(&x, &y, &x2, &y2);
+ r.rect(&x, &y, &w, &h);
+
+ switch (pe) {
+ /* Primitives to draw are:
+
+ PE_ButtonCommand
+ PE_ButtonDropDown
+
+ PE_DockWindowSeparator
+ PE_DockWindowResizeHandle
+
+ PE_Splitter
+
+ PE_PanelGroupBox
+ PE_PanelTabWidget
+ PE_TabBarBase
+
+ PE_ProgressBarChunk
+ PE_GroupBoxFrame
+ PE_WindowFrame
+ PE_SizeGrip
+
+ PE_CheckMark
+ PE_CheckListController
+ PE_CheckListIndicator
+ PE_CheckListExclusiveIndicator
+
+ PE_ScrollBarFirst
+ PE_ScrollBarLast
+ */
+
+ case PE_Splitter:
+ {
+ TQPen oldPen = p->pen();
+ p->setPen(cg.background());
+ p->drawRect(r);
+ p->setPen( cg.light() );
+// if ( sf & Style_Horizontal ) {
+// p->drawLine( r.x() + 1, r.y(), r.x() + 1, r.height() );
+// p->setPen( cg.dark() );
+// p->drawLine( r.x(), r.y(), r.x(), r.height() );
+// p->drawLine( r.right()-1, r.y(), r.right()-1, r.height() );
+// p->setPen( cg.shadow() );
+// p->drawLine( r.right(), r.y(), r.right(), r.height() );
+// } else {
+// p->drawLine( r.x(), r.y() + 1, r.width(), r.y() + 1 );
+// p->setPen( cg.dark() );
+// p->drawLine( r.x(), r.bottom() - 1, r.width(), r.bottom() - 1 );
+// p->setPen( cg.shadow() );
+// p->drawLine( r.x(), r.bottom(), r.width(), r.bottom() );
+// }
+ p->setPen( oldPen );
+ break;
+ }
+
+ case PE_FocusRect: {
+ p->drawWinFocusRect(r, cg.background());
+ break;
+ }
+
+ // FIXME
+ // This appears to do double duty,
+ // specifically it appears both in popup menu headers
+ // *and* at the top of tree views!
+ // The tree views need the stuff that is commented out
+ // to look correct, but when that is done the popup menus
+ // look absolutely HORRIBLE.
+ // How can we tell the two apart? Create PE_HeaderSectionMenu perhaps?
+ case PE_HeaderSection: {
+ p->setPen(cg.shadow());
+ p->setBrush(cg.background());
+ p->drawRect(r);
+
+ if (sf & Style_On) {
+ p->setPen(cg.mid());
+ p->setBrush(TQBrush(cg.light(),TQt::Dense4Pattern));
+ p->drawRect(r);
+ p->setPen(cg.buttonText());
+ } else if (sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+ p->setPen(cg.buttonText());
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ }
+
+ break;
+ }
+
+ case PE_HeaderSectionMenu: {
+ p->setPen(cg.shadow());
+ p->setBrush(cg.background());
+ p->drawRect(r);
+
+// if (sf & Style_On) {
+// p->setPen(cg.mid());
+// p->setBrush(TQBrush(cg.light(),TQt::Dense4Pattern));
+// p->drawRect(r);
+// p->setPen(cg.buttonText());
+// } else if (sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+ p->setPen(cg.buttonText());
+// } else {
+// p->setPen(cg.light());
+// p->drawLine(x, y, x2-1, y);
+// p->drawLine(x, y, x, y2-1);
+//
+// p->setPen(cg.mid());
+// p->drawLine(x2-1, y2-1, x+1, y2-1);
+// p->drawLine(x2-1, y2-1, x2-1, y+1);
+// }
+
+ break;
+ }
+
+ case PE_ButtonBevel: {
+ p->setPen(cg.shadow());
+ p->setBrush(cg.background());
+ p->drawRect(r);
+
+ if (sf & Style_On) {
+ p->setPen(cg.mid());
+ p->setBrush(TQBrush(cg.light(),TQt::Dense4Pattern));
+ p->drawRect(r);
+
+ if (!(sf & Style_ButtonDefault)) {
+ p->setPen(cg.shadow());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(cg.dark());
+ p->drawLine(x+1, y+1, x2-2, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-2);
+
+ p->setPen(cg.light());
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y, x2, y2);
+
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ }
+
+ p->setPen(cg.buttonText());
+ } else if (sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+
+ if (!(sf & Style_ButtonDefault)) {
+ p->setPen(cg.shadow());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(cg.dark());
+ p->drawLine(x+1, y+1, x2-2, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-2);
+
+ p->setPen(cg.light());
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y, x2, y2);
+
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ }
+
+ p->setPen(cg.buttonText());
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ }
+
+ break;
+ }
+
+ case PE_ButtonDefault: {
+ p->setPen(cg.shadow());
+ p->drawRect(r);
+ break;
+ }
+
+ case PE_ButtonTool: {
+ p->setPen(sf & Style_On || sf & Style_Down ? cg.mid() : cg.light());
+ p->drawRect(r);
+ p->setPen(sf & Style_On || sf & Style_Down ? cg.light() : cg.mid());
+ p->drawLine(r.bottomRight(), r.topRight());
+ p->drawLine(r.bottomRight(), r.bottomLeft());
+ p->setPen(cg.buttonText());
+ break;
+ }
+
+ case PE_ScrollBarSlider: {
+ if (sf & Style_Enabled) {
+ p->fillRect(r, cg.background());
+
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x2-2, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ } else {
+ p->fillRect(r, cg.background());
+ p->fillRect(r, TQBrush(cg.light(), Dense4Pattern));
+ }
+
+ break;
+ }
+
+ case PE_StatusBarSection: {
+ p->fillRect(r, cg.background());
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+
+ break;
+ }
+
+ case PE_CheckMark: {
+ int x = r.center().x() - 3, y = r.center().y() - 3;
+ const TQCOORD check[] = { x, y + 2, x, y + 4, x + 2, y + 6, x + 6, y + 2, x + 6, y, x + 2, y + 4 };
+ const TQPointArray a(6, check);
+
+ p->setPen(cg.text());
+ p->setBrush(cg.text());
+ p->drawPolygon(a);
+
+ break;
+ }
+
+ case PE_Indicator: {
+ p->setPen(cg.mid());
+ p->setBrush(sf & Style_Down ? cg.background() : cg.base());
+ p->drawRect(r);
+
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+
+ p->setPen(cg.dark());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ break;
+ }
+
+ case PE_IndicatorMask: {
+ p->fillRect (r, color1);
+
+ break;
+ }
+
+
+ case PE_ExclusiveIndicator: {
+ const TQCOORD outside[] = { 1, 9, 1, 8, 0, 7, 0, 4, 1, 3, 1, 2, 2, 1, 3, 1, 4, 0, 7, 0, 8, 1, 9, 1, 10, 2, 10, 3, 11, 4, 11, 7, 10, 8, 10, 9, 9, 10, 8, 10, 7, 11, 4, 11, 3, 10, 2, 10 };
+ const TQCOORD inside[] = { 2, 8, 1, 7, 1, 4, 2, 3, 2, 2, 3, 2, 4, 1, 7, 1, 8, 2, 9, 2, 9, 3, 10, 4, 10, 7, 9, 8, 9, 9, 8, 9, 7, 10, 4, 10, 3, 9, 2, 9 };
+ p->fillRect(r, cg.background());
+ if (sf & Style_Enabled && !(sf & Style_Down)) {
+ p->setPen(TQPen::NoPen);
+ p->setBrush(cg.base());
+ p->drawPolygon(TQPointArray(24, outside));
+ }
+ p->setPen(cg.mid());
+ p->drawPolyline(TQPointArray(24, outside), 0, 12);
+ p->setPen(cg.light());
+ p->drawPolyline(TQPointArray(24, outside), 12, 12);
+ p->setPen(cg.dark());
+ p->drawPolyline(TQPointArray(20, inside), 0, 10);
+ p->setPen(cg.background());
+ p->drawPolyline(TQPointArray(20, inside), 10, 10);
+ break;
+ }
+
+ case PE_ExclusiveIndicatorMask: {
+ const TQCOORD outside[] = { 1, 9, 1, 8, 0, 7, 0, 4, 1, 3, 1, 2, 2, 1, 3, 1, 4, 0, 7, 0, 8, 1, 9, 1, 10, 2, 10, 3, 11, 4, 11, 7, 10, 8, 10, 9, 9, 10, 8, 10, 7, 11, 4, 11, 3, 10, 2, 10 };
+ p->fillRect(r, color0);
+ p->setPen(color1);
+ p->setBrush(color1);
+ p->drawPolygon(TQPointArray(24, outside));
+ break;
+ }
+
+ case PE_WindowFrame:
+ case PE_Panel: {
+ bool sunken = sf & Style_Sunken;
+
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+
+ p->setPen(sunken ? cg.dark() : cg.background());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+
+ p->setPen(sunken ? cg.light() : cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ p->setPen(sunken ? cg.background() : cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+
+ break;
+ }
+
+ case PE_PanelLineEdit: {
+ p->fillRect(r, cg.base());
+
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y);
+
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+
+ p->setPen(cg.dark());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+
+ break;
+ }
+
+ case PE_PanelDockWindow: {
+ p->setPen(cg.mid());
+ p->drawLine(r.bottomLeft(), r.bottomRight());
+ p->setPen(cg.light());
+ p->drawLine(r.topLeft(), r.topRight());
+ break;
+ }
+
+ case PE_PanelMenuBar: {
+ p->setPen(cg.mid());
+ p->drawLine(r.bottomLeft(), r.bottomRight());
+ break;
+ }
+
+ case PE_ScrollBarAddPage:
+ case PE_ScrollBarSubPage: {
+ if (sf & Style_On || sf & Style_Down) {
+ p->fillRect(r, cg.mid().dark());
+ } else {
+ p->fillRect(r, cg.background());
+ }
+ p->fillRect(r, TQBrush(cg.light(), Dense4Pattern));
+ break;
+ }
+
+ case PE_ScrollBarAddLine: {
+ p->fillRect(r, cg.background());
+
+ if (sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x2-2, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ }
+
+ p->setPen(cg.foreground());
+ if (sf & Style_Enabled) {
+ drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, r, cg, sf);
+ } else {
+ TQPen oldPen = p->pen();
+ p->setPen(cg.light());
+ drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, TQRect(x+1, y+1, w, h), cg, sf);
+ p->setPen(cg.dark());
+ drawPrimitive(sf & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags, r, cg, sf);
+ p->setPen(oldPen);
+ }
+ break;
+ }
+
+ case PE_ScrollBarSubLine: {
+ p->fillRect(r, cg.background());
+
+ if (sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x2-2, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ }
+
+ p->setPen(cg.foreground());
+ if (sf & Style_Enabled) {
+ drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, r, cg, sf);
+ } else {
+ TQPen oldPen = p->pen();
+ p->setPen(cg.light());
+ drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, TQRect(x+1, y+1, w, h), cg, sf);
+ p->setPen(cg.dark());
+ drawPrimitive(sf & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags, r, cg, sf);
+ p->setPen(oldPen);
+ }
+ break;
+ }
+
+ case PE_DockWindowHandle: {
+ p->setPen(cg.light());
+
+ if (sf & Style_Horizontal) {
+ TQRect hr(0, 0, 3, r.height()-6);
+ hr.moveCenter(r.center());
+
+ p->fillRect(r, cg.background());
+ p->drawRect(hr);
+ p->setPen(cg.mid());
+ p->drawLine(hr.bottomRight(), hr.topRight());
+ p->drawLine(hr.bottomRight(), hr.bottomLeft());
+ } else {
+ TQRect hr(0, 0, r.width()-6, 3);
+ hr.moveCenter(r.center());
+
+ p->fillRect(r, cg.background());
+ p->drawRect(hr);
+ p->setPen(cg.mid());
+ p->drawLine(hr.bottomLeft(), hr.bottomRight());
+ p->drawLine(hr.topRight(), hr.bottomRight());
+ }
+
+ break;
+ }
+
+ case PE_Separator:
+ p->fillRect(r, cg.background());
+
+ if (!(sf & Style_Horizontal)) {
+ p->setPen(cg.background());
+ p->drawLine(x + 2, y , x2 - 2, y);
+ p->setPen(cg.light());
+ p->drawLine(x + 2, y + 1, x2 - 2, y + 1);
+ }
+ else
+ {
+ p->setPen(cg.background());
+ p->drawLine(x + 2, y + 2, x + 2, y2 - 2);
+ p->setPen(cg.light());
+ p->drawLine(x + 3, y + 2, x + 3, y2 - 2);
+ }
+ break;
+
+ case PE_DockWindowSeparator: {
+ p->fillRect(r, cg.background());
+
+ if (!(sf & Style_Horizontal)) {
+ p->setPen(cg.mid());
+ p->drawLine(x + 2, y , x2 - 2, y);
+ p->setPen(cg.light());
+ p->drawLine(x + 2, y + 1, x2 - 2, y + 1);
+ }
+ else
+ {
+ p->setPen(cg.mid());
+ p->drawLine(x + 2, y + 2, x + 2, y2 - 2);
+ p->setPen(cg.light());
+ p->drawLine(x + 3, y + 2, x + 3, y2 - 2);
+ }
+ break;
+ }
+
+ case PE_DockWindowResizeHandle: {
+ p->fillRect(r, cg.mid());
+ break;
+ }
+
+ case PE_PanelPopup: {
+ p->setPen(cg.background());
+ p->setBrush(cg.background());
+
+ int menuborder = 3;
+ p->drawRect(r.x(), r.y(), r.x()+menuborder, r.height()); // Left
+ p->drawRect(r.x()+r.width()-menuborder, r.y(), r.width(), r.height()); // Right
+ p->drawRect(r.x(), r.y(), r.width(), r.y()+menuborder); // Top
+ p->drawRect(r.x(), r.y()+r.height()-menuborder, r.width(), r.height()); // Bottom
+
+ p->setPen(cg.dark());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->drawLine(x+1, y+1, x2-1, y+1);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+
+ break;
+ }
+
+ case PE_SpinWidgetUp:
+ case PE_SpinWidgetDown:
+ case PE_HeaderArrow:
+ case PE_ArrowUp:
+ case PE_ArrowDown:
+ case PE_ArrowLeft:
+ case PE_ArrowRight: {
+ TQPointArray a;
+
+ switch (pe) {
+
+ case PE_SpinWidgetUp:
+ case PE_ArrowUp: {
+ a.setPoints(7, u_arrow);
+ break;
+ }
+
+ case PE_SpinWidgetDown:
+ case PE_ArrowDown: {
+ a.setPoints(7, d_arrow);
+ break;
+ }
+
+ case PE_ArrowLeft: {
+ a.setPoints(7, l_arrow);
+ break;
+ }
+
+ case PE_ArrowRight: {
+ a.setPoints(7, r_arrow);
+ break;
+ }
+
+ default: {
+ if (sf & Style_Up) {
+ a.setPoints(7, u_arrow);
+ } else {
+ a.setPoints(7, d_arrow);
+ }
+ }
+ }
+
+ if (p->pen() == Qt::NoPen) {
+ p->setPen(sf & Style_Enabled ? cg.foreground() : cg.light());
+ }
+
+ if (sf & Style_Down) {
+ p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
+ pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
+ }
+
+ a.translate((x + w/2), (y + (h-1)/2));
+ p->drawLineSegments(a, 0, 3);
+ p->drawPoint(a[6]);
+
+ if (sf & Style_Down) {
+ p->translate(-pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
+ -pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
+ }
+
+ break;
+ }
+
+ case PE_MenuItemIndicatorIconFrame:
+ case PE_MenuItemIndicatorFrame: {
+ // Draw nothing
+ break;
+ }
+
+ case PE_MenuItemIndicatorCheck: {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, o, NULL, NULL);
+
+ bool active = sf & Style_Active;
+ bool disabled = !(sf & Style_Enabled);
+
+ int xp = x;
+
+ SFlags cflags = Style_Default;
+ if (disabled) {
+ cflags |= Style_On;
+ } else {
+ cflags |= Style_Enabled;
+ }
+
+ p->setPen(active ? cg.highlightedText() : cg.buttonText());
+
+ TQRect rr = TQRect(xp, y, checkcol, h);
+ if (backwards) {
+ rr = visualRect(rr, r);
+ }
+
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, rr, cg, cflags);
+
+ break;
+ }
+
+ default: {
+ TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, sf, o);
+ }
+ }
+}
+
+void AsteroidStyle::drawControl(TQ_ControlElement ce,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags sf,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ int x, y, x2, y2, sw, sh;
+ r.coords(&x, &y, &x2, &y2);
+ r.rect(&x, &y, &sw, &sh);
+
+ switch (ce) {
+ /* TQ_ControlElements to draw are:
+
+ CE_CheckBoxLabel
+ CE_RadioButtonLabel
+
+ CE_TabBarTab
+ CE_TabBarLabel
+
+ CE_ProgressBarGroove
+ CE_ProgressBarContents
+ CE_ProgressBarLabel
+
+ CE_PopupMenuScroller
+ CE_PopupMenuHorizontalExtra
+ CE_PopupMenuVerticalExtra
+ CE_MenuBarEmptyArea
+ CE_DockWindowEmptyArea
+
+ CE_ToolButtonLabel
+ CE_ToolBoxTab
+
+ */
+
+#ifndef TQT_NO_TABBAR
+ case CE_TabBarTab:
+ {
+ if ( ceData.parentWidgetData.widgetObjectTypes.isEmpty() || !o.tab() )
+ break;
+
+ const TQTab * t = o.tab();
+ bool selected = sf & Style_Selected;
+ bool lastTab = (ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1) ?
+ TRUE : FALSE;
+ TQRect r2( r );
+ if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) {
+ p->setPen( cg.light() );
+ p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 );
+ if ( r2.left() == 0 )
+ p->drawPoint( ceData.rect.bottomLeft() );
+
+ if ( selected ) {
+ p->fillRect( TQRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2),
+ cg.brush( TQColorGroup::Background ));
+ p->setPen( cg.background() );
+ p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 );
+ p->setPen( cg.light() );
+ } else {
+ p->setPen( cg.light() );
+ r2.setRect( r2.left() + 2, r2.top() + 2,
+ r2.width() - 4, r2.height() - 2 );
+ }
+
+ int x1, x2;
+ x1 = r2.left();
+ x2 = r2.right() - 2;
+ p->drawLine( x1, r2.bottom()-1, x1, r2.top() + 2 );
+ x1++;
+ p->drawPoint( x1, r2.top() + 1 );
+ x1++;
+ p->drawLine( x1, r2.top(), x2, r2.top() );
+ x1 = r2.left();
+
+ p->setPen( cg.dark() );
+ x2 = r2.right() - 1;
+ p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - 1 +
+ (selected ? 0:-1) );
+ p->setPen( cg.shadow() );
+ p->drawPoint( x2, r2.top() + 1 );
+ p->drawPoint( x2, r2.top() + 1 );
+ x2++;
+ p->drawLine( x2, r2.top() + 2, x2, r2.bottom() -
+ (selected ? (lastTab ? 0:1) :2));
+ } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) {
+ bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, w ) == TQt::AlignRight;
+ bool firstTab = ceData.tabBarData.identIndexMap[t->identifier()] == 0;
+ if ( selected ) {
+ p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1),
+ cg.brush( TQColorGroup::Background ));
+ p->setPen( cg.background() );
+ p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 );
+ p->setPen( cg.dark() );
+ } else {
+ p->setPen( cg.shadow() );
+ p->drawLine( r2.left() +
+ (rightAligned && firstTab ? 0 : 1),
+ r2.top() + 1,
+ r2.right() - (lastTab ? 0 : 2),
+ r2.top() + 1 );
+
+ if ( rightAligned && lastTab )
+ p->drawPoint( r2.right(), r2.top() );
+ p->setPen( cg.dark() );
+ p->drawLine( r2.left(), r2.top(), r2.right() - 1,
+ r2.top() );
+ r2.setRect( r2.left() + 2, r2.top(),
+ r2.width() - 4, r2.height() - 2 );
+ }
+
+ p->drawLine( r2.right() - 1, r2.top() + (selected ? 0: 2),
+ r2.right() - 1, r2.bottom() - 2 );
+ p->drawPoint( r2.right() - 2, r2.bottom() - 2 );
+ p->drawLine( r2.right() - 2, r2.bottom() - 1,
+ r2.left() + 1, r2.bottom() - 1 );
+
+ p->setPen( cg.shadow() );
+ p->drawLine( r2.right(),
+ r2.top() + (lastTab && rightAligned &&
+ selected) ? 0 : 1,
+ r2.right(), r2.bottom() - 1 );
+ p->drawPoint( r2.right() - 1, r2.bottom() - 1 );
+ p->drawLine( r2.right() - 1, r2.bottom(),
+ r2.left() + 2, r2.bottom() );
+
+ p->setPen( cg.light() );
+ p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2),
+ r2.left(), r2.bottom() - 2 );
+ } else {
+ TQCommonStyle::drawControl(ce, p, ceData, elementFlags, r, cg, sf, o, w);
+ }
+ break;
+ }
+
+ case CE_TabBarLabel:
+ {
+ if ( o.isDefault() )
+ break;
+
+ TQTab * t = o.tab();
+
+ const bool enabled = sf & Style_Enabled;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+
+ TQRect tr = r;
+ if ( t->identifier() == ceData.tabBarData.currentTabIndex )
+ tr.setBottom( tr.bottom() -
+ pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, w ) );
+
+ int alignment = TQt::AlignCenter | TQt::ShowPrefix;
+ if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, w)) && (!acceleratorsShown())))
+ alignment |= TQt::NoAccel;
+ tr.setWidth(tr.width()+4); // Compensate for text appearing too far to the left
+// TQRect tr_offset = TQRect(tr.x()+ETCH_X_OFFSET, tr.y()+ETCH_Y_OFFSET, tr.width(), tr.height());
+ TQRect tr_offset = TQRect(tr.x()+0, tr.y()+0, tr.width(), tr.height());
+ if TABBAR_TEXT_ETCH_CONDITIONS {
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ TQColorGroup etchedcg = cg;
+ etchedcg.setColor( TQColorGroup::Text, cg.light() );
+ etchedcg.setColor( TQColorGroup::Mid, cg.light() );
+ etchedcg.setColor( TQColorGroup::Midlight, cg.light() );
+ etchedcg.setColor( TQColorGroup::Foreground, cg.light() );
+ etchedcg.setColor( TQColorGroup::HighlightedText, cg.light() );
+ etchedcg.setColor( TQColorGroup::BrightText, cg.light() );
+ etchedcg.setColor( TQColorGroup::ButtonText, cg.light() );
+ drawItem( p, tr_offset, alignment, etchedcg, enabled, 0, t->text() );
+ p->setPen( cg.dark() );
+ etchedcg.setColor( TQColorGroup::Text, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Mid, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Midlight, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Foreground, cg.dark() );
+ etchedcg.setColor( TQColorGroup::HighlightedText, cg.dark() );
+ etchedcg.setColor( TQColorGroup::BrightText, cg.dark() );
+ etchedcg.setColor( TQColorGroup::ButtonText, cg.dark() );
+ drawItem( p, tr, alignment, etchedcg, enabled, 0, t->text() );
+ p->setPen(savePen);
+ }
+ else {
+ drawItem( p, tr, alignment, cg, enabled, 0, t->text() );
+ }
+
+ if ( (sf & Style_HasFocus) && !t->text().isEmpty() )
+ drawPrimitive( TQStyle::PE_FocusRect, p, ceData, elementFlags, r, cg );
+ break;
+ }
+#endif // TQT_NO_TABBAR
+
+ case CE_CheckBoxLabel:
+ {
+#ifndef TQT_NO_CHECKBOX
+ const TQCheckBox *checkbox = (const TQCheckBox *) w;
+
+ const bool enabled = sf & Style_Enabled;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+
+ int alignment = TQApplication::reverseLayout() ? TQt::AlignRight : TQt::AlignLeft;
+ if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, w)) && (!acceleratorsShown())))
+ alignment |= TQt::NoAccel;
+
+ //TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height());
+ TQRect r_offset = TQRect(r.x()+0, r.y()+0, r.width(), r.height());
+ if CHECKBOX_TEXT_ETCH_CONDITIONS {
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ TQColorGroup etchedcg = cg;
+ etchedcg.setColor( TQColorGroup::Text, cg.light() );
+ etchedcg.setColor( TQColorGroup::Mid, cg.light() );
+ etchedcg.setColor( TQColorGroup::Midlight, cg.light() );
+ etchedcg.setColor( TQColorGroup::Foreground, cg.light() );
+ etchedcg.setColor( TQColorGroup::HighlightedText, cg.light() );
+ etchedcg.setColor( TQColorGroup::BrightText, cg.light() );
+ etchedcg.setColor( TQColorGroup::ButtonText, cg.light() );
+ drawItem(p, r_offset, alignment | TQt::AlignVCenter | TQt::ShowPrefix, etchedcg, sf & Style_Enabled, checkbox->pixmap(), checkbox->text());
+ p->setPen( cg.dark() );
+ etchedcg.setColor( TQColorGroup::Text, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Mid, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Midlight, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Foreground, cg.dark() );
+ etchedcg.setColor( TQColorGroup::HighlightedText, cg.dark() );
+ etchedcg.setColor( TQColorGroup::BrightText, cg.dark() );
+ etchedcg.setColor( TQColorGroup::ButtonText, cg.dark() );
+ drawItem(p, r, alignment | TQt::AlignVCenter | TQt::ShowPrefix, etchedcg, sf & Style_Enabled, checkbox->pixmap(), checkbox->text());
+ p->setPen(savePen);
+ }
+ else {
+ drawItem(p, r, alignment | TQt::AlignVCenter | TQt::ShowPrefix, cg, sf & Style_Enabled, checkbox->pixmap(), checkbox->text());
+ }
+
+ if (sf & Style_HasFocus) {
+ TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, w), ceData, elementFlags);
+ drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, cg, sf);
+ }
+#endif
+ break;
+ }
+
+ case CE_RadioButtonLabel:
+ {
+#ifndef TQT_NO_RADIOBUTTON
+ const TQRadioButton *radiobutton = (const TQRadioButton *) w;
+
+ const bool enabled = sf & Style_Enabled;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+
+ int alignment = TQApplication::reverseLayout() ? TQt::AlignRight : TQt::AlignLeft;
+ if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, w)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, w)) && (!acceleratorsShown())))
+ alignment |= TQt::NoAccel;
+
+// TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height());
+ TQRect r_offset = TQRect(r.x()+0, r.y()+0, r.width(), r.height());
+ if RADIOBUTTON_TEXT_ETCH_CONDITIONS {
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ TQColorGroup etchedcg = cg;
+ etchedcg.setColor( TQColorGroup::Text, cg.light() );
+ etchedcg.setColor( TQColorGroup::Mid, cg.light() );
+ etchedcg.setColor( TQColorGroup::Midlight, cg.light() );
+ etchedcg.setColor( TQColorGroup::Foreground, cg.light() );
+ etchedcg.setColor( TQColorGroup::HighlightedText, cg.light() );
+ etchedcg.setColor( TQColorGroup::BrightText, cg.light() );
+ etchedcg.setColor( TQColorGroup::ButtonText, cg.light() );
+ drawItem(p, r_offset, alignment | TQt::AlignVCenter | TQt::ShowPrefix, etchedcg, enabled, radiobutton->pixmap(), radiobutton->text());
+ p->setPen( cg.dark() );
+ etchedcg.setColor( TQColorGroup::Text, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Mid, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Midlight, cg.dark() );
+ etchedcg.setColor( TQColorGroup::Foreground, cg.dark() );
+ etchedcg.setColor( TQColorGroup::HighlightedText, cg.dark() );
+ etchedcg.setColor( TQColorGroup::BrightText, cg.dark() );
+ etchedcg.setColor( TQColorGroup::ButtonText, cg.dark() );
+ drawItem(p, r, alignment | TQt::AlignVCenter | TQt::ShowPrefix, etchedcg, enabled, radiobutton->pixmap(), radiobutton->text());
+ p->setPen(savePen);
+ }
+ drawItem(p, r, alignment | TQt::AlignVCenter | TQt::ShowPrefix, cg, enabled, radiobutton->pixmap(), radiobutton->text());
+
+ if (sf & Style_HasFocus) {
+ TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, w), ceData, elementFlags);
+ drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, cg, sf);
+ }
+#endif
+ break;
+ }
+
+ case CE_ToolBoxTab:
+ {
+ qDrawShadePanel( p, r, cg, sf & (Style_Sunken | Style_Down | Style_On) , 1,
+ &cg.brush(TQColorGroup::Button));
+ break;
+ }
+
+ case CE_ProgressBarContents: {
+
+
+ // ### Take into account totalSteps() for busy indicator
+ TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, w);
+ double progress = ceData.currentStep;
+ bool reverse = TQApplication::reverseLayout();
+ int steps = ceData.totalSteps;
+
+ if (!cr.isValid())
+ return;
+
+
+ p->setPen(cg.light());
+ p->setBrush(cg.light());
+ p->drawRect(r);
+
+ // Draw progress bar
+ if (progress > 0 || steps == 0) {
+ double pg = (steps == 0) ? 0.1 : progress / steps;
+ int width = TQMIN(cr.width(), (int)(pg * cr.width()));
+ if (steps == 0) { //Busy indicator
+
+ if (width < 1) width = 1; //A busy indicator with width 0 is kind of useless
+
+ int remWidth = cr.width() - width; //Never disappear completely
+ if (remWidth <= 0) remWidth = 1; //Do something non-crashy when too small...
+
+ int pstep = int(progress) % ( 2 * remWidth );
+
+ if ( pstep > remWidth ) {
+ //Bounce about.. We're remWidth + some delta, we want to be remWidth - delta...
+ // - ( (remWidth + some delta) - 2* remWidth ) = - (some deleta - remWidth) = remWidth - some delta..
+ pstep = - (pstep - 2 * remWidth );
+ }
+
+ if (reverse)
+ p->fillRect(cr.x() + cr.width() - width - pstep, cr.y(), width, cr.height(),
+ cg.brush(TQColorGroup::Highlight));
+ else
+ p->fillRect(cr.x() + pstep, cr.y(), width, cr.height(),
+ cg.brush(TQColorGroup::Highlight));
+
+ return;
+ }
+
+
+
+ if (reverse)
+ p->fillRect(cr.x()+(cr.width()-width), cr.y(), width, cr.height(),
+ cg.brush(TQColorGroup::Highlight));
+ else
+ p->fillRect(cr.x(), cr.y(), width, cr.height(),
+ cg.brush(TQColorGroup::Highlight));
+ }
+ break;
+ }
+
+ case CE_CheckBox: {
+ drawPrimitive(PE_Indicator, p, ceData, elementFlags, r, cg, sf);
+ if (sf & Style_On) {
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, sf);
+ }
+ break;
+ }
+
+ case CE_RadioButton: {
+ drawPrimitive(PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, sf);
+ if (sf & Style_On) {
+ TQCOORD center[] = { 4, 5, 4, 6, 5, 7, 6, 7, 7, 6, 7, 5, 6, 4, 5, 4 };
+ TQPointArray c(8, center);
+ p->setPen(cg.text());
+ p->setBrush(cg.text());
+ p->drawPolygon(c);
+ }
+ break;
+ }
+
+ case CE_PushButton: {
+ // Get rid of ugliness in Konqueror and KDevelop tab bar buttons, respectively
+ if ( ceData.widgetObjectTypes.contains("KMultiTabBarButton") || ceData.widgetObjectTypes.contains("Ideal::Button")) {
+ p->setPen(cg.mid());
+ p->setBrush(cg.background());
+ p->drawRect(r);
+
+ if (sf & Style_On) {
+ p->setPen(cg.mid());
+ p->setBrush(TQBrush(cg.light(),TQt::Dense4Pattern));
+ p->drawRect(r);
+ p->setPen(cg.buttonText());
+ } else if (sf & Style_Down) {
+ p->setPen(cg.mid());
+ p->drawRect(r);
+ p->setPen(cg.buttonText());
+ } else {
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+ }
+ }
+ else {
+ if (elementFlags & CEF_IsDefault) {
+ drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, sf);
+ drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, TQRect(x+1, y+1, sw-2, sh-2), cg, sf);
+ } else {
+ drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, sf);
+ }
+ }
+
+ break;
+ }
+
+ case CE_MenuBarItem: {
+ bool active = sf & Style_Active;
+ bool focused = sf & Style_HasFocus;
+ bool down = sf & Style_Down;
+ bool enabled = sf & Style_Enabled;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+ const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine;
+
+ if (active && focused) {
+ p->setBrush(cg.background());
+ p->setPen(cg.background());
+ p->drawRect(r);
+
+ if (down) {
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ /*p->translate(1, 1);*/
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ p->setPen(cg.mid());
+ p->drawLine(x2, y2, x, y2);
+ p->drawLine(x2, y2, x2, y);
+ }
+ }
+
+ p->setPen( POPUPMENUITEM_TEXT_ETCH_CONDITIONS?cg.dark():cg.foreground() );
+ TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height());
+ if POPUPMENUITEM_TEXT_ETCH_CONDITIONS {
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ p->drawText(r_offset, text_flags, o.menuItem()->text());
+ p->setPen(savePen);
+ }
+ p->drawText(r, text_flags, o.menuItem()->text());
+
+ /*if (active && focused && down) {
+ p->translate(-1, -1);
+ }*/
+
+ break;
+ }
+
+
+ case CE_PushButtonLabel: {
+ const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w);
+ const bool enabled = sf & Style_Enabled;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+ const int text_flags = AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine;
+ int dx = 0;
+
+ if (sf & Style_Down) {
+ p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
+ pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
+ }
+
+ if (pb->iconSet() && !pb->iconSet()->isNull()) {
+ TQIconSet::Mode mode = enabled ? TQIconSet::Normal : TQIconSet::Disabled;
+ TQPixmap pixmap = pb->iconSet()->pixmap(TQIconSet::Small, mode);
+ TQRect pr(0, 0, pixmap.width(), pixmap.height());
+
+ if (pb->text().isNull())
+ dx = r.center().x()-(pixmap.width()/2);
+ else
+ dx = (r.height() - pixmap.height())/2;
+ if ( pb->inherits("KMultiTabBarButton") ) {
+ pr.moveCenter(TQPoint(((pixmap.width()/2)+dx), r.center().y()));
+ dx = (pixmap.width()+dx+(dx*0.5));
+ }
+ else {
+ pr.moveCenter(TQPoint(((pixmap.width()/2)+dx), r.center().y()));
+ dx = (pixmap.width()+dx+(dx*0.5));
+ }
+
+ p->drawPixmap(pr.topLeft(), pixmap);
+ } else if (pb->pixmap() && !pb->text()) {
+ TQRect pr(0, 0, pb->pixmap()->width(), pb->pixmap()->height());
+ pr.moveCenter(r.center());
+ p->drawPixmap(pr.topLeft(), *pb->pixmap());
+ }
+
+ if (!pb->text().isNull()) {
+ p->setPen(POPUPMENUITEM_TEXT_ETCH_CONDITIONS?cg.dark():(enabled ? cg.buttonText() : pb->palette().disabled().buttonText()));
+ if (pb->iconSet() && !pb->iconSet()->isNull()) {
+ TQRect tpr(dx, r.y(), r.width()-dx, r.height());
+ TQRect tr(p->boundingRect(tpr, text_flags, pb->text()));
+
+ TQRect tr_offset = TQRect(tr.x()+ETCH_X_OFFSET, tr.y()+ETCH_Y_OFFSET, tr.width(), tr.height());
+ if PUSHBUTTON_TEXT_ETCH_CONDITIONS {
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ p->drawText(tr_offset, text_flags, pb->text());
+ p->setPen(savePen);
+ }
+ p->drawText(tr, text_flags, pb->text());
+ } else {
+ TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height());
+ if PUSHBUTTON_TEXT_ETCH_CONDITIONS {
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ p->drawText(r_offset, text_flags, pb->text());
+ p->setPen(savePen);
+ }
+ p->drawText(r, text_flags, pb->text());
+ }
+ }
+
+ break;
+ }
+
+ /* Note: This is very poorly documented by TT. I'm disappointed. -clee */
+ case CE_HeaderLabel: {
+ const bool enabled = sf & Style_Enabled;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+ const int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+
+ if (!ceData.iconSet.isNull()) {
+ TQPixmap pm = ceData.iconSet.pixmap(TQIconSet::Small, sf & Style_Enabled ? TQIconSet::Normal : TQIconSet::Disabled);
+ TQRect pr(0, 0, pm.width(), pm.height());
+ pr.moveCenter(r.center());
+ pr.setLeft(r.center().y() - (pm.height() - 1) / 2);
+ p->drawPixmap(pr.topLeft(), pm);
+ pr = TQRect(pr.width(), r.top(), r.width() - pr.width(), r.height());
+ TQRect pr_offset = TQRect(pr.x()+ETCH_X_OFFSET, pr.y()+ETCH_Y_OFFSET, pr.width(), pr.height());
+ if HEADER_TEXT_ETCH_CONDITIONS {
+ p->setPen( cg.dark()) ;
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ p->drawText(pr_offset, text_flags, ceData.textLabel);
+ p->setPen(savePen);
+ }
+ p->drawText(pr, text_flags, ceData.textLabel);
+ } else {
+ p->setPen( POPUPMENUITEM_TEXT_ETCH_CONDITIONS?cg.dark():cg.buttonText() );
+ TQRect r_offset = TQRect(r.x()+ETCH_X_OFFSET, r.y()+ETCH_Y_OFFSET, r.width(), r.height());
+ if HEADER_TEXT_ETCH_CONDITIONS {
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ p->drawText(r_offset, text_flags, ceData.textLabel);
+ p->setPen(savePen);
+ }
+ p->drawText(r, text_flags, ceData.textLabel);
+ }
+ break;
+ }
+
+ case CE_PopupMenuItem: {
+ TQMenuItem *mi = o.menuItem();
+
+ if (!mi) {
+ return;
+ }
+
+ static const int itemFrame = 2;
+ static const int itemHMargin = 3;
+ static const int itemVMargin = 3;
+ static const int arrowHMargin = 4;
+ static const int rightBorder = 16;
+ const int tab = o.tabWidth();
+
+ int checkcol = TQMAX(o.maxIconWidth(), 12);
+
+ bool active = sf & Style_Active;
+ bool disabled = !mi->isEnabled();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+ bool enabled = mi->isEnabled();
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+
+ int xpos = x;
+ int xm = itemFrame + checkcol + itemHMargin;
+
+ if (!ceData.bgPixmap.isNull()) {
+ p->drawPixmap(x, y, ceData.bgPixmap, x, y, sw, sh);
+ } else {
+ p->fillRect(x, y, sw, sh, cg.background());
+ }
+
+ if (mi->widget()) {
+ /* nOOOOOOOOOOOP */
+ } else if (mi->isSeparator()) {
+ p->setPen(cg.mid());
+ p->drawLine(x + 1, y + 3, x2 - 1, y + 3);
+ p->setPen(cg.light());
+ p->drawLine(x + 1, y + 4, x2 - 1, y + 4);
+ return;
+ }
+
+ if (active && !disabled && !mi->isSeparator()) {
+ p->setBrush(cg.highlight());
+ p->fillRect(r, cg.highlight());
+ p->setPen(cg.highlightedText());
+ }
+
+ if (mi->iconSet()) {
+ TQIconSet::Mode mode =
+ disabled ? TQIconSet::Disabled : TQIconSet::Normal;
+ TQPixmap pixmap = mi->iconSet()->pixmap(TQIconSet::Small, mode);
+
+ int pixw = pixmap.width();
+ int pixh = pixmap.height();
+
+ TQRect cr(xpos, y, o.maxIconWidth(), sh);
+ TQRect pmr(0, 0, pixw, pixh);
+ pmr.moveCenter(cr.center());
+
+ if (backwards)
+ pmr = visualRect(pmr, r);
+
+ p->setPen(cg.highlightedText());
+ p->drawPixmap(pmr.topLeft(), pixmap);
+ } else if (checkable) {
+ if (mi->isChecked()) {
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, sf, o);
+ }
+ }
+
+ xpos += xm;
+
+ if (mi->custom()) {
+ int m = itemVMargin;
+ p->setPen( POPUPMENUITEM_TEXT_ETCH_CONDITIONS?cg.dark():cg.foreground() );
+ if POPUPMENUITEM_TEXT_ETCH_CONDITIONS {
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ TQColorGroup etchedcg = cg;
+ etchedcg.setColor( TQColorGroup::Text, cg.light() );
+ etchedcg.setColor( TQColorGroup::Mid, cg.light() );
+ etchedcg.setColor( TQColorGroup::Midlight, cg.light() );
+ etchedcg.setColor( TQColorGroup::Foreground, cg.light() );
+ etchedcg.setColor( TQColorGroup::HighlightedText, cg.light() );
+ etchedcg.setColor( TQColorGroup::BrightText, cg.light() );
+ etchedcg.setColor( TQColorGroup::ButtonText, cg.light() );
+ mi->custom()->paint(p, etchedcg, active, !disabled, x+xm+ETCH_X_OFFSET, y+m+ETCH_Y_OFFSET, sw-xm-tab+1, sh-2*m);
+ p->setPen(savePen);
+ }
+ mi->custom()->paint(p, cg, active, !disabled, x+xm, y+m, sw-xm-tab+1, sh-2*m);
+ return;
+ } else {
+ p->setPen(active ? cg.highlightedText() : cg.buttonText());
+ TQString s = mi->text();
+
+ if(!s.isNull()) {
+ int t = s.find('\t');
+ int m = itemVMargin;
+
+ int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+
+ if (active && !disabled) {
+ p->setPen(cg.highlightedText());
+ } else if (disabled) {
+ p->setPen(cg.mid().light(110));
+ } else {
+ p->setPen(cg.text());
+ }
+
+ if (t >= 0) {
+ int xp = x + sw - tab - rightBorder - itemHMargin - itemFrame + 1;
+
+ TQRect rr = TQRect(xp, y+m, tab, sh-(2*m));
+ TQRect rr_offset = TQRect(xp+ETCH_X_OFFSET, y+m+ETCH_Y_OFFSET, tab, sh-(2*m));
+ if (backwards) {
+ rr = visualRect(rr, r);
+ rr_offset = visualRect(rr_offset, r);
+ }
+
+ if POPUPMENUITEM_TEXT_ETCH_CONDITIONS {
+ p->setPen(cg.dark());
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ p->drawText(rr_offset, text_flags, s.mid(t+1));
+ p->setPen(savePen);
+ }
+ p->drawText(rr, text_flags, s.mid(t+1));
+ s = s.left(t);
+ }
+
+ TQRect rr = TQRect(xpos, y+m, sw-xm-tab+1, sh-(2*m));
+ TQRect rr_offset = TQRect(xpos+ETCH_X_OFFSET, y+m+ETCH_Y_OFFSET, sw-xm-tab+1, sh-(2*m));
+ if (backwards) {
+ rr = visualRect(rr, r);
+ rr_offset = visualRect(rr_offset, r);
+ text_flags |= AlignRight;
+ }
+
+ if POPUPMENUITEM_TEXT_ETCH_CONDITIONS {
+ p->setPen(cg.dark());
+ TQPen savePen = p->pen();
+ p->setPen( cg.light() );
+ p->drawText(rr_offset, text_flags, s);
+ p->setPen(savePen);
+ }
+ p->drawText(rr, text_flags, s);
+ } else if (mi->pixmap()) {
+ TQPixmap *pixmap = mi->pixmap();
+ if (pixmap->depth() == 1) {
+ p->setBackgroundMode(Qt::OpaqueMode);
+ }
+ p->drawPixmap(xpos, y, *pixmap);
+ if (pixmap->depth() == 1) {
+ p->setBackgroundMode(Qt::TransparentMode);
+ }
+ }
+ }
+
+ if (mi->popup()) {
+ int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags);
+
+ xpos = x + sw - arrowHMargin - 2 * itemFrame - dim;
+
+ if (active && !disabled) {
+ p->setPen(cg.highlightedText());
+ } else {
+ p->setPen(cg.text());
+ }
+
+ TQRect rr = TQRect(xpos, y + sh/2 - dim/2, dim, dim);
+ if (backwards)
+ rr = visualRect(rr, r);
+ drawPrimitive((backwards ? PE_ArrowLeft : PE_ArrowRight), p, ceData, elementFlags, rr, cg, Style_Enabled);
+ }
+
+ break;
+ }
+
+ default: {
+ TDEStyle::drawControl(ce, p, ceData, elementFlags, r, cg, sf, o, w);
+ }
+ }
+}
+
+void AsteroidStyle::drawControlMask(TQ_ControlElement ce,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ switch (ce) {
+ /*
+ TQ_ControlElements to draw are:
+
+ CE_PushButton
+ CE_PushButtonLabel
+
+ CE_CheckBox
+ CE_CheckBoxLabel
+
+ CE_RadioButton
+ CE_RadioButtonLabel
+
+ CE_TabBarTab
+ CE_TabBarLabel
+
+ CE_ProgressBarGroove
+ CE_ProgressBarContents
+ CE_ProgressBarLabel
+
+ CE_PopupMenuScroller
+ CE_PopupMenuHorizontalExtra
+ CE_PopupMenuVerticalExtra
+ CE_PopupMenuItem
+ CE_MenuBarItem
+ CE_MenuBarEmptyArea
+ CE_DockWindowEmptyArea
+
+ CE_ToolButtonLabel
+ CE_ToolBoxTab
+
+ CE_HeaderLabel
+ */
+ default: {
+ TDEStyle::drawControlMask(ce, p, ceData, elementFlags, r, o, w);
+ }
+ }
+}
+
+void AsteroidStyle::drawComplexControl(TQ_ComplexControl cc,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags sf,
+ SCFlags sc,
+ SCFlags sa,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ switch (cc) {
+ /* TQ_ComplexControls available are:
+
+ CC_SpinWidget
+ CC_ScrollBar
+ CC_Slider
+ CC_ToolButton
+ CC_TitleBar
+ CC_ListView
+ */
+#ifndef TQT_NO_LISTVIEW
+ case CC_ListView:
+ {
+ if ( sc & SC_ListView ) {
+ TQCommonStyle::drawComplexControl( cc, p, ceData, elementFlags, r, cg, sf, sc, sa, o, w );
+ }
+ if ( sc & ( SC_ListViewBranch | SC_ListViewExpand ) ) {
+ if (o.isDefault())
+ break;
+
+ TQListViewItem *item = o.listViewItem(),
+ *child = item->firstChild();
+
+ int y = r.y();
+ int c;
+ int dotoffset = 0;
+ TQPointArray dotlines;
+ if ( sa == (uint)SC_All && sc == SC_ListViewExpand ) {
+ c = 2;
+ dotlines.resize(2);
+ dotlines[0] = TQPoint( r.right(), r.top() );
+ dotlines[1] = TQPoint( r.right(), r.bottom() );
+ } else {
+ int linetop = 0, linebot = 0;
+ // each branch needs at most two lines, ie. four end points
+ dotoffset = (item->itemPos() + item->height() - y) %2;
+ dotlines.resize( item->childCount() * 4 );
+ c = 0;
+
+ // skip the stuff above the exposed rectangle
+ while ( child && y + child->height() <= 0 ) {
+ y += child->totalHeight();
+ child = child->nextSibling();
+ }
+
+ int bx = r.width() / 2;
+
+ // paint stuff in the magical area
+ TQListView* v = item->listView();
+ while ( child && y < r.height() ) {
+ if (child->isVisible()) {
+ int lh;
+ if ( !item->multiLinesEnabled() )
+ lh = child->height();
+ else
+ lh = p->fontMetrics().height() + 2 * v->itemMargin();
+ lh = TQMAX( lh, TQApplication::globalStrut().height() );
+ if ( lh % 2 > 0 )
+ lh++;
+ linebot = y + lh/2;
+ if ( (child->isExpandable() || child->childCount()) &&
+ (child->height() > 0) ) {
+ // needs a box
+ p->setPen( cg.mid() );
+ p->drawRect( bx-4, linebot-4, 9, 9 );
+ // plus or minus
+ p->setPen( cg.text() );
+ p->drawLine( bx - 2, linebot, bx + 2, linebot );
+ if ( !child->isOpen() )
+ p->drawLine( bx, linebot - 2, bx, linebot + 2 );
+ // dotlinery
+ p->setPen( cg.mid() );
+ dotlines[c++] = TQPoint( bx, linetop );
+ dotlines[c++] = TQPoint( bx, linebot - 4 );
+ dotlines[c++] = TQPoint( bx + 5, linebot );
+ dotlines[c++] = TQPoint( r.width(), linebot );
+ linetop = linebot + 5;
+ } else {
+ // just dotlinery
+ dotlines[c++] = TQPoint( bx+1, linebot -1);
+ dotlines[c++] = TQPoint( r.width(), linebot -1);
+ }
+ y += child->totalHeight();
+ }
+ child = child->nextSibling();
+ }
+
+ // Expand line height to edge of rectangle if there's any
+ // visible child below
+ while ( child && child->height() <= 0)
+ child = child->nextSibling();
+ if ( child )
+ linebot = r.height();
+
+ if ( linetop < linebot ) {
+ dotlines[c++] = TQPoint( bx, linetop );
+ dotlines[c++] = TQPoint( bx, linebot );
+ }
+ }
+ p->setPen( cg.text() );
+
+ static TQBitmap *verticalLine = 0, *horizontalLine = 0;
+ static TQCleanupHandler<TQBitmap> qlv_cleanup_bitmap;
+ if ( !verticalLine ) {
+ // make 128*1 and 1*128 bitmaps that can be used for
+ // drawing the right sort of lines.
+ verticalLine = new TQBitmap( 1, 129, TRUE );
+ horizontalLine = new TQBitmap( 128, 1, TRUE );
+ TQPointArray a( 64 );
+ TQPainter p;
+ p.begin( verticalLine );
+ int i;
+ for( i=0; i<64; i++ )
+ a.setPoint( i, 0, i*2+1 );
+ p.setPen( Qt::color1 );
+ p.drawPoints( a );
+ p.end();
+ TQApplication::flushX();
+ verticalLine->setMask( *verticalLine );
+ p.begin( horizontalLine );
+ for( i=0; i<64; i++ )
+ a.setPoint( i, i*2+1, 0 );
+ p.setPen( Qt::color1 );
+ p.drawPoints( a );
+ p.end();
+ TQApplication::flushX();
+ horizontalLine->setMask( *horizontalLine );
+ qlv_cleanup_bitmap.add( &verticalLine );
+ qlv_cleanup_bitmap.add( &horizontalLine );
+ }
+
+ int line; // index into dotlines
+ if ( sc & SC_ListViewBranch ) for( line = 0; line < c; line += 2 ) {
+ // assumptions here: lines are horizontal or vertical.
+ // lines always start with the numerically lowest
+ // coordinate.
+
+ // point ... relevant coordinate of current point
+ // end ..... same coordinate of the end of the current line
+ // other ... the other coordinate of the current point/line
+ if ( dotlines[line].y() == dotlines[line+1].y() ) {
+ int end = dotlines[line+1].x();
+ int point = dotlines[line].x();
+ int other = dotlines[line].y();
+ while( point < end ) {
+ int i = 128;
+ if ( i+point > end )
+ i = end-point;
+ p->drawPixmap( point, other, *horizontalLine,
+ 0, 0, i, 1 );
+ point += i;
+ }
+ } else {
+ int end = dotlines[line+1].y();
+ int point = dotlines[line].y();
+ int other = dotlines[line].x();
+ int pixmapoffset = ((point & 1) != dotoffset ) ? 1 : 0;
+ while( point < end ) {
+ int i = 128;
+ if ( i+point > end )
+ i = end-point;
+ p->drawPixmap( other, point, *verticalLine,
+ 0, pixmapoffset, 1, i );
+ point += i;
+ }
+ }
+ }
+ }
+ }
+ break;
+#endif //TQT_NO_LISTVIEW
+
+ case CC_ComboBox: {
+ int x, y, x2, y2, sw, sh;
+ r.rect(&x, &y, &sw, &sh);
+ r.coords(&x, &y, &x2, &y2);
+
+ if (sa & Style_Sunken) {
+ sf |= Style_Sunken;
+ }
+
+ static const unsigned char downarrow_bits[] = {
+ 0x7f, 0xbe, 0x9c, 0x08, 0x00, 0x00, 0x00, 0x28,
+ 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0xb8
+ };
+
+ static const unsigned int handle_width = 16;
+ static const unsigned int handle_offset = handle_width + 1;
+
+ TQBitmap downArrow = TQBitmap(7, 4, downarrow_bits, true);
+ downArrow.setMask(downArrow);
+
+ // Draw the frame around the text.
+ p->setPen(cg.mid());
+ p->setBrush(cg.dark());
+ p->drawRect(r);
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x2, y);
+ p->drawLine(x2, y2, x, y2);
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x2-1, y+1);
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+
+ // Fill in the area behind the text.
+ p->fillRect(querySubControlMetrics(cc, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, w), cg.base());
+ p->setBrush(cg.background());
+
+ // Draw the box on the right.
+ TQRect hr(sw - handle_offset-1, y+2, handle_width, sh-4);
+ int hrx, hry, hrx2, hry2;
+ hr.coords(&hrx, &hry, &hrx2, &hry2);
+ if (backwards) { hr = visualRect(hr, r); }
+
+ p->drawRect(hr);
+
+ bool draw_skinny_frame = false;
+// if (!ceData.widgetObjectTypes.contains(TQCOMBOBOX_OBJECT_NAME_STRING)) draw_skinny_frame = true;
+ if (ceData.comboBoxListBoxFlags & CEF_IsVisible) draw_skinny_frame = true;
+ if (draw_skinny_frame) {
+ p->setPen(cg.mid());
+ p->drawRect(hr);
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(hrx+1, hry+1, hrx2-1, hry+1);
+ p->drawLine(hrx+1, hry+1, hrx+1, hry2-1);
+
+ p->setPen(cg.mid());
+ p->drawLine(hrx2-1, hry2-1, hrx+1, hry2-1);
+ p->drawLine(hrx2-1, hry2-1, hrx2-1, hry+1);
+
+ p->setPen(cg.dark());
+ p->drawLine(hrx2, hry2, hrx, hry2);
+ p->drawLine(hrx2, hry2, hrx2, hry);
+ }
+
+ TQRect cr(sw - handle_offset-1, y+2, handle_width, sh - 4);
+ TQRect pmr(0, 0, 7, 4);
+ pmr.moveCenter(cr.center());
+ if (ceData.comboBoxListBoxFlags & CEF_IsVisible) {
+ pmr.moveBy(1, 1);
+ }
+
+ if (backwards) { pmr = visualRect(pmr, r); }
+
+ p->setPen(cg.foreground());
+ p->drawPixmap(pmr.topLeft(), downArrow);
+
+ break;
+ }
+
+#ifndef TQT_NO_TOOLBUTTON
+ case CC_ToolButton:
+ {
+ TQColorGroup c = cg;
+ if ( ceData.backgroundMode != TQt::PaletteButton )
+ c.setBrush( TQColorGroup::Button, ceData.paletteBgColor );
+ TQRect button, menuarea;
+ button = visualRect( querySubControlMetrics(cc, ceData, elementFlags, SC_ToolButton, o, w), ceData, elementFlags );
+ menuarea = visualRect( querySubControlMetrics(cc, ceData, elementFlags, SC_ToolButtonMenu, o, w), ceData, elementFlags );
+
+ SFlags bflags = sf;
+ SFlags mflags = sf;
+
+ if (sa & SC_ToolButton)
+ bflags |= Style_Down;
+ if (sa & SC_ToolButtonMenu)
+ mflags |= Style_Down;
+
+ if (sc & SC_ToolButton) {
+ if (bflags & (Style_Down | Style_On | Style_Raised)) {
+ drawPrimitive(TQStyle::PE_ButtonTool, p, ceData, elementFlags, button, c, bflags, o);
+ } else if ( ! ceData.parentWidgetData.bgPixmap.isNull() ) {
+ TQPixmap pixmap = ceData.parentWidgetData.bgPixmap;
+
+ p->drawTiledPixmap( r, pixmap, ceData.pos );
+ }
+ }
+
+ if (sc & SC_ToolButtonMenu) {
+ if (mflags & (Style_Down | Style_On | Style_Raised))
+ drawPrimitive(TQStyle::PE_ButtonDropDown, p, ceData, elementFlags, menuarea, c, mflags, o);
+ drawPrimitive(TQStyle::PE_ArrowDown, p, ceData, elementFlags, menuarea, c, mflags, o);
+ }
+
+ if ((elementFlags & CEF_HasFocus) && !(elementFlags & CEF_HasFocusProxy)) {
+ TQRect fr = ceData.rect;
+ fr.addCoords(3, 3, -3, -3);
+ drawPrimitive(TQStyle::PE_FocusRect, p, ceData, elementFlags, fr, c);
+ }
+
+ break;
+ }
+#endif // TQT_NO_TOOLBUTTON
+
+ case CC_Slider: {
+ TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove, o, w);
+ TQRect handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle, o, w);
+
+ // Double-buffer slider for no flicker
+ TQPixmap pix(ceData.rect.size());
+ TQPainter p2;
+ p2.begin(&pix);
+
+ if ( !ceData.parentWidgetData.bgPixmap.isNull() ) {
+ TQPixmap pixmap = ceData.parentWidgetData.bgPixmap;
+ p2.drawTiledPixmap(r, pixmap, ceData.pos);
+ } else
+ pix.fill(cg.background());
+
+ // Draw slider groove
+ if ((sc & SC_SliderGroove) && groove.isValid()) {
+ drawTDEStylePrimitive( KPE_SliderGroove, &p2, ceData, elementFlags, groove, cg, sf, o, w );
+
+ // Draw the focus rect around the groove
+ if (elementFlags & CEF_HasFocus)
+ drawPrimitive(PE_FocusRect, &p2, ceData, elementFlags, groove, cg);
+ }
+
+
+ /* Turn these off for now */
+ // Draw the tickmarks
+ /*if (controls & SC_SliderTickmarks)
+ TQCommonStyle::drawComplexControl(control, &p2,
+ r, cg, flags, SC_SliderTickmarks, sa, o);*/
+
+ // Draw the slider handle
+ if ((sc & SC_SliderHandle) && handle.isValid()) {
+ if (sa == SC_SliderHandle)
+ sf |= Style_Active;
+ drawTDEStylePrimitive( KPE_SliderHandle, &p2, ceData, elementFlags, handle, cg, sf, o, w );
+ }
+
+ p2.end();
+ if (w) {
+ bitBlt((TQWidget*)w, r.x(), r.y(), &pix);
+ }
+ else {
+ p->drawPixmap(r.topLeft(), pix);
+ }
+ break;
+ }
+
+ case CC_SpinWidget: {
+ int x, y, x2, y2, w, h;
+ int aw = SPINBOX_BUTTON_WIDTH; // arrow button width
+ r.coords(&x, &y, &x2, &y2);
+ r.rect(&x, &y, &w, &h);
+
+ TQRect arrowup(x2-aw, y+2, aw, h/2-1);
+ TQRect arrowdn(x2-aw, h/2+1, aw, h/2-2);
+
+ // Draw the frame around the text
+ p->setPen(cg.mid());
+ p->setBrush(cg.dark());
+ p->drawRect(r);
+ p->setPen(cg.light());
+ p->drawLine(x2, y2, x2, y);
+ p->drawLine(x2, y2, x, y2);
+ p->setPen(cg.background());
+ p->drawLine(x2-1, y2-1, x2-1, y+2);
+ p->drawLine(x2-1, y2-1, x+1, y2-1);
+ p->drawLine(x2-aw-1, y+2, x2-aw-1, y2-1);
+
+ // Draw the arrow buttons
+ SFlags upflags = Style_Default;
+ SFlags downflags = Style_Default;
+ if (ceData.spinWidgetData.upEnabled) {
+ upflags |= Style_Enabled;
+ }
+ if (ceData.spinWidgetData.downEnabled) {
+ downflags |= Style_Enabled;
+ }
+ if (sa == SC_SpinWidgetUp) {
+ upflags |= Style_On;
+ upflags |= Style_Sunken;
+ downflags |= Style_Raised;
+ }
+ if (sa == SC_SpinWidgetDown) {
+ downflags |= Style_On;
+ downflags |= Style_Sunken;
+ upflags |= Style_Raised;
+ }
+
+ p->setPen(TQt::NoPen);
+ drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, arrowup, cg, upflags, o);
+ p->setPen(TQt::NoPen);
+ drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, arrowdn, cg, downflags, o);
+ p->setPen(TQt::NoPen);
+ drawPrimitive(PE_SpinWidgetUp, p, ceData, elementFlags, arrowup, cg, upflags, o);
+ p->setPen(TQt::NoPen);
+ drawPrimitive(PE_SpinWidgetDown, p, ceData, elementFlags, arrowdn, cg, downflags, o);
+
+ break;
+
+ }
+
+
+
+ default: {
+ TDEStyle::drawComplexControl(cc, p, ceData, elementFlags, r, cg, sf, sc, sa, o, w);
+ }
+ }
+}
+
+void AsteroidStyle::drawComplexControlMask(TQ_ComplexControl cc,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ switch (cc) {
+ /* TQ_ComplexControls available are:
+
+ CC_SpinWidget
+ CC_ComboBox
+ CC_ScrollBar
+ CC_Slider
+ CC_ToolButton
+ CC_TitleBar
+ CC_ListView
+ */
+ default: {
+ TDEStyle::drawComplexControlMask(cc, p, ceData, elementFlags, r, o, w);
+ }
+ }
+}
+
+int AsteroidStyle::pixelMetric(PixelMetric pm, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *w) const
+{
+ switch (pm) {
+ /* PixelMetrics available are:
+
+ PM_ButtonMargin
+ PM_ButtonDefaultIndicator
+
+ PM_SpinBoxFrameWidth
+ PM_MDIFrameWidth
+ PM_MDIMinimizedWidth
+
+ PM_MaximumDragDistance
+
+ PM_ScrollBarExtent
+ PM_ScrollBarSliderMin
+
+ PM_SliderThickness
+ PM_SliderControlThickness
+ PM_SliderLength
+ PM_SliderTickmarkOffset
+ PM_SliderSpaceAvailable
+
+ PM_DockWindowSeparatorExtent
+ PM_DockWindowHandleExtent
+
+ PM_TabBarTabOverlap
+ PM_TabBarTabHSpace
+ PM_TabBarTabVSpace
+ PM_TabBarBaseHeight
+ PM_TabBarBaseOverlap
+
+ PM_ProgressBarChunkWidth
+
+ PM_SplitterWidth
+
+ PM_TitleBarHeight
+
+ PM_CheckListButtonSize
+ PM_CheckListControllerSize
+
+ PM_PopupMenuFrameHorizontalExtra
+ PM_PopupMenuFrameVerticalExtra
+ PM_PopupMenuScrollerHeight
+
+ PM_HeaderMarkSize
+
+ PM_TabBarTabShiftHorizontal
+ PM_TabBarTabShiftVertical
+ */
+
+ case PM_ExclusiveIndicatorWidth:
+ case PM_ExclusiveIndicatorHeight: {
+ return 12;
+ }
+
+ case PM_IndicatorWidth:
+ case PM_IndicatorHeight: {
+ return 13;
+ }
+
+ case PM_MenuBarFrameWidth: {
+ return 2;
+ }
+
+ case PM_ButtonShiftHorizontal:
+ case PM_ButtonShiftVertical: {
+ return 1;
+ }
+
+ case PM_HeaderGripMargin:
+ case PM_HeaderMargin: {
+ return 3;
+ }
+
+ case PM_DialogButtonsButtonWidth: {
+ return MINIMUM_PUSHBUTTON_WIDTH;
+ }
+
+ case PM_DialogButtonsButtonHeight: {
+ return MINIMUM_PUSHBUTTON_HEIGHT;
+ }
+
+ case PM_DockWindowSeparatorExtent:
+ case PM_MenuButtonIndicator:
+ case PM_DockWindowFrameWidth:
+ case PM_DialogButtonsSeparator: {
+ return 6;
+ }
+
+ case PM_DefaultFrameWidth: {
+ if (ceData.widgetObjectTypes.contains(TQPOPUPMENU_OBJECT_NAME_STRING)) {
+ return 3;
+ } else {
+ return TDEStyle::pixelMetric(pm, ceData, elementFlags, w);
+ }
+ }
+
+ case PM_TabBarTabOverlap:
+ return 4;
+
+ case PM_TabBarBaseHeight:
+ return 0;
+
+ case PM_TabBarBaseOverlap:
+ return 0;
+
+ case PM_TabBarTabHSpace:
+ return 24;
+
+ case PM_TabBarTabShiftHorizontal:
+ return 4;
+
+ case PM_TabBarTabShiftVertical:
+ return 2;
+
+ case PM_SplitterWidth:
+ return TQMAX( 4, TQApplication::globalStrut().width() );
+
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ return 0;
+
+ default: {
+ return TDEStyle::pixelMetric(pm, ceData, elementFlags, w);
+ }
+ }
+}
+
+TQRect AsteroidStyle::subRect(SubRect sr, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *w) const
+{
+ switch (sr) {
+ /* SubRects to calculate are:
+
+ SR_PushButtonContents
+ SR_PushButtonFocusRect
+
+ SR_CheckBoxIndicator
+ SR_CheckBoxContents
+ SR_CheckBoxFocusRect
+
+ SR_RadioButtonIndicator
+ SR_RadioButtonContents
+ SR_RadioButtonFocusRect
+
+ SR_ComboBoxFocusRect
+ SR_SliderFocusRect
+
+ SR_DockWindowHandleRect
+
+ SR_ProgressBarGroove
+ SR_ProgressBarContents
+ SR_ProgressBarLabel
+
+ SR_ToolButtonContents
+ SR_ToolBoxTabContents
+
+ SR_DialogButtonAccept
+ SR_DialogButtonReject
+ SR_DialogButtonApply
+ SR_DialogButtonHelp
+ SR_DialogButtonAll
+ SR_DialogButtonAbort
+ SR_DialogButtonIgnore
+ SR_DialogButtonRetry
+ SR_DialogButtonCustom
+ */
+ default: {
+ return TDEStyle::subRect(sr, ceData, elementFlags, w);
+ }
+ }
+}
+
+TQRect AsteroidStyle::querySubControlMetrics(TQ_ComplexControl cc,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl sc,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ switch (cc) {
+ /* Available SubControls are:
+
+ SC_ScrollBarAddLine
+ SC_ScrollBarSubLine
+ SC_ScrollBarAddPage
+ SC_ScrollBarSubPage
+ SC_ScrollBarFirst
+ SC_ScrollBarLast
+ SC_ScrollBarSlider
+ SC_ScrollBarGroove
+
+ SC_SpinWidgetUp
+ SC_SpinWidgetDown
+ SC_SpinWidgetFrame
+ SC_SpinWidgetEditField
+ SC_SpinWidgetButtonField
+
+ SC_ComboBoxFrame
+ SC_ComboBoxArrow
+ SC_ComboBoxListBoxPopup
+
+ SC_SliderGroove
+ SC_SliderHandle
+ SC_SliderTickmarks
+
+ SC_ToolButton
+ SC_ToolButtonMenu
+
+ SC_TitleBarLabel
+ SC_TitleBarSysMenu
+ SC_TitleBarMinButton
+ SC_TitleBarMaxButton
+ SC_TitleBarCloseButton
+ SC_TitleBarNormalButton
+ SC_TitleBarShadeButton
+ SC_TitleBarUnshadeButton
+
+ SC_ListView
+ SC_ListViewBranch
+ SC_ListViewExpand
+ */
+ case CC_ComboBox: {
+ TQRect r(ceData.rect);
+
+ switch (sc) {
+ case SC_ComboBoxEditField: {
+ return TQRect(r.x()+2, r.y()+2, r.width()-20, r.height()-4);
+ }
+ default: {
+ return TDEStyle::querySubControlMetrics(cc, ceData, elementFlags, sc, o, w);
+ }
+ }
+
+ break;
+ }
+
+ case CC_SpinWidget: {
+ int fw = pixelMetric(PM_SpinBoxFrameWidth, ceData, elementFlags, w);
+ TQSize bs;
+ bs.setHeight(ceData.rect.height()/2 - fw);
+ if (bs.height() < 8) {
+ bs.setHeight(8);
+ }
+ bs.setWidth(SPINBOX_BUTTON_WIDTH);
+ bs = bs.expandedTo(TQApplication::globalStrut());
+ int y = fw;
+ int x, lx, rx;
+ x = ceData.rect.width() - y - bs.width();
+ lx = fw;
+ rx = x - fw;
+ switch ( sc ) {
+ case SC_SpinWidgetUp:
+ return TQRect(x, y, bs.width(), bs.height());
+ case SC_SpinWidgetDown:
+ return TQRect(x, y + bs.height(), bs.width(), bs.height());
+ case SC_SpinWidgetButtonField:
+ return TQRect(x, y, bs.width(), ceData.rect.height() - (2*fw));
+ case SC_SpinWidgetEditField:
+ return TQRect(lx, fw, rx, ceData.rect.height() - (2*fw));
+ case SC_SpinWidgetFrame:
+ return ceData.rect;
+ default:
+ return TDEStyle::querySubControlMetrics(cc, ceData, elementFlags, sc, o, w);
+ break;
+ }
+
+ break;
+ }
+
+ default: {
+ return TDEStyle::querySubControlMetrics(cc, ceData, elementFlags, sc, o, w);
+ }
+ }
+}
+
+TQSize AsteroidStyle::sizeFromContents(ContentsType ct,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &s,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ switch (ct) {
+ /* ContentsType values can be:
+
+ CT_CheckBox
+ CT_RadioButton
+ CT_Splitter
+ CT_DockWindow
+ CT_ProgressBar
+ CT_TabBarTab
+ CT_Slider
+ CT_LineEdit
+ CT_SpinBox
+ CT_SizeGrip
+ CT_TabWidget
+ CT_DialogButtons
+ */
+ case CT_ToolButton: {
+ return TQSize(s.width() + 8, s.height() + 8);
+ }
+
+ case CT_PushButton: {
+ const TQPushButton *pb = dynamic_cast<const TQPushButton *>(w);
+ const TQSize ret = TDEStyle::sizeFromContents(ct, ceData, elementFlags, s, o, w);
+ int rw = ret.width(), rh = ret.height();
+ int mw;
+ int mh;
+ if (pb->text().length() > 0) {
+ mw = MINIMUM_PUSHBUTTON_WIDTH;
+ mh = MINIMUM_PUSHBUTTON_HEIGHT;
+ }
+ else {
+ mw = 1;
+ mh = 1;
+ }
+
+ if (pb->text().length() > 0) {
+ if (pb->iconSet() && !pb->iconSet()->isNull()) {
+ rw += ((pb->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).width())*2.0);
+ } else if (pb->pixmap() && !pb->pixmap()->isNull()) {
+ rw += ((pb->pixmap()->width())*2.0);
+ }
+ }
+ else {
+ if (pb->iconSet() && !pb->iconSet()->isNull()) {
+ rw += ((pb->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).width())*0.0);
+ } else if (pb->pixmap() && !pb->pixmap()->isNull()) {
+ rw += ((pb->pixmap()->width())*0.0);
+ }
+ }
+
+ return TQSize((rw < mw ? mw : rw), (rh < mh ? mh : rh));
+ }
+
+ case CT_ComboBox: {
+ int padding = (pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, w) * 2) + 1;
+ return TQSize(s.width() + 21, s.height() + padding);
+ }
+
+ case CT_PopupMenuItem: {
+ if (o.isDefault()) {
+ return TQSize(0, 0);
+ }
+
+ int sw = s.width(), sh = s.height();
+ TQMenuItem *mi = o.menuItem();
+
+ if (mi->custom()) {
+ sw = mi->custom()->sizeHint().width();
+ sh = mi->custom()->sizeHint().height();
+ } else if (mi->widget()) {
+ /* This is a do-nothing branch */
+ } else if (mi->isSeparator()) {
+ sw = 0, sh = 9;
+ } else {
+ if (mi->pixmap()) {
+ sh = TQMAX(sh, mi->pixmap()->height() + 2);
+ } else if (mi->iconSet()) {
+ sh = TQMAX(sh, mi->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).height() + 2);
+ }
+
+ sh = TQMAX(sh, TQFontMetrics(ceData.font).height() + 4);
+ }
+
+ if (!mi->text().isNull()) {
+ if ((mi->text().find('\t') >= 0)) {
+ sw += 16;
+ } else if (mi->popup()) {
+ sw += 8;
+ }
+ }
+
+ int miw = o.maxIconWidth();
+ if (miw) {
+ sw += miw;
+ if (elementFlags & CEF_IsCheckable) {
+ sw += 20 - miw;
+ }
+ }
+
+ sw += 20;
+
+ return TQSize(sw, sh);
+ }
+
+ case CT_MenuBar: {
+ // Fall through is intentional
+// const TQMenuBar *mb = dynamic_cast<const TQMenuBar *>(w);
+// int sh = TQFontInfo(mb->font()).pixelSize() + 4;
+// int sw = 10;
+// return TQSize(sw, sh);
+ }
+
+ case CT_Header: {
+ // Fall through is intentional
+// const TQHeader *hw = dynamic_cast<const TQHeader *>(w);
+// int sh = TQFontInfo(ceData.font).pixelSize() + 8;
+// int sw = 10;
+// return TQSize(sw, sh);
+ }
+
+ default: {
+ return TDEStyle::sizeFromContents(ct, ceData, elementFlags, s, o, w);
+ }
+ }
+}
+
+void AsteroidStyle::paletteChanged()
+{
+}
+
+bool AsteroidStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e )
+{
+ /* Win2K has this interesting behaviour where it sets the current
+ default button to whatever pushbutton the user presses the mouse
+ on. I _think_ this emulates that properly. -clee */
+ if (ceData.widgetObjectTypes.contains(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
+ if (e->type() == TQEvent::MouseButtonPress) {
+ widgetActionRequest(ceData, elementFlags, source, WAR_SetDefault);
+ }
+ }
+
+ return false;
+}
diff --git a/tdestyles/asteroid/asteroid.h b/tdestyles/asteroid/asteroid.h
new file mode 100644
index 000000000..d6be130aa
--- /dev/null
+++ b/tdestyles/asteroid/asteroid.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2003, Chris Lee <clee@kde.org>
+ *
+ * See LICENSE for details about copyright.
+ */
+
+#ifndef __ASTEROID_H
+#define __ASTEROID_H
+
+#include <tdestyle.h>
+
+class AsteroidStyle : public TDEStyle
+{
+ Q_OBJECT
+
+public:
+ AsteroidStyle();
+ virtual ~AsteroidStyle();
+
+ void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+ void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+ void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+ void applicationUnPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+
+
+ void renderSliderHandle(TQPainter *p,
+ const TQRect &r,
+ const TQColorGroup &g,
+ const bool mouseOver,
+ const bool horizontal,
+ const bool enabled) const;
+
+ void renderMenuBlendPixmap(KPixmap &,
+ const TQColorGroup &,
+ const TQPopupMenu *) const;
+
+ void drawTDEStylePrimitive(TDEStylePrimitive,
+ TQPainter *,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &,
+ const TQColorGroup &,
+ SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default,
+ const TQWidget * = 0) const;
+
+ int styleHint(TQ_StyleHint, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQStyleOption & = TQStyleOption::Default,
+ TQStyleHintReturn * = 0,
+ const TQWidget * = 0 ) const;
+
+ void drawPrimitive(TQ_PrimitiveElement,
+ TQPainter *,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &,
+ const TQColorGroup &,
+ SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default) const;
+
+ void drawControl(TQ_ControlElement,
+ TQPainter *,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &,
+ const TQColorGroup &,
+ SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default,
+ const TQWidget * = 0) const;
+
+ void drawControlMask(TQ_ControlElement,
+ TQPainter *,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &,
+ const TQStyleOption &,
+ const TQWidget * = 0) const;
+
+ void drawComplexControl(TQ_ComplexControl,
+ TQPainter *,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &,
+ const TQColorGroup &,
+ SFlags = Style_Default,
+ SCFlags controls = SC_All,
+ SCFlags active = SC_None,
+ const TQStyleOption & = TQStyleOption::Default,
+ const TQWidget * = 0) const;
+
+ void drawComplexControlMask(TQ_ComplexControl,
+ TQPainter *,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption & = TQStyleOption::Default,
+ const TQWidget * = 0) const;
+
+ int pixelMetric(PixelMetric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget * = 0) const;
+
+ int kPixelMetric( TDEStylePixelMetric kpm, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget* /* widget */) const;
+
+ TQRect subRect(SubRect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *) const;
+
+ TQRect querySubControlMetrics(TQ_ComplexControl,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl,
+ const TQStyleOption & = TQStyleOption::Default,
+ const TQWidget * = 0) const;
+
+ TQSize sizeFromContents(ContentsType,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &,
+ const TQStyleOption &,
+ const TQWidget * = 0) const;
+
+ virtual bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
+
+protected slots:
+ void paletteChanged();
+
+private:
+ AsteroidStyle(const AsteroidStyle &);
+ AsteroidStyle &operator = (const AsteroidStyle &);
+
+/* Settings not needed yet. */
+// TQSettings *settings;
+ bool backwards;
+};
+
+#endif /* __ASTEROID_H */
diff --git a/tdestyles/asteroid/asteroid.themerc b/tdestyles/asteroid/asteroid.themerc
new file mode 100644
index 000000000..2679b6818
--- /dev/null
+++ b/tdestyles/asteroid/asteroid.themerc
@@ -0,0 +1,8 @@
+[Misc]
+Name=Asteroid style
+Name[en]=Asteroid style
+Comment=Windows 2000 (codename: Asteroid) appearance
+Comment[en]=Windows 2000 (codename: Asteroid) appearance
+
+[KDE]
+WidgetStyle=Asteroid
diff --git a/tdestyles/highcolor/CMakeLists.txt b/tdestyles/highcolor/CMakeLists.txt
new file mode 100644
index 000000000..8b601d6ac
--- /dev/null
+++ b/tdestyles/highcolor/CMakeLists.txt
@@ -0,0 +1,41 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions(
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdefx
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### highcolor #################################
+
+set( target highcolor )
+
+set( ${target}_SRCS
+ highcolor.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdefx-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
+)
diff --git a/tdestyles/highcolor/Makefile.am b/tdestyles/highcolor/Makefile.am
new file mode 100644
index 000000000..5b2880215
--- /dev/null
+++ b/tdestyles/highcolor/Makefile.am
@@ -0,0 +1,29 @@
+
+# This file is part of the KDE libraries
+# Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
+# (C) 1997 Stephan Kulow (coolo@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 as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# 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; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+AM_CPPFLAGS = -DQT_PLUGIN
+
+INCLUDES = -I$(top_srcdir)/tdefx $(all_includes)
+noinst_HEADERS = highcolor.h bitmaps.h
+kde_style_LTLIBRARIES = highcolor.la
+highcolor_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+highcolor_la_LIBADD = ../../tdefx/libtdefx.la $(LIB_QT)
+highcolor_la_SOURCES = highcolor.cpp
+highcolor_la_METASOURCES = AUTO
diff --git a/tdestyles/highcolor/bitmaps.h b/tdestyles/highcolor/bitmaps.h
new file mode 100644
index 000000000..f63301818
--- /dev/null
+++ b/tdestyles/highcolor/bitmaps.h
@@ -0,0 +1,84 @@
+#ifndef __BITMAPS_H
+#define __BITMAPS_H
+
+/* Image bits processed by KPixmap2Bitmaps */
+static const unsigned char radiooff_light_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x10,
+ 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x08, 0x00, 0x08, 0x0c, 0x06,
+ 0xf0, 0x01};
+
+static const unsigned char radiooff_gray_bits[] = {
+ 0xf0, 0x01, 0x0c, 0x06, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00};
+
+static const unsigned char radiooff_dgray_bits[] = {
+ 0x00, 0x00, 0xf0, 0x01, 0x0c, 0x02, 0x04, 0x00, 0x02, 0x00, 0x02, 0x00,
+ 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00};
+
+static const unsigned char radiooff_center_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0xf8, 0x03, 0xfc, 0x07, 0xfc, 0x07,
+ 0xfc, 0x07, 0xfc, 0x07, 0xfc, 0x07, 0xf8, 0x03, 0xf0, 0x01, 0x00, 0x00,
+ 0x00, 0x00};
+
+static const unsigned char radiomask_bits[] = {
+ 0xf0, 0x01, 0xfc, 0x07, 0xfe, 0x0b, 0xfe, 0x0b, 0xff, 0x17, 0xff, 0x17,
+ 0xff, 0x17, 0xff, 0x17, 0xff, 0x17, 0xfe, 0x0b, 0xf2, 0x09, 0x0c, 0x06,
+ 0xf0, 0x01};
+
+// Checkbox "checked" bitmap
+static const unsigned char x_bits[] = {0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63};
+
+// Arrow bitmaps
+static const TQCOORD u_arrow[]={-1,-3, 0,-3, -2,-2, 1,-2, -3,-1, 2,-1, -4,0, 3,0, -4,1, 3,1};
+static const TQCOORD d_arrow[]={-4,-2, 3,-2, -4,-1, 3,-1, -3,0, 2,0, -2,1, 1,1, -1,2, 0,2};
+static const TQCOORD l_arrow[]={-3,-1, -3,0, -2,-2, -2,1, -1,-3, -1,2, 0,-4, 0,3, 1,-4, 1,3};
+static const TQCOORD r_arrow[]={-2,-4, -2,3, -1,-4, -1,3, 0,-3, 0,2, 1,-2, 1,1, 2,-1, 2,0};
+
+namespace B3 {
+ const TQCOORD u_arrow[]={ 0,-2, 0,-2, -1,-1, 1,-1, -2,0, 2,0, -3,1, 3,1 };
+ const TQCOORD d_arrow[]={ -3,-2, 3,-2, -2,-1, 2,-1, -1,0, 1,0, 0,1, 0,1 };
+ const TQCOORD l_arrow[]={ 1,-3, 1,-3, 0,-2, 1,-2, -1,-1, 1,-1, -2,0, 1,0, -1,1, 1,1, 0,2, 1,2, 1,3, 1,3 };
+ const TQCOORD r_arrow[]={ -2,-3, -2,-3, -2,-2, -1,-2, -2,-1, 0,-1, -2,0, 1,0, -2,1, 0,1, -2,2, -1,2, -2,3, -2,3 };
+}
+
+#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2)
+
+
+// Fix Qt's wacky image positions
+static const char * const hc_minimize_xpm[] = {
+"12 12 2 1",
+"# c #000000",
+". c None",
+"............",
+"............",
+"............",
+"............",
+"............",
+"............",
+"............",
+"............",
+"...######...",
+"...######...",
+"............",
+"............"};
+
+static const char * const hc_close_xpm[] = {
+"12 12 2 1",
+"# c #000000",
+". c None",
+"............",
+"............",
+"............",
+"..##....##..",
+"...##..##...",
+"....####....",
+".....##.....",
+"....####....",
+"...##..##...",
+"..##....##..",
+"............",
+"............"};
+
+#endif
diff --git a/tdestyles/highcolor/highcolor.cpp b/tdestyles/highcolor/highcolor.cpp
new file mode 100644
index 000000000..4fccff059
--- /dev/null
+++ b/tdestyles/highcolor/highcolor.cpp
@@ -0,0 +1,2173 @@
+/*
+ * $Id$
+ *
+ * KDE3 HighColor Style (version 1.0)
+ * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ * (C) 2001-2002 Fredrik H�glund <fredrik@kde.org>
+ *
+ * Drawing routines adapted from the KDE2 HCStyle,
+ * Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ * (C) 2000 Dirk Mueller <mueller@kde.org>
+ * (C) 2001 Martijn Klingens <klingens@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.
+ */
+
+#include <tqdrawutil.h>
+#include <tqpainter.h>
+#include <tqpointarray.h>
+#include <tqstyleplugin.h>
+
+#include <tqcombobox.h>
+#include <tqheader.h>
+#include <tqmenubar.h>
+#include <tqpushbutton.h>
+#include <tqscrollbar.h>
+#include <tqslider.h>
+#include <tqtabbar.h>
+#include <tqtoolbutton.h>
+#include <tqtoolbar.h>
+#include <tqpopupmenu.h>
+
+#include <tqimage.h>
+#include <tqapplication.h>
+
+#include <kdrawutil.h>
+#include <kpixmapeffect.h>
+
+#include "highcolor.h"
+#include "highcolor.moc"
+#include "bitmaps.h"
+
+
+// -- Style Plugin Interface -------------------------
+class HighColorStylePlugin : public TQStylePlugin
+{
+ public:
+ HighColorStylePlugin() {}
+ ~HighColorStylePlugin() {}
+
+ TQStringList keys() const
+ {
+ return TQStringList() << "HighColor" << "Default" << "B3";
+ }
+
+ TQStyle* create( const TQString& key )
+ {
+ if ( key == "highcolor" )
+ return new HighColorStyle( HighColorStyle::HighColor );
+
+ else if ( key == "default" )
+ return new HighColorStyle( HighColorStyle::Default );
+
+ else if ( key == "b3" )
+ return new HighColorStyle( HighColorStyle::B3 );
+
+ return 0;
+ }
+};
+
+KDE_Q_EXPORT_PLUGIN( HighColorStylePlugin )
+// ---------------------------------------------------
+
+
+static TQBitmap lightBmp;
+static TQBitmap grayBmp;
+static TQBitmap dgrayBmp;
+static TQBitmap centerBmp;
+static TQBitmap maskBmp;
+static TQBitmap xBmp;
+static TQIntDict<GradientSet> gDict;
+
+static const int itemFrame = 1;
+static const int itemHMargin = 3;
+static const int itemVMargin = 0;
+static const int arrowHMargin = 6;
+static const int rightBorder = 12;
+static const char* kdeToolbarWidget = "kde toolbar widget";
+
+// ---------------------------------------------------------------------------
+
+GradientSet::GradientSet(const TQColor &baseColor)
+{
+ c = baseColor;
+ for(int i=0; i < GradientCount; i++)
+ gradients[i] = NULL;
+}
+
+
+GradientSet::~GradientSet()
+{
+ for(int i=0; i < GradientCount; i++)
+ if(gradients[i])
+ delete gradients[i];
+}
+
+
+KPixmap* GradientSet::gradient(GradientType type)
+{
+ if (gradients[type])
+ return gradients[type];
+
+ switch(type)
+ {
+ case VSmall: {
+ gradients[VSmall] = new KPixmap;
+ gradients[VSmall]->resize(18, 24);
+ KPixmapEffect::gradient(*gradients[VSmall], c.light(110), c.dark(110),
+ KPixmapEffect::VerticalGradient);
+ break;
+ }
+
+ case VMed: {
+ gradients[VMed] = new KPixmap;
+ gradients[VMed]->resize(18, 34);
+ KPixmapEffect::gradient(*gradients[VMed], c.light(110), c.dark(110),
+ KPixmapEffect::VerticalGradient);
+ break;
+ }
+
+ case VLarge: {
+ gradients[VLarge] = new KPixmap;
+ gradients[VLarge]->resize(18, 64);
+ KPixmapEffect::gradient(*gradients[VLarge], c.light(110), c.dark(110),
+ KPixmapEffect::VerticalGradient);
+ break;
+ }
+
+ case HMed: {
+ gradients[HMed] = new KPixmap;
+ gradients[HMed]->resize(34, 18);
+ KPixmapEffect::gradient(*gradients[HMed], c.light(110), c.dark(110),
+ KPixmapEffect::HorizontalGradient);
+ break;
+ }
+
+ case HLarge: {
+ gradients[HLarge] = new KPixmap;
+ gradients[HLarge]->resize(52, 18);
+ KPixmapEffect::gradient(*gradients[HLarge], c.light(110), c.dark(110),
+ KPixmapEffect::HorizontalGradient);
+ break;
+ }
+
+ default:
+ break;
+ }
+ return(gradients[type]);
+}
+
+
+
+// ---------------------------------------------------------------------------
+
+HighColorStyle::HighColorStyle( StyleType styleType )
+ : TDEStyle( AllowMenuTransparency | FilledFrameWorkaround, ThreeButtonScrollBar )
+{
+ type = styleType;
+ highcolor = (type == HighColor && TQPixmap::defaultDepth() > 8);
+ gDict.setAutoDelete(true);
+ selectionBackground = false;
+}
+
+
+HighColorStyle::~HighColorStyle()
+{
+}
+
+
+void HighColorStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+ // Put in order of highest occurrence to maximise hit rate
+ if (widget->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (widget->inherits(TQMENUBAR_OBJECT_NAME_STRING) || widget->inherits(TQPOPUPMENU_OBJECT_NAME_STRING)) {
+ widget->setBackgroundMode(TQWidget::NoBackground);
+ } else if (type == HighColor && widget->inherits("QToolBarExtensionWidget")) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if ( !qstrcmp( widget->name(), kdeToolbarWidget) ) {
+ widget->setBackgroundMode( NoBackground ); // We paint the whole background.
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (widget->inherits(TQTOOLBOXBUTTON_OBJECT_NAME_STRING)) {
+ TQFont font = widget->font();
+ font.setBold(true);
+ widget->setFont(font);
+ }
+ }
+
+ TDEStyle::polish( ceData, elementFlags, ptr );
+}
+
+
+void HighColorStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+ if (widget->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING)) {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (widget->inherits(TQMENUBAR_OBJECT_NAME_STRING) || widget->inherits(TQPOPUPMENU_OBJECT_NAME_STRING)) {
+ widget->setBackgroundMode(TQWidget::PaletteBackground);
+ } else if (type == HighColor && widget->inherits("QToolBarExtensionWidget")) {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if ( !qstrcmp( widget->name(), kdeToolbarWidget) ) {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ widget->setBackgroundMode( PaletteBackground );
+ }
+ }
+
+ TDEStyle::unPolish( ceData, elementFlags, ptr );
+}
+
+
+/* reimp. */
+void HighColorStyle::renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg,
+ const TQPopupMenu* /* popup */ ) const
+{
+ TQColor col = cg.button();
+
+#ifdef Q_WS_X11 // Only draw menu gradients on TrueColor, X11 visuals
+ if ( TQPaintDevice::x11AppDepth() >= 24 )
+ KPixmapEffect::gradient( pix, col.light(120), col.dark(115),
+ KPixmapEffect::HorizontalGradient );
+ else
+#endif
+ pix.fill( col );
+}
+
+
+// This function draws primitive elements as well as their masks.
+void HighColorStyle::drawPrimitive( TQ_PrimitiveElement pe,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt ) const
+{
+ bool down = flags & Style_Down;
+ bool on = flags & Style_On;
+ bool active = flags & Style_Active;
+ bool reverse = TQApplication::reverseLayout();
+
+ switch(pe)
+ {
+ // BUTTONS
+ // -------------------------------------------------------------------
+ case PE_ButtonDefault: {
+ if ( type != HighColor ) {
+ int x1, y1, x2, y2;
+ r.coords( &x1, &y1, &x2, &y2 );
+
+ // Button default indicator
+ p->setPen( cg.shadow() );
+ p->drawLine( x1+1, y1, x2-1, y1 );
+ p->drawLine( x1, y1+1, x1, y2-1 );
+ p->drawLine( x1+1, y2, x2-1, y2 );
+ p->drawLine( x2, y1+1, x2, y2-1 );
+ }
+ break;
+ }
+
+ case PE_ButtonDropDown:
+ case PE_ButtonTool: {
+ bool sunken = on || down;
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+ TQPen oldPen = p->pen();
+
+ // Outer frame (round style)
+ p->setPen(cg.shadow());
+ p->drawLine(x+1,y,x2-1,y);
+ p->drawLine(x,y+1,x,y2-1);
+ p->drawLine(x+1,y2,x2-1,y2);
+ p->drawLine(x2,y+1,x2,y2-1);
+
+ // Bevel
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->setPen(sunken ? cg.light() : cg.mid());
+ p->drawLine(x+2, y2-1, x2-1, y2-1);
+ p->drawLine(x2-1, y+2, x2-1, y2-1);
+
+ p->fillRect(x+2, y+2, w-4, h-4, cg.button());
+
+ p->setPen( oldPen );
+ break;
+ }
+
+ // PUSH BUTTON
+ // -------------------------------------------------------------------
+ case PE_ButtonCommand: {
+ bool sunken = on || down;
+ bool flat = !(flags & (Style_Raised | Style_Sunken));
+ int x, y, w, h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ if ( sunken )
+ kDrawBeButton( p, x, y, w, h, cg, true,
+ &cg.brush(TQColorGroup::Mid) );
+
+ else if ( flags & Style_MouseOver && !flat ) {
+ TQBrush brush(cg.button().light(110));
+ kDrawBeButton( p, x, y, w, h, cg, false, &brush );
+ }
+
+ // "Flat" button
+ else if ( flat ) {
+ if ( flags & Style_MouseOver )
+ p->fillRect(r, cg.button().light(110));
+ else
+ renderGradient(p, TQRect(x, y, w-1, h-1),
+ cg.button(), false);
+
+ p->setPen(cg.button().light(75));
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y, x2, y2);
+ }
+
+ else if( highcolor )
+ {
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+ p->setPen(cg.shadow());
+ p->drawLine(x+1, y, x2-1, y);
+ p->drawLine(x+1, y2, x2-1, y2);
+ p->drawLine(x, y+1, x, y2-1);
+ p->drawLine(x2, y+1, x2, y2-1);
+
+ p->setPen(cg.light());
+ p->drawLine(x+2, y+2, x2-1, y+2);
+ p->drawLine(x+2, y+3, x2-2, y+3);
+ p->drawLine(x+2, y+4, x+2, y2-1);
+ p->drawLine(x+3, y+4, x+3, y2-2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y+2, x2-1, y2-1);
+ p->drawLine(x+2, y2-1, x2-1, y2-1);
+
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+2, x+1, y2-1);
+ p->drawLine(x2-2, y+3, x2-2, y2-2);
+
+ renderGradient(p, TQRect(x+4, y+4, w-6, h-6),
+ cg.button(), false);
+ } else
+ kDrawBeButton(p, x, y, w, h, cg, false,
+ &cg.brush(TQColorGroup::Button));
+ break;
+ }
+
+
+ // BEVELS
+ // -------------------------------------------------------------------
+ case PE_ButtonBevel: {
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ bool sunken = on || down;
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ // Outer frame
+ p->setPen(cg.shadow());
+ p->drawRect(r);
+
+ // Bevel
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->setPen(sunken ? cg.light() : cg.mid());
+ p->drawLine(x+2, y2-1, x2-1, y2-1);
+ p->drawLine(x2-1, y+2, x2-1, y2-1);
+
+ if (w > 4 && h > 4) {
+ if (sunken)
+ p->fillRect(x+2, y+2, w-4, h-4, cg.button());
+ else
+ renderGradient( p, TQRect(x+2, y+2, w-4, h-4),
+ cg.button(), flags & Style_Horizontal );
+ }
+ break;
+ }
+
+
+ // FOCUS RECT
+ // -------------------------------------------------------------------
+ case PE_FocusRect: {
+ p->drawWinFocusRect( r );
+ break;
+ }
+
+
+ // HEADER SECTION
+ // -------------------------------------------------------------------
+ case PE_HeaderSectionMenu:
+ case PE_HeaderSection: {
+ // Temporary solution for the proper orientation of gradients.
+ bool horizontal = true;
+ if (p && p->device()->devType() == TQInternal::Widget) {
+ TQHeader* hdr = dynamic_cast<TQHeader*>(p->device());
+ if (hdr)
+ horizontal = hdr->orientation() == Qt::Horizontal;
+ }
+
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ bool sunken = on || down;
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+ TQPen oldPen = p->pen();
+
+ // Bevel
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+ p->setPen(sunken ? cg.light() : cg.mid());
+ p->drawLine(x+1, y2-1, x2-1, y2-1);
+ p->drawLine(x2-1, y+1, x2-1, y2-1);
+ p->setPen(cg.shadow());
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y, x2, y2);
+
+ if (sunken)
+ p->fillRect(x+1, y+1, w-3, h-3, cg.button());
+ else
+ renderGradient( p, TQRect(x+1, y+1, w-3, h-3),
+ cg.button(), !horizontal );
+ p->setPen( oldPen );
+ break;
+ }
+
+
+ // SCROLLBAR
+ // -------------------------------------------------------------------
+ case PE_ScrollBarSlider: {
+ // Small hack to ensure scrollbar gradients are drawn the right way.
+ flags ^= Style_Horizontal;
+
+ drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Enabled | Style_Raised);
+
+ // Draw a scrollbar riffle (note direction after above changes)
+ if ( type != B3 ) {
+
+ // HighColor & Default scrollbar
+ if (flags & Style_Horizontal) {
+ if (r.height() >= 15) {
+ int x = r.x()+3;
+ int y = r.y() + (r.height()-7)/2;
+ int x2 = r.right()-3;
+ p->setPen(cg.light());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y+3, x2, y+3);
+ p->drawLine(x, y+6, x2, y+6);
+
+ p->setPen(cg.mid());
+ p->drawLine(x, y+1, x2, y+1);
+ p->drawLine(x, y+4, x2, y+4);
+ p->drawLine(x, y+7, x2, y+7);
+ }
+ } else {
+ if (r.width() >= 15) {
+ int y = r.y()+3;
+ int x = r.x() + (r.width()-7)/2;
+ int y2 = r.bottom()-3;
+ p->setPen(cg.light());
+ p->drawLine(x, y, x, y2);
+ p->drawLine(x+3, y, x+3, y2);
+ p->drawLine(x+6, y, x+6, y2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x+1, y, x+1, y2);
+ p->drawLine(x+4, y, x+4, y2);
+ p->drawLine(x+7, y, x+7, y2);
+ }
+ }
+ } else {
+
+ // B3 scrollbar
+ if (flags & Style_Horizontal) {
+ int buttons = 0;
+
+ if (r.height() >= 36) buttons = 3;
+ else if (r.height() >=24) buttons = 2;
+ else if (r.height() >=16) buttons = 1;
+
+ int x = r.x() + (r.width()-7) / 2;
+ int y = r.y() + (r.height() - (buttons * 5) -
+ (buttons-1)) / 2;
+ int x2 = x + 7;
+
+ for ( int i=0; i<buttons; i++, y+=6 )
+ {
+ p->setPen( cg.mid() );
+ p->drawLine( x+1, y, x2-1, y );
+ p->drawLine( x, y+1, x, y+3 );
+ p->setPen( cg.light() );
+ p->drawLine( x+1, y+1, x2-1, y+1 );
+ p->drawLine( x+1, y+1, x+1, y+3 );
+ p->setPen( cg.dark() );
+ p->drawLine( x+1, y+4, x2-1, y+4 );
+ p->drawLine( x2, y+1, x2, y+3 );
+ }
+ } else {
+ int buttons = 0;
+
+ if (r.width() >= 36) buttons = 3;
+ else if (r.width() >=24) buttons = 2;
+ else if (r.width() >=16) buttons = 1;
+
+ int x = r.x() + (r.width() - (buttons * 5) -
+ (buttons-1)) / 2;
+ int y = r.y() + (r.height()-7) / 2;
+ int y2 = y + 7;
+
+ for ( int i=0; i<buttons; i++, x+=6 )
+ {
+ p->setPen( cg.mid() );
+ p->drawLine( x+1, y, x+3, y );
+ p->drawLine( x, y+1, x, y2-1 );
+ p->setPen( cg.light() );
+ p->drawLine( x+1, y+1, x+3, y+1 );
+ p->drawLine( x+1, y+1, x+1, y2-1 );
+ p->setPen( cg.dark() );
+ p->drawLine( x+1, y2, x+3, y2 );
+ p->drawLine( x+4, y+1, x+4, y2-1 );
+ }
+ }
+ }
+ break;
+ }
+
+
+ case PE_ScrollBarAddPage:
+ case PE_ScrollBarSubPage: {
+ int x, y, w, h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ if ( type != B3 ) {
+ // HighColor & Default scrollbar
+
+ p->setPen(cg.shadow());
+
+ if (flags & Style_Horizontal) {
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y2, x2, y2);
+ renderGradient(p, TQRect(x, y+1, w, h-2),
+ cg.mid(), false);
+ } else {
+ p->drawLine(x, y, x, y2);
+ p->drawLine(x2, y, x2, y2);
+ renderGradient(p, TQRect(x+1, y, w-2, h),
+ cg.mid(), true);
+ }
+ } else {
+ // B3 scrollbar
+
+ p->setPen( cg.mid() );
+
+ if (flags & Style_Horizontal) {
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y2, x2, y2);
+ p->fillRect( TQRect(x, y+1, w, h-2),
+ flags & Style_Down ? cg.button() : cg.midlight() );
+ } else {
+ p->drawLine(x, y, x, y2);
+ p->drawLine(x2, y, x2, y2);
+ p->fillRect( TQRect(x+1, y, w-2, h),
+ flags & Style_Down ? cg.button() : cg.midlight() );
+ }
+ }
+ break;
+ }
+
+
+ case PE_ScrollBarAddLine: {
+ drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) |
+ ((flags & Style_Down) ? Style_Down : Style_Raised) );
+
+ drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
+ p, ceData, elementFlags, r, cg, flags );
+ break;
+ }
+
+
+ case PE_ScrollBarSubLine: {
+ drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) |
+ ((flags & Style_Down) ? Style_Down : Style_Raised) );
+
+ drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
+ p, ceData, elementFlags, r, cg, flags );
+ break;
+ }
+
+
+ // CHECKBOX (indicator)
+ // -------------------------------------------------------------------
+ case PE_Indicator: {
+
+ bool enabled = flags & Style_Enabled;
+ bool nochange = flags & Style_NoChange;
+
+ if (xBmp.isNull()) {
+ xBmp = TQBitmap(7, 7, x_bits, true);
+ xBmp.setMask(xBmp);
+ }
+
+ int x,y,w,h;
+ x=r.x(); y=r.y(); w=r.width(); h=r.height();
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ p->setPen(cg.mid());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+
+ p->setPen(cg.light());
+ p->drawLine(x2, y+1, x2, y2);
+ p->drawLine(x+1, y2, x2, y2);
+
+ p->setPen(cg.shadow());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+
+ p->setPen(cg.midlight());
+ p->drawLine(x2-1, y+2, x2-1, y2-1);
+ p->drawLine(x+2, y2-1, x2-1, y2-1);
+
+ if ( enabled )
+ p->fillRect(x+2, y+2, w-4, h-4,
+ down ? cg.button(): cg.base());
+ else
+ p->fillRect(x+2, y+2, w-4, h-4, cg.background());
+
+ if (!(flags & Style_Off)) {
+ if (on) {
+ p->setPen(nochange ? cg.dark() : cg.text());
+ p->drawPixmap(x+3, y+3, xBmp);
+ }
+ else {
+ p->setPen(cg.shadow());
+ p->drawRect(x+2, y+2, w-4, h-4);
+ p->setPen(nochange ? cg.text() : cg.dark());
+ p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2);
+ p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2);
+ p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2);
+ }
+ }
+ break;
+ }
+
+
+ // RADIOBUTTON (exclusive indicator)
+ // -------------------------------------------------------------------
+ case PE_ExclusiveIndicator: {
+
+ if (lightBmp.isNull()) {
+ lightBmp = TQBitmap(13, 13, radiooff_light_bits, true);
+ grayBmp = TQBitmap(13, 13, radiooff_gray_bits, true);
+ dgrayBmp = TQBitmap(13, 13, radiooff_dgray_bits, true);
+ centerBmp = TQBitmap(13, 13, radiooff_center_bits, true);
+ centerBmp.setMask( centerBmp );
+ }
+
+ // Bevel
+ kColorBitmaps(p, cg, r.x(), r.y(), &lightBmp , &grayBmp,
+ NULL, &dgrayBmp);
+
+ // The center fill of the indicator (grayed out when disabled)
+ if ( flags & Style_Enabled )
+ p->setPen( down ? cg.button() : cg.base() );
+ else
+ p->setPen( cg.background() );
+ p->drawPixmap( r.x(), r.y(), centerBmp );
+
+ // Indicator "dot"
+ if ( on ) {
+ TQColor color = flags & Style_NoChange ?
+ cg.dark() : cg.text();
+
+ p->setPen(color);
+ p->drawLine(5, 4, 7, 4);
+ p->drawLine(4, 5, 4, 7);
+ p->drawLine(5, 8, 7, 8);
+ p->drawLine(8, 5, 8, 7);
+ p->fillRect(5, 5, 3, 3, color);
+ }
+
+ break;
+ }
+
+
+ // RADIOBUTTON (exclusive indicator) mask
+ // -------------------------------------------------------------------
+ case PE_ExclusiveIndicatorMask: {
+ if (maskBmp.isNull()) {
+ maskBmp = TQBitmap(13, 13, radiomask_bits, true);
+ maskBmp.setMask(maskBmp);
+ }
+
+ p->setPen(Qt::color1);
+ p->drawPixmap(r.x(), r.y(), maskBmp);
+ break;
+ }
+
+
+ // SPLITTER/DOCKWINDOW HANDLES
+ // -------------------------------------------------------------------
+ case PE_DockWindowResizeHandle:
+ case PE_Splitter: {
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ p->setPen(cg.dark());
+ p->drawRect(x, y, w, h);
+ p->setPen(cg.background());
+ p->drawPoint(x, y);
+ p->drawPoint(x2, y);
+ p->drawPoint(x, y2);
+ p->drawPoint(x2, y2);
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->setPen(cg.midlight());
+ p->drawLine(x+2, y+2, x+2, y2-2);
+ p->drawLine(x+2, y+2, x2-2, y+2);
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y+1, x2-1, y2-1);
+ p->drawLine(x+1, y2-1, x2-1, y2-1);
+ p->fillRect(x+3, y+3, w-5, h-5, cg.brush(TQColorGroup::Background));
+ break;
+ }
+
+
+ // GENERAL PANELS
+ // -------------------------------------------------------------------
+ case PE_Panel:
+ case PE_PanelPopup:
+ case PE_WindowFrame:
+ case PE_PanelLineEdit: {
+ bool sunken = flags & Style_Sunken;
+ int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
+ : opt.lineWidth();
+ if (lw == 2)
+ {
+ TQPen oldPen = p->pen();
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+ p->setPen(sunken ? cg.light() : cg.dark());
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y, x2, y2);
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ p->setPen(sunken ? cg.midlight() : cg.mid());
+ p->drawLine(x+1, y2-1, x2-1, y2-1);
+ p->drawLine(x2-1, y+1, x2-1, y2-1);
+ p->setPen(sunken ? cg.dark() : cg.midlight());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->setPen(oldPen);
+ } else
+ TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
+
+ break;
+ }
+
+
+ // MENU / TOOLBAR PANEL
+ // -------------------------------------------------------------------
+ case PE_PanelMenuBar: // Menu
+ case PE_PanelDockWindow: { // Toolbar
+ int x2 = r.x()+r.width()-1;
+ int y2 = r.y()+r.height()-1;
+ int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
+ : opt.lineWidth();
+
+ if (lw)
+ {
+ p->setPen(cg.light());
+ p->drawLine(r.x(), r.y(), x2-1, r.y());
+ p->drawLine(r.x(), r.y(), r.x(), y2-1);
+ p->setPen(cg.dark());
+ p->drawLine(r.x(), y2, x2, y2);
+ p->drawLine(x2, r.y(), x2, y2);
+
+ // ### Qt should specify Style_Horizontal where appropriate
+ renderGradient( p, TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2),
+ cg.button(),
+ (r.width() < r.height()) && (pe != PE_PanelMenuBar) );
+ }
+ else
+ renderGradient( p, r, cg.button(),
+ (r.width() < r.height()) && (pe != PE_PanelMenuBar) );
+
+ break;
+ }
+
+
+
+ // TOOLBAR SEPARATOR
+ // -------------------------------------------------------------------
+ case PE_DockWindowSeparator: {
+ renderGradient( p, r, cg.button(),
+ !(flags & Style_Horizontal));
+ if ( !(flags & Style_Horizontal) ) {
+ p->setPen(cg.mid());
+ p->drawLine(4, r.height()/2, r.width()-5, r.height()/2);
+ p->setPen(cg.light());
+ p->drawLine(4, r.height()/2+1, r.width()-5, r.height()/2+1);
+ } else {
+ p->setPen(cg.mid());
+ p->drawLine(r.width()/2, 4, r.width()/2, r.height()-5);
+ p->setPen(cg.light());
+ p->drawLine(r.width()/2+1, 4, r.width()/2+1, r.height()-5);
+ }
+ break;
+ }
+
+ case PE_MenuItemIndicatorFrame: {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
+
+ int cx = reverse ? x+w - checkcol : x;
+
+ // We only have to draw the background if the menu item is inactive -
+ // if it's active the "pressed" background is already drawn
+ if ( ! active )
+ qDrawShadePanel( p, cx, y, checkcol, h, cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
+ }
+ break;
+
+ case PE_MenuItemIndicatorIconFrame: {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
+ qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
+ }
+ break;
+
+ case PE_MenuItemIndicatorCheck: {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
+
+ int cx = reverse ? x+w - checkcol : x;
+
+ // Draw the checkmark
+ SFlags cflags = Style_Default;
+ cflags |= active ? Style_Enabled : Style_On;
+
+ drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( cx + itemFrame, y + itemFrame, checkcol - itemFrame*2, h - itemFrame*2), cg, cflags );
+ }
+ break;
+
+ default:
+ {
+ // ARROWS
+ // -------------------------------------------------------------------
+ if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft)
+ {
+ TQPointArray a;
+
+ if ( type != B3 ) {
+ // HighColor & Default arrows
+ switch(pe) {
+ case PE_ArrowUp:
+ a.setPoints(TQCOORDARRLEN(u_arrow), u_arrow);
+ break;
+
+ case PE_ArrowDown:
+ a.setPoints(TQCOORDARRLEN(d_arrow), d_arrow);
+ break;
+
+ case PE_ArrowLeft:
+ a.setPoints(TQCOORDARRLEN(l_arrow), l_arrow);
+ break;
+
+ default:
+ a.setPoints(TQCOORDARRLEN(r_arrow), r_arrow);
+ }
+ } else {
+ // B3 arrows
+ switch(pe) {
+ case PE_ArrowUp:
+ a.setPoints(TQCOORDARRLEN(B3::u_arrow), B3::u_arrow);
+ break;
+
+ case PE_ArrowDown:
+ a.setPoints(TQCOORDARRLEN(B3::d_arrow), B3::d_arrow);
+ break;
+
+ case PE_ArrowLeft:
+ a.setPoints(TQCOORDARRLEN(B3::l_arrow), B3::l_arrow);
+ break;
+
+ default:
+ a.setPoints(TQCOORDARRLEN(B3::r_arrow), B3::r_arrow);
+ }
+ }
+
+ p->save();
+ if ( flags & Style_Down )
+ p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
+ pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
+
+ if ( flags & Style_Enabled ) {
+ a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
+ p->setPen( cg.buttonText() );
+ p->drawLineSegments( a );
+ } else {
+ a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 );
+ p->setPen( cg.light() );
+ p->drawLineSegments( a );
+ a.translate( -1, -1 );
+ p->setPen( cg.mid() );
+ p->drawLineSegments( a );
+ }
+ p->restore();
+
+ } else
+ TDEStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
+ }
+ }
+}
+
+
+void HighColorStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption &opt,
+ const TQWidget* widget ) const
+{
+ switch ( kpe )
+ {
+ // TOOLBAR HANDLE
+ // -------------------------------------------------------------------
+ case KPE_ToolBarHandle: {
+ int x = r.x(); int y = r.y();
+ int x2 = r.x() + r.width()-1;
+ int y2 = r.y() + r.height()-1;
+
+ if (flags & Style_Horizontal) {
+
+ renderGradient( p, r, cg.button(), false);
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+4, x+1, y2-4);
+ p->drawLine(x+3, y+4, x+3, y2-4);
+ p->drawLine(x+5, y+4, x+5, y2-4);
+
+ p->setPen(cg.mid());
+ p->drawLine(x+2, y+4, x+2, y2-4);
+ p->drawLine(x+4, y+4, x+4, y2-4);
+ p->drawLine(x+6, y+4, x+6, y2-4);
+
+ } else {
+
+ renderGradient( p, r, cg.button(), true);
+ p->setPen(cg.light());
+ p->drawLine(x+4, y+1, x2-4, y+1);
+ p->drawLine(x+4, y+3, x2-4, y+3);
+ p->drawLine(x+4, y+5, x2-4, y+5);
+
+ p->setPen(cg.mid());
+ p->drawLine(x+4, y+2, x2-4, y+2);
+ p->drawLine(x+4, y+4, x2-4, y+4);
+ p->drawLine(x+4, y+6, x2-4, y+6);
+
+ }
+ break;
+ }
+
+
+ // GENERAL/KICKER HANDLE
+ // -------------------------------------------------------------------
+ case KPE_GeneralHandle: {
+ int x = r.x(); int y = r.y();
+ int x2 = r.x() + r.width()-1;
+ int y2 = r.y() + r.height()-1;
+
+ if (flags & Style_Horizontal) {
+
+ p->setPen(cg.light());
+ p->drawLine(x+1, y, x+1, y2);
+ p->drawLine(x+3, y, x+3, y2);
+ p->drawLine(x+5, y, x+5, y2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x+2, y, x+2, y2);
+ p->drawLine(x+4, y, x+4, y2);
+ p->drawLine(x+6, y, x+6, y2);
+
+ } else {
+
+ p->setPen(cg.light());
+ p->drawLine(x, y+1, x2, y+1);
+ p->drawLine(x, y+3, x2, y+3);
+ p->drawLine(x, y+5, x2, y+5);
+
+ p->setPen(cg.mid());
+ p->drawLine(x, y+2, x2, y+2);
+ p->drawLine(x, y+4, x2, y+4);
+ p->drawLine(x, y+6, x2, y+6);
+
+ }
+ break;
+ }
+
+
+ // SLIDER GROOVE
+ // -------------------------------------------------------------------
+ case KPE_SliderGroove: {
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+ int gcenter = (horizontal ? r.height() : r.width()) / 2;
+
+ TQRect gr;
+ if (horizontal)
+ gr = TQRect(r.x(), r.y()+gcenter-3, r.width(), 7);
+ else
+ gr = TQRect(r.x()+gcenter-3, r.y(), 7, r.height());
+
+ int x,y,w,h;
+ gr.rect(&x, &y, &w, &h);
+ int x2=x+w-1;
+ int y2=y+h-1;
+
+ // Draw the slider groove.
+ p->setPen(cg.dark());
+ p->drawLine(x+2, y, x2-2, y);
+ p->drawLine(x, y+2, x, y2-2);
+ p->fillRect(x+2,y+2,w-4, h-4,
+ (elementFlags & CEF_IsEnabled) ? cg.dark() : cg.mid());
+ p->setPen(cg.shadow());
+ p->drawRect(x+1, y+1, w-2, h-2);
+ p->setPen(cg.light());
+ p->drawPoint(x+1,y2-1);
+ p->drawPoint(x2-1,y2-1);
+ p->drawLine(x2, y+2, x2, y2-2);
+ p->drawLine(x+2, y2, x2-2, y2);
+ break;
+ }
+
+ // SLIDER HANDLE
+ // -------------------------------------------------------------------
+ case KPE_SliderHandle: {
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ p->setPen(cg.mid());
+ p->drawLine(x+1, y, x2-1, y);
+ p->drawLine(x, y+1, x, y2-1);
+ p->setPen(cg.shadow());
+ p->drawLine(x+1, y2, x2-1, y2);
+ p->drawLine(x2, y+1, x2, y2-1);
+
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->setPen(cg.dark());
+ p->drawLine(x+2, y2-1, x2-1, y2-1);
+ p->drawLine(x2-1, y+2, x2-1, y2-1);
+ p->setPen(cg.midlight());
+ p->drawLine(x+2, y+2, x2-2, y+2);
+ p->drawLine(x+2, y+2, x+2, y2-2);
+ p->setPen(cg.mid());
+ p->drawLine(x+3, y2-2, x2-2, y2-2);
+ p->drawLine(x2-2, y+3, x2-2, y2-2);
+ renderGradient(p, TQRect(x+3, y+3, w-6, h-6),
+ cg.button(), !horizontal);
+
+ // Paint riffles
+ if (horizontal) {
+ p->setPen(cg.light());
+ p->drawLine(x+5, y+4, x+5, y2-4);
+ p->drawLine(x+8, y+4, x+8, y2-4);
+ p->drawLine(x+11,y+4, x+11, y2-4);
+ p->setPen((elementFlags & CEF_IsEnabled) ? cg.shadow(): cg.mid());
+ p->drawLine(x+6, y+4, x+6, y2-4);
+ p->drawLine(x+9, y+4, x+9, y2-4);
+ p->drawLine(x+12,y+4, x+12, y2-4);
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x+4, y+5, x2-4, y+5);
+ p->drawLine(x+4, y+8, x2-4, y+8);
+ p->drawLine(x+4, y+11, x2-4, y+11);
+ p->setPen((elementFlags & CEF_IsEnabled) ? cg.shadow() : cg.mid());
+ p->drawLine(x+4, y+6, x2-4, y+6);
+ p->drawLine(x+4, y+9, x2-4, y+9);
+ p->drawLine(x+4, y+12, x2-4, y+12);
+ }
+ break;
+ }
+
+ default:
+ TDEStyle::drawTDEStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+}
+
+
+void HighColorStyle::drawControl( TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ switch (element)
+ {
+ // PUSHBUTTON
+ // -------------------------------------------------------------------
+ case CE_PushButton: {
+ if ( type != HighColor ) {
+ TQRect br = r;
+ bool btnDefault = (elementFlags & CEF_IsDefault);
+
+ if ( btnDefault || (elementFlags & CEF_AutoDefault) ) {
+ // Compensate for default indicator
+ static int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
+ br.addCoords( di, di, -di, -di );
+ }
+
+ if ( btnDefault )
+ drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags );
+
+ drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags );
+
+ } else
+ drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags );
+
+ break;
+ }
+
+
+ // PUSHBUTTON LABEL
+ // -------------------------------------------------------------------
+ case CE_PushButtonLabel: {
+ bool active = ((elementFlags & CEF_IsOn) || (elementFlags & CEF_IsDown));
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ // Shift button contents if pushed.
+ if ( active ) {
+ x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget);
+ y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget);
+ flags |= Style_Sunken;
+ }
+
+ // Does the button have a popup menu?
+ if ( elementFlags & CEF_IsMenuWidget ) {
+ int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
+ drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 2, y + 2, dx, h - 4),
+ cg, flags, opt );
+ w -= dx;
+ }
+
+ // Draw the icon if there is one
+ if ( !ceData.iconSet.isNull() ) {
+ TQIconSet::Mode mode = TQIconSet::Disabled;
+ TQIconSet::State state = TQIconSet::Off;
+
+ if (elementFlags & CEF_IsEnabled)
+ mode = (elementFlags & CEF_HasFocus) ? TQIconSet::Active : TQIconSet::Normal;
+ if ((elementFlags & CEF_BiState) && (elementFlags & CEF_IsOn))
+ state = TQIconSet::On;
+
+ TQPixmap pixmap = ceData.iconSet.pixmap( TQIconSet::Small, mode, state );
+
+ // Center the iconset if there's no text or pixmap
+ if (ceData.text.isEmpty() && ceData.fgPixmap.isNull())
+ p->drawPixmap( x + (w - pixmap.width()) / 2,
+ y + (h - pixmap.height()) / 2, pixmap );
+ else
+ p->drawPixmap( x + 4, y + (h - pixmap.height()) / 2, pixmap );
+
+ int pw = pixmap.width();
+ x += pw + 4;
+ w -= pw + 4;
+ }
+
+ // Make the label indicate if the button is a default button or not
+ if ( active || (elementFlags & CEF_IsDefault) ) {
+ // Draw "fake" bold text - this enables the font metrics to remain
+ // the same as computed in TQPushButton::sizeHint(), but gives
+ // a reasonable bold effect.
+ int i;
+
+ // Text shadow
+ if (elementFlags & CEF_IsEnabled) // Don't draw double-shadow when disabled
+ for(i=0; i<2; i++)
+ drawItem( p, TQRect(x+i+1, y+1, w, h), AlignCenter | ShowPrefix,
+ ceData.colorGroup, (elementFlags & CEF_IsEnabled), NULL,
+ ceData.text, -1,
+ (active ? &ceData.colorGroup.dark() : &ceData.colorGroup.mid()) );
+
+ // Normal Text
+ for(i=0; i<2; i++)
+ drawItem( p, TQRect(x+i, y, w, h), AlignCenter | ShowPrefix,
+ ceData.colorGroup, (elementFlags & CEF_IsEnabled), ((i == 0) ? (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap : NULL),
+ ceData.text, -1,
+ (active ? &ceData.colorGroup.light() : &ceData.colorGroup.buttonText()) );
+ } else {
+ drawItem( p, TQRect(x, y, w, h), AlignCenter | ShowPrefix, ceData.colorGroup,
+ (elementFlags & CEF_IsEnabled), (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1,
+ (active ? &ceData.colorGroup.light() : &ceData.colorGroup.buttonText()) );
+ }
+
+ // Draw a focus rect if the button has focus
+ if ( flags & Style_HasFocus )
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
+ TQStyle::visualRect(subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags),
+ cg, flags );
+ break;
+ }
+
+ // TOOLBOX TAB
+ // -------------------------------------------------------------------
+ case CE_ToolBoxTab:
+ {
+ bool pressed = flags & Style_Down;
+ bool selected = flags & Style_Selected;
+ int x, y, x2, y2;
+ r.coords( &x, &y, &x2, &y2 );
+
+ p->setPen( pressed ? cg.shadow() : cg.light() );
+ p->drawLine( x, y, x2-1, y );
+ p->drawLine( x, y, x, y2-1 );
+
+ p->setPen( pressed ? cg.light() : cg.shadow() );
+ p->drawLine( x, y2, x2, y2 );
+ p->drawLine( x2, y, x2, y2 );
+
+ TQColor fill = selected ? cg.highlight() : cg.button();
+ selectionBackground = selected;
+
+ if ( pressed )
+ p->fillRect( TQRect(x+1, y+1, r.width()-2, r.height()-2), fill );
+ else
+ renderGradient(p, TQRect(x+1, y+1, r.width()-2, r.height()-2),
+ fill, false);
+ break;
+ }
+
+ // MENUBAR BACKGROUND
+ // -------------------------------------------------------------------
+ case CE_MenuBarEmptyArea:
+ {
+ renderGradient(p, r, cg.button(), false);
+ break;
+ }
+
+ // MENUBAR ITEM (sunken panel on mouse over)
+ // -------------------------------------------------------------------
+ case CE_MenuBarItem:
+ {
+ TQMenuBar *mb = (TQMenuBar*)widget;
+ TQMenuItem *mi = opt.menuItem();
+ TQRect pr = mb->rect();
+
+ bool active = flags & Style_Active;
+ bool focused = flags & Style_HasFocus;
+
+ if ( active && focused )
+ qDrawShadePanel(p, r.x(), r.y(), r.width(), r.height(),
+ cg, true, 1, &cg.brush(TQColorGroup::Midlight));
+ else
+ renderGradient( p, r, cg.button(), false,
+ r.x(), r.y()-1, pr.width()-2, pr.height()-2);
+
+ drawItem( p, r, AlignCenter | AlignVCenter | ShowPrefix
+ | DontClip | SingleLine, cg, flags & Style_Enabled,
+ mi->pixmap(), mi->text() );
+
+ break;
+ }
+
+
+ // POPUPMENU ITEM
+ // -------------------------------------------------------------------
+ case CE_PopupMenuItem: {
+ TQMenuItem *mi = opt.menuItem();
+ if ( !mi ) {
+ // Don't leave blank holes if we set NoBackground for the TQPopupMenu.
+ // This only happens when the popupMenu spans more than one column.
+ if (! (!ceData.bgPixmap.isNull()) )
+ p->fillRect(r, cg.brush(TQColorGroup::Button) );
+ break;
+ }
+
+ int tab = opt.tabWidth();
+ int checkcol = opt.maxIconWidth();
+ bool enabled = mi->isEnabled();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+ bool active = flags & Style_Active;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+ bool reverse = TQApplication::reverseLayout();
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ // Are we a menu item separator?
+ if ( mi->isSeparator() ) {
+ p->setPen( cg.dark() );
+ p->drawLine( x, y, x+w, y );
+ p->setPen( cg.light() );
+ p->drawLine( x, y+1, x+w, y+1 );
+ break;
+ }
+
+ // Draw the menu item background
+ if ( active )
+ qDrawShadePanel( p, x, y, w, h, cg, true, 1,
+ &cg.brush(TQColorGroup::Midlight) );
+ // Draw the transparency pixmap
+ else if ( !ceData.bgPixmap.isNull() )
+ p->drawPixmap( x, y, ceData.bgPixmap, x, y, w, h );
+ // Draw a solid background
+ else
+ p->fillRect( r, cg.button() );
+
+ // Do we have an icon?
+ if ( mi->iconSet() ) {
+ TQIconSet::Mode mode;
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
+
+ // Select the correct icon from the iconset
+ if ( active )
+ mode = enabled ? TQIconSet::Active : TQIconSet::Disabled;
+ else
+ mode = enabled ? TQIconSet::Normal : TQIconSet::Disabled;
+
+ // Do we have an icon and are checked at the same time?
+ // Then draw a "pressed" background behind the icon
+ if ( checkable && !active && mi->isChecked() )
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags, opt);
+ // Draw the icon
+ TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode );
+ TQRect pmr( 0, 0, pixmap.width(), pixmap.height() );
+ pmr.moveCenter( cr.center() );
+ p->drawPixmap( pmr.topLeft(), pixmap );
+ }
+
+ // Are we checked? (This time without an icon)
+ else if ( checkable && mi->isChecked() ) {
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags, opt);
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, TQRect(x, y, checkcol, h), cg, flags, opt);
+ }
+
+ // Time to draw the menu item label...
+ int xm = itemFrame + checkcol + itemHMargin; // X position margin
+
+ int xp = reverse ? // X position
+ x + tab + rightBorder + itemHMargin + itemFrame - 1 :
+ x + xm;
+
+ int offset = reverse ? -1 : 1; // Shadow offset for etched text
+
+ // Label width (minus the width of the accelerator portion)
+ int tw = w - xm - tab - arrowHMargin - itemHMargin * 3 - itemFrame + 1;
+
+ // Set the color for enabled and disabled text
+ // (used for both active and inactive menu items)
+ p->setPen( enabled ? cg.buttonText() : cg.mid() );
+
+ // This color will be used instead of the above if the menu item
+ // is active and disabled at the same time. (etched text)
+ TQColor discol = cg.mid();
+
+ // Does the menu item draw it's own label?
+ if ( mi->custom() ) {
+ int m = itemVMargin;
+ // Save the painter state in case the custom
+ // paint method changes it in some way
+ p->save();
+
+ // Draw etched text if we're inactive and the menu item is disabled
+ if ( etchtext && !enabled && !active ) {
+ p->setPen( cg.light() );
+ mi->custom()->paint( p, cg, active, enabled, xp+offset, y+m+1, tw, h-2*m );
+ p->setPen( discol );
+ }
+ mi->custom()->paint( p, cg, active, enabled, xp, y+m, tw, h-2*m );
+ p->restore();
+ }
+ else {
+ // The menu item doesn't draw it's own label
+ TQString s = mi->text();
+
+ // Does the menu item have a text label?
+ if ( !s.isNull() ) {
+ int t = s.find( '\t' );
+ int m = itemVMargin;
+ int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ text_flags |= reverse ? AlignRight : AlignLeft;
+
+ // Does the menu item have a tabstop? (for the accelerator text)
+ if ( t >= 0 ) {
+ int tabx = reverse ? x + rightBorder + itemHMargin + itemFrame :
+ x + w - tab - rightBorder - itemHMargin - itemFrame;
+
+ // Draw the right part of the label (accelerator text)
+ if ( etchtext && !enabled && !active ) {
+ // Draw etched text if we're inactive and the menu item is disabled
+ p->setPen( cg.light() );
+ p->drawText( tabx+offset, y+m+1, tab, h-2*m, text_flags, s.mid( t+1 ) );
+ p->setPen( discol );
+ }
+ p->drawText( tabx, y+m, tab, h-2*m, text_flags, s.mid( t+1 ) );
+ s = s.left( t );
+ }
+
+ // Draw the left part of the label (or the whole label
+ // if there's no accelerator)
+ if ( etchtext && !enabled && !active ) {
+ // Etched text again for inactive disabled menu items...
+ p->setPen( cg.light() );
+ p->drawText( xp+offset, y+m+1, tw, h-2*m, text_flags, s, t );
+ p->setPen( discol );
+ }
+
+ p->drawText( xp, y+m, tw, h-2*m, text_flags, s, t );
+
+ }
+
+ // The menu item doesn't have a text label
+ // Check if it has a pixmap instead
+ else if ( mi->pixmap() ) {
+ TQPixmap *pixmap = mi->pixmap();
+
+ // Draw the pixmap
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::OpaqueMode );
+
+ int diffw = ( ( w - pixmap->width() ) / 2 )
+ + ( ( w - pixmap->width() ) % 2 );
+ p->drawPixmap( x+diffw, y+itemFrame, *pixmap );
+
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::TransparentMode );
+ }
+ }
+
+ // Does the menu item have a submenu?
+ if ( mi->popup() ) {
+ TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
+ int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags);
+ TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim,
+ y + h / 2 - dim / 2, dim, dim), r );
+
+ // Draw an arrow at the far end of the menu item
+ if ( active ) {
+ if ( enabled )
+ discol = cg.buttonText();
+
+ TQColorGroup g2( discol, cg.highlight(), white, white,
+ enabled ? white : discol, discol, white );
+
+ drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled );
+ } else
+ drawPrimitive( arrow, p, ceData, elementFlags, vr, cg,
+ enabled ? Style_Enabled : Style_Default );
+ }
+ break;
+ }
+
+ default:
+ TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+}
+
+
+void HighColorStyle::drawControlMask( TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ switch (element)
+ {
+ // PUSHBUTTON MASK
+ // ----------------------------------------------------------------------
+ case CE_PushButton: {
+ int x1, y1, x2, y2;
+ r.coords( &x1, &y1, &x2, &y2 );
+ TQCOORD corners[] = { x1,y1, x2,y1, x1,y2, x2,y2 };
+ p->fillRect( r, color1 );
+ p->setPen( color0 );
+ p->drawPoints( TQPointArray(4, corners) );
+ break;
+ }
+
+ default:
+ TDEStyle::drawControlMask(element, p, ceData, elementFlags, r, opt, widget);
+ }
+}
+
+
+void HighColorStyle::drawComplexControl( TQ_ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ SCFlags controls,
+ SCFlags active,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ switch(control)
+ {
+ // COMBOBOX
+ // -------------------------------------------------------------------
+ case CC_ComboBox: {
+
+ // Draw box and arrow
+ if ( controls & SC_ComboBoxArrow ) {
+ bool sunken = (active == SC_ComboBoxArrow);
+
+ // Draw the combo
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ p->setPen(cg.shadow());
+ p->drawLine(x+1, y, x2-1, y);
+ p->drawLine(x+1, y2, x2-1, y2);
+ p->drawLine(x, y+1, x, y2-1);
+ p->drawLine(x2, y+1, x2, y2-1);
+
+ // Ensure the edge notches are properly colored
+ p->setPen(cg.button());
+ p->drawPoint(x,y);
+ p->drawPoint(x,y2);
+ p->drawPoint(x2,y);
+ p->drawPoint(x2,y2);
+
+ renderGradient( p, TQRect(x+2, y+2, w-4, h-4),
+ cg.button(), false);
+
+ p->setPen(sunken ? cg.light() : cg.mid());
+ p->drawLine(x2-1, y+2, x2-1, y2-1);
+ p->drawLine(x+1, y2-1, x2-1, y2-1);
+
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+2, x+1, y2-2);
+
+ // Get the button bounding box
+ TQRect ar = TQStyle::visualRect(
+ querySubControlMetrics(CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget),
+ ceData, elementFlags );
+
+ // Are we enabled?
+ if ( elementFlags & CEF_IsEnabled )
+ flags |= Style_Enabled;
+
+ // Are we "pushed" ?
+ if ( active & Style_Sunken )
+ flags |= Style_Sunken;
+
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags);
+ }
+
+ // Draw an edit field if required
+ if ( controls & SC_ComboBoxEditField )
+ {
+ const TQComboBox * cb = (const TQComboBox *) widget;
+ TQRect re = TQStyle::visualRect(
+ querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxEditField, TQStyleOption::Default, widget), ceData, elementFlags );
+
+ // Draw the indent
+ if ( elementFlags & CEF_IsEditable ) {
+ p->setPen( cg.dark() );
+ p->drawLine( re.x(), re.y()-1, re.x()+re.width(), re.y()-1 );
+ p->drawLine( re.x()-1, re.y(), re.x()-1, re.y()+re.height() );
+ }
+
+ if ( elementFlags & CEF_HasFocus ) {
+ p->setPen( cg.highlightedText() );
+ p->setBackgroundColor( cg.highlight() );
+ } else {
+ p->setPen( cg.text() );
+ p->setBackgroundColor( cg.button() );
+ }
+
+ if ( (elementFlags & CEF_HasFocus) && !(elementFlags & CEF_IsEditable) ) {
+ // Draw the contents
+ p->fillRect( re.x(), re.y(), re.width(), re.height(),
+ cg.brush( TQColorGroup::Highlight ) );
+
+ TQRect re = TQStyle::visualRect(
+ subRect(SR_ComboBoxFocusRect, ceData, elementFlags, cb), ceData, elementFlags);
+
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg,
+ Style_FocusAtBorder, TQStyleOption(cg.highlight()));
+ }
+ }
+ break;
+ }
+
+ // TOOLBUTTON
+ // -------------------------------------------------------------------
+ case CC_ToolButton: {
+ TQRect button, menuarea;
+ button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
+ menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
+
+ SFlags bflags = flags,
+ mflags = flags;
+
+ if (active & SC_ToolButton)
+ bflags |= Style_Down;
+ if (active & SC_ToolButtonMenu)
+ mflags |= Style_Down;
+
+ if (controls & SC_ToolButton)
+ {
+ // If we're pressed, on, or raised...
+ if (bflags & (Style_Down | Style_On | Style_Raised))
+ drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
+
+ // Check whether to draw a background pixmap
+ else if ( !ceData.parentWidgetData.bgPixmap.isNull() )
+ {
+ TQPixmap pixmap = ceData.parentWidgetData.bgPixmap;
+ p->drawTiledPixmap( r, pixmap, ceData.pos );
+ }
+ else if (!ceData.parentWidgetData.widgetObjectTypes.isEmpty())
+ {
+ if (ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING))
+ {
+ TQToolBar* parent = (TQToolBar*)widget->parent();
+ TQRect pr = parent->rect();
+
+ renderGradient( p, r, cg.button(),
+ parent->orientation() == Qt::Vertical,
+ r.x(), r.y(), pr.width()-2, pr.height()-2);
+ }
+ else if (ceData.parentWidgetData.widgetObjectTypes.contains("QToolBarExtensionWidget"))
+ {
+ TQWidget* parent = (TQWidget*)widget->parent();
+ TQToolBar* toolbar = (TQToolBar*)parent->parent();
+ TQRect tr = toolbar->rect();
+
+ if ( toolbar->orientation() == Qt::Horizontal ) {
+ renderGradient( p, r, cg.button(), false, r.x(), r.y(),
+ r.width(), tr.height() );
+ } else {
+ renderGradient( p, r, cg.button(), true, r.x(), r.y(),
+ tr.width(), r.height() );
+ }
+ }
+ }
+ }
+
+ // Draw a toolbutton menu indicator if required
+ if (controls & SC_ToolButtonMenu)
+ {
+ if (mflags & (Style_Down | Style_On | Style_Raised))
+ drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
+ }
+
+ if ((elementFlags & CEF_HasFocus) && !(elementFlags & CEF_HasFocusProxy)) {
+ TQRect fr = ceData.rect;
+ fr.addCoords(3, 3, -3, -3);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg);
+ }
+
+ break;
+ }
+
+
+ default:
+ TDEStyle::drawComplexControl(control, p, ceData, elementFlags,
+ r, cg, flags, controls, active, opt, widget);
+ break;
+ }
+}
+
+
+void HighColorStyle::drawComplexControlMask( TQ_ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ switch (control)
+ {
+ // COMBOBOX & TOOLBUTTON MASKS
+ // -------------------------------------------------------------------
+ case CC_ComboBox:
+ case CC_ToolButton: {
+ int x1, y1, x2, y2;
+ r.coords( &x1, &y1, &x2, &y2 );
+ TQCOORD corners[] = { x1,y1, x2,y1, x1,y2, x2,y2 };
+ p->fillRect( r, color1 );
+ p->setPen( color0 );
+ p->drawPoints( TQPointArray(4, corners) );
+ break;
+ }
+
+ default:
+ TDEStyle::drawComplexControlMask(control, p, ceData, elementFlags, r, opt, widget);
+ }
+}
+
+
+void HighColorStyle::drawItem( TQPainter *p,
+ const TQRect &r,
+ int flags,
+ const TQColorGroup &cg,
+ bool enabled,
+ const TQPixmap *pixmap,
+ const TQString &text,
+ int len,
+ const TQColor *penColor ) const
+{
+ // We only reimplement this method this so we can override the
+ // text color used for widgets when we draw them with the selection
+ // color and Qt expects them to be drawn them with the button color.
+ // -------------------------------------------------------------------
+ const TQColor *col;
+
+ if ( selectionBackground ) {
+ col = &cg.highlightedText();
+ selectionBackground = false;
+ } else
+ col = penColor;
+
+ TDEStyle::drawItem( p, r, flags, cg, enabled, pixmap,
+ text, len, col );
+}
+
+
+TQRect HighColorStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ // We want the focus rect for buttons to be adjusted from
+ // the Qt3 defaults to be similar to Qt 2's defaults.
+ // -------------------------------------------------------------------
+ if (r == SR_PushButtonFocusRect ) {
+ TQRect wrect(ceData.rect);
+ int dbw1 = 0, dbw2 = 0;
+
+ if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) {
+ dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
+ dbw2 = dbw1 * 2;
+ }
+
+ int dfw1 = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget) * 2,
+ dfw2 = dfw1 * 2;
+
+ return TQRect(wrect.x() + dfw1 + dbw1 + 1,
+ wrect.y() + dfw1 + dbw1 + 1,
+ wrect.width() - dfw2 - dbw2 - 1,
+ wrect.height() - dfw2 - dbw2 - 1);
+ } else
+ return TDEStyle::subRect(r, ceData, elementFlags, widget);
+}
+
+
+int HighColorStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ switch(m)
+ {
+ // BUTTONS
+ // -------------------------------------------------------------------
+ case PM_ButtonMargin: // Space btw. frame and label
+ return 4;
+
+ case PM_ButtonDefaultIndicator: {
+ if ( type == HighColor )
+ return 0; // No indicator when highcolor
+ else
+ return 3;
+ }
+
+ case PM_MenuButtonIndicator: { // Arrow width
+ if ( type != B3 )
+ return 8;
+ else
+ return 7;
+ }
+
+ // CHECKBOXES / RADIO BUTTONS
+ // -------------------------------------------------------------------
+ case PM_ExclusiveIndicatorWidth: // Radiobutton size
+ case PM_ExclusiveIndicatorHeight:
+ case PM_IndicatorWidth: // Checkbox size
+ case PM_IndicatorHeight: {
+ return 13; // 13x13
+ }
+
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ return 0;
+
+ default:
+ return TDEStyle::pixelMetric(m, ceData, elementFlags, widget);
+ }
+}
+
+/*! \reimp */
+int HighColorStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
+{
+ int ret;
+
+ switch (sh) {
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int checkcol = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ ret = checkcol;
+ }
+ break;
+ default:
+ ret = TDEStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
+ break;
+ }
+
+ return ret;
+}
+
+TQSize HighColorStyle::sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentSize,
+ const TQStyleOption& opt,
+ const TQWidget* widget ) const
+{
+ switch (contents)
+ {
+ // PUSHBUTTON SIZE
+ // ------------------------------------------------------------------
+ case CT_PushButton: {
+ int w = contentSize.width();
+ int h = contentSize.height();
+ int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
+ int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
+
+ w += bm + fw + 6; // ### Add 6 to make way for bold font.
+ h += bm + fw;
+
+ // Ensure we stick to standard width and heights.
+ if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) {
+ if ( w < 80 && !ceData.text.isEmpty() )
+ w = 80;
+
+ if ( type != HighColor ) {
+ // Compensate for default indicator
+ int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
+ w += di * 2;
+ h += di * 2;
+ }
+ }
+
+ if ( h < 22 )
+ h = 22;
+
+ return TQSize( w, h );
+ }
+
+
+ // POPUPMENU ITEM SIZE
+ // -----------------------------------------------------------------
+ case CT_PopupMenuItem: {
+ if ( ! widget || opt.isDefault() )
+ return contentSize;
+
+ const TQPopupMenu *popup = (const TQPopupMenu *) widget;
+ bool checkable = popup->isCheckable();
+ TQMenuItem *mi = opt.menuItem();
+ int maxpmw = opt.maxIconWidth();
+ int w = contentSize.width(), h = contentSize.height();
+
+ if ( mi->custom() ) {
+ w = mi->custom()->sizeHint().width();
+ h = mi->custom()->sizeHint().height();
+ if ( ! mi->custom()->fullSpan() )
+ h += 2*itemVMargin + 2*itemFrame;
+ }
+ else if ( mi->widget() ) {
+ } else if ( mi->isSeparator() ) {
+ w = 10; // Arbitrary
+ h = 2;
+ }
+ else {
+ if ( mi->pixmap() )
+ h = QMAX( h, mi->pixmap()->height() + 2*itemFrame );
+ else {
+ // Ensure that the minimum height for text-only menu items
+ // is the same as the icon size used by KDE.
+ h = QMAX( h, 16 + 2*itemFrame );
+ h = QMAX( h, popup->fontMetrics().height()
+ + 2*itemVMargin + 2*itemFrame );
+ }
+
+ if ( mi->iconSet() )
+ h = QMAX( h, mi->iconSet()->pixmap(
+ TQIconSet::Small, TQIconSet::Normal).height() +
+ 2 * itemFrame );
+ }
+
+ if ( ! mi->text().isNull() && mi->text().find('\t') >= 0 )
+ w += 12;
+ else if ( mi->popup() )
+ w += 2 * arrowHMargin;
+
+ if ( maxpmw )
+ w += maxpmw + 6;
+ if ( checkable && maxpmw < 20 )
+ w += 20 - maxpmw;
+ if ( checkable || maxpmw > 0 )
+ w += 12;
+
+ w += rightBorder;
+
+ return TQSize( w, h );
+ }
+
+
+ default:
+ return TDEStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
+ }
+}
+
+
+// Fix Qt's wacky image alignment
+TQPixmap HighColorStyle::stylePixmap(StylePixmap stylepixmap,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption& opt,
+ const TQWidget* widget) const
+{
+ switch (stylepixmap) {
+ case SP_TitleBarMinButton:
+ return TQPixmap((const char **)hc_minimize_xpm);
+ case SP_TitleBarCloseButton:
+ return TQPixmap((const char **)hc_close_xpm);
+ default:
+ break;
+ }
+
+ return TDEStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget);
+}
+
+
+bool HighColorStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
+{
+ if (TDEStyle::objectEventHandler( ceData, elementFlags, source, event ))
+ return true;
+
+ TQToolBar* toolbar;
+
+ if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING))
+ {
+ TQObject* object = reinterpret_cast<TQObject*>(source);
+
+ if ( object->parent() && !qstrcmp( object->name(), kdeToolbarWidget ) )
+ {
+ // Draw a gradient background for custom widgets in the toolbar
+ // that have specified a "kde toolbar widget" name.
+ // FIXME
+ // This currently requires direct widget access
+ // Is there any way to do this without it?
+
+ if (event->type() == TQEvent::Paint ) {
+
+ // Find the top-level toolbar of this widget, since it may be nested in other
+ // widgets that are on the toolbar.
+ TQWidget *widget = TQT_TQWIDGET(object);
+ TQWidget *parent = TQT_TQWIDGET(object->parent());
+ int x_offset = ceData.rect.x(), y_offset = ceData.rect.y();
+ while (parent && parent->parent() && !qstrcmp( parent->name(), kdeToolbarWidget ) )
+ {
+ x_offset += parent->x();
+ y_offset += parent->y();
+ parent = TQT_TQWIDGET(parent->parent());
+ }
+
+ TQRect r = ceData.rect;
+ TQRect pr = ceData.parentWidgetData.rect;
+ bool horiz_grad = pr.width() < pr.height();
+
+ // Check if the parent is a QToolbar, and use its orientation, else guess.
+ TQToolBar* tb = dynamic_cast<TQToolBar*>(parent);
+ if (tb) horiz_grad = tb->orientation() == Qt::Vertical;
+
+ TQPainter p( widget );
+ renderGradient(&p, r, parent->colorGroup().button(), horiz_grad,
+ x_offset, y_offset, pr.width(), pr.height());
+
+ return false; // Now draw the contents
+ }
+ } else if ( object->parent() &&
+ (toolbar = dynamic_cast<TQToolBar*>(object->parent())) )
+ {
+ // We need to override the paint event to draw a
+ // gradient on a QToolBarExtensionWidget.
+ // FIXME
+ // This currently requires direct widget access
+ // Is there any way to do this without it?
+
+ if ( event->type() == TQEvent::Paint ) {
+
+ TQWidget *widget = TQT_TQWIDGET(object);
+ TQRect wr = ceData.rect, tr = ceData.parentWidgetData.rect;
+ TQPainter p( widget );
+ renderGradient(&p, wr, toolbar->colorGroup().button(),
+ toolbar->orientation() == Qt::Vertical,
+ wr.x(), wr.y(), tr.width() - 2, tr.height() - 2);
+
+ p.setPen( toolbar->colorGroup().dark() );
+ if ( toolbar->orientation() == Qt::Horizontal )
+ p.drawLine( wr.width()-1, 0, wr.width()-1, wr.height()-1 );
+ else
+ p.drawLine( 0, wr.height()-1, wr.width()-1, wr.height()-1 );
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+void HighColorStyle::renderGradient( TQPainter* p, const TQRect& r,
+ TQColor clr, bool horizontal, int px, int py, int pwidth, int pheight) const
+{
+ // Make 8 bit displays happy
+ if (!highcolor) {
+ p->fillRect(r, clr);
+ return;
+ }
+
+ // px, py specify the gradient pixmap offset relative to the top-left corner.
+ // pwidth, pheight specify the width and height of the parent's pixmap.
+ // We use these to draw parent-relative pixmaps for toolbar buttons
+ // and menubar items.
+
+ GradientSet* grSet = gDict.find( clr.rgb() );
+
+ if (!grSet) {
+ grSet = new GradientSet(clr);
+ gDict.insert( clr.rgb(), grSet );
+ }
+
+ if (horizontal) {
+ int width = (pwidth != -1) ? pwidth : r.width();
+
+ if (width <= 34)
+ p->drawTiledPixmap(r, *grSet->gradient(HMed), TQPoint(px, 0));
+ else if (width <= 52)
+ p->drawTiledPixmap(r, *grSet->gradient(HLarge), TQPoint(px, 0));
+ else {
+ KPixmap *hLarge = grSet->gradient(HLarge);
+
+ // Don't draw a gradient if we don't need to
+ if (hLarge->width() > px)
+ {
+ int pixmapWidth = hLarge->width() - px;
+
+ // Draw the gradient
+ p->drawTiledPixmap( r.x(), r.y(), pixmapWidth, r.height(),
+ *hLarge, px, 0 );
+ // Draw the remaining fill
+ p->fillRect(r.x()+pixmapWidth, r.y(), r.width()-pixmapWidth,
+ r.height(), clr.dark(110));
+
+ } else
+ p->fillRect(r, clr.dark(110));
+ }
+
+ } else {
+ // Vertical gradient
+ // -----------------
+ int height = (pheight != -1) ? pheight : r.height();
+
+ if (height <= 24)
+ p->drawTiledPixmap(r, *grSet->gradient(VSmall), TQPoint(0, py));
+ else if (height <= 34)
+ p->drawTiledPixmap(r, *grSet->gradient(VMed), TQPoint(0, py));
+ else if (height <= 64)
+ p->drawTiledPixmap(r, *grSet->gradient(VLarge), TQPoint(0, py));
+ else {
+ KPixmap *vLarge = grSet->gradient(VLarge);
+
+ // Only draw the upper gradient if we need to.
+ if (vLarge->height() > py)
+ {
+ int pixmapHeight = vLarge->height() - py;
+
+ // Draw the gradient
+ p->drawTiledPixmap( r.x(), r.y(), r.width(), pixmapHeight,
+ *vLarge, 0, py );
+ // Draw the remaining fill
+ p->fillRect(r.x(), r.y()+pixmapHeight, r.width(),
+ r.height()-pixmapHeight, clr.dark(110));
+
+ } else
+ p->fillRect(r, clr.dark(110));
+ }
+ }
+}
+
+
+// vim: set noet ts=4 sw=4:
+
diff --git a/tdestyles/highcolor/highcolor.h b/tdestyles/highcolor/highcolor.h
new file mode 100644
index 000000000..7fa618a92
--- /dev/null
+++ b/tdestyles/highcolor/highcolor.h
@@ -0,0 +1,190 @@
+/*
+ * $Id$
+ *
+ * KDE3 HighColor Style (version 1.0)
+ * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ * (C) 2001-2002 Fredrik H�glund <fredrik@kde.org>
+ *
+ * Drawing routines adapted from the KDE2 HCStyle,
+ * Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ * (C) 2000 Dirk Mueller <mueller@kde.org>
+ * (C) 2001 Martijn Klingens <klingens@kde.org>
+ *
+ * Many thanks to Bradley T. Hughes for the 3 button scrollbar code.
+ *
+ * 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 __HIGHCOLOR_H
+#define __HIGHCOLOR_H
+
+#include <tqbitmap.h>
+#include <tqintdict.h>
+#include <kdrawutil.h>
+#include <kpixmap.h>
+#include <tdestyle.h>
+
+
+enum GradientType{ VSmall=0, VMed, VLarge, HMed, HLarge, GradientCount };
+
+class GradientSet
+{
+ public:
+ GradientSet(const TQColor &baseColor);
+ ~GradientSet();
+
+ KPixmap* gradient(GradientType type);
+ TQColor* color() { return(&c); }
+ private:
+ KPixmap *gradients[5];
+ TQColor c;
+};
+
+
+class TQPopupMenu;
+
+class HighColorStyle : public TDEStyle
+{
+ Q_OBJECT
+
+ public:
+ enum StyleType { HighColor = 0, Default, B3 };
+
+ HighColorStyle( StyleType );
+ virtual ~HighColorStyle();
+
+ void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+ void unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+
+ void renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg,
+ const TQPopupMenu* popup ) const;
+
+ 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( TQ_PrimitiveElement pe,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags = Style_Default,
+ const TQStyleOption& = TQStyleOption::Default ) const;
+
+ void drawControl( TQ_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 element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) 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;
+
+ void drawComplexControlMask( TQ_ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const;
+
+ void drawItem( TQPainter *p,
+ const TQRect &r,
+ int flags,
+ const TQColorGroup &cg,
+ bool enabled,
+ const TQPixmap *pixmap,
+ const TQString &text,
+ int len = -1,
+ const TQColor *penColor = 0 ) const;
+
+ int pixelMetric( PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQWidget *widget = 0 ) const;
+
+ TQSize sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentSize,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const;
+
+ TQRect subRect( SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags,
+ const TQWidget *widget ) const;
+
+ // Fix Qt3's wacky image positions
+ TQPixmap stylePixmap( StylePixmap stylepixmap,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const;
+
+ int styleHint(TQ_StyleHint, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQStyleOption & = TQStyleOption::Default,
+ TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
+
+ virtual bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
+
+ protected:
+
+ void renderGradient( TQPainter* p,
+ const TQRect& r,
+ TQColor clr,
+ bool horizontal,
+ int px=0,
+ int py=0,
+ int pwidth=-1,
+ int pheight=-1 ) const;
+
+ StyleType type;
+ bool highcolor;
+ mutable bool selectionBackground;
+
+ private:
+ // Disable copy constructor and = operator
+ HighColorStyle( const HighColorStyle & );
+ HighColorStyle& operator=( const HighColorStyle & );
+};
+
+// vim: set noet ts=4 sw=4:
+
+#endif
diff --git a/tdestyles/highcontrast/CMakeLists.txt b/tdestyles/highcontrast/CMakeLists.txt
new file mode 100644
index 000000000..b68dc34e1
--- /dev/null
+++ b/tdestyles/highcontrast/CMakeLists.txt
@@ -0,0 +1,49 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_subdirectory( config )
+
+
+add_definitions(
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdefx
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES highcontrast.themerc DESTINATION ${DATA_INSTALL_DIR}/tdestyle/themes )
+
+
+##### highcontrast ##############################
+
+set( target highcontrast )
+
+set( ${target}_SRCS
+ highcontrast.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdefx-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
+)
diff --git a/tdestyles/highcontrast/Makefile.am b/tdestyles/highcontrast/Makefile.am
new file mode 100644
index 000000000..8c7d11320
--- /dev/null
+++ b/tdestyles/highcontrast/Makefile.am
@@ -0,0 +1,41 @@
+
+# This file is part of the KDE libraries
+# Copyright (C) 2005 Olaf Schmidt (ojschmidt@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 as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# 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; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = config
+
+KDE_CXXFLAGS = -DQT_PLUGIN
+
+INCLUDES = $(all_includes)
+
+stylercdir = $(kde_datadir)/tdestyle/themes
+stylerc_DATA = highcontrast.themerc
+
+EXTRA_DIST = $(stylerc_DATA)
+
+noinst_HEADERS = highcontrast.h
+
+kde_style_LTLIBRARIES = highcontrast.la
+highcontrast_la_SOURCES = highcontrast.cpp
+highcontrast_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+highcontrast_la_LIBADD = ../../tdefx/libtdefx.la $(LIB_QT)
+highcontrast_la_METASOURCES = AUTO
+
+DISTCLEANFILES = $(highcontrast_la_METASOURCES)
diff --git a/tdestyles/highcontrast/TODO b/tdestyles/highcontrast/TODO
new file mode 100644
index 000000000..a7795bab8
--- /dev/null
+++ b/tdestyles/highcontrast/TODO
@@ -0,0 +1,5 @@
+- QLineEdit are much taller than the other widgets. Check why.
+- The QLineEdits background seem to bleed on the outside.
+- Use a thicker dotted line (or a solid line?) for the TreView 'branches'
+
+- ListViewExpanders should get their size from the item text height. (done)
diff --git a/tdestyles/highcontrast/config/CMakeLists.txt b/tdestyles/highcontrast/config/CMakeLists.txt
new file mode 100644
index 000000000..1305f8163
--- /dev/null
+++ b/tdestyles/highcontrast/config/CMakeLists.txt
@@ -0,0 +1,37 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdeui
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### tdestyle_highcontrast_config ################
+
+set( target tdestyle_highcontrast_config )
+
+set( ${target}_SRCS
+ highcontrastconfig.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdecore-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/tdestyles/highcontrast/config/Makefile.am b/tdestyles/highcontrast/config/Makefile.am
new file mode 100644
index 000000000..31592f288
--- /dev/null
+++ b/tdestyles/highcontrast/config/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = highcontrastconfig.h
+kde_module_LTLIBRARIES = tdestyle_highcontrast_config.la
+tdestyle_highcontrast_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+tdestyle_highcontrast_config_la_LIBADD = $(LIB_QT) $(LIB_TDECORE)
+tdestyle_highcontrast_config_la_SOURCES = highcontrastconfig.cpp
+tdestyle_highcontrast_config_la_METASOURCES = AUTO
+
+
+messages:
+ $(XGETTEXT) *.cpp *.h -o $(podir)/tdestyle_highcontrast_config.pot
diff --git a/tdestyles/highcontrast/config/highcontrastconfig.cpp b/tdestyles/highcontrast/config/highcontrastconfig.cpp
new file mode 100644
index 000000000..8d8df0e79
--- /dev/null
+++ b/tdestyles/highcontrast/config/highcontrastconfig.cpp
@@ -0,0 +1,94 @@
+/*
+Copyright (c) 2005 Luciano Montanaro <mikelima@cirulla.net>
+
+based on the Keramick configuration dialog
+Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include <tqcheckbox.h>
+#include <tqlayout.h>
+#include <tqsettings.h>
+#include <kdialog.h>
+#include <tdeglobal.h>
+#include <tdelocale.h>
+
+#include "highcontrastconfig.h"
+
+extern "C" KDE_EXPORT TQWidget*
+allocate_tdestyle_config(TQWidget* parent)
+{
+ return new HighContrastStyleConfig(parent);
+}
+
+HighContrastStyleConfig::HighContrastStyleConfig(
+ TQWidget* parent): TQWidget(parent)
+{
+ // Should have no margins here, the dialog provides them
+ TQVBoxLayout* layout = new TQVBoxLayout(this, 0, 0);
+ TDEGlobal::locale()->insertCatalogue("tdestyle_highcontrast_config");
+
+ wideLinesBox = new TQCheckBox(i18n("Use wider lines"), this);
+
+ layout->add(wideLinesBox);
+ layout->addStretch(1);
+
+ TQSettings s;
+
+ originalWideLinesState = s.readBoolEntry(
+ "/highcontraststyle/Settings/wideLines", false);
+ wideLinesBox->setChecked(originalWideLinesState);
+
+ connect(wideLinesBox, TQT_SIGNAL(toggled(bool)), TQT_SLOT(updateChanged()));
+}
+
+HighContrastStyleConfig::~HighContrastStyleConfig()
+{
+ TDEGlobal::locale()->removeCatalogue("tdestyle_keramik_config");
+}
+
+
+void
+HighContrastStyleConfig::save()
+{
+ TQSettings s;
+ s.writeEntry("/highcontraststyle/Settings/wideLines",
+ wideLinesBox->isChecked());
+}
+
+void
+HighContrastStyleConfig::defaults()
+{
+ wideLinesBox->setChecked(false);
+ // updateChanged would be done by setChecked already
+}
+
+void
+HighContrastStyleConfig::updateChanged()
+{
+ if ((wideLinesBox->isChecked() == originalWideLinesState)) {
+ emit changed(false);
+ } else {
+ emit changed(true);
+ }
+}
+
+#include "highcontrastconfig.moc"
diff --git a/tdestyles/highcontrast/config/highcontrastconfig.h b/tdestyles/highcontrast/config/highcontrastconfig.h
new file mode 100644
index 000000000..d52a22b47
--- /dev/null
+++ b/tdestyles/highcontrast/config/highcontrastconfig.h
@@ -0,0 +1,61 @@
+/*
+Copyright (c) 2005 Luciano Montanaro <mikelima@cirulla.net>
+
+based on the Keramick configuration dialog
+Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef HIGHCONTRAST_CONF_H
+#define HIGHCONTRAST_CONF_H
+
+class TQCheckBox;
+
+class HighContrastStyleConfig: public TQWidget
+{
+ Q_OBJECT
+public:
+ HighContrastStyleConfig(TQWidget* parent);
+ ~HighContrastStyleConfig();
+
+ // This signal and the next two slots are the plugin
+ // page interface
+signals:
+ void changed(bool);
+
+public slots:
+ void save();
+ void defaults();
+
+ // Everything below this is internal.
+protected slots:
+ void updateChanged();
+
+protected:
+ // We store settings directly in widgets to
+ // avoid the hassle of sync'ing things
+ TQCheckBox* wideLinesBox;
+
+ // Original settings, for accurate dirtiness tracking
+ bool originalWideLinesState;
+};
+
+#endif // HIGHCONTRAST_CONF_H
diff --git a/tdestyles/highcontrast/highcontrast.cpp b/tdestyles/highcontrast/highcontrast.cpp
new file mode 100644
index 000000000..af021a91a
--- /dev/null
+++ b/tdestyles/highcontrast/highcontrast.cpp
@@ -0,0 +1,1867 @@
+/*
+ * High Contrast Style (version 1.0)
+ * Copyright (C) 2004 Olaf Schmidt <ojschmidt@kde.org>
+ *
+ * Derived from Axes Style
+ * Copyright (C) 2003 Maksim Orlovich <orlovich@cs.rochester.edu>
+ *
+ * Axes Style based on KDE 3 HighColor Style,
+ * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ * (C) 2001-2002 Fredrik Höglund <fredrik@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.
+ */
+
+#include <tqdrawutil.h>
+#include <tqpainter.h>
+#include <tqpointarray.h>
+#include <tqstyleplugin.h>
+
+#include <tqfont.h>
+#include <tqcombobox.h>
+#include <tqheader.h>
+#include <tqmenubar.h>
+#include <tqpushbutton.h>
+#include <tqscrollbar.h>
+#include <tqslider.h>
+#include <tqtabbar.h>
+#include <tqtoolbutton.h>
+#include <tqtoolbar.h>
+#include <tqpopupmenu.h>
+#include <tqprogressbar.h>
+#include <tqlistview.h>
+#include <tqsettings.h>
+
+#include <tqimage.h>
+#include <tqapplication.h>
+
+#include <kdrawutil.h>
+#include <kpixmapeffect.h>
+
+#include "highcontrast.h"
+#include "highcontrast.moc"
+
+// -- Style Plugin Interface -------------------------
+class HighContrastStylePlugin : public TQStylePlugin
+{
+ public:
+ HighContrastStylePlugin() {}
+ ~HighContrastStylePlugin() {}
+
+ TQStringList keys() const
+ {
+ return TQStringList() << "HighContrast";
+ }
+
+ TQStyle* create( const TQString& key )
+ {
+ if ( key == "highcontrast" )
+ return new HighContrastStyle();
+ return 0;
+ }
+};
+
+KDE_Q_EXPORT_PLUGIN (HighContrastStylePlugin)
+// ---------------------------------------------------
+
+
+
+static const int itemFrame = 1;
+static const int itemHMargin = 3;
+static const int itemVMargin = 0;
+static const int arrowHMargin = 6;
+static const int rightBorder = 12;
+
+
+void addOffset (TQRect* r, int offset, int lineWidth = 0)
+{
+ int offset1 = offset;
+ int offset2 = offset;
+
+ *r = r->normalize();
+
+ if (lineWidth > 0)
+ {
+ offset1 += lineWidth/2;
+ offset2 += lineWidth - lineWidth/2 - 1;
+ }
+
+ if (offset1 + offset2 > r->width())
+ r->addCoords (r->width()/2, 0, - (r->width() - r->width()/2), 0);
+ else
+ r->addCoords (offset1, 0, -offset2, 0);
+
+ if (offset1 + offset2 > r->height())
+ r->addCoords (0, r->height()/2, 0, - (r->height() - r->height()/2));
+ else
+ r->addCoords (0, offset1, 0, -offset2);
+}
+
+
+// ---------------------------------------------------------------------------
+
+HighContrastStyle::HighContrastStyle()
+ : TDEStyle( 0, ThreeButtonScrollBar )
+{
+ TQSettings settings;
+ settings.beginGroup("/highcontraststyle/Settings/");
+ bool useWideLines = settings.readBoolEntry("wideLines", false);
+ basicLineWidth = useWideLines ? 4 : 2;
+}
+
+
+HighContrastStyle::~HighContrastStyle()
+{
+}
+
+
+void HighContrastStyle::polish( TQPalette& pal )
+{
+ //We do not want the disabled widgets to be greyed out,
+ //as that may be hard indeed (and since we use crossed-out text instead),
+ //so we make disabled colors be the same as active foreground and
+ //background colour
+ for (int c = 0; c < TQColorGroup::NColorRoles; ++c)
+ switch (c)
+ {
+ case TQColorGroup::Button:
+ case TQColorGroup::Base:
+ case TQColorGroup::Highlight:
+ pal.setColor(TQPalette::Disabled, TQColorGroup::ColorRole(c), pal.color(TQPalette::Active, TQColorGroup::Background));
+ break;
+ case TQColorGroup::ButtonText:
+ case TQColorGroup::Text:
+ case TQColorGroup::HighlightedText:
+ pal.setColor(TQPalette::Disabled, TQColorGroup::ColorRole(c), pal.color(TQPalette::Active, TQColorGroup::Foreground));
+ break;
+ default:
+ pal.setColor(TQPalette::Disabled, TQColorGroup::ColorRole(c), pal.color(TQPalette::Active, TQColorGroup::ColorRole(c)));
+ }
+}
+
+
+void HighContrastStyle::polish (const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ if (widget->inherits (TQBUTTON_OBJECT_NAME_STRING)
+ || widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING)
+ || widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING)
+ || widget->inherits (TQLINEEDIT_OBJECT_NAME_STRING)
+ || widget->inherits (TQTEXTEDIT_OBJECT_NAME_STRING))
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ TQSpinWidget* spinwidget = dynamic_cast<TQSpinWidget*>(widget);
+ if (spinwidget && spinwidget->editWidget()) {
+ TQWidget* spinEditWidget = spinwidget->editWidget();
+ TQStyleControlElementData swCeData = populateControlElementDataFromWidget(spinEditWidget, TQStyleOption());
+ ControlElementFlags swElementFlags = getControlElementFlagsForObject(spinEditWidget, swCeData.widgetObjectTypes, TQStyleOption());
+ installObjectEventHandler(swCeData, swElementFlags, spinEditWidget, this);
+ }
+ }
+ }
+
+ TDEStyle::polish (ceData, elementFlags, ptr);
+}
+
+
+void HighContrastStyle::unPolish (const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+ if (widget->inherits (TQWIDGET_OBJECT_NAME_STRING) || widget->inherits (TQCOMBOBOX_OBJECT_NAME_STRING) || widget->inherits (TQSPINWIDGET_OBJECT_NAME_STRING) || widget->inherits (TQLINEEDIT_OBJECT_NAME_STRING) || widget->inherits (TQTEXTEDIT_OBJECT_NAME_STRING)) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ }
+
+ TDEStyle::unPolish (ceData, elementFlags, ptr);
+}
+
+void HighContrastStyle::setColorsNormal (TQPainter* p, const TQColorGroup& cg, int flags, int highlight) const
+{
+ setColorsByState (p, cg, cg.foreground(), cg.background(), flags, highlight);
+}
+
+void HighContrastStyle::setColorsButton (TQPainter* p, const TQColorGroup& cg, int flags, int highlight) const
+{
+ setColorsByState (p, cg, cg.buttonText(), cg.button(), flags, highlight);
+}
+
+void HighContrastStyle::setColorsText (TQPainter* p, const TQColorGroup& cg, int flags, int highlight) const
+{
+ setColorsByState (p, cg, cg.text(), cg.base(), flags, highlight);
+}
+
+void HighContrastStyle::setColorsHighlight (TQPainter* p, const TQColorGroup& cg, int flags) const
+{
+ setColorsByState (p, cg, cg.highlightedText(), cg.highlight(), flags, 0);
+}
+
+void HighContrastStyle::setColorsByState (TQPainter* p, const TQColorGroup& cg, const TQColor& fg, const TQColor& bg, int flags, int highlight) const
+{
+ TQFont font = p->font();
+ font.setStrikeOut (! (flags & Style_Enabled));
+ p->setFont (font);
+
+ if ((flags & Style_Enabled) && (flags & highlight))
+ {
+ p->setPen (TQPen (cg.highlightedText(), basicLineWidth, flags & Style_Enabled ? Qt::SolidLine : Qt::DotLine));
+ p->setBackgroundColor (cg.highlight());
+ }
+ else
+ {
+ p->setPen (TQPen (fg, basicLineWidth, flags & Style_Enabled ? Qt::SolidLine : Qt::DotLine));
+ p->setBackgroundColor (bg);
+ }
+
+ p->setBrush (TQBrush ());
+}
+
+void HighContrastStyle::drawRect (TQPainter* p, TQRect r, int offset, bool filled) const
+{
+ addOffset (&r, offset, p->pen().width());
+ if (filled)
+ p->fillRect (r, p->backgroundColor());
+
+ p->drawRect (r);
+}
+
+void HighContrastStyle::drawRoundRect (TQPainter* p, TQRect r, int offset, bool filled) const
+{
+ int lineWidth = p->pen().width();
+ if ((r.width() >= 5*lineWidth + 2*offset) && (r.height() >= 5*lineWidth + 2*offset))
+ {
+ TQRect r2 (r);
+ addOffset (&r2, offset, lineWidth);
+
+ addOffset (&r, offset);
+ TQRect r3 (r);
+ addOffset (&r3, lineWidth);
+
+ p->save();
+ p->setPen (Qt::NoPen);
+ if (filled)
+ p->fillRect (r3, p->backgroundColor());
+ p->drawRect (r3);
+ p->restore();
+
+ p->drawLine (r.left()+lineWidth, r2.top(), r.right()+1-lineWidth, r2.top());
+ p->fillRect (r.left()+1, r.top()+1, lineWidth, lineWidth, p->pen().color());
+ p->drawLine (r2.left(), r.top()+lineWidth, r2.left(), r.bottom()+1-lineWidth);
+ p->fillRect (r.left()+1, r.bottom()-lineWidth, lineWidth, lineWidth, p->pen().color());
+ p->drawLine (r.left()+lineWidth, r2.bottom(), r.right()+1-lineWidth, r2.bottom());
+ p->fillRect (r.right()-lineWidth, r.bottom()-lineWidth, lineWidth, lineWidth, p->pen().color());
+ p->drawLine (r2.right(), r.top()+lineWidth, r2.right(), r.bottom()+1-lineWidth);
+ p->fillRect (r.right()-lineWidth, r.top()+1, lineWidth, lineWidth, p->pen().color());
+ }
+ else
+ drawRect (p, r, offset, filled);
+}
+
+void HighContrastStyle::drawEllipse (TQPainter* p, TQRect r, int offset, bool filled) const
+{
+ addOffset (&r, offset, p->pen().width());
+
+ if (filled) {
+ p->save();
+ p->setBrush (p->backgroundColor());
+ p->drawRoundRect (r, 99, 99);
+ p->restore();
+ }
+
+ p->drawRoundRect (r, 99, 99);
+}
+
+void HighContrastStyle::drawArrow (TQPainter* p, TQRect r, TQ_PrimitiveElement arrow, int offset) const
+{
+ p->save();
+ addOffset (&r, offset);
+
+ TQPoint center = r.center();
+ if (r.height() < r.width())
+ r.setWidth (r.height());
+ if (r.width() % 2 != 0)
+ r.setWidth (r.width() - 1);
+ r.setHeight (r.width());
+ r.moveCenter (center);
+
+ TQPointArray points (3);
+ switch (arrow) {
+ case PE_ArrowUp:
+ case PE_SpinWidgetUp:
+ case PE_SpinWidgetPlus: {
+ points.setPoint (0, r.bottomLeft());
+ points.setPoint (1, r.bottomRight());
+ points.setPoint (2, r.center().x(), r.top() + r.height()/7);
+ break;
+ }
+ case PE_ArrowDown:
+ case PE_SpinWidgetDown:
+ case PE_SpinWidgetMinus: {
+ points.setPoint (0, r.topLeft());
+ points.setPoint (1, r.topRight());
+ points.setPoint (2, r.center().x(), r.bottom() - r.height()/7);
+ break;
+ }
+ case PE_ArrowLeft: {
+ points.setPoint (0, r.topRight());
+ points.setPoint (1, r.bottomRight());
+ points.setPoint (2, r.left() + r.width()/7, r.center().y());
+ break;
+ }
+ default: {
+ points.setPoint (0, r.topLeft());
+ points.setPoint (1, r.bottomLeft());
+ points.setPoint (2, r.right() - r.width()/7, r.center().y());
+ }
+ }
+
+ p->setPen (p->pen().color());
+ p->setBrush (p->pen().color());
+ p->drawPolygon (points);
+ p->restore();
+}
+
+// This function draws primitive elements
+void HighContrastStyle::drawPrimitive (TQ_PrimitiveElement pe,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt ) const
+{
+ switch(pe)
+ {
+ case PE_StatusBarSection: {
+ //### TODO: Not everything uses this!
+ setColorsNormal (p, cg, Style_Enabled);
+ drawRect (p, r);
+ break;
+ }
+ // BUTTONS
+ // -------------------------------------------------------------------
+ case PE_ButtonDefault:
+ case PE_ButtonDropDown:
+ case PE_ButtonCommand:
+ case PE_ButtonTool:
+ case PE_ButtonBevel: {
+ setColorsButton (p, cg, flags, Style_On|Style_MouseOver|Style_Down);
+ drawRoundRect (p, r, 0, false);
+ break;
+ }
+
+ // FOCUS RECT
+ // -------------------------------------------------------------------
+ case PE_FocusRect: {
+ p->save();
+ p->setBrush (TQBrush ());
+ p->setPen (TQPen (cg.highlight(), basicLineWidth, Qt::SolidLine));
+ drawRoundRect (p, r, basicLineWidth, false);
+ p->setPen (TQPen (cg.highlightedText(), basicLineWidth, Qt::DashLine));
+ drawRoundRect (p, r, basicLineWidth, false);
+ p->restore();
+ break;
+ }
+
+ case PE_HeaderArrow: {
+ setColorsButton (p, cg, flags, 0);
+ drawArrow (p, r, flags & Style_Down ? PE_ArrowDown : PE_ArrowUp, 2*basicLineWidth);
+ break;
+ }
+ // HEADER SECTION
+ // -------------------------------------------------------------------
+ case PE_HeaderSectionMenu:
+ case PE_HeaderSection: {
+ setColorsButton (p, cg, flags, 0);
+ drawRect (p, r);
+ break;
+ }
+
+
+ // SCROLLBAR
+ // -------------------------------------------------------------------
+ case PE_ScrollBarSlider: {
+ setColorsNormal (p, cg);
+ p->fillRect (r, p->backgroundColor());
+
+ if (flags & Style_Enabled) {
+ setColorsHighlight (p, cg, flags);
+ drawRoundRect (p, r);
+
+ if (r.width() >= 7*basicLineWidth && r.height() >= 7*basicLineWidth) {
+ TQRect r2 (r);
+ r2.setWidth (4*basicLineWidth);
+ r2.setHeight (4*basicLineWidth);
+ r2.moveCenter (r.center());
+ drawRect (p, r2, 0, false);
+ }
+ }
+ break;
+ }
+
+ case PE_ScrollBarAddPage:
+ case PE_ScrollBarSubPage: {
+ setColorsNormal (p, cg);
+ p->fillRect (r, p->backgroundColor());
+
+ TQRect r2 (r);
+ if (flags & Style_Horizontal)
+ {
+ if (r2.height() > 5*basicLineWidth)
+ {
+ r2.setHeight (5*basicLineWidth);
+ r2.moveCenter (r.center());
+ }
+ }
+ else
+ {
+ if (r2.width() > 5*basicLineWidth)
+ {
+ r2.setWidth (5*basicLineWidth);
+ r2.moveCenter (r.center());
+ }
+ }
+ setColorsText (p, cg, flags);
+ drawRect (p, r2);
+
+ if (flags & Style_Horizontal)
+ r2.addCoords (0, basicLineWidth, 0, -basicLineWidth);
+ else
+ r2.addCoords (basicLineWidth, 0, -basicLineWidth, 0);
+ TQPen pen = p->pen();
+ pen.setColor (p->backgroundColor());
+ p->setPen (pen);
+ drawRect (p, r2);
+
+ break;
+ }
+
+ case PE_ScrollBarAddLine:
+ case PE_ScrollBarSubLine:
+ case PE_ScrollBarFirst:
+ case PE_ScrollBarLast: {
+ setColorsNormal (p, cg);
+ p->fillRect (r, p->backgroundColor());
+
+ if (flags & Style_Enabled) {
+ setColorsButton (p, cg, flags);
+ drawRoundRect (p, r);
+ if (pe == PE_ScrollBarAddLine)
+ drawArrow (p, r, flags & Style_Horizontal ? PE_ArrowRight : PE_ArrowDown, r.height()/3);
+ else if (pe == PE_ScrollBarSubLine)
+ drawArrow (p, r, flags & Style_Horizontal ? PE_ArrowLeft : PE_ArrowUp, r.height()/3);
+ }
+ break;
+ }
+
+
+ case PE_ProgressBarChunk: {
+ p->fillRect (r, Qt::color1);
+ break;
+ }
+
+
+ // CHECKBOX
+ // -------------------------------------------------------------------
+ case PE_Indicator: {
+ setColorsText (p, cg, flags);
+
+ //Draw the outer rect
+ drawRect (p, r);
+
+ if (!(flags & Style_Off))
+ {
+ TQRect r2 (r);
+ addOffset (&r2, basicLineWidth);
+ if (flags & Style_On)
+ {
+ p->drawLine (r2.topLeft(), r2.bottomRight());
+ p->drawLine (r2.bottomLeft(), r2.topRight());
+ }
+ else
+ { // Tristate
+ p->drawLine (r2.left(), r2.top()+r2.width()/2, r2.right(), r2.top()+r2.width()/2);
+ }
+ TQPen pen = p->pen();
+ pen.setColor (p->backgroundColor());
+ p->setPen (pen);
+ drawRect (p, r2, 0, false);
+ }
+ break;
+ }
+ case PE_IndicatorMask: {
+ p->fillRect (r, Qt::color1);
+ break;
+ }
+ case PE_CheckMark: {
+ setColorsText (p, cg, flags);
+
+ if (flags & Style_On)
+ {
+ p->drawLine (r.topLeft(), r.bottomRight());
+ p->drawLine (r.bottomLeft(), r.topRight());
+ }
+ break;
+ }
+
+ // RADIOBUTTON (exclusive indicator)
+ // -------------------------------------------------------------------
+ case PE_ExclusiveIndicator: {
+ setColorsText (p, cg, flags);
+ drawEllipse (p, r);
+
+ // Indicator "dot"
+ if (flags & Style_On) {
+ p->setBackgroundColor (p->pen().color());
+ drawEllipse (p, r, 2*p->pen().width());
+ }
+
+ break;
+ }
+ case PE_ExclusiveIndicatorMask: {
+ p->fillRect (r, Qt::color0);
+ p->setBackgroundColor (Qt::color1);
+ p->setPen (Qt::NoPen);
+ p->setBrush (Qt::color1);
+ p->drawEllipse (r);
+ break;
+ }
+
+
+ // SPLITTER/DOCKWINDOW HANDLES
+ // -------------------------------------------------------------------
+ case PE_DockWindowResizeHandle:
+ case PE_Splitter: {
+ setColorsButton (p, cg, flags);
+ p->fillRect (r, p->backgroundColor());
+
+ p->setPen (TQPen (p->pen().color(), 1, Qt::DashLine));
+ if (flags & Style_Horizontal)
+ p->drawLine (r.center().x(), r.top(), r.center().x(), r.bottom());
+ else
+ p->drawLine (r.left(), r.center().y(), r.right(), r.center().y());
+ break;
+ }
+
+
+ // GENERAL PANELS
+ // -------------------------------------------------------------------
+ case PE_Panel:
+ case PE_GroupBoxFrame:
+ case PE_PanelPopup: {
+ setColorsNormal (p, cg, flags, 0);
+ if (!opt.isDefault())
+ {
+ TQPen pen = p->pen();
+ pen.setWidth (opt.lineWidth());
+ p->setPen (pen);
+ }
+ if (pe == PE_PanelPopup)
+ drawRect (p, r, 0, false);
+ else
+ drawRoundRect (p, r, 0, false);
+ break;
+ }
+ case PE_WindowFrame:
+ case PE_TabBarBase: {
+ setColorsNormal (p, cg, flags, 0);
+ drawRect (p, r, 0, false);
+ break;
+ }
+ case PE_PanelLineEdit: {
+ setColorsText (p, cg, flags, 0);
+ drawRoundRect (p, r);
+ if (flags & (Style_HasFocus | Style_Active))
+ drawPrimitive (PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor()));
+ break;
+ }
+ case PE_PanelTabWidget:
+ case PE_PanelGroupBox: {
+ setColorsNormal (p, cg, flags, 0);
+ drawRoundRect (p, r);
+ break;
+ }
+ case PE_PanelMenuBar: { // Menu
+ p->fillRect (r, cg.background());
+ break;
+ }
+ case PE_PanelDockWindow: { // Toolbar
+ p->fillRect (r, cg.button());
+ break;
+ }
+
+
+
+ // SEPARATORS
+ // -------------------------------------------------------------------
+ case PE_Separator: {
+ setColorsNormal (p, cg);
+ p->fillRect (r, p->backgroundColor());
+ p->setPen (p->pen().color());
+ if (flags & Style_Horizontal)
+ p->drawLine (r.center().x(), r.top()+basicLineWidth, r.center().x(), r.bottom()-basicLineWidth + 1);
+ else
+ p->drawLine (r.left()+basicLineWidth, r.center().y(), r.right()-basicLineWidth + 1, r.center().y());
+ break;
+ }
+ case PE_DockWindowSeparator: {
+ setColorsButton (p, cg);
+ p->fillRect (r, p->backgroundColor());
+ p->setPen (p->pen().color());
+ if (flags & Style_Horizontal)
+ p->drawLine (r.center().x(), r.top()+basicLineWidth, r.center().x(), r.bottom()-basicLineWidth);
+ else
+ p->drawLine (r.left()+basicLineWidth, r.center().y(), r.right()-basicLineWidth, r.center().y());
+ break;
+ }
+
+
+ case PE_MenuItemIndicatorFrame:
+ {
+ // Draw nothing
+ break;
+ }
+ break;
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
+ drawRect (p, cr, 0, false);
+ break;
+ }
+ case PE_MenuItemIndicatorCheck:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
+ bool reverse = TQApplication::reverseLayout();
+ int cx = reverse ? x+w - checkcol : x;
+ TQRect rc (cx, y, checkcol, h);
+ addOffset (&rc, 2*basicLineWidth);
+ TQPoint center = rc.center();
+ if (rc.width() > rc.height())
+ rc.setWidth (rc.height());
+ else
+ rc.setHeight (rc.width());
+ rc.moveCenter (center);
+
+ p->drawLine (rc.topLeft(), rc.bottomRight());
+ p->drawLine (rc.topRight(), rc.bottomLeft());
+ break;
+ }
+
+
+ // ARROWS
+ // -------------------------------------------------------------------
+ case PE_ArrowUp:
+ case PE_ArrowDown:
+ case PE_ArrowRight:
+ case PE_ArrowLeft:
+ case PE_SpinWidgetPlus:
+ case PE_SpinWidgetUp:
+ case PE_SpinWidgetMinus:
+ case PE_SpinWidgetDown: {
+ setColorsNormal (p, cg, flags);
+ drawArrow (p, r, pe);
+ break;
+ }
+
+ default: {
+ TDEStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
+ }
+ }
+}
+
+
+void HighContrastStyle::drawTDEStylePrimitive (TDEStylePrimitive kpe,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption &opt,
+ const TQWidget* widget ) const
+{
+ switch ( kpe )
+ {
+ // TOOLBAR HANDLE
+ // -------------------------------------------------------------------
+ case KPE_ToolBarHandle:
+ case KPE_DockWindowHandle:
+ case KPE_GeneralHandle:
+ {
+ setColorsButton (p, cg);
+ p->fillRect (r, p->backgroundColor());
+ p->setBrush (TQBrush (p->pen().color(), Qt::BDiagPattern));
+ drawRoundRect (p, r);
+ break;
+ }
+
+
+ // SLIDER GROOVE
+ // -------------------------------------------------------------------
+ case KPE_SliderGroove: {
+ setColorsText (p, cg, flags);
+ TQRect r2 (r);
+ if (ceData.widgetObjectTypes.contains(TQSLIDER_OBJECT_NAME_STRING))
+ {
+ if (ceData.orientation == TQt::Horizontal)
+ {
+ if (r2.height() > 5*basicLineWidth)
+ {
+ r2.setHeight (5*basicLineWidth);
+ r2.moveCenter (r.center());
+ }
+ }
+ else
+ {
+ if (r2.width() > 5*basicLineWidth)
+ {
+ r2.setWidth (5*basicLineWidth);
+ r2.moveCenter (r.center());
+ }
+ }
+ }
+
+ drawRoundRect (p, r2);
+ break;
+ }
+
+ // SLIDER HANDLE
+ // -------------------------------------------------------------------
+ case KPE_SliderHandle: {
+ setColorsHighlight (p, cg, flags);
+ drawRoundRect (p, r);
+ break;
+ }
+
+ case KPE_ListViewExpander: {
+ // TODO There is no pixelMetric associated with the
+ // ListViewExpander in TDEStyle.
+ // To have a properly large expander, the CC_ListView case of
+ // drawComplexControl should be handled.
+ // Probably it would be better to add a KPM_ListViewExpander metric
+ // to the TDEStyle TDEStylePixelMetric enum, and have the TDEStyle
+ // drawComplexControl handle it.
+ TQ_PrimitiveElement direction;
+ if (flags & Style_On) { // Collapsed = On
+ direction = PE_ArrowRight;
+
+ } else {
+ direction = PE_ArrowDown;
+ }
+ setColorsText (p, cg, flags);
+ drawArrow (p, r, direction);
+ break;
+ }
+ case KPE_ListViewBranch:
+ // TODO Draw (thick) dotted line. Check tdestyle.cpp
+ // Fall down for now
+ default:
+ TDEStyle::drawTDEStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+}
+
+
+void HighContrastStyle::drawControl (TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ switch (element)
+ {
+ // TABS
+ // -------------------------------------------------------------------
+ case CE_ToolBoxTab: {
+ setColorsNormal (p, cg, flags, Style_Selected);
+ drawRoundRect (p, r);
+ break;
+ }
+
+ case CE_TabBarTab: {
+ setColorsNormal (p, cg, flags, Style_Selected);
+ drawRoundRect (p, r);
+
+ TQTabBar::Shape shape = ceData.tabBarData.shape;
+ if (shape == TQTabBar::TriangularBelow ||
+ shape == TQTabBar::RoundedBelow) {
+ p->fillRect (r.left(), r.top(),
+ r.width(), 2*basicLineWidth,
+ p->pen().color());
+ p->fillRect (r.left()+basicLineWidth,
+ flags & Style_Selected ? basicLineWidth : 2*basicLineWidth,
+ r.width()-2*basicLineWidth,
+ basicLineWidth,
+ p->backgroundColor());
+ } else {
+ p->fillRect (r.left(), r.bottom()-2*basicLineWidth+1,
+ r.width(), 2*basicLineWidth,
+ p->pen().color());
+ p->fillRect (r.left()+basicLineWidth,
+ r.bottom()-2*basicLineWidth+1,
+ r.width()-2*basicLineWidth,
+ flags & Style_Selected ? 2*basicLineWidth : basicLineWidth,
+ p->backgroundColor());
+ }
+ break;
+ }
+
+
+ // PUSHBUTTON
+ // -------------------------------------------------------------------
+ case CE_PushButton: {
+ TQPushButton *button = (TQPushButton*) widget;
+ TQRect br = r;
+ bool btnDefault = (elementFlags & CEF_IsDefault);
+
+ if (( btnDefault || (elementFlags & CEF_AutoDefault) ) && (elementFlags & CEF_IsEnabled)) {
+ // Compensate for default indicator
+ static int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
+ addOffset (&br, di);
+ }
+
+ if ( btnDefault && (elementFlags & CEF_IsEnabled))
+ drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags );
+
+ drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags );
+
+ break;
+ }
+
+
+ // LABEL
+ // -------------------------------------------------------------------
+ case CE_ProgressBarLabel:
+ case CE_TabBarLabel:
+ case CE_RadioButtonLabel:
+ case CE_CheckBoxLabel:
+ case CE_ToolButtonLabel:
+ case CE_PushButtonLabel: {
+ const TQPixmap* pixmap = 0;
+ TQPixmap icon;
+ TQString text;
+ bool popup = false;
+
+ TQIconSet::Mode mode = flags & Style_Enabled ? ((flags & Style_HasFocus) ? TQIconSet::Active : TQIconSet::Normal) : TQIconSet::Disabled;
+ TQIconSet::State state = flags & Style_On ? TQIconSet::On : TQIconSet::Off;
+
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ if (element == CE_ProgressBarLabel) {
+ text = ceData.progressText;
+ setColorsNormal (p, cg, flags);
+ }
+ else if (element == CE_TabBarLabel) {
+ if (!opt.isDefault()) {
+ TQTab* tab = opt.tab();
+ text = tab->text();
+ }
+ setColorsNormal (p, cg, flags, Style_Selected);
+ }
+ else if (element == CE_ToolButtonLabel) {
+ text = ceData.text;
+ pixmap = (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap;
+ if (!ceData.iconSet.isNull())
+ icon = ceData.iconSet.pixmap (TQIconSet::Small, mode, state);
+ popup = (elementFlags & CEF_HasPopupMenu);
+ setColorsButton (p, cg, flags);
+ }
+ else if (element == CE_PushButtonLabel) {
+ text = ceData.text;
+ pixmap = (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap;
+ if (!ceData.iconSet.isNull())
+ icon = ceData.iconSet.pixmap (TQIconSet::Small, mode, state);
+ popup = (elementFlags & CEF_HasPopupMenu);
+ setColorsButton (p, cg, flags);
+ }
+ else {
+ pixmap = (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap;
+ text = ceData.text;
+ setColorsNormal (p, cg);
+ }
+
+ // Does the button have a popup menu?
+ if (popup) {
+ int dx = pixelMetric (PM_MenuButtonIndicator, ceData, elementFlags, widget);
+ drawArrow (p, TQRect(x + w - dx - 2, y + 2, dx, h - 4), PE_ArrowDown);
+ w -= dx;
+ }
+
+ // Draw the icon if there is one
+ if (!icon.isNull())
+ {
+ // Center the iconset if there's no text or pixmap
+ if (text.isEmpty() && ((pixmap == 0) || pixmap->isNull()))
+ p->drawPixmap (x + (w - icon.width()) / 2,
+ y + (h - icon.height()) / 2, icon);
+ else
+ p->drawPixmap (x + 4, y + (h - icon.height()) / 2, icon);
+
+ int pw = icon.width();
+ x += pw + 4;
+ w -= pw + 4;
+ }
+
+ // Draw a focus rect if the button has focus
+ if (flags & Style_HasFocus)
+ drawPrimitive (PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor()));
+
+ // Draw the label itself
+ TQColor color = p->pen().color();
+ drawItem (p, TQRect(x, y, w, h),
+ (element == CE_RadioButtonLabel || element == CE_CheckBoxLabel || element == CE_ProgressBarLabel) ? AlignVCenter|AlignLeft|ShowPrefix : AlignCenter|ShowPrefix,
+ cg, flags & Style_Enabled, pixmap, text, -1, &color);
+ break;
+ }
+
+ // MENUBAR BACKGROUND
+ // -------------------------------------------------------------------
+ case CE_MenuBarEmptyArea:
+ {
+ p->fillRect (r, cg.background());
+ break;
+ }
+
+ // DOCKWINDOW BACKGROUND
+ // -------------------------------------------------------------------
+ case CE_DockWindowEmptyArea:
+ {
+ p->fillRect (r, cg.button());
+ break;
+ }
+
+ // MENUBAR ITEM
+ // -------------------------------------------------------------------
+ case CE_MenuBarItem: {
+ setColorsNormal (p, cg, flags, Style_Active|Style_MouseOver);
+ p->fillRect (r, p->backgroundColor ());
+ if (!opt.isDefault()) {
+ TQMenuItem *mi = opt.menuItem();
+
+ TQColor color = p->pen().color();
+ drawItem (p, r, AlignCenter | AlignVCenter | ShowPrefix
+ | DontClip | SingleLine, cg, flags,
+ mi->pixmap(), mi->text(), -1, &color);
+ }
+ break;
+ }
+
+ // CHECKBOX
+ // -------------------------------------------------------------------
+ case CE_CheckBox: {
+ drawPrimitive (PE_Indicator, p, ceData, elementFlags, r, cg, flags);
+ break;
+ }
+
+ // RADIOBUTTON
+ // -------------------------------------------------------------------
+ case CE_RadioButton: {
+ drawPrimitive (PE_ExclusiveIndicator, p, ceData, elementFlags, r, cg, flags);
+ break;
+ }
+
+ // PROGRESSBAR
+ // -------------------------------------------------------------------
+ case CE_ProgressBarGroove: {
+ setColorsText (p, cg, flags);
+ TQRect r2 (r);
+ r2.setLeft (p->boundingRect (r, AlignVCenter|AlignLeft|ShowPrefix, ceData.progressText).right()
+ + 4*basicLineWidth);
+ drawRoundRect (p, r2);
+ break;
+ }
+ case CE_ProgressBarContents: {
+ TQRect r2 (r);
+ r2.setLeft (p->boundingRect (r, AlignVCenter|AlignLeft|ShowPrefix, ceData.progressText).right()
+ + 4*basicLineWidth);
+ long progress = r2.width() * ceData.currentStep;
+ if (ceData.totalSteps > 0)
+ {
+ r2.setWidth (progress / ceData.totalSteps);
+ }
+ else
+ {
+ int width = r2.width() / 5;
+ int left = ceData.currentStep % (2*(r2.width() - width));
+ if (left > r2.width() - width)
+ left = 2*(r2.width() - width) - left;
+ r2.setLeft (r2.left() + left);
+ r2.setWidth (width);
+ }
+ setColorsHighlight (p, cg, flags);
+ if (r2.width() > 0)
+ drawRoundRect (p, r2);
+ break;
+ }
+
+ // POPUPMENU ITEM
+ // -------------------------------------------------------------------
+ case CE_PopupMenuItem: {
+ setColorsNormal (p, cg, flags, Style_Active|Style_MouseOver);
+ p->fillRect (r, p->backgroundColor ());
+
+ TQMenuItem *mi = opt.menuItem();
+ if (!mi)
+ break;
+
+ int tab = opt.tabWidth();
+ int checkcol = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+ bool reverse = TQApplication::reverseLayout();
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ // Are we a menu item separator?
+ if ( mi->isSeparator() ) {
+ p->drawLine (r.left() + 1, r.center().y(), r.right(), r.center().y());
+ break;
+ }
+
+ // Do we have an icon?
+ if ( mi->iconSet() && !mi->iconSet()->isNull() ) {
+ TQIconSet::Mode mode;
+ TQRect cr = visualRect( TQRect(x, y, checkcol, h), r );
+
+ // Select the correct icon from the iconset
+ if (!(flags & Style_Enabled))
+ mode = TQIconSet::Disabled;
+ else if (flags & Style_Active)
+ mode = TQIconSet::Active;
+ else
+ mode = TQIconSet::Normal;
+
+ // Draw the icon
+ TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode );
+ TQRect pmr( 0, 0, pixmap.width(), pixmap.height() );
+ pmr.moveCenter( cr.center() );
+ p->drawPixmap( pmr.topLeft(), pixmap );
+
+ // Do we have an icon and are checked at the same time?
+ // Then draw a square border around the icon
+ if ( checkable && mi->isChecked() )
+ {
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
+ }
+ }
+
+ // Are we checked? (This time without an icon)
+ else if ( checkable && mi->isChecked() ) {
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
+ }
+
+ // Time to draw the menu item label...
+ int xm = itemFrame + checkcol + itemHMargin; // X position margin
+
+ int xp = reverse ? // X position
+ x + tab + rightBorder + itemHMargin + itemFrame - 1 :
+ x + xm;
+
+ // Label width (minus the width of the accelerator portion)
+ int tw = w - xm - tab - arrowHMargin - itemHMargin * 3 - itemFrame + 1;
+
+ // Does the menu item draw it's own label?
+ if ( mi->custom() ) {
+ int m = itemVMargin;
+ // Save the painter state in case the custom
+ // paint method changes it in some way
+ p->save();
+ mi->custom()->paint( p, cg, flags & Style_Active, flags & Style_Enabled, xp, y+m, tw, h-2*m );
+ p->restore();
+ }
+ else {
+ // The menu item doesn't draw it's own label
+ TQString s = mi->text();
+
+ // Does the menu item have a text label?
+ if ( !s.isNull() ) {
+ int t = s.find( '\t' );
+ int m = itemVMargin;
+ int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ text_flags |= reverse ? AlignRight : AlignLeft;
+
+ // Does the menu item have a tabstop? (for the accelerator text)
+ if ( t >= 0 ) {
+ int tabx = reverse ? x + rightBorder + itemHMargin + itemFrame :
+ x + w - tab - rightBorder - itemHMargin - itemFrame;
+
+ // Draw the right part of the label (accelerator text)
+ p->drawText( tabx, y+m, tab, h-2*m, text_flags, s.mid( t+1 ) );
+ s = s.left( t );
+ }
+
+ // Draw the left part of the label (or the whole label
+ // if there's no accelerator)
+
+ p->drawText( xp, y+m, tw, h-2*m, text_flags, s, t );
+
+ }
+
+ // The menu item doesn't have a text label
+ // Check if it has a pixmap instead
+ else if ( mi->pixmap() ) {
+ TQPixmap *pixmap = mi->pixmap();
+
+ // Draw the pixmap
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::OpaqueMode );
+
+ int diffw = ( ( w - pixmap->width() ) / 2 )
+ + ( ( w - pixmap->width() ) % 2 );
+ p->drawPixmap( x+diffw, y+itemFrame, *pixmap );
+
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::TransparentMode );
+ }
+ }
+
+ // Does the menu item have a submenu?
+ if ( mi->popup() ) {
+ TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
+ int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags);
+ TQRect vr = visualRect( TQRect( x + w - arrowHMargin - 2*itemFrame - dim,
+ y + h / 2 - dim / 2, dim, dim), r );
+
+ // Draw an arrow at the far end of the menu item
+ drawArrow (p, vr, arrow);
+ }
+ break;
+ }
+
+ default:
+ TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+}
+
+void HighContrastStyle::drawControlMask (TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &opt,
+ const TQWidget *w) const
+{
+ switch (element) {
+ case CE_PushButton:
+ case CE_ToolBoxTab:
+ case CE_TabBarTab:
+ case CE_ProgressBarLabel:
+ case CE_TabBarLabel:
+ case CE_RadioButtonLabel:
+ case CE_CheckBoxLabel:
+ case CE_ToolButtonLabel:
+ case CE_PushButtonLabel:
+ case CE_MenuBarEmptyArea:
+ case CE_MenuBarItem:
+ case CE_PopupMenuItem: {
+ p->fillRect (r, color0);
+ break;
+ }
+
+ default: {
+ TDEStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w);
+ }
+ }
+}
+
+// Helper to find the next sibling that's not hidden
+// Lifted from tdestyle.cpp
+static TQListViewItem* nextVisibleSibling(TQListViewItem* item)
+{
+ TQListViewItem* sibling = item;
+ do
+ {
+ sibling = sibling->nextSibling();
+ }
+ while (sibling && !sibling->isVisible());
+
+ return sibling;
+}
+
+void HighContrastStyle::drawComplexControl (TQ_ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ SCFlags controls,
+ SCFlags active,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ switch(control)
+ {
+ // COMBOBOX
+ // -------------------------------------------------------------------
+ case CC_ComboBox: {
+ setColorsText (p, cg, flags);
+ drawRoundRect (p, r);
+
+ TQRect r2 = TQStyle::visualRect (querySubControlMetrics (CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget), ceData, elementFlags);
+ if (flags & Style_HasFocus) {
+ TQRect r3 (r);
+ if (r2.left() > 0)
+ r3.setRight (r2.left()+basicLineWidth-1);
+ else
+ r3.setLeft (r2.right()-basicLineWidth+1);
+
+ drawPrimitive (PE_FocusRect, p, ceData, elementFlags, r3, cg, flags, TQStyleOption (p->backgroundColor()));
+ }
+
+ setColorsButton (p, cg, flags);
+ // Draw arrow if required
+ if (controls & SC_ComboBoxArrow) {
+ drawRoundRect (p, r2);
+ drawArrow (p, r2, PE_ArrowDown, 2*basicLineWidth);
+ }
+
+ setColorsText (p, cg, flags);
+ break;
+ }
+
+ // SPINWIDGET
+ // -------------------------------------------------------------------
+ case CC_SpinWidget: {
+ if (controls & SC_SpinWidgetFrame) {
+ setColorsText (p, cg, flags);
+ drawRoundRect (p, r);
+ if (flags & Style_HasFocus)
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, r, cg, flags, TQStyleOption (p->backgroundColor()));
+ }
+
+ setColorsButton (p, cg, flags);
+ // Draw arrows if required
+ if (controls & SC_SpinWidgetDown) {
+ TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetDown, TQStyleOption::Default, widget), ceData, elementFlags);
+ drawRoundRect (p, r2);
+ drawArrow (p, r2, PE_SpinWidgetDown, 2*basicLineWidth);
+ }
+ if (controls & SC_SpinWidgetUp) {
+ TQRect r2 = TQStyle::visualRect (querySubControlMetrics ((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetUp, TQStyleOption::Default, widget), ceData, elementFlags);
+ drawRoundRect (p, r2);
+ drawArrow (p, r2, PE_SpinWidgetUp, 2*basicLineWidth);
+ }
+
+ setColorsText (p, cg, flags);
+ break;
+ }
+
+ // TOOLBUTTON
+ // -------------------------------------------------------------------
+ case CC_ToolButton: {
+ setColorsButton (p, cg, flags);
+ p->fillRect (r, p->backgroundColor ());
+
+ TQRect button, menuarea;
+ button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
+ menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
+
+ SFlags bflags = flags,
+ mflags = flags;
+
+ if (active & SC_ToolButton)
+ bflags |= Style_Down;
+ if (active & SC_ToolButtonMenu)
+ mflags |= Style_Down;
+
+ if (controls & SC_ToolButton)
+ {
+ // If we're pressed, on, or raised...
+ if (bflags & (Style_Down | Style_On | Style_Raised))
+ drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
+
+ // Check whether to draw a background pixmap
+ else if ( !ceData.parentWidgetData.bgPixmap.isNull() )
+ {
+ TQPixmap pixmap = ceData.parentWidgetData.bgPixmap;
+ p->drawTiledPixmap( r, pixmap, ceData.pos );
+ }
+ }
+
+ // Draw a toolbutton menu indicator if required
+ if (controls & SC_ToolButtonMenu)
+ {
+ if (mflags & (Style_Down | Style_On | Style_Raised))
+ drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
+ drawArrow (p, menuarea, PE_ArrowDown);
+ }
+
+ if ((elementFlags & CEF_HasFocus) && !(elementFlags & CEF_HasFocusProxy)) {
+ TQRect fr = ceData.rect;
+ addOffset (&fr, 3);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags, TQStyleOption (p->backgroundColor()));
+ }
+
+ break;
+ }
+
+ // LISTVIEW
+ // -------------------------------------------------------------------
+ case CC_ListView: {
+ /*
+ * Sigh... Lifted and modified from tdestyle.cpp
+ */
+ /*
+ * Many thanks to TrollTech AS for donating CC_ListView from TQWindowsStyle.
+ * CC_ListView code is Copyright (C) 1998-2000 TrollTech AS.
+ */
+
+ // Paint the icon and text.
+ if ( controls & SC_ListView )
+ TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget );
+
+ // If we're have a branch or are expanded...
+ if ( controls & (SC_ListViewBranch | SC_ListViewExpand) )
+ {
+ // If no list view item was supplied, break
+ if (opt.isDefault())
+ break;
+
+ TQListViewItem *item = opt.listViewItem();
+ TQListViewItem *child = item->firstChild();
+
+ int y = r.y();
+ int c; // dotline vertice count
+ int dotoffset = 0;
+ TQPointArray dotlines;
+
+ if ( active == SC_All && controls == SC_ListViewExpand ) {
+ // We only need to draw a vertical line
+ c = 2;
+ dotlines.resize(2);
+ dotlines[0] = TQPoint( r.right(), r.top() );
+ dotlines[1] = TQPoint( r.right(), r.bottom() );
+
+ } else {
+
+ int linetop = 0, linebot = 0;
+ // each branch needs at most two lines, ie. four end points
+ dotoffset = (item->itemPos() + item->height() - y) % 2;
+ dotlines.resize( item->childCount() * 4 );
+ c = 0;
+
+ // skip the stuff above the exposed rectangle
+ while ( child && y + child->height() <= 0 )
+ {
+ y += child->totalHeight();
+ child = nextVisibleSibling(child);
+ }
+
+ int bx = r.width() / 2;
+
+ // paint stuff in the magical area
+ TQListView* v = item->listView();
+ int lh = QMAX( p->fontMetrics().height() + 2 * v->itemMargin(),
+ TQApplication::globalStrut().height() );
+ if ( lh % 2 > 0 )
+ lh++;
+
+ // Draw all the expand/close boxes...
+ TQRect boxrect;
+ TQStyle::StyleFlags boxflags;
+ while ( child && y < r.height() )
+ {
+ linebot = y + lh/2;
+ if ( (child->isExpandable() || child->childCount()) &&
+ (child->height() > 0) )
+ {
+ int h = QMIN(lh, 24) - 4*basicLineWidth;
+ if (h < 10)
+ h = 10;
+ else
+ h &= ~1; // Force an even number of pixels
+
+ // The primitive requires a rect.
+ boxrect = TQRect( bx-h/2, linebot-h/2, h, h );
+ boxflags = child->isOpen() ? TQStyle::Style_Off : TQStyle::Style_On;
+
+ // TDEStyle extension: Draw the box and expand/collapse indicator
+ drawTDEStylePrimitive( KPE_ListViewExpander, p, ceData, elementFlags, boxrect, cg, boxflags, opt, NULL );
+
+ // dotlinery
+ p->setPen( cg.mid() );
+ dotlines[c++] = TQPoint( bx, linetop );
+ dotlines[c++] = TQPoint( bx, linebot - 5 );
+ dotlines[c++] = TQPoint( bx + 5, linebot );
+ dotlines[c++] = TQPoint( r.width(), linebot );
+ linetop = linebot + 5;
+ } else {
+ // just dotlinery
+ dotlines[c++] = TQPoint( bx+1, linebot );
+ dotlines[c++] = TQPoint( r.width(), linebot );
+ }
+
+ y += child->totalHeight();
+ child = nextVisibleSibling(child);
+ }
+
+ if ( child ) // there's a child to draw, so move linebot to edge of rectangle
+ linebot = r.height();
+
+ if ( linetop < linebot )
+ {
+ dotlines[c++] = TQPoint( bx, linetop );
+ dotlines[c++] = TQPoint( bx, linebot );
+ }
+ }
+
+ // Draw all the branches...
+ static int thickness = kPixelMetric( KPM_ListViewBranchThickness, ceData, elementFlags );
+ int line; // index into dotlines
+ TQRect branchrect;
+ TQStyle::StyleFlags branchflags;
+ for( line = 0; line < c; line += 2 )
+ {
+ // assumptions here: lines are horizontal or vertical.
+ // lines always start with the numerically lowest
+ // coordinate.
+
+ // point ... relevant coordinate of current point
+ // end ..... same coordinate of the end of the current line
+ // other ... the other coordinate of the current point/line
+ if ( dotlines[line].y() == dotlines[line+1].y() )
+ {
+ // Horizontal branch
+ int end = dotlines[line+1].x();
+ int point = dotlines[line].x();
+ int other = dotlines[line].y();
+
+ branchrect = TQRect( point, other-(thickness/2), end-point, thickness );
+ branchflags = TQStyle::Style_Horizontal;
+
+ // TDEStyle extension: Draw the horizontal branch
+ drawTDEStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
+
+ } else {
+ // Vertical branch
+ int end = dotlines[line+1].y();
+ int point = dotlines[line].y();
+ int other = dotlines[line].x();
+ int pixmapoffset = ((point & 1) != dotoffset ) ? 1 : 0;
+
+ branchrect = TQRect( other-(thickness/2), point, thickness, end-point );
+ if (!pixmapoffset) // ### Hackish - used to hint the offset
+ branchflags = TQStyle::Style_NoChange;
+ else
+ branchflags = TQStyle::Style_Default;
+
+ // TDEStyle extension: Draw the vertical branch
+ drawTDEStylePrimitive( KPE_ListViewBranch, p, ceData, elementFlags, branchrect, cg, branchflags, opt, NULL );
+ }
+ }
+ }
+ break;
+ }
+
+ default:
+ TDEStyle::drawComplexControl(control, p, ceData, elementFlags,
+ r, cg, flags, controls, active, opt, widget);
+ break;
+ }
+}
+
+void HighContrastStyle::drawComplexControlMask(TQ_ComplexControl c,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ switch (c) {
+ case CC_SpinWidget:
+ case CC_ToolButton:
+ case CC_ComboBox: {
+ p->fillRect (r, color0);
+ break;
+ }
+ default: {
+ TDEStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w);
+ }
+ }
+}
+
+void HighContrastStyle::drawItem( TQPainter *p,
+ const TQRect &r,
+ int flags,
+ const TQColorGroup &cg,
+ bool enabled,
+ const TQPixmap *pixmap,
+ const TQString &text,
+ int len,
+ const TQColor *penColor ) const
+{
+ p->save();
+
+ // make the disabled things use the cross-line
+ TQFont font = p->font();
+ font.setStrikeOut (!enabled);
+ p->setFont (font);
+
+ enabled = true; //do not ghost it in Qt
+
+ TDEStyle::drawItem (p, r, flags, cg, enabled, pixmap, text, len, penColor);
+
+ p->restore();
+}
+
+TQRect HighContrastStyle::querySubControlMetrics( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl subcontrol,
+ const TQStyleOption& opt,
+ const TQWidget* widget ) const
+{
+ switch (control)
+ {
+ case CC_ComboBox : {
+ int arrow = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, widget);
+ switch (subcontrol)
+ {
+ case SC_ComboBoxFrame:
+ return TQRect (0, 0, ceData.rect.width(), ceData.rect.height());
+ case SC_ComboBoxArrow:
+ return TQRect (ceData.rect.width() - arrow, 0, arrow, ceData.rect.height());
+ case SC_ComboBoxEditField:
+ return TQRect (2*basicLineWidth, 2*basicLineWidth,
+ ceData.rect.width() - arrow - 3*basicLineWidth, ceData.rect.height() - 4*basicLineWidth);
+
+ default: break;
+ }
+ break;
+ }
+ case CC_SpinWidget : {
+ int arrow = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, 0);
+ switch (subcontrol)
+ {
+ case SC_SpinWidgetFrame:
+ return TQRect (0, 0, ceData.rect.width(), ceData.rect.height());
+ case SC_SpinWidgetButtonField:
+ return TQRect (ceData.rect.width() - arrow, 0, arrow, ceData.rect.height());
+ case SC_SpinWidgetUp:
+ return TQRect (ceData.rect.width() - arrow, 0, arrow, ceData.rect.height()/2);
+ case SC_SpinWidgetDown:
+ return TQRect (ceData.rect.width() - arrow, ceData.rect.height()/2,
+ arrow, ceData.rect.height()-ceData.rect.height()/2);
+ case SC_SpinWidgetEditField:
+ return TQRect (2*basicLineWidth, 2*basicLineWidth,
+ ceData.rect.width() - arrow - 3*basicLineWidth, ceData.rect.height() - 4*basicLineWidth);
+
+ default: break;
+ }
+ break;
+ }
+
+ default: break;
+ }
+
+ return TDEStyle::querySubControlMetrics (control, ceData, elementFlags, subcontrol, opt, widget);
+}
+
+
+int HighContrastStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ //### TODO: Use the tab metrics changes from Ker.
+ switch(m)
+ {
+ // BUTTONS
+ // -------------------------------------------------------------------
+ case PM_ButtonMargin: // Space btw. frame and label
+ return 2*basicLineWidth;
+
+ case PM_ButtonDefaultIndicator: {
+ if ((widget != 0) && !(elementFlags & CEF_IsEnabled))
+ return 0;
+ else
+ return 2*basicLineWidth;
+ }
+
+ case PM_ButtonShiftHorizontal:
+ case PM_ButtonShiftVertical:
+ return 0;
+
+ case PM_ScrollBarExtent: {
+ int h = 0;
+ if (widget != 0)
+ h = (2*TQFontMetrics(ceData.font).lineSpacing())/3;
+
+ if (h > 9*basicLineWidth+4)
+ return h;
+ else
+ return 9*basicLineWidth+4;
+ }
+
+ case PM_DefaultFrameWidth: {
+ if (widget && (ceData.widgetObjectTypes.contains (TQLINEEDIT_OBJECT_NAME_STRING) || ceData.widgetObjectTypes.contains (TQTEXTEDIT_OBJECT_NAME_STRING)))
+ return 2*basicLineWidth;
+ else
+ return basicLineWidth;
+ }
+
+ case PM_SpinBoxFrameWidth: {
+ return 2*basicLineWidth;
+ }
+
+ case PM_MenuButtonIndicator: { // Arrow width
+ int h = 0;
+ if (widget != 0)
+ h = TQFontMetrics(ceData.font).lineSpacing()/2;
+
+ if (h > 3*basicLineWidth)
+ return h;
+ else
+ return 3*basicLineWidth;
+ }
+
+ // CHECKBOXES / RADIO BUTTONS
+ // -------------------------------------------------------------------
+ case PM_ExclusiveIndicatorWidth: // Radiobutton size
+ case PM_ExclusiveIndicatorHeight:
+ case PM_IndicatorWidth: // Checkbox size
+ case PM_IndicatorHeight: {
+ int h = 0;
+ if (widget != 0)
+ h = TQFontMetrics(ceData.font).lineSpacing()-2*basicLineWidth;
+
+ if (h > 6*basicLineWidth)
+ return h;
+ else
+ return 6*basicLineWidth;
+ }
+
+ case PM_DockWindowSeparatorExtent: {
+ return 2*basicLineWidth + 1;
+ }
+ case PM_DockWindowHandleExtent: {
+ int w = 0;
+ if (widget != 0)
+ w = TQFontMetrics(ceData.font).lineSpacing()/4;
+ if (w > 5*basicLineWidth)
+ return w;
+ else
+ return 5*basicLineWidth;
+ }
+
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ return 0;
+
+ default:
+ return TDEStyle::pixelMetric(m, ceData, elementFlags, widget);
+ }
+}
+
+int HighContrastStyle::kPixelMetric( TDEStylePixelMetric kpm, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
+{
+ switch (kpm) {
+ case KPM_ListViewBranchThickness:
+ // XXX Proper support of thick branches requires reimplementation of
+ // the drawTDEStylePrimitive KPE_ListViewBranch case.
+ return basicLineWidth;
+ default:
+ return TDEStyle::kPixelMetric(kpm, ceData, elementFlags, widget);
+ }
+}
+
+TQSize HighContrastStyle::sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentSize,
+ const TQStyleOption& opt,
+ const TQWidget* widget ) const
+{
+ switch (contents)
+ {
+ // PUSHBUTTON SIZE
+ // ------------------------------------------------------------------
+ case CT_PushButton: {
+ const TQPushButton* button = (const TQPushButton*) widget;
+ int w = contentSize.width();
+ int h = contentSize.height();
+ int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
+ int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
+
+ w += bm + fw + 6; // ### Add 6 to make way for bold font.
+ h += bm + fw;
+
+ // Ensure we stick to standard width and heights.
+ if (( button->isDefault() || button->autoDefault() ) && (button->isEnabled())) {
+ if ( w < 80 && !button->text().isEmpty() )
+ w = 80;
+
+ // Compensate for default indicator
+ int di = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
+ w += di * 2;
+ h += di * 2;
+ }
+
+ if ( h < 22 )
+ h = 22;
+
+ return TQSize( w + basicLineWidth*2, h + basicLineWidth*2 );
+ }
+
+ // TOOLBUTTON SIZE
+ // -----------------------------------------------------------------
+ case CT_ToolButton: {
+ int w = contentSize.width();
+ int h = contentSize.height();
+ return TQSize(w + basicLineWidth*2 + 6, h + basicLineWidth*2 + 5);
+ break;
+ }
+
+ // COMBOBOX SIZE
+ // -----------------------------------------------------------------
+ case CT_ComboBox: {
+ const TQComboBox *cb = static_cast< const TQComboBox* > (widget);
+ int borderSize = (cb->editable() ? 4 : 2) * basicLineWidth;
+ int arrowSize = pixelMetric (PM_ScrollBarExtent, ceData, elementFlags, cb);
+ return TQSize(borderSize + basicLineWidth + arrowSize, borderSize) + contentSize;
+ }
+
+ // POPUPMENU ITEM SIZE
+ // -----------------------------------------------------------------
+ case CT_PopupMenuItem: {
+ if ( ! widget || opt.isDefault() )
+ return contentSize;
+
+ const TQPopupMenu *popup = (const TQPopupMenu *) widget;
+ bool checkable = popup->isCheckable();
+ TQMenuItem *mi = opt.menuItem();
+ int maxpmw = opt.maxIconWidth();
+ int w = contentSize.width(), h = contentSize.height();
+
+ if ( mi->custom() ) {
+ w = mi->custom()->sizeHint().width();
+ h = mi->custom()->sizeHint().height();
+ if ( ! mi->custom()->fullSpan() )
+ h += 2*itemVMargin + 2*itemFrame;
+ }
+ else if ( mi->widget() ) {
+ } else if ( mi->isSeparator() ) {
+ w = 10; // Arbitrary
+ h = 4;
+ }
+ else {
+ if ( mi->pixmap() )
+ h = QMAX( h, mi->pixmap()->height() + 2*itemFrame );
+ else {
+ // Ensure that the minimum height for text-only menu items
+ // is the same as the icon size used by KDE.
+ h = QMAX( h, 16 + 2*itemFrame );
+ h = QMAX( h, popup->fontMetrics().height()
+ + 2*itemVMargin + 2*itemFrame );
+ }
+
+ if ( mi->iconSet() && ! mi->iconSet()->isNull() )
+ h = QMAX( h, mi->iconSet()->pixmap(
+ TQIconSet::Small, TQIconSet::Normal).height() +
+ 2 * itemFrame );
+ }
+
+ if ( ! mi->text().isNull() && mi->text().find('\t') >= 0 )
+ w += 12;
+ else if ( mi->popup() )
+ w += 2 * arrowHMargin;
+
+ if ( maxpmw )
+ w += maxpmw + 6;
+ if ( checkable && maxpmw < 20 )
+ w += 20 - maxpmw;
+ if ( checkable || maxpmw > 0 )
+ w += 12;
+
+ w += rightBorder;
+
+ return TQSize( w, h );
+ }
+
+
+ // LINEDIT SIZE
+ // -----------------------------------------------------------------
+ case CT_LineEdit: {
+ return contentSize + TQSize (4*basicLineWidth, 4*basicLineWidth);
+ }
+
+
+ default:
+ return TDEStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
+ }
+}
+
+TQRect HighContrastStyle::subRect (SubRect subrect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget * widget) const
+{
+ switch (subrect) {
+ case SR_ProgressBarGroove:
+ case SR_ProgressBarContents:
+ case SR_ProgressBarLabel:
+ return ceData.rect;
+ default:
+ return TDEStyle::subRect (subrect, ceData, elementFlags, widget);
+ }
+}
+
+bool HighContrastStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
+{
+ return TDEStyle::objectEventHandler (ceData, elementFlags, source, event);
+}
+
+/*! \reimp */
+int HighContrastStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
+{
+ int ret;
+
+ switch (sh) {
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int checkcol = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ ret = checkcol;
+ }
+ break;
+ default:
+ ret = TDEStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
+ break;
+ }
+
+ return ret;
+}
+
+// vim: set noet ts=4 sw=4:
+// kate: indent-width 4; replace-tabs off; smart-indent on; tab-width 4;
diff --git a/tdestyles/highcontrast/highcontrast.h b/tdestyles/highcontrast/highcontrast.h
new file mode 100644
index 000000000..552526254
--- /dev/null
+++ b/tdestyles/highcontrast/highcontrast.h
@@ -0,0 +1,180 @@
+/*
+ * High Contrast Style (version 1.0)
+ * Copyright (C) 2004 Olaf Schmidt <ojschmidt@kde.org>
+ *
+ * Derived from Axes Style
+ * Copyright (C) 2003 Maksim Orlovich <orlovich@cs.rochester.edu>
+ *
+ * Axes Style based on KDE 3 HighColor Style,
+ * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ * (C) 2001-2002 Fredrik Höglund <fredrik@kde.org>
+ *
+ * KDE 3 HighColor Style drawing routines adapted from the KDE2 HCStyle,
+ * Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ * (C) 2000 Dirk Mueller <mueller@kde.org>
+ * (C) 2001 Martijn Klingens <klingens@kde.org>
+ *
+ * Includes portions from TDEStyle,
+ * Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ *
+ * Many thanks to Bradley T. Hughes for the 3 button scrollbar code.
+ *
+ * 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 __HIGHCONTRAST_H
+#define __HIGHCONTRAST_H
+
+#include <tqbitmap.h>
+#include <tqintdict.h>
+#include <kdrawutil.h>
+#include <kpixmap.h>
+#include <tdestyle.h>
+
+
+class TQPopupMenu;
+
+class HighContrastStyle : public TDEStyle
+{
+ Q_OBJECT
+
+ public:
+ HighContrastStyle();
+ virtual ~HighContrastStyle();
+
+ void polish( TQPalette& pal );
+
+ void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
+ 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( TQ_PrimitiveElement pe,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags = Style_Default,
+ const TQStyleOption& = TQStyleOption::Default ) const;
+
+ void drawControl( TQ_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 element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) 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;
+
+ void drawComplexControlMask( TQ_ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const;
+
+ TQRect querySubControlMetrics( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl subcontrol,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const;
+
+
+ void drawItem( TQPainter *p,
+ const TQRect &r,
+ int flags,
+ const TQColorGroup &cg,
+ bool enabled,
+ const TQPixmap *pixmap,
+ const TQString &text,
+ int len = -1,
+ const TQColor *penColor = 0 ) const;
+
+ int pixelMetric( PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQWidget *widget = 0 ) const;
+
+ int kPixelMetric( TDEStylePixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQWidget *widget = 0 ) const;
+
+ TQSize sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentSize,
+ const TQStyleOption& opt,
+ const TQWidget *widget = 0 ) const;
+
+ TQRect subRect (SubRect subrect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget * widget) const;
+
+ int styleHint(TQ_StyleHint, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQStyleOption & = TQStyleOption::Default,
+ TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
+
+ protected:
+ virtual bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
+
+ private:
+ void setColorsNormal (TQPainter* p, const TQColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
+ void setColorsButton (TQPainter* p, const TQColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
+ void setColorsText (TQPainter* p, const TQColorGroup& cg, int flags = Style_Enabled, int highlight = Style_Down|Style_MouseOver) const;
+ void setColorsHighlight (TQPainter* p, const TQColorGroup& cg, int flags = Style_Enabled) const;
+ void setColorsByState (TQPainter* p, const TQColorGroup& cg, const TQColor& fg, const TQColor& bg, int flags, int highlight) const;
+
+ void drawRect (TQPainter* p, TQRect r, int offset = 0, bool filled = true) const;
+ void drawRoundRect (TQPainter* p, TQRect r, int offset = 0, bool filled = true) const;
+ void drawEllipse (TQPainter* p, TQRect r, int offset = 0, bool filled = true) const;
+ void drawArrow (TQPainter* p, TQRect r, TQ_PrimitiveElement arrow, int offset = 0) const;
+
+ int basicLineWidth;
+ // Disable copy constructor and = operator
+ HighContrastStyle( const HighContrastStyle & );
+ HighContrastStyle& operator=( const HighContrastStyle & );
+};
+
+// vim: set noet ts=4 sw=4:
+// kate: indent-width 4; replace-tabs off; smart-indent on; tab-width 4;
+
+#endif
diff --git a/tdestyles/highcontrast/highcontrast.themerc b/tdestyles/highcontrast/highcontrast.themerc
new file mode 100644
index 000000000..c3b8445d4
--- /dev/null
+++ b/tdestyles/highcontrast/highcontrast.themerc
@@ -0,0 +1,127 @@
+[Misc]
+Name=HighContrast
+Name[af]=Hoë kontras
+Name[be]=Ð’Ñ‹Ñокі кантраÑÑ‚
+Name[bn]=হাই কনটà§à¦°à¦¾à¦¸à§à¦Ÿ
+Name[br]=Dargemm uhel
+Name[ca]=Contrast alt
+Name[cs]=Vysoký kontrast
+Name[csb]=Wësoczi kòntrast
+Name[da]=Høj kontrast
+Name[de]=Hoher Kontrast
+Name[el]=Υψηλή φωτεινότητα
+Name[eo]=Granda kontrasto
+Name[es]=ContrasteAlto
+Name[et]=Tugev kontrast
+Name[eu]=Kontraste handia
+Name[fa]=سایه روشن بالا
+Name[fi]=KorkeaKontrasti
+Name[fr]=Contraste fort
+Name[fy]=Heechkontrast
+Name[he]=ניגודיות גבוהה
+Name[hr]=Visoki kontrast
+Name[hu]=Erősen kontrasztos
+Name[is]=Há birtuskil
+Name[it]=Contrasto elevato
+Name[ja]=高コントラスト
+Name[ka]=კáƒáƒœáƒ¢áƒ áƒáƒ¡áƒ¢áƒ˜
+Name[kk]=Жоғары контраÑÑ‚Ñ‹
+Name[km]=កម្រិážâ€‹áž–ណ៌​ážáŸ’ពស់
+Name[lb]=HéichKontrast
+Name[lt]=Didelis kontrastas
+Name[lv]=Augsts kontrasts
+Name[mk]=ВиÑок контраÑÑ‚
+Name[ms]=Kontras Tinggi
+Name[nb]=HøyKontrast
+Name[nds]=HoochKontrast
+Name[ne]=उचà¥à¤š वà¥à¤¯à¤¤à¤¿à¤°à¥‡à¤•
+Name[nl]=Hoogcontrast
+Name[nn]=Høg kontrast
+Name[pa]=ਗੂੜਾ
+Name[pl]=Wysoki kontrast
+Name[pt]=Alto Contraste
+Name[pt_BR]=Alto Contraste
+Name[ro]=Contrast mare
+Name[ru]=КонтраÑÑ‚
+Name[rw]=InyuranyamigaragarireRihebuje
+Name[se]=AllaVuostálasvuohta
+Name[sl]=VisokKontrast
+Name[sr]=ВиÑоки контраÑÑ‚
+Name[sr@Latn]=Visoki kontrast
+Name[sv]=Hög kontrast
+Name[ta]=அதிக மாறà¯à®ªà®¾à®Ÿà¯
+Name[te]=à°Žà°•à±à°•à±à°µ à°µà±à°¯à°¤à±à°¯à°¾à°¸à°‚
+Name[tg]=БаландÐкÑ
+Name[th]=คอนทราสต์สูง
+Name[tr]=Yüksek Kontrast
+Name[tt]=KiskenTösle
+Name[uk]=ВиÑока контраÑтніÑÑ‚ÑŒ
+Name[vi]=Äá»™ tÆ°Æ¡ng phản cao
+Name[zh_CN]=高对比度
+Name[zh_HK]=高åå·®
+ConfigPage=tdestyle_highcontrast_config
+Comment=A style that works well with high contrast color schemes
+Comment[af]=´n Styl wat goed werk met hoë kontras kleur skemas
+Comment[be]=Стыль, Ñкі Ñтвораны Ð´Ð»Ñ Ð¿Ñ€Ð°Ñ†Ñ‹ з выÑокакантраÑтнымі колернымі Ñхемамі
+Comment[bg]=Стил за Ñхеми Ñ Ð²Ð¸Ñок контраÑÑ‚
+Comment[bs]=Stil koji izgleda dobro sa Å¡emama boja visokog kontrasta
+Comment[ca]=Un estil que funciona bé amb esquemes de color de contrast alt
+Comment[cs]=Styl vhodný pro barevná schémata s vysokým kontrastem
+Comment[csb]=Sztél, jaczi dzejô pòprôwno z témama farwów ò wësoczim kòntrasce
+Comment[da]=En stil der virker godt med farvesammensætninger med høj kontrast
+Comment[de]=Ein Stil, der gut zu kontrastreichen Farbschemas passt
+Comment[el]=Ένα στυλ που δουλεÏει καλά με σχήματα υψηλής φωτεινότητας
+Comment[en_GB]=A style that works well with high contrast colour schemes
+Comment[eo]=Stilo kiu konvenas al kolor-etosoj kiuj havas grandajn kontrastojn
+Comment[es]=Un estilo que funciona con esquemas de color de contraste alto
+Comment[et]=Stiil, mis sobib hästi tugeva kontrastiga värviskeemidele
+Comment[eu]=Kontraste handiko gaiekin ongi moldatzen den estiloa
+Comment[fa]=سبکی که به خوبی با طرحهای رنگ، با سایه روشن بالا کار می‌کند
+Comment[fi]=Tyyli joka toimii hyvin korkeakontrastisien väriteemojen kanssa
+Comment[fr]=Un style se combinant bien avec les modèles de couleurs à fort contraste
+Comment[fy]=In styl dy goed wurket mei hege kontrast kleureskema’s
+Comment[gl]=Un estilo que traballa ben con esquemas de cor de alto contraste
+Comment[hr]=Stil koji dobro fukcionira s shemama bojanja u visokom kontrastu
+Comment[hu]=Erősen kontrasztos színsémákhoz jól illeszkedő stílus
+Comment[id]=Gaya yang sesuai untuk skema warna kontras tinggi
+Comment[is]=Stíll sem passar vel við litaskemu sem nota há birtuskil
+Comment[it]=Uno stile che funziona bene con combinazioni di colori ad alto contrasto
+Comment[ja]=高コントラストã®è‰²ã‚¹ã‚­ãƒ¼ãƒ ã«ãµã•ã‚ã—ã„スタイル
+Comment[ka]=ფერების მáƒáƒ¦áƒáƒš კáƒáƒœáƒ¢áƒ áƒáƒ¡áƒ¢áƒ£áƒšáƒ˜ სქემების სტილი
+Comment[kk]=КонтраÑÑ‚Ñ‹Ò“Ñ‹ жоғары Ñ‚Ò¯Ñтер Ñұлбалы Ñтиль
+Comment[km]=រចនាបáŸáž‘្មដែល​ធ្វើការ​យ៉ាង​ល្អ​ជាមួយ​គ្រោង​ពណ៌​កម្រិážâ€‹ážáŸ’ពស់
+Comment[lb]=E Stil, dee gutt bei Faarfschemaë mat engem héiche Kontrast passt
+Comment[lt]=Stilius, kuris labai tinka didelio kontrasto spalvų schemoms
+Comment[mk]=Стил што добро работи Ñо шеми на бои Ñо виÑок контраÑÑ‚
+Comment[ms]=Gaya yang berfungsi baik dengan skema warna kontras tinggi
+Comment[nb]=En stil som passer bra sammen med temaer med høy kontrast
+Comment[nds]=En Stil, de goot för Klöörschemas mit hogen Kontrast passt.
+Comment[ne]=उचà¥à¤š वà¥à¤¯à¤¤à¤¿à¤°à¥‡à¤• रङ सà¥à¤•à¥€à¤®à¤¾à¤¸à¤à¤— रामà¥à¤°à¥‹ कारà¥à¤¯ गरà¥à¤¨à¥‡ शैली
+Comment[nl]=Een stijl die goed werkt met hoog contrast kleurenschema's
+Comment[nn]=Ein stil som fungerer bra når fargeoppsettet har høg kontrast
+Comment[pa]= ਇੱਕ ਸ਼ੈਲੀ, ਜੋ ਕਿ ਗੂੜੀ ਰੰਗ ਸਕੀਮ ਨਾਲ ਵਧੀਆ ਕੰਮ ਕਰਦੀ ਹੈ
+Comment[pl]=Styl, który działa dobrze z motywami kolorów o wysokim kontraście
+Comment[pt]=Um estilo que funciona bem com esquemas de cores de alto contraste
+Comment[pt_BR]=Um estilo que funciona bem com esquemas de cor de alto contraste
+Comment[ro]=Un stil care se potriveÅŸte cu schemele de culori cu contrast mare
+Comment[ru]=Стиль Ñ ÐºÐ¾Ð½Ñ‚Ñ€Ð°Ñтными цветовыми Ñхемами
+Comment[rw]=Imisusire ikorana neza n'ibishushanyombonera by'ibara inyuranyamigaragarire yo hejuru
+Comment[se]=Stiila mii doaibmá bures ovttas ivdneÄoahkádusaiguin mas leat alla vuostálasvuohta
+Comment[sk]=Štýl, ktorý funguje dobre pri schémach s vysokým kontrastom
+Comment[sl]=Slog, ki se dobro obnese z visokokontrastnimi shemami
+Comment[sr]=Стил који ради Ñа виÑоко контраÑтним шемама боја
+Comment[sr@Latn]=Stil koji radi sa visoko kontrastnim Å¡emama boja
+Comment[sv]=En stil som fungerar bra med färgscheman för hög kontrast
+Comment[ta]=அதிக மாறà¯à®ªà®¾à®Ÿà¯à®Ÿà¯ வணà¯à®£ அமைபà¯à®ªà¯à®•à®³à®¿à®²à¯ சரியாக இயஙà¯à®•à¯à®®à¯ ஒர௠பாணி
+Comment[te]=à°Žà°•à±à°•à±à°µ à°µà±à°¯à°¤à±à°¯à°¾à°¸à°¾à°² à°°à°‚à°—à±à°² పదà±à°¦à°¤à±à°²à°¤à±Š బాగా పనిచేయౠఒక శైలి
+Comment[tg]=УÑлуб, ки бо иÑтифодаи нақшаҳо бо рангҳои Ð±Ð°Ð»Ð°Ð½Ð´Ð°ÐºÑ Ñоз кор мекунад
+Comment[th]=รูปà¹à¸šà¸šà¸—ี่ทำงานได้ดีà¸à¸±à¸šà¸Šà¸¸à¸”สีคอนทราสต์สูง
+Comment[tr]=Yüksek kontrast renk şemalarına uygun bir stil
+Comment[tt]=Bu tışlaw bik kisken tösle köyläwlärgä yaxşı kileşä
+Comment[uk]=Стиль, Ñкий підходить до Ñхем кольорів з виÑокою контраÑтніÑÑ‚ÑŽ
+Comment[vi]=Kiểu dáng thích hợp với lược đồ màu có độ tương phản cao.
+Comment[zh_CN]=在高对比度é…色方案中适用的样å¼
+Comment[zh_HK]=é©ç”¨æ–¼é«˜å差色彩的佈景
+Comment[zh_TW]=在高彩度下å¯ä»¥ä½¿ç”¨çš„風格
+[KDE]
+WidgetStyle=HighContrast
diff --git a/tdestyles/keramik/CMakeLists.txt b/tdestyles/keramik/CMakeLists.txt
new file mode 100644
index 000000000..8ee7c9730
--- /dev/null
+++ b/tdestyles/keramik/CMakeLists.txt
@@ -0,0 +1,70 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions(
+ -UQT_NO_ASCII_CAST
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdefx
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### genembed ##################################
+
+set( target genembed )
+
+set( ${target}_SRCS
+ genembed.cpp
+)
+
+tde_add_executable( ${target}
+ SOURCES ${${target}_SRCS}
+ LINK tdefx-shared
+)
+
+
+##### pixmaps.keramik ###########################
+
+file(GLOB _pics "${CMAKE_CURRENT_SOURCE_DIR}/pics/*.png" )
+
+add_custom_command(
+ OUTPUT pixmaps.keramik keramikrc.h
+ COMMAND ./genembed ${_pics} 2>/dev/null > pixmaps.keramik
+ DEPENDS genembed )
+
+
+##### keramik ###################################
+
+set( target keramik )
+
+set( ${target}_SRCS
+ keramik.cpp pixmaploader.cpp gradients.cpp colorutil.cpp
+)
+
+set_source_files_properties( pixmaploader.cpp PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pixmaps.keramik )
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdefx-shared Xext
+ DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
+)
diff --git a/tdestyles/keramik/Makefile.am b/tdestyles/keramik/Makefile.am
new file mode 100644
index 000000000..4f3dbebae
--- /dev/null
+++ b/tdestyles/keramik/Makefile.am
@@ -0,0 +1,90 @@
+AM_CPPFLAGS = -DQT_PLUGIN
+
+INCLUDES = -I$(top_srcdir)/tdefx $(all_includes)
+# qembed's output needs that...
+KDE_CXXFLAGS = -UQT_NO_ASCII_CAST
+noinst_HEADERS = keramik.h pixmaploader.h keramikimage.h bitmaps.h gradients.h colorutil.h
+kde_style_LTLIBRARIES = keramik.la
+keramik_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+keramik_la_LIBADD = ../../tdefx/libtdefx.la $(LIB_QT) $(LIB_XEXT)
+keramik_la_SOURCES = keramik.cpp pixmaploader.cpp gradients.cpp colorutil.cpp
+keramik_la_COMPILE_FIRST = keramikrc.h
+keramik_la_METASOURCES = AUTO
+
+noinst_PROGRAMS = genembed
+
+genembed_SOURCES = genembed.cpp
+genembed_LDADD = ../../tdefx/libtdefx.la
+genembed_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
+
+pixmaps.keramik: pics/checkbox-off.png pics/checkbox-on.png pics/combobox-list-bc.png\
+ pics/combobox-list-bl.png pics/combobox-list-br.png pics/combobox-list-cl.png pics/combobox-list-cr.png\
+ pics/combobox-list-tc.png pics/combobox-list-tl.png pics/combobox-list-tr.png pics/frame-shadow-cl.png\
+ pics/frame-shadow-tc.png pics/frame-shadow-tl.png pics/listview-bc.png pics/listview-bl.png pics/listview-br.png\
+ pics/listview-cc.png pics/listview-cl.png pics/listview-cr.png pics/listview-pressed-bc.png pics/listview-pressed-bl.png\
+ pics/listview-pressed-br.png pics/listview-pressed-cc.png pics/listview-pressed-cl.png pics/listview-pressed-cr.png\
+ pics/listview-pressed-tc.png pics/listview-pressed-tl.png pics/listview-pressed-tr.png pics/listview-tc.png pics/listview-tl.png\
+ pics/listview-tr.png pics/pushbutton-bc.png pics/pushbutton-bl.png pics/pushbutton-br.png pics/pushbutton-cc.png\
+ pics/pushbutton-cl.png pics/pushbutton-cr.png pics/pushbutton-default-bc.png pics/pushbutton-default-bl.png\
+ pics/pushbutton-default-br.png pics/pushbutton-default-cc.png pics/pushbutton-default-cl.png pics/pushbutton-default-cr.png\
+ pics/pushbutton-default-hov-tl.png pics/pushbutton-default-hov-tc.png pics/pushbutton-default-hov-tr.png\
+ pics/pushbutton-default-hov-cl.png pics/pushbutton-default-hov-cc.png pics/pushbutton-default-hov-cr.png\
+ pics/pushbutton-default-hov-bl.png pics/pushbutton-default-hov-bc.png pics/pushbutton-default-hov-br.png\
+ pics/pushbutton-default-pressed-bc.png pics/pushbutton-default-pressed-bl.png pics/pushbutton-default-pressed-br.png\
+ pics/pushbutton-default-pressed-cc.png pics/pushbutton-default-pressed-cl.png pics/pushbutton-default-pressed-cr.png\
+ pics/pushbutton-default-pressed-tc.png pics/pushbutton-default-pressed-tl.png pics/pushbutton-default-pressed-tr.png\
+ pics/pushbutton-default-tc.png pics/pushbutton-default-tl.png pics/pushbutton-default-tr.png \
+ pics/pushbutton-pressed-bc.png pics/pushbutton-pressed-bl.png pics/pushbutton-pressed-br.png pics/pushbutton-pressed-cc.png\
+ pics/pushbutton-pressed-cl.png pics/pushbutton-pressed-cr.png pics/pushbutton-pressed-tc.png pics/pushbutton-pressed-tl.png\
+ pics/pushbutton-pressed-tr.png pics/pushbutton-small-bc.png pics/pushbutton-small-bl.png pics/pushbutton-small-br.png\
+ pics/pushbutton-small-cc.png pics/pushbutton-small-cl.png pics/pushbutton-small-cr.png\
+ pics/pushbutton-small-pressed-bc.png pics/pushbutton-small-pressed-bl.png pics/pushbutton-small-pressed-br.png\
+ pics/pushbutton-small-pressed-cc.png pics/pushbutton-small-pressed-cl.png pics/pushbutton-small-pressed-cr.png\
+ pics/pushbutton-small-pressed-tc.png pics/pushbutton-small-pressed-tl.png pics/pushbutton-small-pressed-tr.png\
+ pics/pushbutton-small-tc.png pics/pushbutton-small-tl.png pics/pushbutton-small-tr.png pics/pushbutton-tc.png\
+ pics/pushbutton-tl.png pics/pushbutton-tr.png pics/radiobutton-off.png pics/radiobutton-on.png pics/ripple.png\
+ pics/scrollbar-hbar-arrow1.png \
+ pics/scrollbar-hbar-arrow2.png pics/scrollbar-hbar-groove1.png pics/scrollbar-hbar-groove2.png\
+ pics/scrollbar-hbar-slider1.png pics/scrollbar-hbar-slider2.png pics/scrollbar-hbar-slider3.png pics/scrollbar-hbar-slider4.png\
+ pics/scrollbar-vbar-arrow1.png\
+ pics/scrollbar-vbar-arrow2.png pics/scrollbar-vbar-groove1.png\
+ pics/scrollbar-vbar-groove2.png pics/scrollbar-vbar-slider1.png pics/scrollbar-vbar-slider2.png\
+ pics/menuitem-cl.png pics/menuitem-cc.png pics/menuitem-cr.png\
+ pics/scrollbar-vbar-slider3.png pics/scrollbar-vbar-slider4.png pics/slider-hgroove-bc.png\
+ pics/slider-hgroove-bl.png pics/slider-hgroove-br.png pics/slider-hgroove-cc.png pics/slider-hgroove-cl.png pics/slider-hgroove-cr.png\
+ pics/slider-hgroove-tc.png pics/slider-hgroove-tl.png pics/slider-hgroove-tr.png pics/slider-vgroove-bc.png pics/slider-vgroove-bl.png\
+ pics/slider-vgroove-br.png pics/slider-vgroove-cc.png pics/slider-vgroove-cl.png pics/slider-vgroove-cr.png pics/slider-vgroove-tc.png\
+ pics/slider-vgroove-tl.png pics/slider-vgroove-tr.png pics/slider.png pics/spinbox-1.png pics/spinbox-2.png pics/spinbox-3.png\
+ pics/spinbox-arrow-down.png pics/spinbox-arrow-up.png pics/spinbox-pressed-arrow-down.png pics/spinbox-pressed-arrow-up.png\
+ pics/progressbar-cc.png pics/progressbar-cl.png pics/progressbar-cr.png\
+ pics/toolbar-clk-bc.png pics/toolbar-clk-bl.png pics/toolbar-clk-br.png\
+ pics/toolbar-clk-cc.png pics/toolbar-clk-cl.png pics/toolbar-clk-cr.png\
+ pics/toolbar-clk-tc.png pics/toolbar-clk-tl.png pics/toolbar-clk-tr.png pics/checkbox-tri.png\
+ pics/spinbox-pressed-down.png pics/spinbox-pressed-up.png \
+ pics/tab-bottom-active-bc.png pics/tab-bottom-active-bl.png\
+ pics/tab-bottom-active-br.png pics/tab-bottom-active-cc.png\
+ pics/tab-bottom-active-cl.png pics/tab-bottom-active-cr.png\
+ pics/tab-bottom-inactive-bc.png pics/tab-bottom-inactive-bl.png\
+ pics/tab-bottom-inactive-br.png pics/tab-bottom-inactive-cc.png\
+ pics/tab-bottom-inactive-cl.png pics/tab-bottom-inactive-cr.png\
+ pics/tab-bottom-inactive-separator.png pics/tab-top-active-cc.png\
+ pics/tab-top-active-cl.png pics/tab-top-active-cr.png\
+ pics/tab-top-active-tc.png pics/tab-top-active-tl.png\
+ pics/tab-top-active-tr.png pics/tab-top-inactive-cc.png\
+ pics/tab-top-inactive-cl.png pics/tab-top-inactive-cr.png\
+ pics/tab-top-inactive-separator.png pics/tab-top-inactive-tc.png\
+ pics/tab-top-inactive-tl.png pics/tab-top-inactive-tr.png pics/vslider.png\
+ pics/pushbutton-hov-tl.png pics/pushbutton-hov-tc.png pics/pushbutton-hov-tr.png\
+ pics/pushbutton-hov-cl.png pics/pushbutton-hov-cc.png pics/pushbutton-hov-cr.png\
+ pics/pushbutton-hov-bl.png pics/pushbutton-hov-bc.png pics/pushbutton-hov-br.png\
+ pics/title-close-tiny.png pics/title-close.png pics/title-iconify.png\
+ pics/title-maximize.png pics/title-restore.png pics/titlebutton-pressed.png\
+ pics/titlebutton.png
+
+
+pixmaps.keramik keramikrc.h: genembed
+ pics=`ls $(srcdir)/pics/*.png 2>/dev/null` ;\
+ ./genembed $$pics > pixmaps.keramik
+
+pixmaploader.lo: pixmaps.keramik
+
diff --git a/tdestyles/keramik/bitmaps.h b/tdestyles/keramik/bitmaps.h
new file mode 100644
index 000000000..54c30dd8d
--- /dev/null
+++ b/tdestyles/keramik/bitmaps.h
@@ -0,0 +1,83 @@
+#ifndef __BITMAPS_H
+#define __BITMAPS_H
+
+/* Image bits processed by KPixmap2Bitmaps */
+// Arrow bitmaps
+static const TQCOORD u_arrow[]={-1,-3, 0,-3, -2,-2, 1,-2, -3,-1, 2,-1, -4,0, 3,0, -4,1, 3,1};
+static const TQCOORD d_arrow[]={-4,-2, 3,-2, -4,-1, 3,-1, -3,0, 2,0, -2,1, 1,1, -1,2, 0,2};
+static const TQCOORD l_arrow[]={-3,-1, -3,0, -2,-2, -2,1, -1,-3, -1,2, 0,-4, 0,3, 1,-4, 1,3};
+static const TQCOORD r_arrow[]={-2,-4, -2,3, -1,-4, -1,3, 0,-3, 0,2, 1,-2, 1,1, 2,-1, 2,0};
+
+static const TQCOORD keramik_combo_arrow[] =
+ {-4,-5, 4, -5,
+ -2 ,-2, 2, -2,
+ -2 ,-1, 2, -1,
+ -2 ,0, 2, 0,
+ -4, 1, 4, 1,
+ -3, 2, 3, 2,
+ -2 , 3, 2, 3,
+ -1 , 4, 1, 4,
+ 0 , 5, 0, 5
+ };
+
+
+static const TQCOORD keramik_up_arrow[] =
+ {
+ 0, -4, 0, -4,
+ -1, -3, 1, -3,
+ -2, -2, 2, -2,
+ -3, -1, 3, -1,
+ -4, 0, 4, 0,
+ -2, 1, 2, 1,
+ -2, 2, 2, 2,
+ -2, 3, 2, 3,
+ -2, 4, 2, 4
+ };
+
+static const TQCOORD keramik_down_arrow[] =
+ {
+ 0, 4, 0, 4,
+ -1, 3, 1, 3,
+ -2, 2, 2, 2,
+ -3, 1, 3, 1,
+ -4, 0, 4, 0,
+ -2, -1, 2, -1,
+ -2, -2, 2, -2,
+ -2, -3, 2, -3,
+ -2, -4, 2, -4
+ };
+
+
+ static const TQCOORD keramik_right_arrow[] =
+ {
+ 4, 0, 4, 0,
+ 3, -1, 3, 1,
+ 2, -2, 2, 2,
+ 1, -3, 1, 3,
+ 0, -4, 0, 4,
+ -1, -2, -1, 2,
+ -2, -2, -2, 2,
+ -3, -2, -3, 2,
+ -4, -2, -4, 2
+ };
+
+ static const TQCOORD keramik_left_arrow[] =
+ {
+ -4, 0, -4, 0,
+ -3, -1, -3, 1,
+ -2, -2, -2, 2,
+ -1, -3, -1, 3,
+ 0, -4, 0, 4,
+ 1, -2, 1, 2,
+ 2, -2, 2, 2,
+ 3, -2, 3, 2,
+ 4, -2, 4, 2
+ };
+
+
+
+#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2)
+
+
+
+#endif
diff --git a/tdestyles/keramik/colorutil.cpp b/tdestyles/keramik/colorutil.cpp
new file mode 100644
index 000000000..81d5eeb7a
--- /dev/null
+++ b/tdestyles/keramik/colorutil.cpp
@@ -0,0 +1,65 @@
+/* Keramik Style for KDE3, color utility routines..
+ Copyright (c) 2002 Malte Starostik <malte@kde.org>
+ (c) 2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+// $Id$
+
+#include <tqcolor.h>
+
+#include "colorutil.h"
+
+namespace Keramik
+{
+ TQColor ColorUtil::lighten(TQColor in, int factor)
+ {
+ if (factor > 100)
+ {
+ int h, s, v;
+ in.hsv(&h, &s, &v);
+
+ float mShare = v/230.0;
+ if (mShare > 1) mShare = 1;
+
+ mShare *= mShare;
+
+ int diff = factor - 100;
+ int hd = int(mShare*diff);
+ int delta = int((diff - hd)*7.55);
+
+ TQColor wrk = in.light(100+hd);
+
+ int r = wrk.red();
+ int g = wrk.green();
+ int b = wrk.blue();
+
+ r+=delta;
+ g+=delta;
+ b+=delta;
+
+ if (r>255) r=255;
+ if (g>255) g=255;
+ if (b>255) b=255;
+
+ return TQColor(r,g,b);
+ }
+
+ return in;
+ }
+}
+
+// vim: ts=4 sw=4 noet
diff --git a/tdestyles/keramik/colorutil.h b/tdestyles/keramik/colorutil.h
new file mode 100644
index 000000000..7bffe75f1
--- /dev/null
+++ b/tdestyles/keramik/colorutil.h
@@ -0,0 +1,37 @@
+/* Keramik Style for KDE3, color utility routines...
+ Copyright (c) 2002 Malte Starostik <malte@kde.org>
+ (c) 2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+// $Id$
+
+#ifndef KERAMIK_COLORUTIL_H
+#define KERAMIK_COLORUTIL_H
+
+class TQPainter;
+
+
+namespace Keramik
+{
+ class ColorUtil
+ {
+ public:
+ static TQColor lighten(TQColor in, int factor);
+ };
+}
+
+#endif
diff --git a/tdestyles/keramik/genembed.cpp b/tdestyles/keramik/genembed.cpp
new file mode 100644
index 000000000..18608205d
--- /dev/null
+++ b/tdestyles/keramik/genembed.cpp
@@ -0,0 +1,387 @@
+/**
+A small utility to generate embedded images for Keramik, especially structured for easy recoloring...
+
+Copyright (c) 2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include <tqfileinfo.h>
+#include <tqimage.h>
+#include <tqmap.h>
+#include <tqregexp.h>
+#include <tqtextstream.h>
+#include <tqvaluevector.h>
+
+#include <kimageeffect.h>
+
+#include <iostream>
+using namespace std;
+
+#include <string.h>
+#include <math.h>
+
+//NOTE: Use of old-style header is intentional for portability. See revisions 1.6 and 1.7
+
+//Force-touch-embedded-revision: 2
+
+#include "keramikimage.h"
+
+/**
+Need to generate something like this:
+TargetColorAlpha, GreyAdd, SrcAlpha;
+
+so that one can do (R*T+GreyAdd, G*T+GreyAdd, B*T+GreyAdd, SrcAlpha) as pixel values
+*/
+
+
+int evalSuffix(TQString suffix)
+{
+ if (suffix == "-tl")
+ return 0;
+
+ if (suffix == "-tc")
+ return 1;
+
+ if (suffix == "-tr")
+ return 2;
+
+ if (suffix == "-cl")
+ return 3;
+
+ if (suffix == "-cc")
+ return 4;
+
+ if (suffix == "-cr")
+ return 5;
+
+ if (suffix == "-bl")
+ return 6;
+
+ if (suffix == "-bc")
+ return 7;
+
+ if (suffix == "-br")
+ return 8;
+
+ if (suffix == "-separator")
+ return KeramikTileSeparator;
+
+ if (suffix == "-slider1")
+ return KeramikSlider1;
+
+ if (suffix == "-slider2")
+ return KeramikSlider2;
+
+ if (suffix == "-slider3")
+ return KeramikSlider3;
+
+ if (suffix == "-slider4")
+ return KeramikSlider4;
+
+ if (suffix == "-groove1")
+ return KeramikGroove1;
+
+ if (suffix == "-groove2")
+ return KeramikGroove2;
+
+ if (suffix == "-1")
+ return 1;
+
+ if (suffix == "-2")
+ return 2;
+
+ if (suffix == "-3")
+ return 3;
+
+ return -1;
+}
+
+
+int main(int argc, char** argv)
+{
+ if (argc < 2)
+ return 0;
+
+ TQValueVector<KeramikEmbedImage> images;
+
+ cout<<"#include <tqintdict.h>\n\n";
+ cout<<"#include \"keramikimage.h\"\n\n";
+
+ TQMap<TQString, int> assignID;
+ int nextID = 0;
+
+ for (int c = 1; c<argc; c++)
+ {
+
+ TQImage input(argv[c]);
+
+
+ TQFileInfo fi(argv[c]);
+ TQString s = fi.baseName();
+
+ KeramikEmbedImage image;
+
+ int pos;
+
+ TQString id = s;
+
+ int readJustID = 0;
+
+
+ if ((pos = s.findRev("-")) != -1)
+ {
+ int suffix = evalSuffix(s.mid(pos));
+ if (suffix !=-1 )
+ {
+ id = s.mid(0,pos);
+ readJustID = suffix;
+ }
+ }
+
+ if (!assignID.contains(id))
+ {
+ assignID[id] = nextID;
+ nextID += 256;
+ }
+
+ s.replace("-","_");
+
+
+ if (s.contains("button"))
+ KImageEffect::contrastHSV(input);
+
+ int fullID = assignID[id] + readJustID;//Subwidget..
+
+ bool highlights = true;
+ bool shadows = true;
+
+ float gamma = 1.0;
+ int brightAdj = 0;
+
+
+
+ if (s.contains("toolbar") || s.contains("tab-top-active") || s.contains("menubar") )
+ {
+// highlights = false;
+ gamma = 1/1.25f;
+ //brightAdj = 10;
+ shadows = false;
+ }
+
+ if (s.contains("scrollbar") && s.contains("groove"))
+ {
+ //highlights = false;
+ //gamma = 1.5;
+ shadows = false;
+ }
+ //brightAdj = -10;
+
+ if (s.contains("scrollbar") && s.contains("slider"))
+ {
+ //highlights = false;
+ gamma =1/0.7f;
+ //shadows = false;
+ }
+
+
+ if (s.contains("menuitem"))
+ {
+ //highlights = false;
+ gamma =1/0.6f;
+ //shadows = false;
+ }
+
+ image.width = input.width();
+ image.height = input.height();
+ image.id = fullID;
+ image.data = reinterpret_cast<unsigned char*>(strdup(s.latin1()));
+
+
+ bool reallySolid = true;
+
+ int pixCount = 0;
+ int pixSolid = 0;
+
+ cout<<"static const unsigned char "<<s.latin1()<<"[]={\n";
+
+ TQ_UINT32* read = reinterpret_cast< TQ_UINT32* >(input.bits() );
+ int size = input.width()*input.height();
+
+ for (int pos=0; pos<size; pos++)
+ {
+ QRgb basePix = (QRgb)*read;
+
+ if (tqAlpha(basePix) != 255)
+ reallySolid = false;
+ else
+ pixSolid++;
+
+ pixCount++;
+ read++;
+ }
+
+ image.haveAlpha = !reallySolid;
+
+ images.push_back(image);
+
+ read = reinterpret_cast< TQ_UINT32* >(input.bits() );
+ for (int pos=0; pos<size; pos++)
+ {
+ QRgb basePix = (QRgb)*read;
+ //cout<<(r*destAlpha.alphas[pos])<<"\n";
+ //cout<<(int)destAlpha.alphas[pos]<<"\n";
+ TQColor clr(basePix);
+ int h,s,v;
+ clr.hsv(&h,&s,&v);
+
+ v=tqGray(basePix);
+
+ int targetColorAlpha = 0 , greyAdd = 0;
+ //int srcAlpha = tqAlpha(basePix);
+
+ if (s>0 || v > 128)
+ { //Non-shadow
+ float fv = v/255.0;
+ fv = pow(fv, gamma);
+ v = int(255.5*fv);
+
+
+ if (s<17 && highlights) //A bit of a highligt..
+ {
+ float effectPortion = (16 - s)/15.0;
+
+ greyAdd = (int)(v/4.0 * effectPortion*1.2);
+ targetColorAlpha = v - greyAdd;
+ }
+ else
+ {
+ targetColorAlpha = v;//(int)(fv*255);
+ greyAdd = 0;
+ }
+ }
+ else
+ {
+ if (shadows)
+ {
+ targetColorAlpha = 0;
+ greyAdd = v;
+ }
+ else
+ {
+ targetColorAlpha = v;//(int)(fv*255);
+ greyAdd = 0;
+ }
+ }
+
+ greyAdd+=brightAdj;
+
+ if (reallySolid)
+ cout<<targetColorAlpha<<","<<greyAdd<<",";
+ else
+ cout<<targetColorAlpha<<","<<greyAdd<<","<<tqAlpha(basePix)<<",";
+ //cout<<tqRed(basePix)<<","<<tqGreen(basePix)<<","<<tqBlue(basePix)<<","<<tqAlpha(basePix)<<",";
+
+ if (pos%8 == 7)
+ cout<<"\n";
+
+ read++;
+ }
+
+ cerr<<s.latin1()<<":"<<pixSolid<<"/"<<pixCount<<"("<<reallySolid<<")\n";
+
+ cout<<!reallySolid<<"\n";
+
+ cout<<"};\n\n";
+ }
+
+ cout<<"static const KeramikEmbedImage image_db[] = {\n";
+
+ for (unsigned int c=0; c<images.size(); c++)
+ {
+ cout<<"\t{ "<<(images[c].haveAlpha?"true":"false")<<","<<images[c].width<<", "<<images[c].height<<", "<<images[c].id<<", "<<(char *)images[c].data<<"},";
+ cout<<"\n";
+ }
+ cout<<"\t{0, 0, 0, 0, 0}\n";
+ cout<<"};\n\n";
+
+ cout<<"class KeramikImageDb\n";
+ cout<<"{\n";
+ cout<<"public:\n";
+ cout<<"\tstatic KeramikImageDb* getInstance()\n";
+ cout<<"\t{\n";
+ cout<<"\t\tif (!instance) instance = new KeramikImageDb;\n";
+ cout<<"\t\treturn instance;\n";
+ cout<<"\t}\n\n";
+ cout<<"\tstatic void release()\n";
+ cout<<"\t{\n";
+ cout<<"\t\tdelete instance;\n";
+ cout<<"\t\tinstance=0;\n";
+ cout<<"\t}\n\n";
+ cout<<"\tKeramikEmbedImage* getImage(int id)\n";
+ cout<<"\t{\n";
+ cout<<"\t\treturn images[id];\n";
+ cout<<"\t}\n\n";
+ cout<<"private:\n";
+ cout<<"\tKeramikImageDb():images(503)\n";
+ cout<<"\t{\n";
+ cout<<"\t\tfor (int c=0; image_db[c].width; c++)\n";
+ cout<<"\t\t\timages.insert(image_db[c].id, &image_db[c]);\n";
+ cout<<"\t}\n";
+ cout<<"\tstatic KeramikImageDb* instance;\n";
+ cout<<"\tTQIntDict<KeramikEmbedImage> images;\n";
+ cout<<"};\n\n";
+ cout<<"KeramikImageDb* KeramikImageDb::instance = 0;\n\n";
+
+ cout<<"KeramikEmbedImage* KeramikGetDbImage(int id)\n";
+ cout<<"{\n";
+ cout<<"\treturn KeramikImageDb::getInstance()->getImage(id);\n";
+ cout<<"}\n\n";
+
+ cout<<"void KeramikDbCleanup()\n";
+ cout<<"{\n";
+ cout<<"\t\tKeramikImageDb::release();\n";
+ cout<<"}\n";
+
+
+
+
+ TQFile file("keramikrc.h");
+ file.open(IO_WriteOnly);
+ TQTextStream ts( &file);
+ ts<<"#ifndef KERAMIK_RC_H\n";
+ ts<<"#define KERAMIK_RC_H\n";
+
+ ts<<"enum KeramikWidget {\n";
+ for (TQMap<TQString, int>::iterator i = assignID.begin(); i != assignID.end(); ++i)
+ {
+ TQString name = "keramik_"+i.key();
+ name.replace("-","_");
+ ts<<"\t"<<name<<" = "<<i.data()<<",\n";
+ }
+ ts<<"\tkeramik_last\n";
+ ts<<"};\n";
+
+ ts<<"#endif\n";
+
+ return 0;
+}
+
+// vim: ts=4 sw=4 noet
diff --git a/tdestyles/keramik/gradients.cpp b/tdestyles/keramik/gradients.cpp
new file mode 100644
index 000000000..ab804d117
--- /dev/null
+++ b/tdestyles/keramik/gradients.cpp
@@ -0,0 +1,179 @@
+/* Keramik Style for KDE3, gradient routines..
+ Copyright (c) 2002 Malte Starostik <malte@kde.org>
+ (c) 2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+// $Id$
+
+#include <tqpainter.h>
+#include <tqrect.h>
+#include <tqcolor.h>
+
+#include "gradients.h"
+#include "colorutil.h"
+
+#include <tqimage.h>
+#include <tqintcache.h>
+#include <kimageeffect.h>
+
+namespace
+{
+ struct GradientCacheEntry
+ {
+ TQPixmap* m_pixmap;
+ QRgb m_color;
+ bool m_menu;
+ int m_width;
+ int m_height;
+
+ GradientCacheEntry(int width, int height, const TQColor& color, bool menu):
+ m_pixmap(0), m_color(color.rgb()), m_menu(menu), m_width(width), m_height(height)
+ {}
+
+ int key()
+ {
+ return (int)m_menu ^ m_width ^ (m_height << 16) ^ ((m_color)<<8);
+ }
+
+ bool operator == (const GradientCacheEntry& other)
+ {
+ return ((m_width == other.m_width) &&
+ (m_height == other.m_height) &&
+ (m_menu == other.m_menu) &&
+ (m_color == other.m_color));
+ }
+
+ ~GradientCacheEntry()
+ {
+ delete m_pixmap;
+ }
+
+ };
+
+
+ TQIntCache<GradientCacheEntry> cache(65636, 17);
+
+}
+
+using namespace Keramik;
+
+void GradientPainter::releaseCache()
+{
+ cache.clear();
+}
+
+void GradientPainter::renderGradient( TQPainter* p, const TQRect& r, TQColor c,
+ bool horizontal, bool menu, int px, int py,
+ int pwidth, int pheight)
+{
+ int width = r.width(), height = r.height();
+ if (pwidth != -1) width = pwidth;
+ if (pheight != -1) height = pheight;
+
+ if (horizontal)
+ width = 18;
+ else
+ height = 18;
+
+ GradientCacheEntry entry (width, height, c, menu);
+ GradientCacheEntry* cacheEntry = 0;
+
+ cache.setAutoDelete(true);
+
+ int key = entry.key();
+
+ if ((cacheEntry = cache.find(key, false)))
+ {
+ if (entry == *cacheEntry)
+ {
+ p->drawTiledPixmap(r, *cacheEntry->m_pixmap, horizontal? TQPoint(0,py): TQPoint(px,0));
+ return;
+ }
+ else
+ cache.remove(key);
+ //Remove old entry in case of conflicts.. otherwise we end up w/unreachable items in cache
+ }
+
+
+ if (horizontal)
+ {
+ TQPixmap* pix = new TQPixmap(18, height);
+
+ if (menu)
+ {
+ TQImage gr = KImageEffect::gradient(TQSize(4,height), c.light(93), ColorUtil::lighten(c,109), KImageEffect::VerticalGradient );
+ TQPixmap grT(gr);
+ TQPainter p2(pix);
+ p2.drawTiledPixmap(0,0, 18, height, grT);
+ p2.end();
+ }
+ else
+ {
+ int h1 = 3 * height/4;
+ int h2 = height - h1;
+
+ TQImage top = KImageEffect::gradient(TQSize(4,h1), ColorUtil::lighten(c,110), c.light(94), KImageEffect::VerticalGradient );
+ TQImage bot = KImageEffect::gradient(TQSize(4,h2), c.light(94), ColorUtil::lighten(c,109), KImageEffect::VerticalGradient );
+
+ TQPixmap topT(top);
+ TQPixmap botT(bot);
+
+ TQPainter p2(pix);
+ p2.drawTiledPixmap(0, 0, 18, h1, topT);
+ p2.drawTiledPixmap(0, h1, 18, h2, botT);
+ p2.end();
+ }
+
+ entry.m_pixmap = pix;
+ }
+ else
+ {
+ TQPixmap* pix = new TQPixmap(width, 18);
+
+ int h1 = 3 * width/4;
+ int h2 = width - h1;
+
+ TQImage top = KImageEffect::gradient(TQSize(h1,4), ColorUtil::lighten(c,110), c.light(94), KImageEffect::HorizontalGradient );
+ TQImage bot = KImageEffect::gradient(TQSize(h2,4), c.light(94), ColorUtil::lighten(c,109), KImageEffect::HorizontalGradient );
+
+ TQPixmap topT(top);
+ TQPixmap botT(bot);
+
+ TQPainter p2(pix);
+ p2.drawTiledPixmap(0, 0, h1, 18, topT);
+ p2.drawTiledPixmap(h1, 0, h2, 18, botT);
+ p2.end();
+
+ entry.m_pixmap = pix;
+
+ }
+
+ bool cacheOK = false;
+ GradientCacheEntry* imgToAdd = new GradientCacheEntry(entry);
+ cacheOK = cache.insert(imgToAdd->key(), imgToAdd,
+ imgToAdd->m_pixmap->width() * imgToAdd->m_pixmap->height()*
+ imgToAdd->m_pixmap->depth()/8);
+
+ p->drawTiledPixmap(r, *imgToAdd->m_pixmap, horizontal? TQPoint(0,py): TQPoint(px,0));
+
+ if (!cacheOK)
+ delete imgToAdd;
+
+ entry.m_pixmap = 0;//Don't free too early..
+}
+
+// vim: ts=4 sw=4 noet
diff --git a/tdestyles/keramik/gradients.h b/tdestyles/keramik/gradients.h
new file mode 100644
index 000000000..8a9a17425
--- /dev/null
+++ b/tdestyles/keramik/gradients.h
@@ -0,0 +1,41 @@
+/* Keramik Style for KDE3, gradient routines..
+ Copyright (c) 2002 Malte Starostik <malte@kde.org>
+ (c) 2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+// $Id$
+
+#ifndef KERAMIK_GRADIENTS_H
+#define KERAMIK_GRADIENTS_H
+
+class TQPainter;
+
+
+namespace Keramik
+{
+ class GradientPainter
+ {
+ public:
+ static void renderGradient( TQPainter* p, const TQRect& r, TQColor cr,
+ bool horizontal, bool menu = false,
+ int px = 0, int py = 0, int pwidth = -1, int pheight = -1 );
+
+ static void releaseCache();
+ };
+}
+
+#endif
diff --git a/tdestyles/keramik/keramik.cpp b/tdestyles/keramik/keramik.cpp
new file mode 100644
index 000000000..fa1848203
--- /dev/null
+++ b/tdestyles/keramik/keramik.cpp
@@ -0,0 +1,3004 @@
+/* Keramik Style for KDE3
+ Copyright (c) 2002 Malte Starostik <malte@kde.org>
+ (c) 2002,2003 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+ based on the KDE3 HighColor Style
+
+ Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ (C) 2001-2002 Fredrik H�glund <fredrik@kde.org>
+
+ Drawing routines adapted from the KDE2 HCStyle,
+ Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ (C) 2000 Dirk Mueller <mueller@kde.org>
+ (C) 2001 Martijn Klingens <klingens@kde.org>
+
+ Progressbar code based on TDEStyle, Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>,
+ Improvements to progressbar animation from Plastik, Copyright (C) 2003 Sandro Giessl <sandro@giessl.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+
+// $Id$
+
+#include <tqapplication.h>
+#include <tqbitmap.h>
+#include <tqcheckbox.h>
+#include <tqcombobox.h>
+#include <tqdrawutil.h>
+#include <tqframe.h>
+#include <tqheader.h>
+#include <tqintdict.h>
+#include <tqlineedit.h>
+#include <tqlistbox.h>
+#include <tqmenubar.h>
+#include <tqpainter.h>
+#include <tqpointarray.h>
+#include <tqprogressbar.h>
+#include <tqpushbutton.h>
+#include <tqsettings.h>
+#include <tqslider.h>
+#include <tqstyleplugin.h>
+#include <tqtabbar.h>
+#include <tqtimer.h>
+#include <tqtoolbar.h>
+#include <tqtoolbutton.h>
+
+#include <kpixmap.h>
+#include <kpixmapeffect.h>
+
+#include "keramik.moc"
+
+#include "gradients.h"
+#include "colorutil.h"
+#include "keramikrc.h"
+#include "keramikimage.h"
+
+#include "bitmaps.h"
+#include "pixmaploader.h"
+
+#define loader Keramik::PixmapLoader::the()
+
+// -- Style Plugin Interface -------------------------
+class KeramikStylePlugin : public TQStylePlugin
+{
+public:
+ KeramikStylePlugin() {}
+ ~KeramikStylePlugin() {}
+
+ TQStringList keys() const
+ {
+ if (TQPixmap::defaultDepth() > 8)
+ return TQStringList() << "Keramik";
+ else
+ return TQStringList();
+ }
+
+ TQStyle* create( const TQString& key )
+ {
+ if ( key == "keramik" ) return new KeramikStyle();
+ return 0;
+ }
+};
+
+KDE_Q_EXPORT_PLUGIN( KeramikStylePlugin )
+// ---------------------------------------------------
+
+
+// ### Remove globals
+/*
+TQBitmap lightBmp;
+TQBitmap grayBmp;
+TQBitmap dgrayBmp;
+TQBitmap centerBmp;
+TQBitmap maskBmp;
+TQBitmap xBmp;
+*/
+namespace
+{
+ const int itemFrame = 2;
+ const int itemHMargin = 6;
+ const int itemVMargin = 0;
+ const int arrowHMargin = 6;
+ const int rightBorder = 12;
+ const char* kdeToolbarWidget = "kde toolbar widget";
+
+ const int smallButMaxW = 27;
+ const int smallButMaxH = 20;
+ const int titleBarH = 22;
+}
+// ---------------------------------------------------------------------------
+
+namespace
+{
+ void drawKeramikArrow(TQPainter* p, TQColorGroup cg, TQRect r, TQStyle::TQ_PrimitiveElement pe, bool down, bool enabled)
+ {
+ TQPointArray a;
+
+ switch(pe)
+ {
+ case TQStyle::PE_ArrowUp:
+ a.setPoints(TQCOORDARRLEN(keramik_up_arrow), keramik_up_arrow);
+ break;
+
+ case TQStyle::PE_ArrowDown:
+ a.setPoints(TQCOORDARRLEN(keramik_down_arrow), keramik_down_arrow);
+ break;
+
+ case TQStyle::PE_ArrowLeft:
+ a.setPoints(TQCOORDARRLEN(keramik_left_arrow), keramik_left_arrow);
+ break;
+
+ default:
+ a.setPoints(TQCOORDARRLEN(keramik_right_arrow), keramik_right_arrow);
+ }
+
+ p->save();
+ /*if ( down )
+ p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
+ pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
+ */
+
+ if ( enabled ) {
+ //CHECKME: Why is the -1 needed?
+ a.translate( r.x() + r.width() / 2 - 1, r.y() + r.height() / 2 );
+
+ if (!down)
+ p->setPen( cg.buttonText() );
+ else
+ p->setPen ( cg.button() );
+ p->drawLineSegments( a );
+ } else {
+ a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 + 1 );
+ p->setPen( cg.light() );
+ p->drawLineSegments( a );
+ a.translate( -1, -1 );
+ p->setPen( cg.mid() );
+ p->drawLineSegments( a );
+ }
+ p->restore();
+ }
+}
+
+// XXX
+/* reimp. */
+void KeramikStyle::renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg,
+ const TQPopupMenu* /* popup */ ) const
+{
+ TQColor col = cg.button();
+
+#ifdef Q_WS_X11 // Only draw menu gradients on TrueColor, X11 visuals
+ if ( TQPaintDevice::x11AppDepth() >= 24 )
+ KPixmapEffect::gradient( pix, col.light(120), col.dark(115),
+ KPixmapEffect::HorizontalGradient );
+ else
+#endif
+ pix.fill( col );
+}
+
+// XXX
+TQRect KeramikStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ // We want the focus rect for buttons to be adjusted from
+ // the Qt3 defaults to be similar to Qt 2's defaults.
+ // -------------------------------------------------------------------
+ switch ( r )
+ {
+ case SR_PushButtonFocusRect:
+ {
+ TQRect wrect(ceData.rect);
+
+ if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault))
+ {
+ return TQRect(wrect.x() + 6, wrect.y() + 5, wrect.width() - 12, wrect.height() - 10);
+ }
+ else
+ {
+ return TQRect(wrect.x() + 3, wrect.y() + 5, wrect.width() - 8, wrect.height() - 10);
+ }
+
+ break;
+ }
+
+ case SR_ComboBoxFocusRect:
+ {
+ return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget );
+ }
+
+ case SR_CheckBoxFocusRect:
+ {
+ //Only checkbox, no label
+ if (ceData.text.isEmpty() && (ceData.fgPixmap.isNull()) )
+ {
+ TQRect bounding = ceData.rect;
+ TQSize checkDim = loader.size( keramik_checkbox_on);
+ int cw = checkDim.width();
+ int ch = checkDim.height();
+
+ TQRect checkbox(bounding.x() + 1, bounding.y() + 1 + (bounding.height() - ch)/2,
+ cw - 3, ch - 4);
+
+ return checkbox;
+ }
+
+ //Fallthrough intentional
+ }
+
+ default:
+ return TDEStyle::subRect( r, ceData, elementFlags, widget );
+ }
+}
+
+
+TQPixmap KeramikStyle::stylePixmap(StylePixmap stylepixmap,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption& opt,
+ const TQWidget* widget) const
+{
+ switch (stylepixmap) {
+ case SP_TitleBarMinButton:
+ return Keramik::PixmapLoader::the().pixmap(keramik_title_iconify,
+ Qt::black, Qt::black, false, false);
+ //return qpixmap_from_bits( iconify_bits, "title-iconify.png" );
+ case SP_TitleBarMaxButton:
+ return Keramik::PixmapLoader::the().pixmap(keramik_title_maximize,
+ Qt::black, Qt::black, false, false);
+ case SP_TitleBarCloseButton:
+ if (widget && widget->inherits("KDockWidgetHeader"))
+ return Keramik::PixmapLoader::the().pixmap(keramik_title_close_tiny,
+ Qt::black, Qt::black, false, false);
+ else return Keramik::PixmapLoader::the().pixmap(keramik_title_close,
+ Qt::black, Qt::black, false, false);
+ case SP_TitleBarNormalButton:
+ return Keramik::PixmapLoader::the().pixmap(keramik_title_restore,
+ Qt::black, Qt::black, false, false);
+ default:
+ break;
+ }
+
+ return TDEStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget);
+}
+
+
+
+
+KeramikStyle::KeramikStyle()
+ :TDEStyle( AllowMenuTransparency | FilledFrameWorkaround, ThreeButtonScrollBar ),
+ maskMode(false), formMode(false),
+ toolbarBlendWidget(0), titleBarMode(None), flatMode(false), customScrollMode(false), kickerMode(false)
+{
+ forceSmallMode = false;
+
+ TQSettings settings;
+
+ highlightScrollBar = settings.readBoolEntry("/keramik/Settings/highlightScrollBar", true);
+ animateProgressBar = settings.readBoolEntry("/keramik/Settings/animateProgressBar", false);
+
+ if (animateProgressBar)
+ {
+ animationTimer = new TQTimer( this );
+ connect( animationTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateProgressPos()) );
+ }
+
+ firstComboPopupRelease = false;
+}
+
+void KeramikStyle::updateProgressPos()
+{
+ //Update the registered progressbars.
+ TQMap<TQProgressBar*, int>::iterator iter;
+ bool visible = false;
+ for (iter = progAnimWidgets.begin(); iter != progAnimWidgets.end(); ++iter)
+ {
+ TQProgressBar* pbar = iter.key();
+ if (pbar->isVisible() && pbar->isEnabled() &&
+ pbar->progress() != pbar->totalSteps())
+ {
+ ++iter.data();
+ if (iter.data() == 28)
+ iter.data() = 0;
+ iter.key()->update();
+ }
+ if (iter.key()->isVisible())
+ visible = true;
+
+ }
+ if (!visible)
+ animationTimer->stop();
+}
+
+KeramikStyle::~KeramikStyle()
+{
+ Keramik::PixmapLoader::release();
+ Keramik::GradientPainter::releaseCache();
+ KeramikDbCleanup();
+}
+
+void KeramikStyle::applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
+ TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
+ if (!qstrcmp(app->argv()[0], "kicker")) {
+ kickerMode = true;
+ }
+ }
+}
+
+void KeramikStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ // Put in order of highest occurrence to maximise hit rate
+ if ( widget->inherits( TQPUSHBUTTON_OBJECT_NAME_STRING ) || widget->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) || widget->inherits(TQTOOLBUTTON_OBJECT_NAME_STRING) )
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ if ( widget->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) )
+ widget->setBackgroundMode( NoBackground );
+ }
+ else if ( widget->inherits( TQMENUBAR_OBJECT_NAME_STRING ) || widget->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ) )
+ widget->setBackgroundMode( NoBackground );
+
+ else if ( widget->parentWidget() &&
+ ( ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) && widget->parentWidget()->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) ||
+ widget->inherits( "TDECompletionBox" ) ) ) {
+ TQListBox* listbox = (TQListBox*) widget;
+ listbox->setLineWidth( 4 );
+ listbox->setBackgroundMode( NoBackground );
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ } else if (widget->inherits("QToolBarExtensionWidget")) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ //widget->setBackgroundMode( NoBackground );
+ }
+ else if ( !qstrcmp( widget->name(), kdeToolbarWidget ) ) {
+ widget->setBackgroundMode( NoBackground );
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+
+ if (animateProgressBar && ::tqqt_cast<TQProgressBar*>(widget))
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ progAnimWidgets[static_cast<TQProgressBar*>(widget)] = 0;
+ connect(widget, TQT_SIGNAL(destroyed(TQObject*)), this, TQT_SLOT(progressBarDestroyed(TQObject*)));
+ if (!animationTimer->isActive())
+ animationTimer->start( 50, false );
+ }
+ }
+
+ TDEStyle::polish(ceData, elementFlags, ptr);
+}
+
+void KeramikStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ //### TODO: This needs major cleanup (and so does polish() )
+ if ( widget->inherits( TQPUSHBUTTON_OBJECT_NAME_STRING ) || widget->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) )
+ {
+ if ( widget->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) )
+ widget->setBackgroundMode( PaletteButton );
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if ( widget->inherits( TQMENUBAR_OBJECT_NAME_STRING ) || widget->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ) )
+ widget->setBackgroundMode( PaletteBackground );
+
+ else if ( widget->parentWidget() &&
+ ( ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) && widget->parentWidget()->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) ||
+ widget->inherits( "TDECompletionBox" ) ) ) {
+ TQListBox* listbox = (TQListBox*) widget;
+ listbox->setLineWidth( 1 );
+ listbox->setBackgroundMode( PaletteBackground );
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ widget->clearMask();
+ } else if (widget->inherits("QToolBarExtensionWidget")) {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if ( !qstrcmp( widget->name(), kdeToolbarWidget ) ) {
+ widget->setBackgroundMode( PaletteBackground );
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if ( ::tqqt_cast<TQProgressBar*>(widget) )
+ {
+ progAnimWidgets.remove(static_cast<TQProgressBar*>(widget));
+ }
+ }
+
+ TDEStyle::unPolish(ceData, elementFlags, ptr);
+}
+
+void KeramikStyle::progressBarDestroyed(TQObject* obj)
+{
+ progAnimWidgets.remove(static_cast<TQProgressBar*>(TQT_TQWIDGET(obj)));
+}
+
+
+void KeramikStyle::polish( TQPalette& )
+{
+ loader.clear();
+}
+
+/**
+ Draws gradient background for toolbar buttons, handles and spacers
+*/
+static void renderToolbarEntryBackground(TQPainter* paint,
+ const TQToolBar* parent, TQRect r, const TQColorGroup& cg, bool horiz)
+{
+ int toolWidth, toolHeight;
+
+ //Do we have a parent toolbar to use?
+ if (parent)
+ {
+ //Calculate the toolbar geometry.
+ //The initial guess is the size of the parent widget
+ toolWidth = parent->width();
+ toolHeight = parent->height();
+
+ //If we're floating, however, wee need to fiddle
+ //with height to skip the titlebar
+ if (parent->place() == TQDockWindow::OutsideDock)
+ {
+ toolHeight = toolHeight - titleBarH - 2*parent->frameWidth() + 2;
+ //2 at the end = the 2 pixels of border of a "regular"
+ //toolbar we normally paint over.
+ }
+ }
+ else
+ {
+ //No info, make a guess.
+ //We take the advantage of the fact that the non-major
+ //sizing direction parameter is ignored
+ toolWidth = r.width () + 2;
+ toolHeight = r.height() + 2;
+ }
+
+ //Calculate where inside the toolbar we're
+ int xoff = 0, yoff = 0;
+ if (horiz)
+ yoff = (toolHeight - r.height())/2;
+ else
+ xoff = (toolWidth - r.width())/2;
+
+ Keramik::GradientPainter::renderGradient( paint, r, cg.button(),
+ horiz, false /*Not a menubar*/,
+ xoff, yoff,
+ toolWidth, toolHeight);
+}
+
+static void renderToolbarWidgetBackground(TQPainter* painter, const TQStyleControlElementData &ceData, const TQStyle::ControlElementFlags elementFlags, const TQWidget* widget)
+{
+ // Draw a gradient background for custom widgets in the toolbar
+ // that have specified a "kde toolbar widget" name, or
+ // are caught as toolbar widgets otherwise
+
+ // Find the top-level toolbar of this widget, since it may be nested in other
+ // widgets that are on the toolbar.
+ TQWidget *parent = (widget)?TQT_TQWIDGET(widget->parentWidget()):(TQWidget*)NULL;
+ int x_offset = ceData.rect.x(), y_offset = ceData.rect.y();
+ while (parent && parent->parent() && !qstrcmp( parent->name(), kdeToolbarWidget ) )
+ {
+ x_offset += parent->x();
+ y_offset += parent->y();
+ parent = TQT_TQWIDGET(parent->parent());
+ }
+
+ TQRect pr = ceData.parentWidgetData.rect;
+ bool horiz_grad = pr.width() > pr.height();
+
+ int toolHeight = ceData.parentWidgetData.rect.height();
+ int toolWidth = ceData.parentWidgetData.rect.width ();
+
+ // Check if the parent is a QToolbar, and use its orientation, else guess.
+ //Also, get the height to use in the gradient from it.
+ TQToolBar* tb = dynamic_cast<TQToolBar*>(parent);
+ if (tb)
+ {
+ horiz_grad = ceData.orientation == TQt::Horizontal;
+
+ //If floating, we need to skip the titlebar.
+ if (tb->place() == TQDockWindow::OutsideDock)
+ {
+ toolHeight = tb->height() - titleBarH - 2*tb->frameWidth() + 2;
+ //Calculate offset here by looking at the bottom edge difference, and height.
+ //First, calculate by how much the widget needs to be extended to touch
+ //the bottom edge, minus the frame (except we use the current y_offset
+ // to map to parent coordinates)
+ int needToTouchBottom = tb->height() - tb->frameWidth() -
+ (ceData.rect.bottom() + y_offset);
+
+ //Now, with that, we can see which portion to skip in the full-height
+ //gradient -- which is the stuff other than the extended
+ //widget
+ y_offset = toolHeight - (ceData.rect.height() + needToTouchBottom) - 1;
+ }
+ }
+
+ if (painter)
+ {
+ Keramik::GradientPainter::renderGradient( painter, ceData.rect,
+ ceData.colorGroup.button(), horiz_grad, false,
+ x_offset, y_offset, toolWidth, toolHeight);
+ }
+ else
+ {
+ TQPainter p( widget );
+ Keramik::GradientPainter::renderGradient( &p, ceData.rect,
+ ceData.colorGroup.button(), horiz_grad, false,
+ x_offset, y_offset, toolWidth, toolHeight);
+ }
+}
+
+// This function draws primitive elements as well as their masks.
+void KeramikStyle::drawPrimitive( TQ_PrimitiveElement pe,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt ) const
+{
+ bool down = flags & Style_Down;
+ bool on = flags & Style_On;
+ bool active = flags & Style_Active;
+ bool disabled = ( flags & Style_Enabled ) == 0;
+ int x, y, w, h;
+ r.rect(&x, &y, &w, &h);
+
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ switch(pe)
+ {
+ // BUTTONS
+ // -------------------------------------------------------------------
+ case PE_ButtonDefault:
+ {
+ bool sunken = on || down;
+
+ int id;
+ if ( sunken ) id = keramik_pushbutton_default_pressed;
+ else id = keramik_pushbutton_default;
+
+ if (flags & Style_MouseOver && id == keramik_pushbutton_default )
+ id = keramik_pushbutton_default_hov;
+
+
+ //p->fillRect( r, cg.background() );
+ Keramik::RectTilePainter( id, false ).draw(p, r, cg.button(), cg.background(), disabled, pmode() );
+ break;
+ }
+
+ case PE_ButtonDropDown:
+ case PE_ButtonTool:
+ {
+ if (titleBarMode)
+ {
+ TQRect nr;
+ if (titleBarMode == Maximized)
+ {
+ //### What should we draw at sides?
+ nr = TQRect(r.x(), r.y(), r.width()-1, r.height() );
+ }
+ else
+ {
+ int offX = (r.width() - 15)/2;
+ int offY = (r.height() - 15)/2;
+
+ if (flags & Style_Down)
+ offY += 1;
+
+ nr = TQRect(r.x()+offX, r.y()+offY, 15, 15);
+ }
+
+ Keramik::ScaledPainter(flags & Style_Down ? keramik_titlebutton_pressed : keramik_titlebutton,
+ Keramik::ScaledPainter::Both).draw( p, nr, cg.button(), cg.background());
+ return;
+ }
+
+ if (on)
+ {
+ Keramik::RectTilePainter(keramik_toolbar_clk).draw(p, r, cg.button(), cg.background());
+ p->setPen(cg.dark());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ }
+ else if (down)
+ {
+ Keramik::RectTilePainter(keramik_toolbar_clk).draw(p, r, cg.button(), cg.background());
+ }
+ else {
+ if (flags & Style_MouseOver)
+ {
+ Keramik::GradientPainter::renderGradient( p,
+ TQRect(r.x(), 0, r.width(), r.height()),
+ Keramik::ColorUtil::lighten(cg.button(), 115), flags & Style_Horizontal, false );
+ }
+ else
+ Keramik::GradientPainter::renderGradient( p,
+ TQRect(r.x(), 0, r.width(), r.height()),
+ cg.button(), flags & Style_Horizontal, false );
+
+ p->setPen(cg.button().light(70));
+ p->drawLine(x, y, x2-1, y);
+ p->drawLine(x, y, x, y2-1);
+ p->drawLine(x+2, y2-1, x2-1, y2-1);
+ p->drawLine(x2-1, y+2, x2-1, y2-2);
+
+ p->setPen(Keramik::ColorUtil::lighten(cg.button(), 115) );
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2);
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y, x2, y2);
+ }
+
+ break;
+ }
+
+ // PUSH BUTTON
+ // -------------------------------------------------------------------
+ case PE_ButtonCommand:
+ {
+ bool sunken = on || down;
+
+ int name;
+
+ if ( w <= smallButMaxW || h <= smallButMaxH || forceSmallMode)
+ {
+ if (sunken)
+ name = keramik_pushbutton_small_pressed;
+ else
+ name = keramik_pushbutton_small;
+ forceSmallMode = false;
+ }
+ else
+ {
+ if (sunken)
+ name = keramik_pushbutton_pressed;
+ else
+ name = keramik_pushbutton;
+ }
+
+ if (flags & Style_MouseOver && name == keramik_pushbutton )
+ name = keramik_pushbutton_hov;
+
+ if (toolbarBlendWidget && !flatMode )
+ {
+ //Render the toolbar gradient.
+ renderToolbarWidgetBackground(p, ceData, elementFlags, toolbarBlendWidget);
+
+ //Draw and blend the actual bevel..
+ Keramik::RectTilePainter( name, false ).draw(p, r, cg.button(), cg.background(),
+ disabled, Keramik::TilePainter::PaintFullBlend );
+ }
+ else if (!flatMode)
+ Keramik::RectTilePainter( name, false ).draw(p, r, cg.button(), cg.background(), disabled, pmode() );
+ else {
+ Keramik::ScaledPainter( name + KeramikTileCC, Keramik::ScaledPainter::Vertical).draw(
+ p, r, cg.button(), cg.background(), disabled, pmode() );
+
+ p->setPen(cg.button().light(75));
+
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y, x2, y2);
+ flatMode = false;
+ }
+
+ break;
+
+ }
+
+ // BEVELS
+ // -------------------------------------------------------------------
+ case PE_ButtonBevel:
+ {
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ bool sunken = on || down;
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ // Outer frame
+ p->setPen(cg.shadow());
+ p->drawRect(r);
+
+ // Bevel
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->setPen(sunken ? cg.light() : cg.mid());
+ p->drawLine(x+2, y2-1, x2-1, y2-1);
+ p->drawLine(x2-1, y+2, x2-1, y2-1);
+
+ if (w > 4 && h > 4)
+ {
+ if (sunken)
+ p->fillRect(x+2, y+2, w-4, h-4, cg.button());
+ else
+ Keramik::GradientPainter::renderGradient( p, TQRect(x+2, y+2, w-4, h-4),
+ cg.button(), flags & Style_Horizontal );
+ }
+ break;
+ }
+
+
+ // FOCUS RECT
+ // -------------------------------------------------------------------
+ case PE_FocusRect:
+ //Qt may pass the background color to use for the focus indicator
+ //here. This particularly happens within the iconview.
+ //If that happens, pass it on to drawWinFocusRect() so it can
+ //honor it
+ if ( opt.isDefault() )
+ p->drawWinFocusRect( r );
+ else
+ p->drawWinFocusRect( r, opt.color() );
+ break;
+
+ // HEADER SECTION
+ // -------------------------------------------------------------------
+ case PE_HeaderSectionMenu:
+ case PE_HeaderSection:
+ if ( flags & Style_Down )
+ Keramik::RectTilePainter( keramik_listview_pressed, false ).draw( p, r, cg.button(), cg.background() );
+ else
+ Keramik::RectTilePainter( keramik_listview, false ).draw( p, r, cg.button(), cg.background() );
+ break;
+
+ case PE_HeaderArrow:
+ if ( flags & Style_Up )
+ drawPrimitive( PE_ArrowUp, p, ceData, elementFlags, r, cg, Style_Enabled );
+ else drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, r, cg, Style_Enabled );
+ break;
+
+
+ // // SCROLLBAR
+ // -------------------------------------------------------------------
+
+ case PE_ScrollBarSlider:
+ {
+ bool horizontal = flags & Style_Horizontal;
+ bool active = ( flags & Style_Active ) || ( flags & Style_Down );
+ int name = KeramikSlider1;
+ unsigned int count = 3;
+
+
+
+ if ( horizontal )
+ {
+ if ( w > ( loader.size( keramik_scrollbar_hbar+KeramikSlider1 ).width() +
+ loader.size( keramik_scrollbar_hbar+KeramikSlider4 ).width() +
+ loader.size( keramik_scrollbar_hbar+KeramikSlider3 ).width() + 2 ) )
+ count = 5;
+ }
+ else if ( h > ( loader.size( keramik_scrollbar_vbar+KeramikSlider1 ).height() +
+ loader.size( keramik_scrollbar_vbar+KeramikSlider4 ).height() +
+ loader.size( keramik_scrollbar_vbar+KeramikSlider3 ).height() + 2 ) )
+ count = 5;
+
+ TQColor col = cg.highlight();
+
+ if (customScrollMode || !highlightScrollBar)
+ col = cg.button();
+
+ if (!active)
+ Keramik::ScrollBarPainter( name, count, horizontal ).draw( p, r, col, cg.background(), false, pmode() );
+ else
+ Keramik::ScrollBarPainter( name, count, horizontal ).draw( p, r, Keramik::ColorUtil::lighten(col ,110),
+ cg.background(), false, pmode() );
+ break;
+ }
+
+ case PE_ScrollBarAddLine:
+ {
+ bool down = flags & Style_Down;
+
+ if ( flags & Style_Horizontal )
+ {
+ Keramik::CenteredPainter painter( keramik_scrollbar_hbar_arrow2 );
+ painter.draw( p, r, down? cg.buttonText() : cg.button(), cg.background(), disabled, pmode() );
+
+ p->setPen( cg.buttonText() );
+ p->drawLine(r.x()+r.width()/2 - 1, r.y() + r.height()/2 - 3,
+ r.x()+r.width()/2 - 1, r.y() + r.height()/2 + 3);
+
+
+ drawKeramikArrow(p, cg, TQRect(r.x(), r.y(), r.width()/2, r.height()), PE_ArrowLeft, down, !disabled);
+
+ drawKeramikArrow(p, cg, TQRect(r.x()+r.width()/2, r.y(), r.width() - r.width()/2, r.height()),
+ PE_ArrowRight, down, !disabled);
+ }
+ else
+ {
+ Keramik::CenteredPainter painter( keramik_scrollbar_vbar_arrow2 );
+ painter.draw( p, r, down? cg.buttonText() : cg.button(), cg.background(), disabled, pmode() );
+
+ p->setPen( cg.buttonText() );
+ p->drawLine(r.x()+r.width()/2 - 4, r.y()+r.height()/2,
+ r.x()+r.width()/2 + 2, r.y()+r.height()/2);
+
+
+ drawKeramikArrow(p, cg, TQRect(r.x(), r.y(), r.width(), r.height()/2), PE_ArrowUp, down, !disabled);
+
+ drawKeramikArrow(p, cg, TQRect(r.x(), r.y()+r.height()/2, r.width(), r.height() - r.height()/2),
+ PE_ArrowDown, down, !disabled);
+ //drawKeramikArrow(p, cg, r, PE_ArrowUp, down, !disabled);
+ }
+
+
+ break;
+ }
+
+ case PE_ScrollBarSubLine:
+ {
+ bool down = flags & Style_Down;
+
+ if ( flags & Style_Horizontal )
+ {
+ Keramik::CenteredPainter painter(keramik_scrollbar_hbar_arrow1 );
+ painter.draw( p, r, down? cg.buttonText() : cg.button(), cg.background(), disabled, pmode() );
+ drawKeramikArrow(p, cg, r, PE_ArrowLeft, down, !disabled);
+
+ }
+ else
+ {
+ Keramik::CenteredPainter painter( keramik_scrollbar_vbar_arrow1 );
+ painter.draw( p, r, down? cg.buttonText() : cg.button(), cg.background(), disabled, pmode() );
+ drawKeramikArrow(p, cg, r, PE_ArrowUp, down, !disabled);
+ }
+ break;
+ }
+
+ // CHECKBOX (indicator)
+ // -------------------------------------------------------------------
+ case PE_Indicator:
+ case PE_IndicatorMask:
+
+ if (flags & Style_On)
+ Keramik::ScaledPainter( keramik_checkbox_on ).draw( p, r, cg.button(), cg.background(), disabled, pmode() );
+ else if (flags & Style_Off)
+ Keramik::ScaledPainter( keramik_checkbox_off ).draw( p, r, cg.button(), cg.background(), disabled, pmode() );
+ else
+ Keramik::ScaledPainter( keramik_checkbox_tri ).draw( p, r, cg.button(), cg.background(), disabled, pmode() );
+
+ break;
+
+ // RADIOBUTTON (exclusive indicator)
+ // -------------------------------------------------------------------
+ case PE_ExclusiveIndicator:
+ case PE_ExclusiveIndicatorMask:
+ {
+
+ Keramik::ScaledPainter( on ? keramik_radiobutton_on : keramik_radiobutton_off ).draw( p, r, cg.button(), cg.background(), disabled, pmode() );
+ break;
+ }
+
+ // line edit frame
+ case PE_PanelLineEdit:
+ {
+ if ( opt.isDefault() || opt.lineWidth() == 1 )
+ {
+ //1-pixel frames can not be simply clipped wider frames, as that would produce too little contrast on the lower border
+ p->setPen( cg.dark() );
+ p->drawLine( x, y, x + w - 1, y );
+ p->drawLine( x, y, x, y + h - 1 );
+
+ p->setPen( cg.light().dark( 110 ) );
+ p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 );
+ p->drawLine( x, y + h - 1, x + w - 1, y + h - 1);
+ }
+ else
+ {
+ p->setPen( cg.dark() );
+ p->drawLine( x, y, x + w - 1, y );
+ p->drawLine( x, y, x, y + h - 1 );
+ p->setPen( cg.mid() );
+ p->drawLine( x + 1, y + 1, x + w - 1, y + 1 );
+ p->drawLine( x + 1, y + 1, x + 1, y + h - 1 );
+ p->setPen( cg.light() );
+ p->drawLine( x + w - 1, y, x + w - 1, y + h - 1 );
+ p->drawLine( x, y + h - 1, x + w - 1, y + h - 1);
+ p->setPen( cg.light().dark( 110 ) );
+ p->drawLine( x + w - 2, y + 1, x + w - 2, y + h - 2 );
+ p->drawLine( x + 1, y + h - 2, x + w - 2, y + h - 2);
+ }
+ break;
+ }
+
+ // SPLITTER/DOCKWINDOW HANDLES
+ // -------------------------------------------------------------------
+ case PE_DockWindowResizeHandle:
+ case PE_Splitter:
+ {
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ p->setPen(cg.dark());
+ p->drawRect( r );
+ p->setPen(cg.background());
+ p->drawPoint(x, y);
+ p->drawPoint(x2, y);
+ p->drawPoint(x, y2);
+ p->drawPoint(x2, y2);
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->setPen(cg.midlight());
+ p->drawLine(x+2, y+2, x+2, y2-2);
+ p->drawLine(x+2, y+2, x2-2, y+2);
+ p->setPen(cg.mid());
+ p->drawLine(x2-1, y+1, x2-1, y2-1);
+ p->drawLine(x+1, y2-1, x2-1, y2-1);
+ p->fillRect(x+3, y+3, w-5, h-5, cg.brush(TQColorGroup::Background));
+ break;
+ }
+
+
+ //case PE_PanelPopup:
+ //p->setPen (cg.light() );
+ //p->setBrush( cg.background().light( 110 ) );
+ //p->drawRect( r );
+
+ //p->setPen( cg.shadow() );
+ //p->drawRect( r.x()+1, r.y()+1, r.width()-2, r.height()-2);
+ //p->fillRect( visualRect( TQRect( x + 1, y + 1, 23, h - 2 ), r ), cg.background().dark( 105 ) );
+ //break;
+
+ // GENERAL PANELS
+ // -------------------------------------------------------------------
+ case PE_Panel:
+ {
+ if (kickerMode)
+ {
+ if (p->device() && p->device()->devType() == TQInternal::Widget &&
+ TQCString(TQT_TQWIDGET(static_cast<TQPaintDevice*>(p->device()))->className()) == "FittsLawFrame" )
+ {
+ int x2 = x + r.width() - 1;
+ int y2 = y + r.height() - 1;
+ p->setPen(cg.dark());
+ p->drawLine(x+1,y2,x2-1,y2);
+ p->drawLine(x2,y+1,x2,y2);
+
+ p->setPen( cg.light() );
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+
+
+ return;
+ }
+ }
+ TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
+ break;
+ }
+ case PE_WindowFrame:
+ {
+ bool sunken = flags & Style_Sunken;
+ int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
+ : opt.lineWidth();
+ if (lw == 2)
+ {
+ TQPen oldPen = p->pen();
+ int x,y,w,h;
+ r.rect(&x, &y, &w, &h);
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+ p->setPen(sunken ? cg.light() : cg.dark());
+ p->drawLine(x, y2, x2, y2);
+ p->drawLine(x2, y, x2, y2);
+ p->setPen(sunken ? cg.mid() : cg.light());
+ p->drawLine(x, y, x2, y);
+ p->drawLine(x, y, x, y2);
+ p->setPen(sunken ? cg.midlight() : cg.mid());
+ p->drawLine(x+1, y2-1, x2-1, y2-1);
+ p->drawLine(x2-1, y+1, x2-1, y2-1);
+ p->setPen(sunken ? cg.dark() : cg.midlight());
+ p->drawLine(x+1, y+1, x2-1, y+1);
+ p->drawLine(x+1, y+1, x+1, y2-1);
+ p->setPen(oldPen);
+ } else
+ TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
+
+ break;
+ }
+
+
+ // MENU / TOOLBAR PANEL
+ // -------------------------------------------------------------------
+ case PE_PanelMenuBar: // Menu
+ {
+ Keramik::GradientPainter::renderGradient( p, r, cg.button(), true, true);
+ //Keramik::ScaledPainter( keramik_menubar , Keramik::ScaledPainter::Vertical).draw( p, r, cg.button(), cg.background() );
+
+ int x2 = r.x()+r.width()-1;
+ int y2 = r.y()+r.height()-1;
+ int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
+ : opt.lineWidth();
+ if (lw)
+ {
+ p->setPen(cg.mid());
+ p->drawLine(x2, y, x2, y2);
+ }
+
+ break;
+ }
+
+ case PE_PanelDockWindow: // Toolbar
+ {
+ bool horiz = r.width() > r.height();
+
+ //Here, we just draw the border.
+ int x = r.x();
+ int y = r.y();
+ int x2 = r.x() + r.width() - 1;
+ int y2 = r.y() + r.height() - 1;
+ int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
+ : opt.lineWidth();
+
+ if (lw)
+ {
+ //Gradient border colors.
+ //(Same as in gradients.cpp)
+ TQColor gradTop = Keramik::ColorUtil::lighten(cg.button(),110);
+ TQColor gradBot = Keramik::ColorUtil::lighten(cg.button(),109);
+ if (horiz)
+ {
+ //Top line
+ p->setPen(gradTop);
+ p->drawLine(x, y, x2, y);
+
+ //Bottom line
+ p->setPen(gradBot);
+ p->drawLine(x, y2, x2, y2);
+
+ //Left line
+ Keramik::GradientPainter::renderGradient(
+ p, TQRect(r.x(), r.y(), 1, r.height()),
+ cg.button(), true);
+
+ //Right end-line
+ p->setPen(cg.mid());
+ p->drawLine(x2, y, x2, y2);
+ }
+ else
+ {
+ //Left line
+ p->setPen(gradTop);
+ p->drawLine(x, y, x, y2);
+
+ //Right line
+ p->setPen(gradBot);
+ p->drawLine(x2, y, x2, y2);
+
+ //Top line
+ Keramik::GradientPainter::renderGradient(
+ p, TQRect(r.x(), r.y(), r.width(), 1),
+ cg.button(), false);
+
+ //Bottom end-line
+ p->setPen(cg.mid());
+ p->drawLine(x, y2, x2, y2);
+ }
+ }
+ break;
+ }
+
+ // TOOLBAR SEPARATOR
+ // -------------------------------------------------------------------
+ case PE_DockWindowSeparator:
+ {
+ TQWidget* paintWidget = dynamic_cast<TQWidget*>(p->device());
+ TQToolBar* parent = 0;
+ if (paintWidget)
+ parent = ::tqqt_cast<TQToolBar*>(paintWidget->parentWidget());
+
+ renderToolbarEntryBackground(p, parent, r, cg, (flags & Style_Horizontal) );
+ if ( !(flags & Style_Horizontal) )
+ {
+ p->setPen(cg.mid());
+ p->drawLine(4, r.height()/2-1, r.width()-5, r.height()/2-1);
+ p->setPen(cg.light());
+ p->drawLine(4, r.height()/2, r.width()-5, r.height()/2);
+ }
+ else
+ {
+ p->setPen(cg.mid());
+ p->drawLine(r.width()/2-1, 4, r.width()/2-1, r.height()-5);
+ p->setPen(cg.light());
+ p->drawLine(r.width()/2, 4, r.width()/2, r.height()-5);
+ }
+ break;
+ }
+
+ case PE_PanelScrollBar:
+ {
+ Keramik::ScrollBarPainter( KeramikGroove1, 2, (ceData.orientation == TQt::Horizontal)?true:false ).draw( p, r, cg.button(), cg.background(), (( flags & Style_Enabled ) == 0)?true:false );
+ break;
+ }
+
+ case PE_MenuItemIndicatorFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
+ qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
+ }
+ break;
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
+ qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
+ }
+ break;
+ case PE_MenuItemIndicatorCheck:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
+
+ SFlags cflags = Style_Default;
+ cflags |= active ? Style_Enabled : Style_On;
+
+ drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
+ }
+ break;
+
+ default:
+ {
+ // ARROWS
+ // -------------------------------------------------------------------
+ if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft)
+ {
+ TQPointArray a;
+
+ switch(pe)
+ {
+ case PE_ArrowUp:
+ a.setPoints(TQCOORDARRLEN(u_arrow), u_arrow);
+ break;
+
+ case PE_ArrowDown:
+ a.setPoints(TQCOORDARRLEN(d_arrow), d_arrow);
+ break;
+
+ case PE_ArrowLeft:
+ a.setPoints(TQCOORDARRLEN(l_arrow), l_arrow);
+ break;
+
+ default:
+ a.setPoints(TQCOORDARRLEN(r_arrow), r_arrow);
+ }
+
+ p->save();
+ if ( flags & Style_Down )
+ p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
+ pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
+
+ if ( flags & Style_Enabled )
+ {
+ a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
+ p->setPen( cg.buttonText() );
+ p->drawLineSegments( a );
+ }
+ else
+ {
+ a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 );
+ p->setPen( cg.light() );
+ p->drawLineSegments( a );
+ a.translate( -1, -1 );
+ p->setPen( cg.mid() );
+ p->drawLineSegments( a );
+ }
+ p->restore();
+
+ }
+ else
+ TDEStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
+ }
+ }
+}
+
+void KeramikStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption &opt,
+ const TQWidget* widget ) const
+{
+ bool disabled = ( flags & Style_Enabled ) == 0;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ switch ( kpe )
+ {
+ // SLIDER GROOVE
+ // -------------------------------------------------------------------
+ case KPE_SliderGroove:
+ {
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+
+ Keramik::TilePainter::PaintMode pmod = Keramik::TilePainter::PaintNormal;
+
+ if (!ceData.bgPixmap.isNull())
+ pmod = Keramik::TilePainter::PaintFullBlend;
+
+ if ( horizontal )
+ Keramik::RectTilePainter( keramik_slider_hgroove, false ).draw(p, r, cg.button(), cg.background(), disabled, pmod);
+ else
+ Keramik::RectTilePainter( keramik_slider_vgroove, true, false ).draw( p, r, cg.button(), cg.background(), disabled, pmod);
+
+ break;
+ }
+
+ // SLIDER HANDLE
+ // -------------------------------------------------------------------
+ case KPE_SliderHandle:
+ {
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+
+ TQColor hl = cg.highlight();
+ if (!disabled && flags & Style_Active)
+ hl = Keramik::ColorUtil::lighten(cg.highlight(),110);
+
+ if (horizontal)
+ Keramik::ScaledPainter( keramik_slider ).draw( p, r, disabled ? cg.button() : hl,
+ Qt::black, disabled, Keramik::TilePainter::PaintFullBlend );
+ else
+ Keramik::ScaledPainter( keramik_vslider ).draw( p, r, disabled ? cg.button() : hl,
+ Qt::black, disabled, Keramik::TilePainter::PaintFullBlend );
+ break;
+ }
+
+ // TOOLBAR HANDLE
+ // -------------------------------------------------------------------
+ case KPE_ToolBarHandle: {
+ int x = r.x(); int y = r.y();
+ int x2 = r.x() + r.width()-1;
+ int y2 = r.y() + r.height()-1;
+
+ TQToolBar* parent = 0;
+
+ if (widget && widget->parent() && widget->parent()->inherits(TQTOOLBAR_OBJECT_NAME_STRING))
+ parent = static_cast<TQToolBar*>(TQT_TQWIDGET(widget->parent()));
+
+ renderToolbarEntryBackground(p, parent, r, cg, (flags & Style_Horizontal));
+ if (flags & Style_Horizontal) {
+ p->setPen(cg.light());
+ p->drawLine(x+1, y+4, x+1, y2-4);
+ p->drawLine(x+3, y+4, x+3, y2-4);
+ p->drawLine(x+5, y+4, x+5, y2-4);
+
+ p->setPen(cg.mid());
+ p->drawLine(x+2, y+4, x+2, y2-4);
+ p->drawLine(x+4, y+4, x+4, y2-4);
+ p->drawLine(x+6, y+4, x+6, y2-4);
+ } else {
+ p->setPen(cg.light());
+ p->drawLine(x+4, y+1, x2-4, y+1);
+ p->drawLine(x+4, y+3, x2-4, y+3);
+ p->drawLine(x+4, y+5, x2-4, y+5);
+
+ p->setPen(cg.mid());
+ p->drawLine(x+4, y+2, x2-4, y+2);
+ p->drawLine(x+4, y+4, x2-4, y+4);
+ p->drawLine(x+4, y+6, x2-4, y+6);
+
+ }
+ break;
+ }
+
+
+ // GENERAL/KICKER HANDLE
+ // -------------------------------------------------------------------
+ case KPE_GeneralHandle: {
+ int x = r.x(); int y = r.y();
+ int x2 = r.x() + r.width()-1;
+ int y2 = r.y() + r.height()-1;
+
+ if (flags & Style_Horizontal) {
+
+ p->setPen(cg.light());
+ p->drawLine(x+1, y, x+1, y2);
+ p->drawLine(x+3, y, x+3, y2);
+ p->drawLine(x+5, y, x+5, y2);
+
+ p->setPen(cg.mid());
+ p->drawLine(x+2, y, x+2, y2);
+ p->drawLine(x+4, y, x+4, y2);
+ p->drawLine(x+6, y, x+6, y2);
+
+ } else {
+
+ p->setPen(cg.light());
+ p->drawLine(x, y+1, x2, y+1);
+ p->drawLine(x, y+3, x2, y+3);
+ p->drawLine(x, y+5, x2, y+5);
+
+ p->setPen(cg.mid());
+ p->drawLine(x, y+2, x2, y+2);
+ p->drawLine(x, y+4, x2, y+4);
+ p->drawLine(x, y+6, x2, y+6);
+
+ }
+ break;
+ }
+
+
+ default:
+ TDEStyle::drawTDEStylePrimitive( kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+}
+
+bool KeramikStyle::isFormWidget(const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const
+{
+ if (widget) {
+ //Form widgets are in the TDEHTMLView, but that has 2 further inner levels
+ //of widgets - QClipperWidget, and outside of that, QViewportWidget
+ TQWidget* potentialClipPort = widget->parentWidget();
+ if ((ceData.parentWidgetData.widgetObjectTypes.isEmpty()) && (ceData.parentWidgetFlags & CEF_IsTopLevel)) {
+ return false;
+ }
+
+ TQWidget* potentialViewPort = potentialClipPort->parentWidget();
+ if (!potentialViewPort || potentialViewPort->isTopLevel() ||
+ qstrcmp(potentialViewPort->name(), "qt_viewport") )
+ return false;
+
+ TQWidget* potentialTDEHTML = potentialViewPort->parentWidget();
+ if (!potentialTDEHTML || potentialTDEHTML->isTopLevel() ||
+ qstrcmp(potentialTDEHTML->className(), "TDEHTMLView") )
+ return false;
+
+
+ return true;
+ }
+}
+
+void KeramikStyle::drawControl( TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ bool disabled = ( flags & Style_Enabled ) == 0;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ switch (element)
+ {
+ // PUSHBUTTON
+ // -------------------------------------------------------------------
+ case CE_PushButton:
+ {
+ const TQPushButton* btn = dynamic_cast< const TQPushButton* >( widget );
+
+ if (isFormWidget(ceData, elementFlags, btn))
+ formMode = true;
+
+ if ( elementFlags & CEF_IsFlat )
+ flatMode = true;
+
+ if ( (elementFlags & CEF_IsDefault) && !flatMode )
+ {
+ drawPrimitive( PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags );
+ }
+ else
+ {
+ if (ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING))
+ toolbarBlendWidget = widget;
+
+ drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags );
+ toolbarBlendWidget = 0;
+ }
+
+ formMode = false;
+ break;
+ }
+
+
+ // PUSHBUTTON LABEL
+ // -------------------------------------------------------------------
+ case CE_PushButtonLabel:
+ {
+ const TQPushButton* button = dynamic_cast<const TQPushButton *>( widget );
+ bool active = ((elementFlags & CEF_IsOn) || (elementFlags & CEF_IsDown));
+ bool cornArrow = false;
+
+ // Shift button contents if pushed.
+ if ( active )
+ {
+ x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget);
+ y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget);
+ flags |= Style_Sunken;
+ }
+
+ // Does the button have a popup menu?
+ if (elementFlags & CEF_IsMenuWidget)
+ {
+ int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
+ if ( !ceData.iconSet.isNull() &&
+ (dx + ceData.iconSet.pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w )
+ {
+ cornArrow = true; //To little room. Draw the arrow in the corner, don't adjust the widget
+ }
+ else
+ {
+ drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ),
+ cg, flags, opt );
+ w -= dx;
+ }
+ }
+
+ // Draw the icon if there is one
+ if ( !ceData.iconSet.isNull() )
+ {
+ TQIconSet::Mode mode = TQIconSet::Disabled;
+ TQIconSet::State state = TQIconSet::Off;
+
+ if (elementFlags & CEF_IsEnabled)
+ mode = (elementFlags & CEF_HasFocus) ? TQIconSet::Active : TQIconSet::Normal;
+ if ((elementFlags & CEF_BiState) && (elementFlags & CEF_IsOn))
+ state = TQIconSet::On;
+
+ TQPixmap icon = ceData.iconSet.pixmap( TQIconSet::Small, mode, state );
+
+ if (!ceData.text.isEmpty())
+ {
+ const int TextToIconMargin = 6;
+ //Center text + icon w/margin in between..
+
+ //Calculate length of both.
+ int length = icon.width() + TextToIconMargin
+ + p->fontMetrics().size(ShowPrefix, ceData.text).width();
+
+ //Calculate offset.
+ int offset = (w - length)/2;
+
+ //draw icon
+ p->drawPixmap( x + offset, y + h / 2 - icon.height() / 2, icon );
+
+ //new bounding rect for the text
+ x += offset + icon.width() + TextToIconMargin;
+ w = length - icon.width() - TextToIconMargin;
+ }
+ else
+ {
+ //Icon only. Center it.
+ if (ceData.fgPixmap.isNull())
+ p->drawPixmap( x + w/2 - icon.width()/2, y + h / 2 - icon.height() / 2,
+ icon );
+ else //icon + pixmap. Ugh.
+ p->drawPixmap( x + (elementFlags & CEF_IsDefault) ? 8 : 4 , y + h / 2 - icon.height() / 2, icon );
+ }
+
+ if (cornArrow) //Draw over the icon
+ drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ),
+ cg, flags, opt );
+ }
+
+ // Make the label indicate if the button is a default button or not
+ drawItem( p, TQRect(x, y, w, h), AlignCenter | ShowPrefix, ceData.colorGroup,
+ (elementFlags & CEF_IsEnabled), (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1,
+ &ceData.colorGroup.buttonText() );
+
+ if ( flags & Style_HasFocus )
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
+ visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ),
+ cg, flags );
+ break;
+ }
+
+ case CE_ToolButtonLabel:
+ {
+ bool onToolbar = ceData.parentWidgetData.widgetObjectTypes.contains( TQTOOLBAR_OBJECT_NAME_STRING );
+ TQRect nr = r;
+
+ if (!onToolbar)
+ {
+ if (!qstrcmp(ceData.parentWidgetData.name.ascii(),"qt_maxcontrols" ) )
+ {
+ //Make sure we don't cut into the endline
+ if (!qstrcmp(ceData.name.ascii(), "close"))
+ {
+ nr.addCoords(0,0,-1,0);
+ p->setPen(cg.dark());
+ p->drawLine(r.x() + r.width() - 1, r.y(),
+ r.x() + r.width() - 1, r.y() + r.height() - 1 );
+ }
+ }
+ //else if ( w > smallButMaxW && h > smallButMaxH )
+ // nr.setWidth(r.width()-2); //Account for shadow
+ }
+
+ TDEStyle::drawControl(element, p, ceData, elementFlags, nr, cg, flags, opt, widget);
+ break;
+ }
+
+ case CE_TabBarTab:
+ {
+ bool bottom = ceData.tabBarData.shape == TQTabBar::RoundedBelow ||
+ ceData.tabBarData.shape == TQTabBar::TriangularBelow;
+
+ if ( flags & Style_Selected )
+ {
+ TQRect tabRect = r;
+ //If not the right-most tab, readjust the painting to be one pixel wider
+ //to avoid a doubled line
+ int rightMost = TQApplication::reverseLayout() ? 0 : ceData.tabBarData.tabCount - 1;
+
+ if (ceData.tabBarData.identIndexMap[opt.tab()->identifier()] != rightMost)
+ tabRect.setWidth( tabRect.width() + 1);
+ Keramik::ActiveTabPainter( bottom ).draw( p, tabRect, cg.button().light(110), cg.background(), !(elementFlags & CEF_IsEnabled), pmode());
+ }
+ else
+ {
+ Keramik::InactiveTabPainter::Mode mode;
+ int index = ceData.tabBarData.identIndexMap[opt.tab()->identifier()];
+ if ( index == 0 ) mode = Keramik::InactiveTabPainter::First;
+ else if ( index == ceData.tabBarData.tabCount - 1 ) mode = Keramik::InactiveTabPainter::Last;
+ else mode = Keramik::InactiveTabPainter::Middle;
+
+ if ( bottom )
+ {
+ Keramik::InactiveTabPainter( mode, bottom ).draw( p, x, y, w, h - 3, cg.button(), cg.background(), disabled, pmode() );
+ p->setPen( cg.dark() );
+ p->drawLine( x, y, x + w, y );
+ }
+ else
+ {
+ Keramik::InactiveTabPainter( mode, bottom ).draw( p, x, y + 3, w, h - 3, cg.button(), cg.background(), disabled, pmode() );
+ p->setPen( cg.light() );
+ p->drawLine( x, y + h - 1, x + w, y + h - 1 );
+ }
+ }
+
+ break;
+ }
+
+ case CE_DockWindowEmptyArea:
+ {
+ TQRect pr = r;
+ if (ceData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING))
+ {
+ const TQToolBar* tb = static_cast<const TQToolBar*>(widget);
+ if (tb->place() == TQDockWindow::OutsideDock)
+ {
+ //Readjust the paint rectangle to skip the titlebar
+ pr = TQRect(r.x(), titleBarH + tb->frameWidth(),
+ r.width(), tb->height() - titleBarH - 2 * tb->frameWidth() + 2);
+ //2 at the end = the 2 pixels of border of a "regular"
+ //toolbar we normally paint over.
+ }
+ Keramik::GradientPainter::renderGradient( p, pr, cg.button(),
+ tb->orientation() == Qt::Horizontal);
+ }
+ else
+ TDEStyle::drawControl( (TQ_ControlElement)CE_DockWindowEmptyArea, p, ceData, elementFlags,
+ r, cg, flags, opt, widget );
+ break;
+ }
+ case CE_MenuBarEmptyArea:
+ {
+ Keramik::GradientPainter::renderGradient( p, r, cg.button(), true, true);
+ break;
+ }
+ // MENUBAR ITEM (sunken panel on mouse over)
+ // -------------------------------------------------------------------
+ case CE_MenuBarItem:
+ {
+ TQMenuBar *mb = (TQMenuBar*)widget;
+ TQMenuItem *mi = opt.menuItem();
+ TQRect pr = mb->rect();
+
+ bool active = flags & Style_Active;
+ bool focused = flags & Style_HasFocus;
+
+ if ( active && focused )
+ qDrawShadePanel(p, r.x(), r.y(), r.width(), r.height(),
+ cg, true, 1, &cg.brush(TQColorGroup::Midlight));
+ else
+ Keramik::GradientPainter::renderGradient( p, pr, cg.button(), true, true);
+
+ drawItem( p, r, AlignCenter | AlignVCenter | ShowPrefix
+ | DontClip | SingleLine, cg, flags & Style_Enabled,
+ mi->pixmap(), mi->text() );
+
+ break;
+ }
+
+
+ // POPUPMENU ITEM
+ // -------------------------------------------------------------------
+ case CE_PopupMenuItem: {
+ TQRect main = r;
+
+ TQMenuItem *mi = opt.menuItem();
+
+ if ( !mi )
+ {
+ // Don't leave blank holes if we set NoBackground for the TQPopupMenu.
+ // This only happens when the popupMenu spans more than one column.
+ if (! ( !ceData.bgPixmap.isNull() ) )
+ p->fillRect( r, cg.background().light( 105 ) );
+
+ break;
+ }
+ int tab = opt.tabWidth();
+ int checkcol = opt.maxIconWidth();
+ bool enabled = mi->isEnabled();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+ bool active = flags & Style_Active;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+ bool reverse = TQApplication::reverseLayout();
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ // Draw the menu item background
+ if ( active )
+ {
+ if ( enabled )
+ Keramik::RowPainter( keramik_menuitem ).draw( p, main, cg.highlight(), cg.background() );
+ else {
+ if ( !ceData.bgPixmap.isNull() )
+ p->drawPixmap( main.topLeft(), ceData.bgPixmap, main );
+ else p->fillRect( main, cg.background().light( 105 ) );
+ p->drawWinFocusRect( r );
+ }
+ }
+ // Draw the transparency pixmap
+ else if ( !ceData.bgPixmap.isNull() )
+ p->drawPixmap( main.topLeft(), ceData.bgPixmap, main );
+ // Draw a solid background
+ else
+ p->fillRect( main, cg.background().light( 105 ) );
+ // Are we a menu item separator?
+
+ if ( mi->isSeparator() )
+ {
+ p->setPen( cg.mid() );
+ p->drawLine( main.x()+5, main.y() + 1, main.right()-5, main.y() + 1 );
+ p->setPen( cg.light() );
+ p->drawLine( main.x()+5, main.y() + 2, main.right()-5, main.y() + 2 );
+ break;
+ }
+
+ TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
+ // Do we have an icon?
+ if ( mi->iconSet() )
+ {
+ TQIconSet::Mode mode;
+
+
+
+ // Select the correct icon from the iconset
+ if ( active )
+ mode = enabled ? TQIconSet::Active : TQIconSet::Disabled;
+ else
+ mode = enabled ? TQIconSet::Normal : TQIconSet::Disabled;
+
+ // Do we have an icon and are checked at the same time?
+ // Then draw a "pressed" background behind the icon
+ if ( checkable && /*!active &&*/ mi->isChecked() )
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
+ // Draw the icon
+ TQPixmap pixmap = mi->iconSet()->pixmap( TQIconSet::Small, mode );
+ TQRect pmr( 0, 0, pixmap.width(), pixmap.height() );
+ pmr.moveCenter( cr.center() );
+ p->drawPixmap( pmr.topLeft(), pixmap );
+ }
+
+ // Are we checked? (This time without an icon)
+ else if ( checkable && mi->isChecked() )
+ {
+ // We only have to draw the background if the menu item is inactive -
+ // if it's active the "pressed" background is already drawn
+ // if ( ! active )
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt);
+ // Draw the checkmark
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
+ }
+
+ // Time to draw the menu item label...
+ int xm = itemFrame + checkcol + itemHMargin; // X position margin
+
+ int xp = reverse ? // X position
+ x + tab + rightBorder + itemHMargin + itemFrame - 1 :
+ x + xm;
+
+ int offset = reverse ? -1 : 1; // Shadow offset for etched text
+
+ // Label width (minus the width of the accelerator portion)
+ int tw = w - xm - tab - arrowHMargin - itemHMargin * 3 - itemFrame + 1;
+
+ // Set the color for enabled and disabled text
+ // (used for both active and inactive menu items)
+ p->setPen( enabled ? cg.buttonText() : cg.mid() );
+
+ // This color will be used instead of the above if the menu item
+ // is active and disabled at the same time. (etched text)
+ TQColor discol = cg.mid();
+
+ // Does the menu item draw it's own label?
+ if ( mi->custom() ) {
+ int m = itemVMargin;
+ // Save the painter state in case the custom
+ // paint method changes it in some way
+ p->save();
+
+ // Draw etched text if we're inactive and the menu item is disabled
+ if ( etchtext && !enabled && !active ) {
+ p->setPen( cg.light() );
+ mi->custom()->paint( p, cg, active, enabled, xp+offset, y+m+1, tw, h-2*m );
+ p->setPen( discol );
+ }
+ mi->custom()->paint( p, cg, active, enabled, xp, y+m, tw, h-2*m );
+ p->restore();
+ }
+ else {
+ // The menu item doesn't draw it's own label
+ TQString s = mi->text();
+ // Does the menu item have a text label?
+ if ( !s.isNull() ) {
+ int t = s.find( '\t' );
+ int m = itemVMargin;
+ int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ text_flags |= reverse ? AlignRight : AlignLeft;
+
+ //TQColor draw = cg.text();
+ TQColor draw = (active && enabled) ? cg.highlightedText () : cg.text();
+ p->setPen(draw);
+
+
+ // Does the menu item have a tabstop? (for the accelerator text)
+ if ( t >= 0 ) {
+ int tabx = reverse ? x + rightBorder + itemHMargin + itemFrame :
+ x + w - tab - rightBorder - itemHMargin - itemFrame;
+
+ // Draw the right part of the label (accelerator text)
+ if ( etchtext && !enabled ) {
+ // Draw etched text if we're inactive and the menu item is disabled
+ p->setPen( cg.light() );
+ p->drawText( tabx+offset, y+m+1, tab, h-2*m, text_flags, s.mid( t+1 ) );
+ p->setPen( discol );
+ }
+ p->drawText( tabx, y+m, tab, h-2*m, text_flags, s.mid( t+1 ) );
+ s = s.left( t );
+ }
+
+ // Draw the left part of the label (or the whole label
+ // if there's no accelerator)
+ if ( etchtext && !enabled ) {
+ // Etched text again for inactive disabled menu items...
+ p->setPen( cg.light() );
+ p->drawText( xp+offset, y+m+1, tw, h-2*m, text_flags, s, t );
+ p->setPen( discol );
+ }
+
+
+ p->drawText( xp, y+m, tw, h-2*m, text_flags, s, t );
+
+ p->setPen(cg.text());
+
+ }
+
+ // The menu item doesn't have a text label
+ // Check if it has a pixmap instead
+ else if ( mi->pixmap() ) {
+ TQPixmap *pixmap = mi->pixmap();
+
+ // Draw the pixmap
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::OpaqueMode );
+
+ int diffw = ( ( w - pixmap->width() ) / 2 )
+ + ( ( w - pixmap->width() ) % 2 );
+ p->drawPixmap( x+diffw, y+itemFrame, *pixmap );
+
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::TransparentMode );
+ }
+ }
+
+ // Does the menu item have a submenu?
+ if ( mi->popup() ) {
+ TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
+ int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags) - itemFrame;
+ TQRect vr = visualRect( TQRect( x + w - arrowHMargin - itemFrame - dim,
+ y + h / 2 - dim / 2, dim, dim), r );
+
+ // Draw an arrow at the far end of the menu item
+ if ( active ) {
+ if ( enabled )
+ discol = cg.buttonText();
+
+ TQColorGroup g2( discol, cg.highlight(), white, white,
+ enabled ? white : discol, discol, white );
+
+ drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled );
+ } else
+ drawPrimitive( arrow, p, ceData, elementFlags, vr, cg,
+ enabled ? Style_Enabled : Style_Default );
+ }
+ break;
+ }
+ case CE_ProgressBarContents: {
+ TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget);
+ double progress = ceData.currentStep;
+ bool reverse = TQApplication::reverseLayout();
+ int steps = ceData.totalSteps;
+
+ if (!cr.isValid())
+ return;
+
+ // Draw progress bar
+ if (progress > 0 || steps == 0) {
+ double pg = (steps == 0) ? 0.1 : progress / steps;
+ int width = QMIN(cr.width(), (int)(pg * cr.width()));
+ if (steps == 0)
+ width = QMIN(width,20); //Don't cross squares
+
+ if (steps == 0) { //Busy indicator
+
+ if (width < 1) width = 1; //A busy indicator with width 0 is kind of useless
+
+ int remWidth = cr.width() - width; //Never disappear completely
+ if (remWidth <= 0) remWidth = 1; //Do something non-crashy when too small...
+
+ int pstep = int(progress) % ( 2 * remWidth );
+
+ if ( pstep > remWidth ) {
+ //Bounce about.. We're remWidth + some delta, we want to be remWidth - delta...
+ // - ( (remWidth + some delta) - 2* remWidth ) = - (some deleta - remWidth) = remWidth - some delta..
+ pstep = - (pstep - 2 * remWidth );
+ }
+
+ //Store the progress rect.
+ TQRect progressRect;
+ if (reverse)
+ progressRect = TQRect(cr.x() + cr.width() - width - pstep, cr.y(),
+ width, cr.height());
+ else
+ progressRect = TQRect(cr.x() + pstep, cr.y(), width, cr.height());
+
+ Keramik::RowPainter(keramik_progressbar).draw(p, progressRect,
+ cg.highlight(), cg.background() );
+ return;
+ }
+
+ TQRect progressRect;
+
+ if (reverse)
+ progressRect = TQRect(cr.x()+(cr.width()-width), cr.y(), width, cr.height());
+ else
+ progressRect = TQRect(cr.x(), cr.y(), width, cr.height());
+
+ //Apply the animation rectangle.
+ //////////////////////////////////////
+ if (animateProgressBar)
+ {
+ const TQProgressBar* pb = (const TQProgressBar*)widget;
+ int progAnimShift = progAnimWidgets[const_cast<TQProgressBar*>(pb)];
+ if (reverse)
+ {
+ //Here, we can't simply shift, as the painter code calculates everything based
+ //on the left corner, so we need to draw the 2 portions ourselves.
+
+ //Start off by checking the geometry of the end pixmap - it introduces a bit of an offset
+ TQSize endDim = loader.size(keramik_progressbar + 3); //3 = 3*1 + 0 = (1,0) = cl
+
+ //We might not have anything to animate at all, though, if the ender is the only thing to paint
+ if (endDim.width() < progressRect.width())
+ {
+ //OK, so we do have some stripes.
+ // Render the endline now - the clip region below will protect it from getting overwriten
+ TQPixmap endline = loader.scale(keramik_progressbar + 3, endDim.width(), progressRect.height(),
+ cg.highlight(), cg.background());
+ p->drawPixmap(progressRect.x(), progressRect.y(), endline);
+
+ //Now, calculate where the stripes should be, and set a clip region to that
+ progressRect.setLeft(progressRect.x() + endline.width());
+ p->setClipRect(progressRect, TQPainter::CoordPainter);
+
+ //Expand the paint region slightly to get the animation offset.
+ progressRect.setLeft(progressRect.x() - progAnimShift);
+
+ //Paint the stripes.
+ TQPixmap stripe = loader.scale(keramik_progressbar + 4, 28, progressRect.height(),
+ cg.highlight(), cg.background());
+ //4 = 3*1 + 1 = (1,1) = cc
+
+ p->drawTiledPixmap(progressRect, stripe);
+ //Exit out here to skip the regular paint path
+ return;
+ }
+ }
+ else
+ {
+ //Clip to the old rectangle
+ p->setClipRect(progressRect, TQPainter::CoordPainter);
+ //Expand the paint region
+ progressRect.setLeft(progressRect.x() - 28 + progAnimShift);
+ }
+ }
+
+ Keramik::ProgressBarPainter(keramik_progressbar, reverse).draw( p,
+ progressRect , cg.highlight(), cg.background());
+ }
+ break;
+ }
+
+
+ default:
+ TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+}
+
+void KeramikStyle::drawControlMask( TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ p->fillRect(r, color1);
+ maskMode = true;
+ drawControl( element, p, ceData, elementFlags, r, TQApplication::palette().active(), TQStyle::Style_Default, opt, widget);
+ maskMode = false;
+}
+
+bool KeramikStyle::isSizeConstrainedCombo(const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQComboBox* combo) const
+{
+ if (ceData.rect.width() >= 80)
+ return false;
+
+ if (combo) {
+ int suggestedWidth = combo->sizeHint().width();
+
+ if (ceData.rect.width() - suggestedWidth < -5)
+ return true;
+
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+void KeramikStyle::drawComplexControl( TQ_ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ SCFlags controls,
+ SCFlags active,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ bool disabled = ( flags & Style_Enabled ) == 0;
+ switch(control)
+ {
+ // COMBOBOX
+ // -------------------------------------------------------------------
+ case CC_ComboBox:
+ {
+ bool toolbarMode = false;
+ const TQComboBox* cb = dynamic_cast< const TQComboBox* >( widget );
+ bool compact = isSizeConstrainedCombo(ceData, elementFlags, cb);
+
+ if (isFormWidget(ceData, elementFlags, cb))
+ formMode = true;
+
+ TQPixmap * buf = 0;
+ TQPainter* p2 = p;
+
+ TQRect br = r;
+
+ if (controls == SC_All)
+ {
+ //Double-buffer only when we are in the slower full-blend mode
+ if ( ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING) || !qstrcmp(ceData.parentWidgetData.name.ascii(), kdeToolbarWidget) )
+ {
+ buf = new TQPixmap( r.width(), r.height() );
+ br.setX(0);
+ br.setY(0);
+ p2 = new TQPainter(buf);
+
+ //Ensure that we have clipping on, and have a sane base.
+ //If need be, Qt will shrink us to the paint region.
+ p->setClipRect(r);
+ toolbarMode = true;
+ }
+ }
+
+
+ if ( br.width() >= 28 && br.height() > 20 && !compact )
+ br.addCoords( 0, -2, 0, 0 );
+
+ //When in compact mode, we force the shadow-less bevel mode,
+ //but that also alters height and not just width.
+ //readjust height to fake the other metrics (plus clear
+ //the other areas, as appropriate). The automasker
+ //will take care of the overall shape.
+ if ( compact )
+ {
+ forceSmallMode = true;
+ br.setHeight( br.height() - 2);
+ p->fillRect ( r.x(), r.y() + br.height(), r.width(), 2, cg.background());
+ }
+
+
+ if ( controls & SC_ComboBoxFrame )
+ {
+ if (toolbarMode)
+ toolbarBlendWidget = widget;
+
+ drawPrimitive( PE_ButtonCommand, p2, ceData, elementFlags, br, cg, flags );
+
+ toolbarBlendWidget = 0;
+ }
+
+ // don't draw the focus rect etc. on the mask
+ if ( cg.button() == color1 && cg.background() == color0 )
+ break;
+
+ if ( controls & SC_ComboBoxArrow )
+ {
+ if ( active )
+ flags |= Style_On;
+
+ TQRect ar = querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxArrow, TQStyleOption::Default, widget );
+ if (!compact)
+ {
+ ar.setWidth(ar.width()-13);
+ TQRect rr = visualRect( TQRect( ar.x(), ar.y() + 4,
+ loader.size(keramik_ripple ).width(), ar.height() - 8 ),
+ ceData, elementFlags );
+
+ ar = visualRect( TQRect( ar.x() + loader.size( keramik_ripple ).width() + 4, ar.y(),
+ 11, ar.height() ),
+ ceData, elementFlags );
+
+ TQPointArray a;
+
+ a.setPoints(TQCOORDARRLEN(keramik_combo_arrow), keramik_combo_arrow);
+
+ a.translate( ar.x() + ar.width() / 2, ar.y() + ar.height() / 2 );
+ p2->setPen( cg.buttonText() );
+ p2->drawLineSegments( a );
+
+ Keramik::ScaledPainter( keramik_ripple ).draw( p2, rr, cg.button(), Qt::black, disabled, Keramik::TilePainter::PaintFullBlend );
+ }
+ else //Size-constrained combo -- loose the ripple.
+ {
+ ar.setWidth(ar.width() - 7);
+ ar = visualRect( TQRect( ar.x(), ar.y(), 11, ar.height() ), ceData, elementFlags);
+ TQPointArray a;
+
+ a.setPoints(TQCOORDARRLEN(keramik_combo_arrow), keramik_combo_arrow);
+
+ a.translate( ar.x() + ar.width() / 2, ar.y() + ar.height() / 2 );
+ p2->setPen( cg.buttonText() );
+ p2->drawLineSegments( a );
+ }
+ }
+
+ if ( controls & SC_ComboBoxEditField )
+ {
+ if ( elementFlags & CEF_IsEditable )
+ {
+ TQRect er = visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags );
+ er.addCoords( -2, -2, 2, 2 );
+ p2->fillRect( er, cg.base() );
+ drawPrimitive( PE_PanelLineEdit, p2, ceData, elementFlags, er, cg );
+ Keramik::RectTilePainter( keramik_frame_shadow, false, false, 2, 2 ).draw( p2, er, cg.button(),
+ Qt::black, false, pmodeFullBlend() );
+ }
+ else if ( elementFlags & CEF_HasFocus )
+ {
+ TQRect re = TQStyle::visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, cb), ceData, elementFlags);
+ if ( compact )
+ re.addCoords( 3, 3, 0, -3 );
+ p2->fillRect( re, cg.brush( TQColorGroup::Highlight ) );
+ drawPrimitive( PE_FocusRect, p2, ceData, elementFlags, re, cg,
+ Style_FocusAtBorder, TQStyleOption( cg.highlight() ) );
+ }
+ // TQComboBox draws the text on its own and uses the painter's current colors
+ if ( elementFlags & CEF_HasFocus )
+ {
+ p->setPen( cg.highlightedText() );
+ p->setBackgroundColor( cg.highlight() );
+ }
+ else
+ {
+ p->setPen( cg.text() );
+ p->setBackgroundColor( cg.button() );
+ }
+ }
+
+ if (p2 != p)
+ {
+ p2->end();
+ delete p2;
+ p->drawPixmap(r.x(), r.y(), *buf);
+ delete buf;
+ }
+
+ formMode = false;
+ break;
+ }
+
+ case CC_SpinWidget:
+ {
+ const TQSpinWidget* sw = static_cast< const TQSpinWidget* >( widget );
+ TQRect br = visualRect( querySubControlMetrics( (TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags, SC_SpinWidgetButtonField, TQStyleOption::Default, widget ), ceData, elementFlags );
+ if ( controls & SC_SpinWidgetButtonField )
+ {
+ Keramik::SpinBoxPainter().draw( p, br, cg.button(), cg.background(), !sw->isEnabled() );
+ if ( active & SC_SpinWidgetUp )
+ Keramik::CenteredPainter( keramik_spinbox_pressed_arrow_up ).draw( p, br.x(), br.y() + 3, br.width(), br.height() / 2, cg.button(), cg.background() );
+ else
+ Keramik::CenteredPainter( keramik_spinbox_arrow_up ).draw( p, br.x(), br.y() + 3, br.width(), br.height() / 2, cg.button(), cg.background(), !sw->isUpEnabled() );
+ if ( active & SC_SpinWidgetDown )
+ Keramik::CenteredPainter( keramik_spinbox_pressed_arrow_down ).draw( p, br.x(), br.y() + br.height() / 2 , br.width(), br.height() / 2 - 8, cg.button(), cg.background() );
+ else
+ Keramik::CenteredPainter( keramik_spinbox_arrow_down ).draw( p, br.x(), br.y() + br.height() / 2, br.width(), br.height() / 2 - 8, cg.background(), cg.button(), !sw->isDownEnabled() );
+ }
+
+ if ( controls & SC_SpinWidgetFrame )
+ drawPrimitive( PE_PanelLineEdit, p, ceData, elementFlags, r, cg );
+
+ break;
+ }
+ case CC_ScrollBar:
+ {
+ if (highlightScrollBar && (elementFlags & CEF_HasParentWidget)) //Don't do the check if not highlighting anyway
+ {
+ if (ceData.parentWidgetData.colorGroup.button() != ceData.colorGroup.button())
+ customScrollMode = true;
+ }
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+ TQRect slider, subpage, addpage, subline, addline;
+ if ( ceData.minSteps == ceData.maxSteps ) flags &= ~Style_Enabled;
+
+ slider = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget );
+ subpage = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget );
+ addpage = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget );
+ subline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget );
+ addline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget );
+
+ if ( controls & SC_ScrollBarSubLine )
+ drawPrimitive( PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
+ flags | ( ( active & SC_ScrollBarSubLine ) ? Style_Down : 0 ) );
+
+ TQRegion clip;
+ if ( controls & SC_ScrollBarSubPage ) clip |= subpage;
+ if ( controls & SC_ScrollBarAddPage ) clip |= addpage;
+ if ( horizontal )
+ clip |= TQRect( slider.x(), 0, slider.width(), ceData.rect.height() );
+ else
+ clip |= TQRect( 0, slider.y(), ceData.rect.width(), slider.height() );
+ clip ^= slider;
+
+ p->setClipRegion( clip );
+ Keramik::ScrollBarPainter( KeramikGroove1, 2, horizontal ).draw( p, slider | subpage | addpage, cg.button(), cg.background(), disabled );
+
+ if ( controls & SC_ScrollBarSlider )
+ {
+ if ( horizontal )
+ p->setClipRect( slider.x(), slider.y(), addpage.right() - slider.x() + 1, slider.height() );
+ else
+ p->setClipRect( slider.x(), slider.y(), slider.width(), addpage.bottom() - slider.y() + 1 );
+ drawPrimitive( PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
+ flags | ( ( active == SC_ScrollBarSlider ) ? Style_Down : 0 ) );
+ }
+ p->setClipping( false );
+
+ if ( controls & ( SC_ScrollBarSubLine | SC_ScrollBarAddLine ) )
+ {
+ drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags );
+ if ( active & SC_ScrollBarSubLine )
+ {
+ if ( horizontal )
+ p->setClipRect( TQRect( addline.x(), addline.y(), addline.width() / 2, addline.height() ) );
+ else
+ p->setClipRect( TQRect( addline.x(), addline.y(), addline.width(), addline.height() / 2 ) );
+ drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags | Style_Down );
+ }
+ else if ( active & SC_ScrollBarAddLine )
+ {
+ if ( horizontal )
+ p->setClipRect( TQRect( addline.x() + addline.width() / 2, addline.y(), addline.width() / 2, addline.height() ) );
+ else
+ p->setClipRect( TQRect( addline.x(), addline.y() + addline.height() / 2, addline.width(), addline.height() / 2 ) );
+ drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg, flags | Style_Down );
+ }
+ }
+
+ customScrollMode = false;
+
+
+ break;
+ }
+
+ // TOOLBUTTON
+ // -------------------------------------------------------------------
+ case CC_ToolButton: {
+ bool onToolbar = ceData.parentWidgetData.widgetObjectTypes.contains(TQTOOLBAR_OBJECT_NAME_STRING);
+ bool onExtender = !onToolbar &&
+ ceData.parentWidgetData.widgetObjectTypes.contains( "QToolBarExtensionWidget") &&
+ widget && widget->parentWidget()->parentWidget()->inherits( TQTOOLBAR_OBJECT_NAME_STRING );
+
+ bool onControlButtons = false;
+ if (!onToolbar && !onExtender && !ceData.parentWidgetData.widgetObjectTypes.isEmpty() &&
+ !qstrcmp(ceData.parentWidgetData.name.ascii(),"qt_maxcontrols" ) )
+ {
+ onControlButtons = true;
+ titleBarMode = Maximized;
+ }
+
+ TQRect button, menuarea;
+ button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
+ menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
+
+ SFlags bflags = flags,
+ mflags = flags;
+
+ if (active & SC_ToolButton)
+ bflags |= Style_Down;
+ if (active & SC_ToolButtonMenu)
+ mflags |= Style_Down;
+
+ if (onToolbar && ceData.toolBarData.orientation == TQt::Horizontal)
+ bflags |= Style_Horizontal;
+
+ if (controls & SC_ToolButton)
+ {
+ // If we're pressed, on, or raised...
+ if (bflags & (Style_Down | Style_On | Style_Raised) || onControlButtons)
+ {
+ //Make sure the standalone toolbuttons have a gradient in the right direction
+ if (!onToolbar && !onControlButtons)
+ bflags |= Style_Horizontal;
+
+ drawPrimitive( PE_ButtonTool, p, ceData, elementFlags, button, cg,
+ bflags, opt);
+ }
+
+ // Check whether to draw a background pixmap
+ else if ( !ceData.parentWidgetData.bgPixmap.isNull() )
+ {
+ TQPixmap pixmap = ceData.parentWidgetData.bgPixmap;
+ p->drawTiledPixmap( r, pixmap, ceData.pos );
+ }
+ else if (onToolbar)
+ {
+ renderToolbarWidgetBackground(p, ceData, elementFlags, widget);
+ }
+ else if (onExtender)
+ {
+ // This assumes floating toolbars can't have extenders,
+ //(so if we're on an extender, we're not floating)
+ TQWidget* parent = static_cast<TQWidget*> (TQT_TQWIDGET(widget->parent()));
+ TQToolBar* toolbar = static_cast<TQToolBar*>(TQT_TQWIDGET(parent->parent()));
+ TQRect tr = ceData.parentWidgetData.rect;
+ bool horiz = ceData.toolBarData.orientation == TQt::Horizontal;
+
+ //Calculate offset. We do this by translating our coordinates,
+ //which are relative to the parent, to be relative to the toolbar.
+ int xoff = 0, yoff = 0;
+ if (horiz)
+ yoff = parent->mapToParent(ceData.pos).y();
+ else
+ xoff = parent->mapToParent(ceData.pos).x();
+
+ Keramik::GradientPainter::renderGradient( p, r, cg.button(),
+ horiz, false, /*Not a menubar*/
+ xoff, yoff,
+ tr.width(), tr.height());
+ }
+ }
+
+ // Draw a toolbutton menu indicator if required
+ if (controls & SC_ToolButtonMenu)
+ {
+ if (mflags & (Style_Down | Style_On | Style_Raised))
+ drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
+ }
+
+ if ((elementFlags & CEF_HasFocus) && !(elementFlags & CEF_HasFocusProxy)) {
+ TQRect fr = ceData.rect;
+ fr.addCoords(3, 3, -3, -3);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg);
+ }
+
+ titleBarMode = None;
+
+ break;
+ }
+
+ case CC_TitleBar:
+ titleBarMode = Regular; //Handle buttons on titlebar different from toolbuttons
+ default:
+ TDEStyle::drawComplexControl( control, p, ceData, elementFlags,
+ r, cg, flags, controls, active, opt, widget );
+
+ titleBarMode = None;
+ }
+}
+
+void KeramikStyle::drawComplexControlMask( TQ_ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ if (control == CC_ComboBox)
+ {
+ maskMode = true;
+ drawComplexControl(CC_ComboBox, p, ceData, elementFlags, r,
+ TQApplication::palette().active(), Style_Default,
+ SC_ComboBoxFrame,SC_None, opt, widget);
+ maskMode = false;
+
+ }
+ else
+ p->fillRect(r, color1);
+
+}
+
+int KeramikStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ switch(m)
+ {
+ // BUTTONS
+ // -------------------------------------------------------------------
+ case PM_ButtonMargin: // Space btw. frame and label
+ return 4;
+
+ case PM_SliderLength:
+ return 12;
+ case PM_SliderControlThickness:
+ return loader.size( keramik_slider ).height() - 4;
+ case PM_SliderThickness:
+ return loader.size( keramik_slider ).height();
+
+ case PM_ButtonShiftHorizontal:
+ return 0;
+ case PM_ButtonShiftVertical: // Offset by 1
+ return 1;
+
+
+ // CHECKBOXES / RADIO BUTTONS
+ // -------------------------------------------------------------------
+ case PM_ExclusiveIndicatorWidth: // Radiobutton size
+ return loader.size( keramik_radiobutton_on ).width();
+ case PM_ExclusiveIndicatorHeight:
+ return loader.size( keramik_radiobutton_on ).height();
+ case PM_IndicatorWidth: // Checkbox size
+ return loader.size( keramik_checkbox_on ).width();
+ case PM_IndicatorHeight:
+ return loader.size( keramik_checkbox_on) .height();
+
+ case PM_ScrollBarExtent:
+ return loader.size( keramik_scrollbar_vbar + KeramikGroove1).width();
+ case PM_ScrollBarSliderMin:
+ return loader.size( keramik_scrollbar_vbar + KeramikSlider1 ).height() +
+ loader.size( keramik_scrollbar_vbar + KeramikSlider3 ).height();
+
+ case PM_SpinBoxFrameWidth:
+ case PM_DefaultFrameWidth:
+ return 1;
+
+ case PM_MenuButtonIndicator:
+ return 13;
+
+ case PM_TabBarTabVSpace:
+ return 12;
+
+ case PM_TabBarTabOverlap:
+ return 0;
+
+ case PM_TabBarTabShiftVertical:
+ {
+ if (ceData.widgetObjectTypes.contains(TQTABBAR_OBJECT_NAME_STRING))
+ {
+ if (ceData.tabBarData.shape == TQTabBar::RoundedBelow ||
+ ceData.tabBarData.shape == TQTabBar::TriangularBelow)
+ return 0;
+ }
+
+ return 2; //For top, or if not sure
+ }
+
+
+ case PM_TitleBarHeight:
+ return titleBarH;
+
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ return 2;
+
+ default:
+ return TDEStyle::pixelMetric(m, ceData, elementFlags, widget);
+ }
+}
+
+
+TQSize KeramikStyle::sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentSize,
+ const TQStyleOption& opt,
+ const TQWidget* widget ) const
+{
+ switch (contents)
+ {
+ // PUSHBUTTON SIZE
+ // ------------------------------------------------------------------
+ case CT_PushButton:
+ {
+ const TQPushButton* btn = dynamic_cast< const TQPushButton* >( widget );
+
+ int w = contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
+ int h = contentSize.height() + 2 * pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
+ if ( ceData.text.isEmpty() && contentSize.width() < 32 ) return TQSize( w, h );
+
+
+ //For some reason kcontrol no longer does this...
+ //if ( (elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault) )
+ // w = QMAX( w, 40 );
+
+ return TQSize( w + 30, h + 5 ); //MX: No longer blank space -- can make a bit smaller
+ }
+
+ case CT_ToolButton:
+ {
+ bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( TQTOOLBAR_OBJECT_NAME_STRING );
+ if (!onToolbar) //Behaves like a button, so scale appropriately to the border
+ {
+ int w = contentSize.width();
+ int h = contentSize.height();
+ return TQSize( w + 12, h + 10 );
+ }
+ else
+ {
+ return TDEStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
+ }
+ }
+
+ case CT_ComboBox: {
+ int arrow = 11 + loader.size( keramik_ripple ).width();
+ return TQSize( contentSize.width() + arrow + ((elementFlags & CEF_IsEditable) ? 26 : 22),
+ contentSize.height() + 10 );
+ }
+
+ // POPUPMENU ITEM SIZE
+ // -----------------------------------------------------------------
+ case CT_PopupMenuItem: {
+ if ( ! widget || opt.isDefault() )
+ return contentSize;
+
+ const TQPopupMenu *popup = (const TQPopupMenu *) widget;
+ bool checkable = popup->isCheckable();
+ TQMenuItem *mi = opt.menuItem();
+ int maxpmw = opt.maxIconWidth();
+ int w = contentSize.width(), h = contentSize.height();
+
+ if ( mi->custom() ) {
+ w = mi->custom()->sizeHint().width();
+ h = mi->custom()->sizeHint().height();
+ if ( ! mi->custom()->fullSpan() )
+ h += 2*itemVMargin + 2*itemFrame;
+ }
+ else if ( mi->widget() ) {
+ } else if ( mi->isSeparator() ) {
+ w = 30; // Arbitrary
+ h = 3;
+ }
+ else {
+ if ( mi->pixmap() )
+ h = QMAX( h, mi->pixmap()->height() + 2*itemFrame );
+ else {
+ // Ensure that the minimum height for text-only menu items
+ // is the same as the icon size used by KDE.
+ h = QMAX( h, 16 + 2*itemFrame );
+ h = QMAX( h, popup->fontMetrics().height()
+ + 2*itemVMargin + 2*itemFrame );
+ }
+
+ if ( mi->iconSet() )
+ h = QMAX( h, mi->iconSet()->pixmap(
+ TQIconSet::Small, TQIconSet::Normal).height() +
+ 2 * itemFrame );
+ }
+
+ if ( ! mi->text().isNull() && mi->text().find('\t') >= 0 )
+ w += itemHMargin + itemFrame*2 + 7;
+ else if ( mi->popup() )
+ w += 2 * arrowHMargin;
+
+ if ( maxpmw )
+ w += maxpmw + 6;
+ if ( checkable && maxpmw < 20 )
+ w += 20 - maxpmw;
+ if ( checkable || maxpmw > 0 )
+ w += 12;
+
+ w += rightBorder;
+
+ return TQSize( w, h );
+ }
+
+ default:
+ return TDEStyle::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
+ }
+}
+
+
+TQStyle::SubControl KeramikStyle::querySubControl( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQPoint& point,
+ const TQStyleOption& opt,
+ const TQWidget* widget ) const
+{
+ SubControl result = TDEStyle::querySubControl( control, ceData, elementFlags, point, opt, widget );
+ if ( control == CC_ScrollBar && result == SC_ScrollBarAddLine )
+ {
+ TQRect addline = querySubControlMetrics( control, ceData, elementFlags, result, opt, widget );
+ if ( static_cast< const TQScrollBar* >( widget )->orientation() == Qt::Horizontal )
+ {
+ if ( point.x() < addline.center().x() ) result = SC_ScrollBarSubLine;
+ }
+ else if ( point.y() < addline.center().y() ) result = SC_ScrollBarSubLine;
+ }
+ return result;
+}
+
+TQRect KeramikStyle::querySubControlMetrics( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl subcontrol,
+ const TQStyleOption& opt,
+ const TQWidget* widget ) const
+{
+ switch ( control )
+ {
+ case CC_ComboBox:
+ {
+ int arrow;
+ bool compact = false;
+ if ( isSizeConstrainedCombo(ceData, elementFlags, dynamic_cast<const TQComboBox*>(widget)) ) //### constant
+ compact = true;
+
+ if ( compact )
+ arrow = 11;
+ else
+ arrow = 11 + loader.size( keramik_ripple ).width();
+
+ switch ( subcontrol )
+ {
+ case SC_ComboBoxArrow:
+ if ( compact )
+ return TQRect( ceData.rect.width() - arrow - 7, 0, arrow + 6, ceData.rect.height() );
+ else
+ return TQRect( ceData.rect.width() - arrow - 14, 0, arrow + 13, ceData.rect.height() );
+
+ case SC_ComboBoxEditField:
+ {
+ if ( compact )
+ return TQRect( 2, 4, ceData.rect.width() - arrow - 2 - 7, ceData.rect.height() - 8 );
+ else if ( ceData.rect.width() < 36 || ceData.rect.height() < 22 )
+ return TQRect( 4, 3, ceData.rect.width() - arrow - 20, ceData.rect.height() - 6 );
+ else if ( elementFlags & CEF_IsEditable )
+ return TQRect( 8, 4, ceData.rect.width() - arrow - 26, ceData.rect.height() - 11 );
+ else
+ return TQRect( 6, 4, ceData.rect.width() - arrow - 22, ceData.rect.height() - 9 );
+ }
+
+ case SC_ComboBoxListBoxPopup:
+ {
+ //Note that the widget here == the combo, not the completion
+ //box, so we don't get any recursion
+ int suggestedWidth = widget->sizeHint().width();
+ TQRect def = opt.rect();
+ def.addCoords( 4, -4, -6, 4 );
+
+ if ((def.width() - suggestedWidth < -12) && (def.width() < 80))
+ def.setWidth(QMIN(80, suggestedWidth - 10));
+
+ return def;
+ }
+
+ default: break;
+ }
+ break;
+ }
+
+ case CC_ScrollBar:
+ {
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+ int addline, subline, sliderpos, sliderlen, maxlen, slidermin;
+ if ( horizontal )
+ {
+ subline = loader.size( keramik_scrollbar_hbar_arrow1 ).width();
+ addline = loader.size( keramik_scrollbar_hbar_arrow2 ).width();
+ maxlen = ceData.rect.width() - subline - addline + 2;
+ }
+ else
+ {
+ subline = loader.size( keramik_scrollbar_vbar_arrow1 ).height();
+ addline = loader.size( keramik_scrollbar_vbar_arrow2 ).height();
+ maxlen = ceData.rect.height() - subline - addline + 2;
+ }
+ sliderpos = ceData.startStep;
+ if ( ceData.minSteps != ceData.maxSteps )
+ {
+ int range = ceData.maxSteps - ceData.minSteps;
+ sliderlen = ( ceData.pageStep * maxlen ) / ( range + ceData.pageStep );
+ slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
+ if ( sliderlen < slidermin ) sliderlen = slidermin;
+ if ( sliderlen > maxlen ) sliderlen = maxlen;
+ }
+ else sliderlen = maxlen;
+
+ switch ( subcontrol )
+ {
+ case SC_ScrollBarGroove:
+ if ( horizontal ) return TQRect( subline, 0, maxlen, ceData.rect.height() );
+ else return TQRect( 0, subline, ceData.rect.width(), maxlen );
+
+ case SC_ScrollBarSlider:
+ if (horizontal) return TQRect( sliderpos, 0, sliderlen, ceData.rect.height() );
+ else return TQRect( 0, sliderpos, ceData.rect.width(), sliderlen );
+
+ case SC_ScrollBarSubLine:
+ if ( horizontal ) return TQRect( 0, 0, subline, ceData.rect.height() );
+ else return TQRect( 0, 0, ceData.rect.width(), subline );
+
+ case SC_ScrollBarAddLine:
+ if ( horizontal ) return TQRect( ceData.rect.width() - addline, 0, addline, ceData.rect.height() );
+ else return TQRect( 0, ceData.rect.height() - addline, ceData.rect.width(), addline );
+
+ case SC_ScrollBarSubPage:
+ if ( horizontal ) return TQRect( subline, 0, sliderpos - subline, ceData.rect.height() );
+ else return TQRect( 0, subline, ceData.rect.width(), sliderpos - subline );
+
+ case SC_ScrollBarAddPage:
+ if ( horizontal ) return TQRect( sliderpos + sliderlen, 0, ceData.rect.width() - addline - (sliderpos + sliderlen) , ceData.rect.height() );
+ else return TQRect( 0, sliderpos + sliderlen, ceData.rect.width(), ceData.rect.height() - addline - (sliderpos + sliderlen)
+ /*maxlen - sliderpos - sliderlen + subline - 5*/ );
+
+ default: break;
+ };
+ break;
+ }
+ case CC_Slider:
+ {
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+ TQSlider::TickSetting ticks = (TQSlider::TickSetting)ceData.tickMarkSetting;
+ int pos = ceData.startStep;
+ int size = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
+ int handleSize = pixelMetric( PM_SliderThickness, ceData, elementFlags, widget );
+ int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
+
+ //Shrink the metrics if the widget is too small
+ //to fit our normal values for them.
+ if (horizontal)
+ handleSize = QMIN(handleSize, ceData.rect.height());
+ else
+ handleSize = QMIN(handleSize, ceData.rect.width());
+
+ size = QMIN(size, handleSize);
+
+ switch ( subcontrol )
+ {
+ case SC_SliderGroove:
+ if ( horizontal )
+ {
+ if ( ticks == TQSlider::Both )
+ return TQRect( 0, ( ceData.rect.height() - size ) / 2, ceData.rect.width(), size );
+ else if ( ticks == TQSlider::Above )
+ return TQRect( 0, ceData.rect.height() - size - ( handleSize - size ) / 2, ceData.rect.width(), size );
+ return TQRect( 0, ( handleSize - size ) / 2, ceData.rect.width(), size );
+ }
+ else
+ {
+ if ( ticks == TQSlider::Both )
+ return TQRect( ( ceData.rect.width() - size ) / 2, 0, size, ceData.rect.height() );
+ else if ( ticks == TQSlider::Above )
+ return TQRect( ceData.rect.width() - size - ( handleSize - size ) / 2, 0, size, ceData.rect.height() );
+ return TQRect( ( handleSize - size ) / 2, 0, size, ceData.rect.height() );
+ }
+ case SC_SliderHandle:
+ if ( horizontal )
+ {
+ if ( ticks == TQSlider::Both )
+ return TQRect( pos, ( ceData.rect.height() - handleSize ) / 2, len, handleSize );
+ else if ( ticks == TQSlider::Above )
+ return TQRect( pos, ceData.rect.height() - handleSize, len, handleSize );
+ return TQRect( pos, 0, len, handleSize );
+ }
+ else
+ {
+ if ( ticks == TQSlider::Both )
+ return TQRect( ( ceData.rect.width() - handleSize ) / 2, pos, handleSize, len );
+ else if ( ticks == TQSlider::Above )
+ return TQRect( ceData.rect.width() - handleSize, pos, handleSize, len );
+ return TQRect( 0, pos, handleSize, len );
+ }
+ default: break;
+ }
+ break;
+ }
+ default: break;
+ }
+ return TDEStyle::querySubControlMetrics( control, ceData, elementFlags, subcontrol, opt, widget );
+}
+
+
+#include <config.h>
+
+#if !defined Q_WS_X11 || defined K_WS_QTONLY
+#undef HAVE_X11_EXTENSIONS_SHAPE_H
+#endif
+
+#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
+//Xlib headers are a mess -> include them down here (any way to ensure that we go second in enable-final order?)
+#include <X11/Xlib.h>
+#include <X11/extensions/shape.h>
+#undef KeyPress
+#undef KeyRelease
+#endif
+
+bool KeramikStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
+{
+ if (TDEStyle::objectEventHandler( ceData, elementFlags, source, event ))
+ return true;
+
+ if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
+ TQObject* object = reinterpret_cast<TQObject*>(source);
+
+ if ( !object->isWidgetType() ) return false;
+
+ //Combo line edits get special frames
+ if ( event->type() == TQEvent::Paint && ::tqqt_cast<TQLineEdit*>(object) )
+ {
+ static bool recursion = false;
+ if (recursion )
+ return false;
+
+ recursion = true;
+ object->event( TQT_TQPAINTEVENT( event ) );
+ TQWidget* widget = TQT_TQWIDGET( object );
+ TQPainter p( widget );
+ Keramik::RectTilePainter( keramik_frame_shadow, false, false, 2, 2 ).draw( &p, ceData.rect,
+ widget->palette().color( TQPalette::Normal, TQColorGroup::Button ),
+ Qt::black, false, Keramik::TilePainter::PaintFullBlend);
+ recursion = false;
+ return true;
+ }
+ else if ( ::tqqt_cast<TQListBox*>(object) )
+ {
+ //Handle combobox drop downs
+ switch (event->type())
+ {
+#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
+ //Combo dropdowns are shaped
+ case TQEvent::Resize:
+ {
+ TQListBox* listbox = static_cast<TQListBox*>(TQT_TQWIDGET(object));
+ TQResizeEvent* resize = TQT_TQRESIZEEVENT(event);
+ if (resize->size().height() < 6)
+ return false;
+
+ //CHECKME: Not sure the rects are perfect..
+ XRectangle rects[5] = {
+ {0, 0, resize->size().width()-2, resize->size().height()-6},
+ {0, resize->size().height()-6, resize->size().width()-2, 1},
+ {1, resize->size().height()-5, resize->size().width()-3, 1},
+ {2, resize->size().height()-4, resize->size().width()-5, 1},
+ {3, resize->size().height()-3, resize->size().width()-7, 1}
+ };
+
+ XShapeCombineRectangles(tqt_xdisplay(), listbox->handle(), ShapeBounding, 0, 0,
+ rects, 5, ShapeSet, YXSorted);
+ }
+ break;
+#endif
+ //Combo dropdowns get fancy borders
+ case TQEvent::Paint:
+ {
+ static bool recursion = false;
+ if (recursion )
+ return false;
+ TQListBox* listbox = (TQListBox*) object;
+ TQPaintEvent* paint = (TQPaintEvent*) event;
+
+
+ if ( !listbox->contentsRect().contains( paint->rect() ) )
+ {
+ TQPainter p( listbox );
+ Keramik::RectTilePainter( keramik_combobox_list, false, false ).draw( &p, 0, 0, listbox->width(), listbox->height(),
+ listbox->palette().color( TQPalette::Normal, TQColorGroup::Button ),
+ listbox->palette().color( TQPalette::Normal, TQColorGroup::Background ) );
+
+ TQPaintEvent newpaint( paint->region().intersect( listbox->contentsRect() ), paint->erased() );
+ recursion = true;
+ object->event( &newpaint );
+ recursion = false;
+ return true;
+ }
+ }
+ break;
+
+ /**
+ Since our popup is shown a bit overlapping the combo body, a mouse click at the bottom of the
+ widget will result in the release going to the popup, which will cause it to close (#56435).
+ We solve it by filtering out the first release, if it's in the right area. To do this, we notices shows,
+ move ourselves to front of event filter list, and then capture the first release event, and if it's
+ in the overlap area, filter it out.
+ */
+ case TQEvent::Show:
+ //Prioritize ourselves to see the mouse events first
+ removeObjectEventHandler(ceData, elementFlags, source, this);
+ installObjectEventHandler(ceData, elementFlags, source, this);
+ firstComboPopupRelease = true;
+ break;
+
+ //We need to filter some clicks out.
+ case TQEvent::MouseButtonRelease:
+ if (firstComboPopupRelease)
+ {
+ firstComboPopupRelease = false;
+
+ TQMouseEvent* mev = TQT_TQMOUSEEVENT(event);
+ TQListBox* box = static_cast<TQListBox*>(TQT_TQWIDGET(object));
+
+ TQWidget* parent = box->parentWidget();
+ if (!parent)
+ return false;
+
+ TQPoint inParCoords = parent->mapFromGlobal(mev->globalPos());
+ if (parent->rect().contains(inParCoords))
+ return true;
+ }
+ break;
+ case TQEvent::MouseButtonPress:
+ case TQEvent::MouseButtonDblClick:
+ case TQEvent::Wheel:
+ case TQEvent::KeyPress:
+ case TQEvent::KeyRelease:
+ firstComboPopupRelease = false;
+ default:
+ return false;
+ }
+ }
+ //Toolbar background gradient handling
+ else if (event->type() == TQEvent::Paint &&
+ object->parent() && !qstrcmp(object->name(), kdeToolbarWidget) )
+ {
+ // Draw a gradient background for custom widgets in the toolbar
+ // that have specified a "kde toolbar widget" name.
+ renderToolbarWidgetBackground(0, ceData, elementFlags, TQT_TQWIDGET(object));
+
+ return false; // Now draw the contents
+ }
+#if 0 // FIXME
+ // This does not work on modern systems
+ // Rather than resorting to hacks like this, which can stop working at any time, the required functionality should simply be added to TQt3!
+ else if (event->type() == TQEvent::Paint && object->parent() && ::tqqt_cast<TQToolBar*>(object->parent())
+ && !::tqqt_cast<TQPopupMenu*>(object) )
+ {
+ // We need to override the paint event to draw a
+ // gradient on a QToolBarExtensionWidget.
+ TQToolBar* toolbar = static_cast<TQToolBar*>(TQT_TQWIDGET(object->parent()));
+ TQWidget* widget = TQT_TQWIDGET(object);
+ TQRect wr = widget->rect (), tr = toolbar->rect();
+ TQPainter p( widget );
+
+ if ( toolbar->orientation() == Qt::Horizontal )
+ {
+ Keramik::GradientPainter::renderGradient( &p, wr, widget->colorGroup().button(),
+ true /*horizontal*/, false /*not a menu*/,
+ 0, widget->y(), wr.width(), tr.height());
+ }
+ else
+ {
+ Keramik::GradientPainter::renderGradient( &p, wr, widget->colorGroup().button(),
+ false /*vertical*/, false /*not a menu*/,
+ widget->x(), 0, tr.width(), wr.height());
+ }
+
+
+ //Draw terminator line, too
+ p.setPen( toolbar->colorGroup().mid() );
+ if ( toolbar->orientation() == Qt::Horizontal )
+ p.drawLine( wr.width()-1, 0, wr.width()-1, wr.height()-1 );
+ else
+ p.drawLine( 0, wr.height()-1, wr.width()-1, wr.height()-1 );
+ return true;
+
+ }
+#endif
+ // Track show events for progress bars
+ if ( animateProgressBar && ::tqqt_cast<TQProgressBar*>(object) )
+ {
+ if ((event->type() == TQEvent::Show) && !animationTimer->isActive())
+ {
+ animationTimer->start( 50, false );
+ }
+ }
+ }
+
+ return false;
+}
+
+/*! \reimp */
+int KeramikStyle::styleHint(StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *returnData, const TQWidget *w) const
+{
+ int ret;
+
+ switch (sh) {
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int checkcol = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ ret = checkcol;
+ }
+ break;
+ case SH_ScrollBar_CombineAddLineRegionDrawingAreas:
+ ret = 1;
+ break;
+ default:
+ ret = TDEStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w);
+ break;
+ }
+
+ return ret;
+}
+
+// vim: ts=4 sw=4 noet
+// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
diff --git a/tdestyles/keramik/keramik.h b/tdestyles/keramik/keramik.h
new file mode 100644
index 000000000..7bf8cd3d4
--- /dev/null
+++ b/tdestyles/keramik/keramik.h
@@ -0,0 +1,226 @@
+/* Keramik Style for KDE3
+ Copyright (c) 2002 Malte Starostik <malte@kde.org>
+
+ based on the KDE3 HighColor Style
+
+ Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ (C) 2001-2002 Fredrik H�glund <fredrik@kde.org>
+
+ Drawing routines adapted from the KDE2 HCStyle,
+ Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ (C) 2000 Dirk Mueller <mueller@kde.org>
+ (C) 2001 Martijn Klingens <klingens@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+
+// $Id$
+
+#ifndef __keramik_h__
+#define __keramik_h__
+
+#include <tqframe.h>
+#include <tdestyle.h>
+
+#include "pixmaploader.h"
+
+class TQProgressBar;
+
+class KeramikStyle : public TDEStyle
+{
+ Q_OBJECT
+
+public:
+ KeramikStyle();
+ virtual ~KeramikStyle();
+
+ void renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup &cg, const TQPopupMenu* ) const;
+ TQPixmap stylePixmap(StylePixmap stylepixmap, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption& opt, const TQWidget* widget = 0) const;
+
+ void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
+ void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
+ void polish( TQPalette& );
+ void applicationPolish( 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( TQ_PrimitiveElement pe,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect& r,
+ const TQColorGroup& cg,
+ SFlags flags = Style_Default,
+ const TQStyleOption& = TQStyleOption::Default ) const;
+
+ void drawControl( TQ_ControlElement element,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect& r,
+ const TQColorGroup& cg,
+ SFlags flags = Style_Default,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const;
+
+ void drawControlMask( TQ_ControlElement element,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect& r,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) 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;
+
+ void drawComplexControlMask( TQ_ComplexControl control,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect& r,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const;
+
+ int pixelMetric( PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget* widget = 0 ) const;
+
+ TQSize sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize& contentSize,
+ const TQStyleOption& opt,
+ const TQWidget* widget = 0 ) const;
+
+ SubControl querySubControl( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQPoint& point,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const;
+
+ TQRect querySubControlMetrics( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl subcontrol,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const;
+
+ int styleHint(TQ_StyleHint, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQStyleOption & = TQStyleOption::Default,
+ TQStyleHintReturn * = 0, const TQWidget * = 0 ) const;
+
+private slots:
+ //Animation slots.
+ void updateProgressPos();
+ void progressBarDestroyed(TQObject* bar);
+
+private:
+
+ bool isSizeConstrainedCombo(const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQComboBox* widget) const;
+ bool isFormWidget (const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const;
+
+ ///Configuration settings
+ bool animateProgressBar;
+ bool highlightScrollBar;
+
+ //Rendering flags
+ mutable bool forceSmallMode;
+ mutable bool maskMode; //Ugly round trip flag to permit masking with little code;
+ mutable bool formMode; //Set when rendering form widgets
+
+ mutable const TQWidget* toolbarBlendWidget; //Ditto for blending with toolbars
+
+ enum TitleBarMode
+ {
+ None = 0,
+ Regular,
+ Maximized
+ };
+
+ mutable TitleBarMode titleBarMode; //Set when passing back CC_TilteBar modes to handle
+ //PE_ButtonTool properly for them, as well as when handling CC_ToolButton from
+ //The maximized window controls.
+
+ mutable bool flatMode; //Set when calling PE_PushButton or PE_ButtonDefault
+ // on a flat button.
+
+ mutable bool customScrollMode; //Set when drawing scrollbars with custom colors.
+
+ bool firstComboPopupRelease;
+
+ //Animation support.
+ TQMap<TQProgressBar*, int> progAnimWidgets;
+
+ virtual bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
+
+ Keramik::TilePainter::PaintMode pmode() const
+ {
+ if (formMode)
+ {
+ //If we're a form widget, we blend on painting, and consider ourselves
+ //not to have a mask (so we don't get clipped to it)
+ if (maskMode)
+ return Keramik::TilePainter::PaintTrivialMask;
+ else
+ return Keramik::TilePainter::PaintFullBlend;
+ }
+ else
+ {
+ if (maskMode)
+ return Keramik::TilePainter::PaintMask;
+ else
+ return Keramik::TilePainter::PaintNormal;
+ }
+ }
+
+ Keramik::TilePainter::PaintMode pmodeFullBlend() const
+ {
+ return maskMode?Keramik::TilePainter::PaintMask : Keramik::TilePainter::PaintFullBlend;
+ }
+
+ bool kickerMode;
+
+ // For progress bar animation
+ TQTimer *animationTimer;
+
+ TQRect subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const;
+
+ // Disable copy constructor and = operator
+ KeramikStyle( const KeramikStyle& );
+ KeramikStyle& operator=( const KeramikStyle& );
+};
+
+#endif
+
+// vim: ts=4 sw=4 noet
+// kate: indent-width 4; replace-tabs off; tab-width 4;
diff --git a/tdestyles/keramik/keramikimage.h b/tdestyles/keramik/keramikimage.h
new file mode 100644
index 000000000..05bc75900
--- /dev/null
+++ b/tdestyles/keramik/keramikimage.h
@@ -0,0 +1,69 @@
+/* Keramik Style for KDE3
+ Copyright (c) 2002 Malte Starostik <malte@kde.org>
+ (c) 2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+ based on the KDE3 HighColor Style
+
+ Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ (C) 2001-2002 Fredrik Höglund <fredrik@kde.org>
+
+ Drawing routines adapted from the KDE2 HCStyle,
+ Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ (C) 2000 Dirk Mueller <mueller@kde.org>
+ (C) 2001 Martijn Klingens <klingens@kde.org>
+
+ Progressbar code based on TDEStyle, Copyright (C) 2001-2002 Karol Szwed <gallium@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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 KERAMIK_IMAGE_H
+#define KERAMIK_IMAGE_H
+
+struct KeramikEmbedImage
+{
+ bool haveAlpha;
+ int width;
+ int height;
+ int id;
+ const unsigned char* data;
+};
+
+extern KeramikEmbedImage* KeramikGetDbImage(int id);
+extern void KeramikDbCleanup();
+
+enum KeramikTileType
+{
+ KeramikTileTL = 0,
+ KeramikTileTC = 1,
+ KeramikTileTR = 2,
+ KeramikTileCL = 3,
+ KeramikTileCC = 4,
+ KeramikTileCR = 5,
+ KeramikTileRL = 6,
+ KeramikTileRC = 7,
+ KeramikTileRR = 8,
+ KeramikTileSeparator = 16,
+ KeramikSlider1 = 32,
+ KeramikSlider2 = 48,
+ KeramikSlider3 = 64,
+ KeramikSlider4 = 80,
+ KeramikGroove1 = 96,
+ KeramikGroove2 = 112
+};
+
+#endif
diff --git a/tdestyles/keramik/pics/checkbox-off.png b/tdestyles/keramik/pics/checkbox-off.png
new file mode 100644
index 000000000..0cade1079
--- /dev/null
+++ b/tdestyles/keramik/pics/checkbox-off.png
Binary files differ
diff --git a/tdestyles/keramik/pics/checkbox-on.png b/tdestyles/keramik/pics/checkbox-on.png
new file mode 100644
index 000000000..69c1a7d83
--- /dev/null
+++ b/tdestyles/keramik/pics/checkbox-on.png
Binary files differ
diff --git a/tdestyles/keramik/pics/checkbox-tri.png b/tdestyles/keramik/pics/checkbox-tri.png
new file mode 100644
index 000000000..c73ca8124
--- /dev/null
+++ b/tdestyles/keramik/pics/checkbox-tri.png
Binary files differ
diff --git a/tdestyles/keramik/pics/combobox-list-bc.png b/tdestyles/keramik/pics/combobox-list-bc.png
new file mode 100644
index 000000000..609a72627
--- /dev/null
+++ b/tdestyles/keramik/pics/combobox-list-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/combobox-list-bl.png b/tdestyles/keramik/pics/combobox-list-bl.png
new file mode 100644
index 000000000..512bbeafe
--- /dev/null
+++ b/tdestyles/keramik/pics/combobox-list-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/combobox-list-br.png b/tdestyles/keramik/pics/combobox-list-br.png
new file mode 100644
index 000000000..93151ffa6
--- /dev/null
+++ b/tdestyles/keramik/pics/combobox-list-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/combobox-list-cl.png b/tdestyles/keramik/pics/combobox-list-cl.png
new file mode 100644
index 000000000..e0b29c26d
--- /dev/null
+++ b/tdestyles/keramik/pics/combobox-list-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/combobox-list-cr.png b/tdestyles/keramik/pics/combobox-list-cr.png
new file mode 100644
index 000000000..33b9b7224
--- /dev/null
+++ b/tdestyles/keramik/pics/combobox-list-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/combobox-list-tc.png b/tdestyles/keramik/pics/combobox-list-tc.png
new file mode 100644
index 000000000..a3f5d7225
--- /dev/null
+++ b/tdestyles/keramik/pics/combobox-list-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/combobox-list-tl.png b/tdestyles/keramik/pics/combobox-list-tl.png
new file mode 100644
index 000000000..89d4b48d2
--- /dev/null
+++ b/tdestyles/keramik/pics/combobox-list-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/combobox-list-tr.png b/tdestyles/keramik/pics/combobox-list-tr.png
new file mode 100644
index 000000000..54e5d6032
--- /dev/null
+++ b/tdestyles/keramik/pics/combobox-list-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/frame-shadow-cl.png b/tdestyles/keramik/pics/frame-shadow-cl.png
new file mode 100644
index 000000000..d9b5edb1f
--- /dev/null
+++ b/tdestyles/keramik/pics/frame-shadow-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/frame-shadow-tc.png b/tdestyles/keramik/pics/frame-shadow-tc.png
new file mode 100644
index 000000000..408e07314
--- /dev/null
+++ b/tdestyles/keramik/pics/frame-shadow-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/frame-shadow-tl.png b/tdestyles/keramik/pics/frame-shadow-tl.png
new file mode 100644
index 000000000..8e6e3a147
--- /dev/null
+++ b/tdestyles/keramik/pics/frame-shadow-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-bc.png b/tdestyles/keramik/pics/listview-bc.png
new file mode 100644
index 000000000..fc615ea8a
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-bl.png b/tdestyles/keramik/pics/listview-bl.png
new file mode 100644
index 000000000..efd68101a
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-br.png b/tdestyles/keramik/pics/listview-br.png
new file mode 100644
index 000000000..7e35a14c8
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-cc.png b/tdestyles/keramik/pics/listview-cc.png
new file mode 100644
index 000000000..9fa204bf4
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-cl.png b/tdestyles/keramik/pics/listview-cl.png
new file mode 100644
index 000000000..41850b2e6
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-cr.png b/tdestyles/keramik/pics/listview-cr.png
new file mode 100644
index 000000000..69b1cf8c6
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-bc.png b/tdestyles/keramik/pics/listview-pressed-bc.png
new file mode 100644
index 000000000..283fe7329
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-bl.png b/tdestyles/keramik/pics/listview-pressed-bl.png
new file mode 100644
index 000000000..a457f83a6
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-br.png b/tdestyles/keramik/pics/listview-pressed-br.png
new file mode 100644
index 000000000..a49203f89
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-cc.png b/tdestyles/keramik/pics/listview-pressed-cc.png
new file mode 100644
index 000000000..63265116e
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-cl.png b/tdestyles/keramik/pics/listview-pressed-cl.png
new file mode 100644
index 000000000..7dcc0540c
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-cr.png b/tdestyles/keramik/pics/listview-pressed-cr.png
new file mode 100644
index 000000000..3a0b74f9a
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-tc.png b/tdestyles/keramik/pics/listview-pressed-tc.png
new file mode 100644
index 000000000..1fa2e6905
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-tl.png b/tdestyles/keramik/pics/listview-pressed-tl.png
new file mode 100644
index 000000000..e58e62306
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-pressed-tr.png b/tdestyles/keramik/pics/listview-pressed-tr.png
new file mode 100644
index 000000000..bc33f3823
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-pressed-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-tc.png b/tdestyles/keramik/pics/listview-tc.png
new file mode 100644
index 000000000..09434cebb
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-tl.png b/tdestyles/keramik/pics/listview-tl.png
new file mode 100644
index 000000000..d2ca26d7a
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/listview-tr.png b/tdestyles/keramik/pics/listview-tr.png
new file mode 100644
index 000000000..42c49a597
--- /dev/null
+++ b/tdestyles/keramik/pics/listview-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/menuitem-cc.png b/tdestyles/keramik/pics/menuitem-cc.png
new file mode 100644
index 000000000..29362ccc8
--- /dev/null
+++ b/tdestyles/keramik/pics/menuitem-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/menuitem-cl.png b/tdestyles/keramik/pics/menuitem-cl.png
new file mode 100644
index 000000000..c742516f4
--- /dev/null
+++ b/tdestyles/keramik/pics/menuitem-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/menuitem-cr.png b/tdestyles/keramik/pics/menuitem-cr.png
new file mode 100644
index 000000000..c742516f4
--- /dev/null
+++ b/tdestyles/keramik/pics/menuitem-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/progressbar-cc.png b/tdestyles/keramik/pics/progressbar-cc.png
new file mode 100644
index 000000000..e7881df47
--- /dev/null
+++ b/tdestyles/keramik/pics/progressbar-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/progressbar-cl.png b/tdestyles/keramik/pics/progressbar-cl.png
new file mode 100644
index 000000000..66824c873
--- /dev/null
+++ b/tdestyles/keramik/pics/progressbar-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/progressbar-cr.png b/tdestyles/keramik/pics/progressbar-cr.png
new file mode 100644
index 000000000..c6d61e75d
--- /dev/null
+++ b/tdestyles/keramik/pics/progressbar-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-bc.png b/tdestyles/keramik/pics/pushbutton-bc.png
new file mode 100644
index 000000000..62f169aa2
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-bl.png b/tdestyles/keramik/pics/pushbutton-bl.png
new file mode 100644
index 000000000..ea17ef991
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-br.png b/tdestyles/keramik/pics/pushbutton-br.png
new file mode 100644
index 000000000..91703e742
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-cc.png b/tdestyles/keramik/pics/pushbutton-cc.png
new file mode 100644
index 000000000..ac5a2fdc0
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-cl.png b/tdestyles/keramik/pics/pushbutton-cl.png
new file mode 100644
index 000000000..0a9c56630
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-cr.png b/tdestyles/keramik/pics/pushbutton-cr.png
new file mode 100644
index 000000000..68449467f
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-bc.png b/tdestyles/keramik/pics/pushbutton-default-bc.png
new file mode 100644
index 000000000..308020237
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-bl.png b/tdestyles/keramik/pics/pushbutton-default-bl.png
new file mode 100644
index 000000000..97c69cd1c
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-br.png b/tdestyles/keramik/pics/pushbutton-default-br.png
new file mode 100644
index 000000000..e084dca00
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-cc.png b/tdestyles/keramik/pics/pushbutton-default-cc.png
new file mode 100644
index 000000000..51e655302
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-cl.png b/tdestyles/keramik/pics/pushbutton-default-cl.png
new file mode 100644
index 000000000..5c4c001b1
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-cr.png b/tdestyles/keramik/pics/pushbutton-default-cr.png
new file mode 100644
index 000000000..0b1ea243b
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-bc.png b/tdestyles/keramik/pics/pushbutton-default-hov-bc.png
new file mode 100644
index 000000000..1c3f23766
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-bl.png b/tdestyles/keramik/pics/pushbutton-default-hov-bl.png
new file mode 100644
index 000000000..5072df3a7
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-br.png b/tdestyles/keramik/pics/pushbutton-default-hov-br.png
new file mode 100644
index 000000000..827df317d
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-cc.png b/tdestyles/keramik/pics/pushbutton-default-hov-cc.png
new file mode 100644
index 000000000..ec57f7ed7
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-cl.png b/tdestyles/keramik/pics/pushbutton-default-hov-cl.png
new file mode 100644
index 000000000..09fdf4dfa
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-cr.png b/tdestyles/keramik/pics/pushbutton-default-hov-cr.png
new file mode 100644
index 000000000..131c96f55
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-tc.png b/tdestyles/keramik/pics/pushbutton-default-hov-tc.png
new file mode 100644
index 000000000..45f4e86c3
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-tl.png b/tdestyles/keramik/pics/pushbutton-default-hov-tl.png
new file mode 100644
index 000000000..13e2cdfa2
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-hov-tr.png b/tdestyles/keramik/pics/pushbutton-default-hov-tr.png
new file mode 100644
index 000000000..0eb2d5f2d
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-hov-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-bc.png b/tdestyles/keramik/pics/pushbutton-default-pressed-bc.png
new file mode 100644
index 000000000..7d1f31b4b
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-bl.png b/tdestyles/keramik/pics/pushbutton-default-pressed-bl.png
new file mode 100644
index 000000000..05d432d3a
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-br.png b/tdestyles/keramik/pics/pushbutton-default-pressed-br.png
new file mode 100644
index 000000000..5ac4eb761
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-cc.png b/tdestyles/keramik/pics/pushbutton-default-pressed-cc.png
new file mode 100644
index 000000000..a29eb9b26
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-cl.png b/tdestyles/keramik/pics/pushbutton-default-pressed-cl.png
new file mode 100644
index 000000000..1732ab586
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-cr.png b/tdestyles/keramik/pics/pushbutton-default-pressed-cr.png
new file mode 100644
index 000000000..3e52fd79f
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-tc.png b/tdestyles/keramik/pics/pushbutton-default-pressed-tc.png
new file mode 100644
index 000000000..a2774ed4d
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-tl.png b/tdestyles/keramik/pics/pushbutton-default-pressed-tl.png
new file mode 100644
index 000000000..209673d91
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-pressed-tr.png b/tdestyles/keramik/pics/pushbutton-default-pressed-tr.png
new file mode 100644
index 000000000..4b4d8bed1
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-pressed-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-tc.png b/tdestyles/keramik/pics/pushbutton-default-tc.png
new file mode 100644
index 000000000..e71531f73
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-tl.png b/tdestyles/keramik/pics/pushbutton-default-tl.png
new file mode 100644
index 000000000..02c8adb38
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-default-tr.png b/tdestyles/keramik/pics/pushbutton-default-tr.png
new file mode 100644
index 000000000..741dd67cb
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-default-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-bc.png b/tdestyles/keramik/pics/pushbutton-hov-bc.png
new file mode 100644
index 000000000..1b7731085
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-bl.png b/tdestyles/keramik/pics/pushbutton-hov-bl.png
new file mode 100644
index 000000000..29f066774
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-br.png b/tdestyles/keramik/pics/pushbutton-hov-br.png
new file mode 100644
index 000000000..c7b045337
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-cc.png b/tdestyles/keramik/pics/pushbutton-hov-cc.png
new file mode 100644
index 000000000..f57781d87
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-cl.png b/tdestyles/keramik/pics/pushbutton-hov-cl.png
new file mode 100644
index 000000000..1540ef437
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-cr.png b/tdestyles/keramik/pics/pushbutton-hov-cr.png
new file mode 100644
index 000000000..e105ae6f8
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-tc.png b/tdestyles/keramik/pics/pushbutton-hov-tc.png
new file mode 100644
index 000000000..fa2a00270
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-tl.png b/tdestyles/keramik/pics/pushbutton-hov-tl.png
new file mode 100644
index 000000000..9eddbf5f9
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-hov-tr.png b/tdestyles/keramik/pics/pushbutton-hov-tr.png
new file mode 100644
index 000000000..c4ea2e1ae
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-hov-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-bc.png b/tdestyles/keramik/pics/pushbutton-pressed-bc.png
new file mode 100644
index 000000000..1e9097faa
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-bl.png b/tdestyles/keramik/pics/pushbutton-pressed-bl.png
new file mode 100644
index 000000000..ae8ad9ba3
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-br.png b/tdestyles/keramik/pics/pushbutton-pressed-br.png
new file mode 100644
index 000000000..8d1a62e7e
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-cc.png b/tdestyles/keramik/pics/pushbutton-pressed-cc.png
new file mode 100644
index 000000000..09cb446ba
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-cl.png b/tdestyles/keramik/pics/pushbutton-pressed-cl.png
new file mode 100644
index 000000000..1291cf33f
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-cr.png b/tdestyles/keramik/pics/pushbutton-pressed-cr.png
new file mode 100644
index 000000000..6e35bd28b
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-tc.png b/tdestyles/keramik/pics/pushbutton-pressed-tc.png
new file mode 100644
index 000000000..ab1ccf476
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-tl.png b/tdestyles/keramik/pics/pushbutton-pressed-tl.png
new file mode 100644
index 000000000..41df0033f
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-pressed-tr.png b/tdestyles/keramik/pics/pushbutton-pressed-tr.png
new file mode 100644
index 000000000..fc83cfdef
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-pressed-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-bc.png b/tdestyles/keramik/pics/pushbutton-small-bc.png
new file mode 100644
index 000000000..b55ed441c
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-bl.png b/tdestyles/keramik/pics/pushbutton-small-bl.png
new file mode 100644
index 000000000..fc14a94c1
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-br.png b/tdestyles/keramik/pics/pushbutton-small-br.png
new file mode 100644
index 000000000..f24b47af1
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-cc.png b/tdestyles/keramik/pics/pushbutton-small-cc.png
new file mode 100644
index 000000000..8f8d49964
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-cl.png b/tdestyles/keramik/pics/pushbutton-small-cl.png
new file mode 100644
index 000000000..9ce9e492f
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-cr.png b/tdestyles/keramik/pics/pushbutton-small-cr.png
new file mode 100644
index 000000000..db05257b2
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-bc.png b/tdestyles/keramik/pics/pushbutton-small-pressed-bc.png
new file mode 100644
index 000000000..560f17c5d
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-bl.png b/tdestyles/keramik/pics/pushbutton-small-pressed-bl.png
new file mode 100644
index 000000000..36e39f88d
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-br.png b/tdestyles/keramik/pics/pushbutton-small-pressed-br.png
new file mode 100644
index 000000000..d269e61bf
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-cc.png b/tdestyles/keramik/pics/pushbutton-small-pressed-cc.png
new file mode 100644
index 000000000..abab3832c
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-cl.png b/tdestyles/keramik/pics/pushbutton-small-pressed-cl.png
new file mode 100644
index 000000000..8049bee04
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-cr.png b/tdestyles/keramik/pics/pushbutton-small-pressed-cr.png
new file mode 100644
index 000000000..ef13139c2
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-tc.png b/tdestyles/keramik/pics/pushbutton-small-pressed-tc.png
new file mode 100644
index 000000000..d10fc26a8
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-tl.png b/tdestyles/keramik/pics/pushbutton-small-pressed-tl.png
new file mode 100644
index 000000000..7f189e50d
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-pressed-tr.png b/tdestyles/keramik/pics/pushbutton-small-pressed-tr.png
new file mode 100644
index 000000000..5262f63a2
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-pressed-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-tc.png b/tdestyles/keramik/pics/pushbutton-small-tc.png
new file mode 100644
index 000000000..216126077
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-tl.png b/tdestyles/keramik/pics/pushbutton-small-tl.png
new file mode 100644
index 000000000..75d8052b1
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-small-tr.png b/tdestyles/keramik/pics/pushbutton-small-tr.png
new file mode 100644
index 000000000..18ac1208d
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-small-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-tc.png b/tdestyles/keramik/pics/pushbutton-tc.png
new file mode 100644
index 000000000..0d0e396d2
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-tl.png b/tdestyles/keramik/pics/pushbutton-tl.png
new file mode 100644
index 000000000..6904db252
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/pushbutton-tr.png b/tdestyles/keramik/pics/pushbutton-tr.png
new file mode 100644
index 000000000..b3e34dec2
--- /dev/null
+++ b/tdestyles/keramik/pics/pushbutton-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/radiobutton-off.png b/tdestyles/keramik/pics/radiobutton-off.png
new file mode 100644
index 000000000..6eefc781c
--- /dev/null
+++ b/tdestyles/keramik/pics/radiobutton-off.png
Binary files differ
diff --git a/tdestyles/keramik/pics/radiobutton-on.png b/tdestyles/keramik/pics/radiobutton-on.png
new file mode 100644
index 000000000..ab4dc6798
--- /dev/null
+++ b/tdestyles/keramik/pics/radiobutton-on.png
Binary files differ
diff --git a/tdestyles/keramik/pics/ripple.png b/tdestyles/keramik/pics/ripple.png
new file mode 100644
index 000000000..6b7d04ef3
--- /dev/null
+++ b/tdestyles/keramik/pics/ripple.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-hbar-arrow1.png b/tdestyles/keramik/pics/scrollbar-hbar-arrow1.png
new file mode 100644
index 000000000..af21cb269
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-hbar-arrow1.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-hbar-arrow2.png b/tdestyles/keramik/pics/scrollbar-hbar-arrow2.png
new file mode 100644
index 000000000..231520d12
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-hbar-arrow2.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-hbar-groove1.png b/tdestyles/keramik/pics/scrollbar-hbar-groove1.png
new file mode 100644
index 000000000..0219f2e28
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-hbar-groove1.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-hbar-groove2.png b/tdestyles/keramik/pics/scrollbar-hbar-groove2.png
new file mode 100644
index 000000000..990b5b06d
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-hbar-groove2.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-hbar-slider1.png b/tdestyles/keramik/pics/scrollbar-hbar-slider1.png
new file mode 100644
index 000000000..6f0896ed9
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-hbar-slider1.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-hbar-slider2.png b/tdestyles/keramik/pics/scrollbar-hbar-slider2.png
new file mode 100644
index 000000000..c13ecc00c
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-hbar-slider2.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-hbar-slider3.png b/tdestyles/keramik/pics/scrollbar-hbar-slider3.png
new file mode 100644
index 000000000..105718ba7
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-hbar-slider3.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-hbar-slider4.png b/tdestyles/keramik/pics/scrollbar-hbar-slider4.png
new file mode 100644
index 000000000..9d56a784c
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-hbar-slider4.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-vbar-arrow1.png b/tdestyles/keramik/pics/scrollbar-vbar-arrow1.png
new file mode 100644
index 000000000..cb2f70aeb
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-vbar-arrow1.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-vbar-arrow2.png b/tdestyles/keramik/pics/scrollbar-vbar-arrow2.png
new file mode 100644
index 000000000..4d36f077e
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-vbar-arrow2.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-vbar-groove1.png b/tdestyles/keramik/pics/scrollbar-vbar-groove1.png
new file mode 100644
index 000000000..62ed6491d
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-vbar-groove1.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-vbar-groove2.png b/tdestyles/keramik/pics/scrollbar-vbar-groove2.png
new file mode 100644
index 000000000..219781e23
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-vbar-groove2.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-vbar-slider1.png b/tdestyles/keramik/pics/scrollbar-vbar-slider1.png
new file mode 100644
index 000000000..29b85856c
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-vbar-slider1.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-vbar-slider2.png b/tdestyles/keramik/pics/scrollbar-vbar-slider2.png
new file mode 100644
index 000000000..ebacc8e67
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-vbar-slider2.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-vbar-slider3.png b/tdestyles/keramik/pics/scrollbar-vbar-slider3.png
new file mode 100644
index 000000000..197be82c5
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-vbar-slider3.png
Binary files differ
diff --git a/tdestyles/keramik/pics/scrollbar-vbar-slider4.png b/tdestyles/keramik/pics/scrollbar-vbar-slider4.png
new file mode 100644
index 000000000..fdb931f4f
--- /dev/null
+++ b/tdestyles/keramik/pics/scrollbar-vbar-slider4.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-bc.png b/tdestyles/keramik/pics/slider-hgroove-bc.png
new file mode 100644
index 000000000..d509e8357
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-bl.png b/tdestyles/keramik/pics/slider-hgroove-bl.png
new file mode 100644
index 000000000..12cb99a5b
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-br.png b/tdestyles/keramik/pics/slider-hgroove-br.png
new file mode 100644
index 000000000..c540bd09b
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-cc.png b/tdestyles/keramik/pics/slider-hgroove-cc.png
new file mode 100644
index 000000000..cad18f802
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-cl.png b/tdestyles/keramik/pics/slider-hgroove-cl.png
new file mode 100644
index 000000000..a261a086f
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-cr.png b/tdestyles/keramik/pics/slider-hgroove-cr.png
new file mode 100644
index 000000000..601ff7d20
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-tc.png b/tdestyles/keramik/pics/slider-hgroove-tc.png
new file mode 100644
index 000000000..f8ee8d90b
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-tl.png b/tdestyles/keramik/pics/slider-hgroove-tl.png
new file mode 100644
index 000000000..525242cf5
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-hgroove-tr.png b/tdestyles/keramik/pics/slider-hgroove-tr.png
new file mode 100644
index 000000000..7fcd449ad
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-hgroove-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-bc.png b/tdestyles/keramik/pics/slider-vgroove-bc.png
new file mode 100644
index 000000000..d81815cbf
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-bl.png b/tdestyles/keramik/pics/slider-vgroove-bl.png
new file mode 100644
index 000000000..5f7063525
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-br.png b/tdestyles/keramik/pics/slider-vgroove-br.png
new file mode 100644
index 000000000..80fbb0c38
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-cc.png b/tdestyles/keramik/pics/slider-vgroove-cc.png
new file mode 100644
index 000000000..56c3e1665
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-cl.png b/tdestyles/keramik/pics/slider-vgroove-cl.png
new file mode 100644
index 000000000..cca74d7e3
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-cr.png b/tdestyles/keramik/pics/slider-vgroove-cr.png
new file mode 100644
index 000000000..5e0bba54f
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-tc.png b/tdestyles/keramik/pics/slider-vgroove-tc.png
new file mode 100644
index 000000000..d381a1672
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-tl.png b/tdestyles/keramik/pics/slider-vgroove-tl.png
new file mode 100644
index 000000000..e2bb6ca4e
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider-vgroove-tr.png b/tdestyles/keramik/pics/slider-vgroove-tr.png
new file mode 100644
index 000000000..03fe46405
--- /dev/null
+++ b/tdestyles/keramik/pics/slider-vgroove-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/slider.png b/tdestyles/keramik/pics/slider.png
new file mode 100644
index 000000000..6949eec33
--- /dev/null
+++ b/tdestyles/keramik/pics/slider.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-1.png b/tdestyles/keramik/pics/spinbox-1.png
new file mode 100644
index 000000000..728959423
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-1.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-2.png b/tdestyles/keramik/pics/spinbox-2.png
new file mode 100644
index 000000000..8dcebdc47
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-2.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-3.png b/tdestyles/keramik/pics/spinbox-3.png
new file mode 100644
index 000000000..43cdaf21d
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-3.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-arrow-down.png b/tdestyles/keramik/pics/spinbox-arrow-down.png
new file mode 100644
index 000000000..58d326e01
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-arrow-down.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-arrow-up.png b/tdestyles/keramik/pics/spinbox-arrow-up.png
new file mode 100644
index 000000000..1e1f7a72b
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-arrow-up.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-pressed-arrow-down.png b/tdestyles/keramik/pics/spinbox-pressed-arrow-down.png
new file mode 100644
index 000000000..71ce2ff98
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-pressed-arrow-down.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-pressed-arrow-up.png b/tdestyles/keramik/pics/spinbox-pressed-arrow-up.png
new file mode 100644
index 000000000..7fd277c26
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-pressed-arrow-up.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-pressed-down.png b/tdestyles/keramik/pics/spinbox-pressed-down.png
new file mode 100644
index 000000000..47ac06d41
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-pressed-down.png
Binary files differ
diff --git a/tdestyles/keramik/pics/spinbox-pressed-up.png b/tdestyles/keramik/pics/spinbox-pressed-up.png
new file mode 100644
index 000000000..ed499f6ef
--- /dev/null
+++ b/tdestyles/keramik/pics/spinbox-pressed-up.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-active-bc.png b/tdestyles/keramik/pics/tab-bottom-active-bc.png
new file mode 100644
index 000000000..2cc3e597a
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-active-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-active-bl.png b/tdestyles/keramik/pics/tab-bottom-active-bl.png
new file mode 100644
index 000000000..2f28a1cfa
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-active-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-active-br.png b/tdestyles/keramik/pics/tab-bottom-active-br.png
new file mode 100644
index 000000000..8d086710a
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-active-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-active-cc.png b/tdestyles/keramik/pics/tab-bottom-active-cc.png
new file mode 100644
index 000000000..29fa285ef
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-active-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-active-cl.png b/tdestyles/keramik/pics/tab-bottom-active-cl.png
new file mode 100644
index 000000000..54c629b55
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-active-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-active-cr.png b/tdestyles/keramik/pics/tab-bottom-active-cr.png
new file mode 100644
index 000000000..f36039005
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-active-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-inactive-bc.png b/tdestyles/keramik/pics/tab-bottom-inactive-bc.png
new file mode 100644
index 000000000..538b0e20e
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-inactive-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-inactive-bl.png b/tdestyles/keramik/pics/tab-bottom-inactive-bl.png
new file mode 100644
index 000000000..14e04519d
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-inactive-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-inactive-br.png b/tdestyles/keramik/pics/tab-bottom-inactive-br.png
new file mode 100644
index 000000000..79298a562
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-inactive-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-inactive-cc.png b/tdestyles/keramik/pics/tab-bottom-inactive-cc.png
new file mode 100644
index 000000000..e7fbaf864
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-inactive-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-inactive-cl.png b/tdestyles/keramik/pics/tab-bottom-inactive-cl.png
new file mode 100644
index 000000000..9d3aaed8f
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-inactive-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-inactive-cr.png b/tdestyles/keramik/pics/tab-bottom-inactive-cr.png
new file mode 100644
index 000000000..e873688c8
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-inactive-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-bottom-inactive-separator.png b/tdestyles/keramik/pics/tab-bottom-inactive-separator.png
new file mode 100644
index 000000000..525341543
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-bottom-inactive-separator.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-active-cc.png b/tdestyles/keramik/pics/tab-top-active-cc.png
new file mode 100644
index 000000000..494659c77
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-active-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-active-cl.png b/tdestyles/keramik/pics/tab-top-active-cl.png
new file mode 100644
index 000000000..b369f9570
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-active-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-active-cr.png b/tdestyles/keramik/pics/tab-top-active-cr.png
new file mode 100644
index 000000000..6cbf4238e
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-active-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-active-tc.png b/tdestyles/keramik/pics/tab-top-active-tc.png
new file mode 100644
index 000000000..44cf7d16d
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-active-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-active-tl.png b/tdestyles/keramik/pics/tab-top-active-tl.png
new file mode 100644
index 000000000..437f95bc2
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-active-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-active-tr.png b/tdestyles/keramik/pics/tab-top-active-tr.png
new file mode 100644
index 000000000..74cbc48e3
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-active-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-inactive-cc.png b/tdestyles/keramik/pics/tab-top-inactive-cc.png
new file mode 100644
index 000000000..1c2f0d47f
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-inactive-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-inactive-cl.png b/tdestyles/keramik/pics/tab-top-inactive-cl.png
new file mode 100644
index 000000000..3f4a23136
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-inactive-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-inactive-cr.png b/tdestyles/keramik/pics/tab-top-inactive-cr.png
new file mode 100644
index 000000000..477af0bc7
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-inactive-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-inactive-separator.png b/tdestyles/keramik/pics/tab-top-inactive-separator.png
new file mode 100644
index 000000000..fc03d5dbb
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-inactive-separator.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-inactive-tc.png b/tdestyles/keramik/pics/tab-top-inactive-tc.png
new file mode 100644
index 000000000..41eda7245
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-inactive-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-inactive-tl.png b/tdestyles/keramik/pics/tab-top-inactive-tl.png
new file mode 100644
index 000000000..114d9e99a
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-inactive-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/tab-top-inactive-tr.png b/tdestyles/keramik/pics/tab-top-inactive-tr.png
new file mode 100644
index 000000000..04a9019f8
--- /dev/null
+++ b/tdestyles/keramik/pics/tab-top-inactive-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/title-close-tiny.png b/tdestyles/keramik/pics/title-close-tiny.png
new file mode 100644
index 000000000..1e497547b
--- /dev/null
+++ b/tdestyles/keramik/pics/title-close-tiny.png
Binary files differ
diff --git a/tdestyles/keramik/pics/title-close.png b/tdestyles/keramik/pics/title-close.png
new file mode 100644
index 000000000..b9a7a8f45
--- /dev/null
+++ b/tdestyles/keramik/pics/title-close.png
Binary files differ
diff --git a/tdestyles/keramik/pics/title-iconify.png b/tdestyles/keramik/pics/title-iconify.png
new file mode 100644
index 000000000..6c87e05f3
--- /dev/null
+++ b/tdestyles/keramik/pics/title-iconify.png
Binary files differ
diff --git a/tdestyles/keramik/pics/title-maximize.png b/tdestyles/keramik/pics/title-maximize.png
new file mode 100644
index 000000000..6a47ce12d
--- /dev/null
+++ b/tdestyles/keramik/pics/title-maximize.png
Binary files differ
diff --git a/tdestyles/keramik/pics/title-restore.png b/tdestyles/keramik/pics/title-restore.png
new file mode 100644
index 000000000..12d48df42
--- /dev/null
+++ b/tdestyles/keramik/pics/title-restore.png
Binary files differ
diff --git a/tdestyles/keramik/pics/titlebutton-pressed.png b/tdestyles/keramik/pics/titlebutton-pressed.png
new file mode 100644
index 000000000..23587dd2f
--- /dev/null
+++ b/tdestyles/keramik/pics/titlebutton-pressed.png
Binary files differ
diff --git a/tdestyles/keramik/pics/titlebutton.png b/tdestyles/keramik/pics/titlebutton.png
new file mode 100644
index 000000000..bb99c9b30
--- /dev/null
+++ b/tdestyles/keramik/pics/titlebutton.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-bc.png b/tdestyles/keramik/pics/toolbar-clk-bc.png
new file mode 100644
index 000000000..4d8acdcde
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-bc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-bl.png b/tdestyles/keramik/pics/toolbar-clk-bl.png
new file mode 100644
index 000000000..891f380ed
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-bl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-br.png b/tdestyles/keramik/pics/toolbar-clk-br.png
new file mode 100644
index 000000000..d2493b18e
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-br.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-cc.png b/tdestyles/keramik/pics/toolbar-clk-cc.png
new file mode 100644
index 000000000..0ae970f6b
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-cc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-cl.png b/tdestyles/keramik/pics/toolbar-clk-cl.png
new file mode 100644
index 000000000..12467b4e7
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-cl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-cr.png b/tdestyles/keramik/pics/toolbar-clk-cr.png
new file mode 100644
index 000000000..75bea2f4c
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-cr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-tc.png b/tdestyles/keramik/pics/toolbar-clk-tc.png
new file mode 100644
index 000000000..fcd0e8cd2
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-tc.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-tl.png b/tdestyles/keramik/pics/toolbar-clk-tl.png
new file mode 100644
index 000000000..13625cf8e
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-tl.png
Binary files differ
diff --git a/tdestyles/keramik/pics/toolbar-clk-tr.png b/tdestyles/keramik/pics/toolbar-clk-tr.png
new file mode 100644
index 000000000..1b8c8f33d
--- /dev/null
+++ b/tdestyles/keramik/pics/toolbar-clk-tr.png
Binary files differ
diff --git a/tdestyles/keramik/pics/vslider.png b/tdestyles/keramik/pics/vslider.png
new file mode 100644
index 000000000..e43857388
--- /dev/null
+++ b/tdestyles/keramik/pics/vslider.png
Binary files differ
diff --git a/tdestyles/keramik/pixmaploader.cpp b/tdestyles/keramik/pixmaploader.cpp
new file mode 100644
index 000000000..00b4626fd
--- /dev/null
+++ b/tdestyles/keramik/pixmaploader.cpp
@@ -0,0 +1,629 @@
+/*
+ Copyright (c) 2002 Malte Starostik <malte@kde.org>
+ (c) 2002,2003 Maksim Orlovich <maksim@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+
+// $Id$
+
+#include <tqapplication.h>
+#include <tqbitmap.h>
+#include <tqglobal.h>
+#include <tqimage.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+
+#include "pixmaploader.h"
+
+
+#include "pixmaps.keramik"
+
+using namespace Keramik;
+
+PixmapLoader* PixmapLoader::s_instance = 0;
+
+PixmapLoader::PixmapLoader(): m_pixmapCache(327680, 2017)
+
+{
+ m_pixmapCache.setAutoDelete(true);
+
+ for (int c=0; c<256; c++)
+ clamp[c]=static_cast<unsigned char>(c);
+
+ for (int c=256; c<540; c++)
+ clamp[c] = 255;
+
+}
+
+void PixmapLoader::clear()
+{
+ //m_cache.clear();
+}
+
+TQImage* PixmapLoader::getDisabled(int name, const TQColor& color, const TQColor& back, bool blend)
+{
+ KeramikEmbedImage* edata = KeramikGetDbImage(name);
+ if (!edata)
+ return 0;
+
+ //Like getColored, but desaturate a bit, and lower gamma..
+
+ //Create a real image...
+ TQImage* img = new TQImage(edata->width, edata->height, 32);
+
+
+
+ //OK, now, fill it in, using the color..
+ TQ_UINT32 r, g,b;
+ TQ_UINT32 i = tqGray(color.rgb());
+ r = (3*color.red()+i)>>2;
+ g = (3*color.green()+i)>>2;
+ b = (3*color.blue()+i)>>2;
+
+ TQ_UINT32 br = back.red(), bg = back.green(), bb = back.blue();
+
+
+ if (edata->haveAlpha)
+ {
+ if (blend)
+ {
+ img->setAlphaBuffer(false);
+ TQ_UINT32* write = reinterpret_cast< TQ_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 3;
+
+ for (int pos = 0; pos < size; pos+=3)
+ {
+ TQ_UINT32 scale = edata->data[pos];
+ TQ_UINT32 add = (edata->data[pos+1]*i+127)>>8;
+ TQ_UINT32 alpha = edata->data[pos+2];
+ TQ_UINT32 destAlpha = 256 - alpha;
+
+ TQ_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ TQ_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ TQ_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+ *write =tqRgb(((rr*alpha+127)>>8) + ((br*destAlpha+127)>>8),
+ ((rg*alpha+127)>>8) + ((bg*destAlpha+127)>>8),
+ ((rb*alpha+127)>>8) + ((bb*destAlpha+127)>>8));
+
+ write++;
+ }
+ }
+ else
+ {
+ img->setAlphaBuffer(true);
+ TQ_UINT32* write = reinterpret_cast< TQ_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 3;
+
+ for (int pos = 0; pos < size; pos+=3)
+ {
+ TQ_UINT32 scale = edata->data[pos];
+ TQ_UINT32 add = (edata->data[pos+1]*i+127)>>8;
+ TQ_UINT32 alpha = edata->data[pos+2];
+
+ TQ_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ TQ_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ TQ_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+ *write =tqRgba(rr, rg, rb, alpha);
+
+ write++;
+ }
+
+ }
+ }
+ else
+ {
+ img->setAlphaBuffer(false);
+ TQ_UINT32* write = reinterpret_cast< TQ_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 2;
+
+ for (int pos = 0; pos < size; pos+=2)
+ {
+ TQ_UINT32 scale = edata->data[pos];
+ TQ_UINT32 add = (edata->data[pos+1]*i+127)>>8;
+ TQ_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ TQ_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ TQ_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+ *write =tqRgb(rr, rg, rb);
+ write++;
+ }
+ }
+
+ return img;
+}
+
+TQImage* PixmapLoader::getColored(int name, const TQColor& color, const TQColor& back, bool blend)
+{
+ KeramikEmbedImage* edata = KeramikGetDbImage(name);
+ if (!edata)
+ return 0;
+
+ //Create a real image...
+ TQImage* img = new TQImage(edata->width, edata->height, 32);
+
+ //OK, now, fill it in, using the color..
+ TQ_UINT32 r, g,b;
+ r = color.red() + 2;
+ g = color.green() + 2;
+ b = color.blue() + 2;
+
+// int i = tqGray(color.rgb());
+
+ TQ_UINT32 br = back.red(), bg = back.green(), bb = back.blue();
+
+ if (edata->haveAlpha)
+ {
+ if (blend)
+ {
+ img->setAlphaBuffer(false);
+
+ TQ_UINT32* write = reinterpret_cast< TQ_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 3;
+ for (int pos = 0; pos < size; pos+=3)
+ {
+ TQ_UINT32 scale = edata->data[pos];
+ TQ_UINT32 add = edata->data[pos+1];
+ TQ_UINT32 alpha = edata->data[pos+2];
+ TQ_UINT32 destAlpha = 256 - alpha;
+
+ if (scale != 0)
+ add = add*5/4;
+
+ TQ_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ TQ_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ TQ_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+ *write =tqRgb(((rr*alpha+127)>>8) + ((br*destAlpha+127)>>8),
+ ((rg*alpha+127)>>8) + ((bg*destAlpha+127)>>8),
+ ((rb*alpha+127)>>8) + ((bb*destAlpha+127)>>8));
+
+ write++;
+ }
+ }
+ else
+ {
+ img->setAlphaBuffer(true);
+
+ TQ_UINT32* write = reinterpret_cast< TQ_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 3;
+
+ for (int pos = 0; pos < size; pos+=3)
+ {
+ TQ_UINT32 scale = edata->data[pos];
+ TQ_UINT32 add = edata->data[pos+1];
+ TQ_UINT32 alpha = edata->data[pos+2];
+ if (scale != 0)
+ add = add*5/4;
+
+ TQ_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ TQ_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ TQ_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+ *write =tqRgba(rr, rg, rb, alpha);
+ write++;
+ }
+ }
+ }
+ else
+ {
+ img->setAlphaBuffer(false);
+
+ TQ_UINT32* write = reinterpret_cast< TQ_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 2;
+
+ for (int pos = 0; pos < size; pos+=2)
+ {
+ TQ_UINT32 scale = edata->data[pos];
+ TQ_UINT32 add = edata->data[pos+1];
+ if (scale != 0)
+ add = add*5/4;
+
+ TQ_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ TQ_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ TQ_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+
+ *write =tqRgb(rr, rg, rb);
+ write++;
+ }
+ }
+
+ return img;
+}
+
+TQPixmap PixmapLoader::pixmap( int name, const TQColor& color, const TQColor& bg, bool disabled, bool blend )
+{
+ return scale(name, 0, 0, color, bg, disabled, blend);
+}
+
+
+TQPixmap PixmapLoader::scale( int name, int width, int height, const TQColor& color, const TQColor& bg, bool disabled, bool blend )
+{
+ KeramikCacheEntry entry(name, color, bg, disabled, blend, width, height);
+ KeramikCacheEntry* cacheEntry;
+
+ int key = entry.key();
+
+ if ((cacheEntry = m_pixmapCache.find(key, true)))
+ {
+ if (entry == *cacheEntry) //True match!
+ return *cacheEntry->m_pixmap;
+ else //Remove old entry in case of a conflict!
+ m_pixmapCache.remove(key);
+ }
+
+
+ TQImage* img = 0;
+ TQPixmap* result = 0;
+
+ if (disabled)
+ img = getDisabled(name, color, bg, blend);
+ else
+ img = getColored(name, color, bg, blend);
+
+ if (!img)
+ {
+ KeramikCacheEntry* toAdd = new KeramikCacheEntry(entry);
+ toAdd->m_pixmap = new TQPixmap();
+ m_pixmapCache.insert(key, toAdd, 16);
+ return TQPixmap();
+ }
+
+ if (width == 0 && height == 0)
+ result = new TQPixmap(*img);
+ else
+ result = new TQPixmap(img->smoothScale( width ? width : img->width(),
+ height ? height: img->height()));
+ delete img;
+
+ KeramikCacheEntry* toAdd = new KeramikCacheEntry(entry);
+ toAdd->m_pixmap = result;
+
+ if (!m_pixmapCache.insert(key, toAdd, result->width()*result->height()*result->depth()/8)) {
+ TQPixmap toRet = *result;
+ delete toAdd;
+ return toRet;
+ }
+
+ return *result;
+}
+
+TQSize PixmapLoader::size( int id )
+{
+ KeramikEmbedImage* edata = KeramikGetDbImage(id);
+ if (!edata)
+ return TQSize(0,0);
+ return TQSize(edata->width, edata->height);
+}
+
+void TilePainter::draw( TQPainter *p, int x, int y, int width, int height, const TQColor& color, const TQColor& bg, bool disabled, PaintMode mode )
+{
+ if (mode == PaintTrivialMask)
+ {
+ p->fillRect(x, y, width, height, Qt::color1);
+ return;
+ }
+
+ bool swBlend = (mode != PaintFullBlend);
+ unsigned int scaledColumns = 0, scaledRows = 0, lastScaledColumn = 0, lastScaledRow = 0;
+ int scaleWidth = width, scaleHeight = height;
+
+ //scaleWidth, scaleHeight are calculated to contain the area available
+ //for all tiled and stretched columns/rows respectively.
+ //This is need to redistribute the area remaining after painting
+ //the "fixed" elements. We also keep track of the last col and row
+ //being scaled so rounding errors don't cause us to be short a pixel or so.
+ for ( unsigned int col = 0; col < columns(); ++col )
+ if ( columnMode( col ) != Fixed )
+ {
+ scaledColumns++;
+ lastScaledColumn = col;
+ }
+ else scaleWidth -= PixmapLoader::the().size (absTileName( col, 0 ) ).width();
+
+ for ( unsigned int row = 0; row < rows(); ++row )
+ if ( rowMode( row ) != Fixed )
+ {
+ scaledRows++;
+ lastScaledRow = row;
+ }
+ else scaleHeight -= PixmapLoader::the().size (absTileName( 0, row ) ).height();
+
+
+ if ( scaleWidth < 0 ) scaleWidth = 0;
+ if ( scaleHeight < 0 ) scaleHeight = 0;
+
+
+ int ypos = y;
+
+ //Center vertically if everything is fixed but there is extra room remaining
+ if ( scaleHeight && !scaledRows )
+ ypos += scaleHeight / 2;
+
+ for ( unsigned int row = 0; row < rows(); ++row )
+ {
+ int xpos = x;
+
+ //Center horizontally if extra space and no where to redistribute it to...
+ if ( scaleWidth && !scaledColumns )
+ xpos += scaleWidth / 2;
+
+ //If not fixed vertically, calculate our share of space available
+ //for scalable rows.
+ int h = rowMode( row ) == Fixed ? 0 : scaleHeight / scaledRows;
+
+ //Redistribute any "extra" pixels to the last scaleable row.
+ if ( scaledRows && row == lastScaledRow )
+ {
+ int allocatedEvenly = scaleHeight / scaledRows * scaledRows;
+ h += scaleHeight - allocatedEvenly;
+ }
+
+
+ //If we're fixed, get the height from the pixmap itself.
+ int realH = h ? h : PixmapLoader::the().size (absTileName( 0, row ) ).height();
+
+ //Skip non-fitting stretched/tiled rows, too.
+ if (rowMode( row ) != Fixed && h == 0)
+ continue;
+
+
+ //Set h to 0 to denote that we aren't scaling
+ if ( rowMode( row ) == Tiled )
+ h = 0;
+
+ for ( unsigned int col = 0; col < columns(); ++col )
+ {
+ //Calculate width for rows that aren't fixed.
+ int w = columnMode( col ) == Fixed ? 0 : scaleWidth / scaledColumns;
+
+ //Get the width of the pixmap..
+ int tileW = PixmapLoader::the().size (absTileName( col, row ) ).width();
+
+ //Redistribute any extra pixels..
+ if ( scaledColumns && col == lastScaledColumn ) w += scaleWidth - scaleWidth / scaledColumns * scaledColumns;
+
+ //The width to use...
+ int realW = w ? w : tileW;
+
+ //Skip any non-fitting stretched/tiled columns
+ if (columnMode( col ) != Fixed && w == 0)
+ continue;
+
+ //Set w to 0 to denote that we aren't scaling
+ if ( columnMode( col ) == Tiled )
+ w = 0;
+
+ //If we do indeed have a pixmap..
+ if ( tileW )
+ {
+ //If scaling in either direction.
+ if ( w || h )
+ {
+ if (mode != PaintMask)
+ {
+ p->drawTiledPixmap( xpos, ypos, realW, realH, scale( col, row, w, h, color, bg, disabled, swBlend ) );
+ }
+ else
+ {
+ const TQBitmap* mask = scale( col, row, w, h, color, bg, disabled, false ).mask();
+ if (mask)
+ {
+ p->setBackgroundColor(Qt::color0);
+ p->setPen(Qt::color1);
+ p->drawTiledPixmap( xpos, ypos, realW, realH, *mask);
+ }
+ else
+ p->fillRect ( xpos, ypos, realW, realH, Qt::color1);
+ }
+ }
+ else
+ {
+ //Tiling (or fixed, the same really)
+ if (mode != PaintMask)
+ {
+ p->drawTiledPixmap( xpos, ypos, realW, realH, tile( col, row, color, bg, disabled, swBlend ) );
+ }
+ else
+ {
+ const TQBitmap* mask = tile( col, row, color, bg, disabled, false ).mask();
+ if (mask)
+ {
+ p->setBackgroundColor(Qt::color0);
+ p->setPen(Qt::color1);
+ p->drawTiledPixmap( xpos, ypos, realW, realH, *mask);
+ }
+ else
+ p->fillRect ( xpos, ypos, realW, realH, Qt::color1);
+
+ }
+ }
+ }
+
+ //Advance horizontal position
+ xpos += realW;
+ }
+
+ //Advance vertical position
+ ypos += realH;
+ }
+}
+
+RectTilePainter::RectTilePainter( int name,
+ bool scaleH, bool scaleV,
+ unsigned int columns, unsigned int rows )
+ : TilePainter( name ),
+ m_scaleH( scaleH ),
+ m_scaleV( scaleV )
+{
+ m_columns = columns;
+ m_rows = rows;
+
+ TileMode mh = m_scaleH ? Scaled : Tiled;
+ TileMode mv = m_scaleV ? Scaled : Tiled;
+ for (int c=0; c<4; c++)
+ {
+ if (c != 1)
+ colMde[c] = Fixed;
+ else
+ colMde[c] = mh;
+ }
+
+ for (int c=0; c<4; c++)
+ {
+ if (c != 1)
+ rowMde[c] = Fixed;
+ else
+ rowMde[c] = mv;
+ }
+
+}
+
+int RectTilePainter::tileName( unsigned int column, unsigned int row ) const
+{
+ return row *3 + column;
+}
+
+ActiveTabPainter::ActiveTabPainter( bool bottom )
+ : RectTilePainter( bottom? keramik_tab_bottom_active: keramik_tab_top_active, false),
+ m_bottom( bottom )
+{
+ m_rows = 2;
+ if (m_bottom)
+ {
+ rowMde[0] = rowMde[2] = rowMde[3] = Scaled;
+ rowMde[1] = Fixed;
+ }
+ else
+ {
+ rowMde[0] = rowMde[2] = rowMde[3] = Fixed;
+ rowMde[1] = Scaled;
+ }
+}
+
+int ActiveTabPainter::tileName( unsigned int column, unsigned int row ) const
+{
+ if ( m_bottom )
+ return RectTilePainter::tileName( column, row + 1 );
+ return RectTilePainter::tileName( column, row );
+}
+
+InactiveTabPainter::InactiveTabPainter( Mode mode, bool bottom )
+ : RectTilePainter( bottom? keramik_tab_bottom_inactive: keramik_tab_top_inactive, false),
+ m_mode( mode ), m_bottom( bottom )
+{
+ m_rows = 2;
+ if (m_bottom)
+ {
+ rowMde[0] = Scaled;
+ rowMde[1] = Fixed;
+ }
+ else
+ {
+ rowMde[0] = Fixed;
+ rowMde[1] = Scaled;
+ }
+
+ /**
+ Most fully, inactive tabs look like this:
+ L C R
+ / --- \
+ | === |
+
+ Where L,C, and R denote the tile positions. Of course, we don't want to draw all of the rounding for all the tabs.
+
+ We want the left-most tab to look like this:
+
+ L C
+ / --
+ | ==
+
+ "Middle" tabs look like this:
+
+ L C
+ | --
+ | ==
+
+ And the right most tab looks like this:
+
+ L C R
+ | -- \
+ | == |
+
+ So we have to vary the number of columns, and for everything but left-most tab, the L tab gets the special separator
+ tile.
+ */
+
+ Mode rightMost = TQApplication::reverseLayout() ? First : Last;
+ m_columns = (m_mode == rightMost ? 3 : 2);
+}
+
+int InactiveTabPainter::tileName( unsigned int column, unsigned int row ) const
+{
+ Mode leftMost = TQApplication::reverseLayout() ? Last : First;
+ if ( column == 0 && m_mode != leftMost )
+ return KeramikTileSeparator;
+ if ( m_bottom )
+ return RectTilePainter::tileName( column, row + 1 );
+ return RectTilePainter::tileName( column, row );
+}
+
+ScrollBarPainter::ScrollBarPainter( int type, int count, bool horizontal )
+ : TilePainter( name( horizontal ) ),
+ m_type( type ),
+ m_count( count ),
+ m_horizontal( horizontal )
+{
+ for (int c=0; c<5; c++)
+ {
+ if ( !m_horizontal || !( c % 2 ) ) colMde[c] = Fixed;
+ else colMde[c] = Tiled;
+
+ if ( m_horizontal || !( c % 2 ) ) rowMde[c] = Fixed;
+ else rowMde[c] = Tiled;
+ }
+
+ m_columns = m_horizontal ? m_count : 1;
+ m_rows = m_horizontal ? 1 : m_count;
+
+}
+
+int ScrollBarPainter::name( bool horizontal )
+{
+ return horizontal? keramik_scrollbar_hbar: keramik_scrollbar_vbar;
+}
+
+int ScrollBarPainter::tileName( unsigned int column, unsigned int row ) const
+{
+ unsigned int num = ( column ? column : row ) + 1;
+ if ( m_count == 5 )
+ if ( num == 3 ) num = 4;
+ else if ( num == 4 ) num = 2;
+ else if ( num == 5 ) num = 3;
+
+ return m_type + (num-1)*16;
+}
+
+int SpinBoxPainter::tileName( unsigned int column, unsigned int ) const
+{
+ return column + 1;
+}
+
+// vim: ts=4 sw=4 noet
+// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
diff --git a/tdestyles/keramik/pixmaploader.h b/tdestyles/keramik/pixmaploader.h
new file mode 100644
index 000000000..ab0bb4223
--- /dev/null
+++ b/tdestyles/keramik/pixmaploader.h
@@ -0,0 +1,367 @@
+/*
+ Copyright (c) 2002 Malte Starostik <malte@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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.
+*/
+
+// $Id$
+
+#ifndef __pixmaploader_h__
+#define __pixmaploader_h__
+
+#include <tqintcache.h>
+#include <tqdict.h>
+#include <tqimage.h>
+
+class TQPixmap;
+class TQImage;
+
+#include "keramikrc.h"
+
+namespace Keramik
+{
+ class PixmapLoader
+ {
+ public:
+ PixmapLoader();
+
+ TQPixmap pixmap( int name, const TQColor& color, const TQColor& bg,
+ bool disabled = false, bool blend = true );
+
+ TQPixmap scale( int name, int width, int height, const TQColor& color, const TQColor& bg,
+ bool disabled = false, bool blend = true );
+ TQSize size( int id );
+
+ void clear();
+
+ static PixmapLoader& the()
+ {
+ if (!s_instance)
+ s_instance = new PixmapLoader;
+ return *s_instance;
+ }
+
+ static void release()
+ {
+ delete s_instance;
+ s_instance = 0;
+ }
+
+ private:
+
+ struct KeramikCacheEntry
+ {
+ int m_id;
+ int m_width;
+ int m_height;
+ QRgb m_colorCode;
+ QRgb m_bgCode;
+ bool m_disabled;
+ bool m_blended;
+
+ TQPixmap* m_pixmap;
+
+ KeramikCacheEntry(int id, const TQColor& color, const TQColor& bg, bool disabled,
+ bool blended, int width, int height, TQPixmap* pixmap = 0 ):
+ m_id(id), m_width(width), m_height(height), m_colorCode(color.rgb()),m_bgCode(bg.rgb()),
+ m_disabled(disabled), m_blended(blended), m_pixmap(pixmap)
+ {}
+
+ int key()
+ {
+ return (int)m_disabled ^ (m_blended << 1) ^ (m_id<<2) ^ (m_width<<14) ^ (m_height<<24) ^ m_colorCode ^ (m_bgCode<<8);
+ }
+
+ bool operator == (const KeramikCacheEntry& other)
+ {
+ return (m_id == other.m_id) &&
+ (m_width == other.m_width) &&
+ (m_height == other.m_height) &&
+ (m_blended == other.m_blended) &&
+ (m_bgCode == other.m_bgCode) &&
+ (m_colorCode == other.m_colorCode) &&
+ (m_disabled == other.m_disabled);
+ }
+
+ ~KeramikCacheEntry()
+ {
+ delete m_pixmap;
+ }
+ };
+
+
+
+ TQImage* getColored(int id, const TQColor& color, const TQColor& bg, bool blended);
+ TQImage* getDisabled(int id, const TQColor& color, const TQColor& bg, bool blended);
+ TQIntCache <KeramikCacheEntry> m_pixmapCache;
+
+
+ unsigned char clamp[540];
+
+ static PixmapLoader* s_instance;
+ };
+
+ class TilePainter
+ {
+ public:
+ TilePainter( int name ) : m_columns(1),m_rows(1),m_name( name ) {};
+ virtual ~TilePainter() {};
+
+ enum PaintMode
+ {
+ PaintNormal,
+ PaintMask,
+ PaintFullBlend,
+ PaintTrivialMask
+ };
+
+ void draw( TQPainter *p, int x, int y, int width, int height, const TQColor& color, const TQColor& bg,
+ bool disabled = false, PaintMode mode = PaintNormal );
+ void draw( TQPainter *p, const TQRect& rect, const TQColor& color, const TQColor& bg, bool disabled = false, PaintMode mode = PaintNormal )
+ {
+ draw( p, rect.x(), rect.y(), rect.width(), rect.height(), color, bg, disabled, mode );
+ }
+
+ protected:
+ enum TileMode { Fixed, Scaled, Tiled };
+
+ unsigned int columns() const { return m_columns; }
+ unsigned int rows() const { return m_rows; }
+
+ /**
+ The idea behind all this stuff is that for performance reasons, we want to
+ use only integers to refer to widgets. So we give each widget a base ID
+ that's divisible by 256, and have all the various tiles be referred to as that ID +
+ some small number.
+
+ genembed generates and assigns the base widget IDs, and maps various pixmaps suffixes
+ into the adjustment numbers; using that info it writes out the tables mapping
+ the IDs to pixmaps, and keramikrc.h, which provides nice symbolic constants for base IDs.
+
+ When painting, however, we essentially represent the widget as a table, providing
+ fixed/tiled/stretched modes for each column and row. So to draw the widget knowing its
+ base ID, we need to know how many rows and columns there, what the scaling modes
+ are, and how to get to each of the tiles -- i.e. the tiles' offset from the base ID.
+
+ The various painter subclasses simply fill in most of that info into the members
+ here during their construction, and implement the virtual tileName to get the offsets.
+
+ Note that the IDs and offsets are separated since we can reuse the same code in many
+ cases by splitting the widget identify from tile identity (as there are many
+ different widgets that have the same or similar tile layout)
+ */
+ virtual int tileName( unsigned int, unsigned int ) const { return 0; }
+
+ TileMode columnMode( unsigned int col) const
+ {
+ return colMde[col];
+ }
+
+ TileMode rowMode( unsigned int row) const
+ {
+ return rowMde[row];
+ }
+
+ protected:
+ TileMode colMde[5], rowMde[5];
+ unsigned int m_columns;
+ unsigned int m_rows;
+ private:
+
+ int absTileName( unsigned int column, unsigned int row ) const
+ {
+ int name = tileName( column, row );
+ return m_name + name;
+ }
+
+
+ TQPixmap tile( unsigned int column, unsigned int row, const TQColor& color, const TQColor& bg, bool disabled, bool blend)
+ { return PixmapLoader::the().pixmap( absTileName( column, row ), color, bg, disabled, blend ); }
+ TQPixmap scale( unsigned int column, unsigned int row, int width, int height, const TQColor& color, const TQColor& bg,
+ bool disabled, bool blend )
+ { return PixmapLoader::the().scale( absTileName( column, row ), width, height, color,
+ bg, disabled, blend ); }
+
+ int m_name;
+
+ };
+
+ class ScaledPainter : public TilePainter
+ {
+ public:
+ enum Direction { Horizontal = 1, Vertical = 2, Both = Horizontal | Vertical };
+ ScaledPainter( int name, Direction direction = Both )
+ : TilePainter( name ), m_direction( direction )
+ {
+ colMde[0] = ( m_direction & Horizontal ) ? Scaled : Tiled;
+ rowMde[0] = ( m_direction & Vertical ) ? Scaled : Tiled;
+ }
+
+ virtual ~ScaledPainter() {};
+
+ private:
+ Direction m_direction;
+ };
+
+ class CenteredPainter : public TilePainter
+ {
+ public:
+ CenteredPainter( int name ) : TilePainter( name ) {
+ colMde[0] = colMde[1] = colMde[2] = colMde[3] = Fixed;
+ rowMde[0] = rowMde[1] = rowMde[2] = rowMde[3] = Fixed;
+ };
+ virtual ~CenteredPainter() {};
+
+ protected:
+ };
+
+ class RectTilePainter : public TilePainter
+ {
+ public:
+ RectTilePainter( int name,
+ bool scaleH = true, bool scaleV = true,
+ unsigned int columns = 3, unsigned int rows = 3 );
+
+ virtual ~RectTilePainter() {};
+
+ protected:
+ virtual int tileName( unsigned int column, unsigned int row ) const;
+ private:
+ bool m_scaleH;
+ bool m_scaleV;
+ };
+
+ class RowPainter: public TilePainter
+ {
+ public:
+ RowPainter(int name): TilePainter(name)
+ {
+ colMde[0] = colMde[2] = Fixed;
+ colMde[1] = Tiled;
+ rowMde[0] = Scaled;
+ m_columns = 3;
+ }
+
+ virtual ~RowPainter() {};
+ protected:
+ virtual int tileName( unsigned int column, unsigned int /*row*/) const
+ {
+ return column + 3; //So can use cl, cc, cr
+ }
+ };
+
+ class ProgressBarPainter: public TilePainter
+ {
+ public:
+ ProgressBarPainter(int name, bool reverse): TilePainter(name), m_reverse(reverse)
+ {
+ //We use only of the tip bitmaps..
+ if (reverse)
+ {
+ colMde[0] = Fixed;
+ colMde[1] = Tiled;
+ }
+ else
+ {
+ colMde[0] = Tiled;
+ colMde[1] = Fixed;
+ }
+ rowMde[0] = Scaled;
+
+ m_columns = 2;
+ }
+
+ virtual ~ProgressBarPainter() {};
+ protected:
+ virtual int tileName( unsigned int column, unsigned int /*row*/ ) const
+ {
+ if (m_reverse)
+ {
+ return column + 3; //So can use cl, cc, cr
+ }
+ else
+ return column + 4; //So can use cl, cc, cr + we start from cc.
+
+ }
+
+ bool m_reverse;
+ };
+
+
+ class ActiveTabPainter : public RectTilePainter
+ {
+ public:
+ ActiveTabPainter( bool bottom );
+ virtual ~ActiveTabPainter() {};
+
+ protected:
+ virtual int tileName( unsigned int column, unsigned int row ) const;
+
+ private:
+ bool m_bottom;
+ };
+
+ class InactiveTabPainter : public RectTilePainter
+ {
+ public:
+ enum Mode { First, Middle, Last };
+ InactiveTabPainter( Mode mode, bool bottom );
+ virtual ~InactiveTabPainter() {};
+
+ protected:
+ virtual int tileName( unsigned int column, unsigned int row ) const;
+
+ private:
+ Mode m_mode;
+ bool m_bottom;
+ };
+
+ class ScrollBarPainter : public TilePainter
+ {
+ public:
+ ScrollBarPainter( int type, int count, bool horizontal );
+ virtual ~ScrollBarPainter() {};
+
+ static int name( bool horizontal );
+
+ protected:
+ virtual int tileName( unsigned int column, unsigned int row ) const;
+ private:
+ int m_type;
+ int m_count;
+ bool m_horizontal;
+ };
+
+ class SpinBoxPainter : public TilePainter
+ {
+ public:
+ SpinBoxPainter() : TilePainter( keramik_spinbox ) {
+ colMde[0] = colMde[2] = Fixed;
+ colMde[1] = Scaled;
+ rowMde[0]=rowMde[1]=rowMde[2] = Scaled;
+ m_columns = 3;
+ };
+ virtual ~SpinBoxPainter() {};
+
+ protected:
+ virtual int tileName( unsigned int column, unsigned int row ) const;
+ };
+}
+
+#endif
+
+// vim: ts=4 sw=4 noet
+// kate: indent-width 4; replace-tabs off; tab-width 4;
diff --git a/tdestyles/klegacy/Makefile.am b/tdestyles/klegacy/Makefile.am
new file mode 100644
index 000000000..9bdee9267
--- /dev/null
+++ b/tdestyles/klegacy/Makefile.am
@@ -0,0 +1,8 @@
+INCLUDES= $(all_includes)
+
+noinst_HEADERS = klegacystyle.h
+lib_LTLIBRARIES = klegacystyle.la
+klegacystyle_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+klegacystyle_la_LIBADD = $(LIB_TDECORE)
+klegacystyle_la_SOURCES = klegacystyle.cpp plugin.cpp
+klegacystyle_la_METASOURCES = AUTO
diff --git a/tdestyles/klegacy/klegacystyle.cpp b/tdestyles/klegacy/klegacystyle.cpp
new file mode 100644
index 000000000..a169de874
--- /dev/null
+++ b/tdestyles/klegacy/klegacystyle.cpp
@@ -0,0 +1,3366 @@
+/*
+
+ Copyright (c) 2000 KDE Project
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ */
+
+#include "klegacystyle.h"
+#include "klegacystyle.moc"
+#include <tdelocale.h>
+#include <kiconloader.h>
+
+#define INCLUDE_MENUITEM_DEF
+#include <tqapplication.h>
+#include <tqbitmap.h>
+#include <tqbuttongroup.h>
+#include <tqcanvas.h>
+#include <tqcheckbox.h>
+#include <tqcolor.h>
+#include <tqcolordialog.h>
+#include <tqcombobox.h>
+#include <tqdial.h>
+#include <tqdialog.h>
+#include <tqdict.h>
+#include <tqfile.h>
+#include <tqfiledialog.h>
+#include <tqfileinfo.h>
+#include <tqfont.h>
+#include <tqfontdialog.h>
+#include <tqframe.h>
+#include <tqguardedptr.h>
+#include <tqgrid.h>
+#include <tqgroupbox.h>
+#include <tqhbox.h>
+#include <tqhbuttongroup.h>
+#include <tqheader.h>
+#include <tqhgroupbox.h>
+#include <tqiconview.h>
+#include <tqimage.h>
+#include <tqinputdialog.h>
+#include <tqintdict.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlcdnumber.h>
+#include <tqlineedit.h>
+#include <tqptrlist.h>
+#include <tqlistbox.h>
+#include <tqlistview.h>
+#include <tqmainwindow.h>
+#include <tqmenubar.h>
+#include <tqmenudata.h>
+#include <tqmessagebox.h>
+#include <tqmultilineedit.h>
+#include <tqobjectlist.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqpixmapcache.h>
+#include <tqpopupmenu.h>
+#include <tqprintdialog.h>
+#include <tqprogressbar.h>
+#include <tqprogressdialog.h>
+#include <tqpushbutton.h>
+#include <tqradiobutton.h>
+#include <tqregexp.h>
+#include <tqscrollbar.h>
+#include <tqscrollview.h>
+#include <tqsemimodal.h>
+#include <tqsizegrip.h>
+#include <tqslider.h>
+#include <tqspinbox.h>
+#include <tqsplitter.h>
+#include <tqstatusbar.h>
+#include <tqstring.h>
+#include <tqtabbar.h>
+#include <tqtabdialog.h>
+#include <qtableview.h>
+#include <tqtabwidget.h>
+#include <tqtextbrowser.h>
+#include <tqtextstream.h>
+#include <tqtextview.h>
+#include <tqtoolbar.h>
+#include <tqtoolbutton.h>
+#include <tqtooltip.h>
+#include <tqvbox.h>
+#include <tqvbuttongroup.h>
+#include <tqvgroupbox.h>
+#include <tqwidget.h>
+#include <tqwidgetstack.h>
+#include <tqwizard.h>
+#include <tqworkspace.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <limits.h>
+#include <sys/types.h>
+
+// forward declaration of classes
+class KLegacyBorder;
+class KLegacyStyleData;
+class KLegacyImageData;
+class GtkObject;
+
+// declaration of hidden functions
+typedef void (TQStyle::*QDrawMenuBarItemImpl) (TQPainter *, int, int, int, int,
+ TQMenuItem *, TQColorGroup &, bool, bool);
+extern QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
+
+// the addresses of the integers are used to place things in the
+// style data dict
+static int listviewitem_ptr = 0;
+static int listboxitem_ptr = 1;
+static int menuitem_ptr = 2;
+static int separator_ptr = 3;
+static int arrow_ptr = 4;
+static int whatsthis_ptr = 5;
+static int checkmenuitem_ptr = 6;
+static int radiomenuitem_ptr = 7;
+static int eventbox_ptr = 8;
+
+// a TQImage cache, since we need to resize some images to different sizes, we
+// will cache them, to save the overhead of loading the image from disk each
+// time it's needed
+static const int imageCacheSize = 61;
+static TQDict<TQImage> *imageCache = 0;
+
+
+class KLegacy {
+public:
+ enum Function { Box = 1, FlatBox, Extension, Check, Option,
+ HLine, VLine, BoxGap, Slider, Tab, Arrow, Handle, FShadow, Focus };
+ enum State { Normal = 1, Prelight, Active, Insensitive, Selected };
+ enum Shadow { NoShadow = 0, In, Out, EtchedIn, EtchedOut };
+ enum GapSide { Left = 1, Right, Top, Bottom };
+};
+
+
+class KLegacyBorder : public KLegacy {
+private:
+ int l, r, t, b;
+
+
+public:
+ KLegacyBorder(int ll = 0, int rr = 0, int tt = 0, int bb = 0)
+ : l(ll), r(rr), t(tt), b(bb)
+ { }
+
+ KLegacyBorder(const KLegacyBorder &br)
+ : l(br.l), r(br.r), t(br.t), b(br.b)
+ { }
+
+ inline int left(void) const
+ { return l; }
+ inline int right(void) const
+ { return r; }
+ inline int top(void) const
+ { return t; }
+ inline int bottom(void) const
+ { return b; }
+
+ inline void setLeft(int ll)
+ { l = ll; }
+ inline void setRight(int rr)
+ { r = rr; }
+ inline void setTop(int tt)
+ { t = tt; }
+ inline void setBottom(int bb)
+ { b = bb; }
+};
+
+
+struct KLegacyImageDataKeyField {
+ TQ_INT8 function : 8;
+ TQ_INT8 state : 8;
+ TQ_INT8 shadow : 4;
+ TQ_INT8 orientation : 4;
+ TQ_INT8 arrowDirection : 4;
+ TQ_INT8 gapSide : 4;
+};
+
+
+union KLegacyImageDataKey {
+ KLegacyImageDataKeyField data;
+ long cachekey;
+};
+
+
+class KLegacyImageData : public KLegacy {
+public:
+ KLegacyImageDataKey key;
+
+ TQString file;
+ TQString detail;
+ TQString overlayFile;
+ TQString gapFile;
+ TQString gapStartFile;
+ TQString gapEndFile;
+
+ KLegacyBorder border;
+ KLegacyBorder overlayBorder;
+ KLegacyBorder gapBorder;
+ KLegacyBorder gapStartBorder;
+ KLegacyBorder gapEndBorder;
+
+ bool recolorable;
+ bool stretch;
+ bool overlayStretch;
+
+ KLegacyImageData()
+ : recolorable(false),
+ stretch(false),
+ overlayStretch(false)
+ { key.cachekey = 0; }
+};
+
+
+class KLegacyStyleData : public KLegacy {
+public:
+ // name of this style
+ TQString name;
+
+ // font to use
+ TQFont *fn;
+
+ // list of image datas (which tell us how to draw things)
+ QList<KLegacyImageData> imageList;
+
+ // background, foreground and base colors for the 5 widget
+ //states that Gtk defines
+ TQColor back[5], fore[5], base[5];
+
+ // reference count
+ int ref;
+
+ KLegacyStyleData()
+ : fn(0), ref(0)
+ {
+ // have the imageList delete the items it holds when it's deleted
+ imageList.setAutoDelete(true);
+ }
+};
+
+
+class GtkObject : public TQObject {
+private:
+ KLegacyStyleData *d;
+
+ friend class KLegacyStylePrivate;
+
+
+public:
+ GtkObject(GtkObject *parent, const char *name)
+ : TQObject(parent, name)
+ { d = 0; }
+
+ GtkObject *find(TQRegExp &) const;
+
+ TQColor backColor(KLegacy::State);
+ TQColor baseColor(KLegacy::State);
+ TQColor foreColor(KLegacy::State);
+
+ TQFont *font();
+
+ inline TQString styleName()
+ { return styleData()->name; }
+
+ KLegacyStyleData *styleData();
+ KLegacyImageData *getImageData(KLegacyImageDataKey,
+ const TQString & = TQString::null);
+
+ TQPixmap *draw(KLegacyImageDataKey, int, int, const TQString & = TQString::null);
+ TQPixmap *draw(KLegacyImageData *, int, int);
+};
+
+
+static TQPixmap *drawImage(TQImage *image, int width, int height,
+ KLegacyBorder border, bool scale)
+{
+ if ((! image) || (image->isNull()) || (width < 1) || (height < 1)) {
+ return (TQPixmap *) 0;
+ }
+
+ TQPixmap *pixmap = new TQPixmap(width, height);
+
+ if (scale) {
+ if (width < 2) width = 2;
+ if (height < 2) height = 2;
+
+ int x[3], y[3], w[3], h[3], x2[3], y2[3], w2[3], h2[3];
+
+ // left
+ x[0] = x2[0] = 0;
+ w[0] = (border.left() < 1) ? 1 : border.left();
+
+ // middle
+ x[1] = border.left();
+ w[1] = image->width() - border.left() - border.right();
+ if (w[1] < 1) w[1] = 1;
+
+ // right
+ x[2] = image->width() - border.right();
+ w[2] = (border.right() < 1) ? 1 : border.right();
+ if (x[2] < 0) x[2] = 0;
+
+ if ((border.left() + border.right()) > width) {
+ // left
+ x2[0] = 0;
+ w2[0] = (width / 2) + 1;
+
+ // middle
+ x2[1] = w2[0] - 1;
+ w2[1] = 1;
+
+ // right
+ x2[2] = x2[1];
+ w2[2] = w2[0];
+ } else {
+ // left
+ x2[0] = 0;
+ w2[0] = border.left();
+
+ // middle
+ x2[1] = w2[0];
+ w2[1] = width - border.left() - border.right() + 1;
+
+ // right
+ x2[2] = width - border.right();
+ w2[2] = border.right();
+ }
+
+ // top
+ y[0] = 0;
+ h[0] = (border.top() < 1) ? 1 : border.top();
+
+ // middle
+ y[1] = border.top();
+ h[1] = image->height() - border.top() - border.bottom();
+ if (h[1] < 1) h[1] = 1;
+
+ // bottom
+ y[2] = image->height() - border.bottom();
+ h[2] = (border.bottom() < 1) ? 1 : border.bottom();
+ if (y[2] < 0) y[2] = 0;
+
+ if ((border.top() + border.bottom()) > height) {
+ // left
+ y2[0] = 0;
+ h2[0] = height / 2;
+
+ // middle
+ y2[1] = h2[0];
+ h2[1] = 1;
+
+ // right
+ y2[2] = y2[1];
+ h2[2] = h2[0];
+ } else {
+ // left
+ y2[0] = 0;
+ h2[0] = border.top();
+
+ // middle
+ y2[1] = h2[0];
+ h2[1] = height - border.top() - border.bottom() + 1;
+
+ // bottom
+ y2[2] = height - border.bottom();
+ h2[2] = border.bottom();
+ }
+
+ // draw the image
+ bool mask = image->hasAlphaBuffer();
+ TQBitmap bm(width, height);
+ bm.fill(Qt::color1);
+
+ TQImage nimage[3][3];
+ int xx = -1, yy = -1;
+ while (++yy < 3) {
+ xx = -1;
+ while (++xx < 3) {
+ nimage[yy][xx] = image->copy(x[xx], y[yy], w[xx], h[yy]);
+
+ if (nimage[yy][xx].isNull()) continue;
+
+ if ((w[xx] != w2[xx]) || (h[yy] != h2[yy]))
+ nimage[yy][xx] = nimage[yy][xx].smoothScale(w2[xx], h2[yy]);
+
+ if (nimage[yy][xx].isNull()) continue;
+
+ bitBlt(pixmap, x2[xx], y2[yy], &nimage[yy][xx],
+ 0, 0, w2[xx], h2[yy], Qt::CopyROP);
+
+ if (mask) {
+ TQImage am = nimage[yy][xx].createAlphaMask();
+ bitBlt(&bm, x2[xx], y2[yy], &am,
+ 0, 0, w2[xx], h2[yy], Qt::CopyROP);
+ }
+ }
+ }
+
+ if (mask)
+ pixmap->setMask(bm);
+ } else {
+ for (int y = 0; y < height; y += image->height())
+ for (int x = 0; x < width; x += image->width())
+ bitBlt(pixmap, x, y, image, 0, 0, -1, -1, Qt::CopyROP);
+
+ if (image->hasAlphaBuffer()) {
+ TQImage mask = image->createAlphaMask();
+
+ if (! mask.isNull() && mask.depth() == 1) {
+ TQBitmap bm(width, height);
+ bm.fill(Qt::color1);
+ bm = mask;
+ pixmap->setMask(bm);
+ }
+ }
+ }
+
+ return pixmap;
+}
+
+
+// Generate an object tree for all the known Gtk widgets...
+// returns a pointer to the bottom of the tree
+static GtkObject *initialize(TQPtrDict<GtkObject> &dict) {
+ //
+ // auto generated stuff from :
+ // --
+ // #!/usr/bin/perl -w
+ //
+ // foreach $line ( <STDIN> ) {
+ // chomp $line;
+ // $line =~ s/[^\sa-zA-Z0-9]/ /g;
+ // $line =~ /^(\s*)(\S*)/;
+ // $prefixlength = length $1;
+ // $classname = $2;
+ // $class{$prefixlength} = $classname;
+ // $prefixlength--;
+ // while( $prefixlength >= 0 && !defined($class{$prefixlength}) ) {
+ // $prefixlength--;
+ // }
+ // $parent = $class{$prefixlength};
+ // $parent = "0" if ( $parent eq $classname );
+ //
+ // # for GtkBin:
+ // # myGtkBin = new GtkObject( myGtkWidget, "GtkBin" );
+ //
+ // print "GtkObject * my$classname =
+ // new GtkObject( my$parent, \"$classname\" );\n";
+ // }
+ // --
+
+ GtkObject * myGtkObject =
+ new GtkObject( 0, "GtkObject" );
+ GtkObject * myGtkWidget =
+ new GtkObject( myGtkObject, "GtkWidget" );
+ GtkObject * myGtkMisc =
+ new GtkObject( myGtkWidget, "GtkMisc" );
+ GtkObject * myGtkLabel =
+ new GtkObject( myGtkMisc, "GtkLabel" );
+ // GtkObject * myGtkAccelLabel =
+ // new GtkObject( myGtkLabel, "GtkAccelLabel" );
+ GtkObject * myGtkTipsQuery =
+ new GtkObject( myGtkLabel, "GtkTipsQuery" );
+ GtkObject * myGtkArrow =
+ new GtkObject( myGtkMisc, "GtkArrow" );
+ // GtkObject * myGtkImage =
+ // new GtkObject( myGtkMisc, "GtkImage" );
+ // GtkObject * myGtkPixmap =
+ // new GtkObject( myGtkMisc, "GtkPixmap" );
+ GtkObject * myGtkContainer =
+ new GtkObject( myGtkWidget, "GtkContainer" );
+ GtkObject * myGtkBin =
+ new GtkObject( myGtkContainer, "GtkBin" );
+ // GtkObject * myGtkAlignment =
+ // new GtkObject( myGtkBin, "GtkAlignment" );
+ GtkObject * myGtkFrame =
+ new GtkObject( myGtkBin, "GtkFrame" );
+ // GtkObject * myGtkAspectFrame =
+ // new GtkObject( myGtkFrame, "GtkAspectFrame" );
+ GtkObject * myGtkButton =
+ new GtkObject( myGtkBin, "GtkButton" );
+ GtkObject * myGtkToggleButton =
+ new GtkObject( myGtkButton, "GtkToggleButton" );
+ GtkObject * myGtkCheckButton =
+ new GtkObject( myGtkToggleButton, "GtkCheckButton" );
+ GtkObject * myGtkRadioButton =
+ new GtkObject( myGtkCheckButton, "GtkRadioButton" );
+ GtkObject * myGtkOptionMenu =
+ new GtkObject( myGtkButton, "GtkOptionMenu" );
+ GtkObject * myGtkItem =
+ new GtkObject( myGtkBin, "GtkItem" );
+ GtkObject * myGtkMenuItem =
+ new GtkObject( myGtkItem, "GtkMenuItem" );
+ GtkObject * myGtkCheckMenuItem =
+ new GtkObject( myGtkMenuItem, "GtkCheckMenuItem" );
+ GtkObject * myGtkRadioMenuItem =
+ new GtkObject( myGtkCheckMenuItem, "GtkRadioMenuItem" );
+ // GtkObject * myGtkTearoffMenuItem =
+ // new GtkObject( myGtkMenuItem, "GtkTearoffMenuItem" );
+ GtkObject * myGtkListItem =
+ new GtkObject( myGtkItem, "GtkListItem" );
+ GtkObject * myGtkTreeItem =
+ new GtkObject( myGtkItem, "GtkTreeItem" );
+ GtkObject * myGtkWindow =
+ new GtkObject( myGtkBin, "GtkWindow" );
+ GtkObject * myGtkColorSelectionDialog =
+ new GtkObject( myGtkWindow, "GtkColorSelectionDialog" );
+ GtkObject * myGtkDialog =
+ new GtkObject( myGtkWindow, "GtkDialog" );
+ GtkObject * myGtkInputDialog =
+ new GtkObject( myGtkDialog, "GtkInputDialog" );
+ // GtkObject * myGtkDrawWindow =
+ // new GtkObject( myGtkWindow, "GtkDrawWindow" );
+ GtkObject * myGtkFileSelection =
+ new GtkObject( myGtkWindow, "GtkFileSelection" );
+ GtkObject * myGtkFontSelectionDialog =
+ new GtkObject( myGtkWindow, "GtkFontSelectionDialog" );
+ // GtkObject * myGtkPlug =
+ // new GtkObject( myGtkWindow, "GtkPlug" );
+ GtkObject * myGtkEventBox =
+ new GtkObject( myGtkBin, "GtkEventBox" );
+ // GtkObject * myGtkHandleBox =
+ // new GtkObject( myGtkBin, "GtkHandleBox" );
+ // GtkObject * myGtkScrolledWindow =
+ // new GtkObject( myGtkBin, "GtkScrolledWindow" );
+ GtkObject * myGtkViewport =
+ new GtkObject( myGtkBin, "GtkViewport" );
+ GtkObject * myGtkBox =
+ new GtkObject( myGtkContainer, "GtkBox" );
+ GtkObject * myGtkButtonBox =
+ new GtkObject( myGtkBox, "GtkButtonBox" );
+ GtkObject * myGtkHButtonBox =
+ new GtkObject( myGtkButtonBox, "GtkHButtonBox" );
+ GtkObject * myGtkVButtonBox =
+ new GtkObject( myGtkButtonBox, "GtkVButtonBox" );
+ GtkObject * myGtkVBox =
+ new GtkObject( myGtkBox, "GtkVBox" );
+ // GtkObject * myGtkColorSelection =
+ // new GtkObject( myGtkVBox, "GtkColorSelection" );
+ // GtkObject * myGtkGammaCurve =
+ // new GtkObject( myGtkVBox, "GtkGammaCurve" );
+ GtkObject * myGtkHBox =
+ new GtkObject( myGtkBox, "GtkHBox" );
+
+
+ // CHANGED! It seems that the gtk optionmenu and gtk combobox aren't related,
+ // but in Qt they are the same class... so we have changed gth GtkCombo to inherit
+ // from GtkOptionMenu (so that Qt comboboxes look like the optionmenus by default)
+ GtkObject * myGtkCombo =
+ new GtkObject( myGtkOptionMenu, "GtkCombo" );
+
+
+ GtkObject * myGtkStatusbar =
+ new GtkObject( myGtkHBox, "GtkStatusbar" );
+ GtkObject * myGtkCList =
+ new GtkObject( myGtkContainer, "GtkCList" );
+ GtkObject * myGtkCTree =
+ new GtkObject( myGtkCList, "GtkCTree" );
+ // GtkObject * myGtkFixed =
+ // new GtkObject( myGtkContainer, "GtkFixed" );
+ GtkObject * myGtkNotebook =
+ new GtkObject( myGtkContainer, "GtkNotebook" );
+ // GtkObject * myGtkFontSelection =
+ // new GtkObject( myGtkNotebook, "GtkFontSelection" );
+ GtkObject * myGtkPaned =
+ new GtkObject( myGtkContainer, "GtkPaned" );
+ // GtkObject * myGtkHPaned =
+ // new GtkObject( myGtkPaned, "GtkHPaned" );
+ // GtkObject * myGtkVPaned =
+ // new GtkObject( myGtkPaned, "GtkVPaned" );
+ // GtkObject * myGtkLayout =
+ // new GtkObject( myGtkContainer, "GtkLayout" );
+ // GtkObject * myGtkList =
+ // new GtkObject( myGtkContainer, "GtkList" );
+ GtkObject * myGtkMenuShell =
+ new GtkObject( myGtkContainer, "GtkMenuShell" );
+ GtkObject * myGtkMenuBar =
+ new GtkObject( myGtkMenuShell, "GtkMenuBar" );
+ GtkObject * myGtkMenu =
+ new GtkObject( myGtkMenuShell, "GtkMenu" );
+ // GtkObject * myGtkPacker =
+ // new GtkObject( myGtkContainer, "GtkPacker" );
+ // GtkObject * myGtkSocket =
+ // new GtkObject( myGtkContainer, "GtkSocket" );
+ GtkObject * myGtkTable =
+ new GtkObject( myGtkContainer, "GtkTable" );
+ GtkObject * myGtkToolbar =
+ new GtkObject( myGtkContainer, "GtkToolbar" );
+ // GtkObject * myGtkTree =
+ // new GtkObject( myGtkContainer, "GtkTree" );
+ // GtkObject * myGtkCalendar =
+ // new GtkObject( myGtkWidget, "GtkCalendar" );
+ GtkObject * myGtkDrawingArea =
+ new GtkObject( myGtkWidget, "GtkDrawingArea");
+ // GtkObject * myGtkCurve =
+ // new GtkObject( myGtkDrawingArea, "GtkCurve" );
+ GtkObject * myGtkEditable =
+ new GtkObject( myGtkWidget, "GtkEditable" );
+ GtkObject * myGtkEntry =
+ new GtkObject( myGtkEditable, "GtkEntry" );
+ GtkObject * myGtkSpinButton =
+ new GtkObject( myGtkEntry, "GtkSpinButton" );
+ GtkObject * myGtkText =
+ new GtkObject( myGtkEditable, "GtkText" );
+ GtkObject * myGtkRuler =
+ new GtkObject( myGtkWidget, "GtkRuler" );
+ // GtkObject * myGtkHRuler =
+ // new GtkObject( myGtkRuler, "GtkHRuler" );
+ // GtkObject * myGtkVRuler =
+ // new GtkObject( myGtkRuler, "GtkVRuler" );
+ GtkObject * myGtkRange =
+ new GtkObject( myGtkWidget, "GtkRange" );
+ GtkObject * myGtkScale =
+ new GtkObject( myGtkRange, "GtkScale" );
+ // GtkObject * myGtkHScale =
+ // new GtkObject( myGtkScale, "GtkHScale" );
+ // GtkObject * myGtkVScale =
+ // new GtkObject( myGtkScale, "GtkVScale" );
+ GtkObject * myGtkScrollbar =
+ new GtkObject( myGtkRange, "GtkScrollbar" );
+ // GtkObject * myGtkHScrollbar =
+ // new GtkObject( myGtkScrollbar, "GtkHScrollbar" );
+ // GtkObject * myGtkVScrollbar =
+ // new GtkObject( myGtkScrollbar, "GtkVScrollbar" );
+ GtkObject * myGtkSeparator =
+ new GtkObject( myGtkWidget, "GtkSeparator" );
+ // GtkObject * myGtkHSeparator =
+ // new GtkObject( myGtkSeparator, "GtkHSeparator" );
+ // GtkObject * myGtkVSeparator =
+ // new GtkObject( myGtkSeparator, "GtkVSeparator" );
+ // GtkObject * myGtkPreview =
+ // new GtkObject( myGtkWidget, "GtkPreview" );
+ GtkObject * myGtkProgress =
+ new GtkObject( myGtkWidget, "GtkProgress" );
+ GtkObject * myGtkProgressBar =
+ new GtkObject( myGtkProgress, "GtkProgressBar" );
+ //GtkObject * myGtkData =
+ // new GtkObject( myGtkObject, "GtkData" );
+ // GtkObject * myGtkAdjustment =
+ // new GtkObject( myGtkData, "GtkAdjustment" );
+ // GtkObject * myGtkTooltips =
+ // new GtkObject( myGtkData, "GtkTooltips" );
+ // GtkObject * myGtkItemFactory =
+ // new GtkObject( myGtkObject, "GtkItemFactory" );
+
+ // Insert the above Gtk widgets into a dict, using meta data pointers for
+ // the different widgets in Qt
+ //
+ // verify with:
+ // --
+ // egrep "::staticMetaObject\(\)$" **/*.cpp | fmt -1 | grep :: |
+ // sort | uniq > meta
+ //--
+
+ dict.insert(TQButton::staticMetaObject(), myGtkButton);
+ dict.insert(TQButtonGroup::staticMetaObject(), myGtkButtonBox);
+ dict.insert(TQCanvas::staticMetaObject(), myGtkDrawingArea);
+ dict.insert(TQCanvasView::staticMetaObject(), myGtkDrawingArea);
+ dict.insert(TQCheckBox::staticMetaObject(), myGtkCheckButton);
+ dict.insert(QColorDialog::staticMetaObject(), myGtkColorSelectionDialog);
+ dict.insert(TQComboBox::staticMetaObject(), myGtkCombo);
+ dict.insert(TQDial::staticMetaObject(), myGtkWidget);
+ dict.insert(TQDialog::staticMetaObject(), myGtkDialog);
+ dict.insert(TQFileDialog::staticMetaObject(), myGtkFileSelection);
+ dict.insert(QFontDialog::staticMetaObject(), myGtkFontSelectionDialog);
+ dict.insert(TQFrame::staticMetaObject(), myGtkFrame);
+ dict.insert(TQGrid::staticMetaObject(), myGtkFrame);
+ dict.insert(TQGroupBox::staticMetaObject(), myGtkBox);
+ dict.insert(TQHBox::staticMetaObject(), myGtkHBox);
+ dict.insert(TQHButtonGroup::staticMetaObject(), myGtkHButtonBox);
+ dict.insert(TQHGroupBox::staticMetaObject(), myGtkHBox);
+ dict.insert(TQHeader::staticMetaObject(), myGtkRuler);
+ dict.insert(TQIconView::staticMetaObject(), myGtkCTree);
+ dict.insert(QInputDialog::staticMetaObject(), myGtkInputDialog);
+ dict.insert(TQLCDNumber::staticMetaObject(), myGtkFrame);
+ dict.insert(TQLabel::staticMetaObject(), myGtkLabel);
+ dict.insert(TQLineEdit::staticMetaObject(), myGtkEntry);
+ dict.insert(TQListBox::staticMetaObject(), myGtkCList);
+ dict.insert(TQListView::staticMetaObject(), myGtkCTree);
+ dict.insert(TQMainWindow::staticMetaObject(), myGtkWindow);
+ dict.insert(TQMenuBar::staticMetaObject(), myGtkMenuBar);
+ dict.insert(TQMessageBox::staticMetaObject(), myGtkDialog);
+ dict.insert(TQMultiLineEdit::staticMetaObject(), myGtkText);
+ dict.insert(TQPopupMenu::staticMetaObject(), myGtkMenu);
+ dict.insert(TQPrintDialog::staticMetaObject(), myGtkDialog);
+ dict.insert(TQProgressBar::staticMetaObject(), myGtkProgressBar);
+ dict.insert(TQProgressDialog::staticMetaObject(), myGtkDialog);
+ dict.insert(TQPushButton::staticMetaObject(), myGtkButton);
+ dict.insert(TQRadioButton::staticMetaObject(), myGtkRadioButton);
+ dict.insert(TQScrollBar::staticMetaObject(), myGtkScrollbar);
+ dict.insert(TQScrollView::staticMetaObject(), myGtkViewport);
+ dict.insert(TQSemiModal::staticMetaObject(), myGtkDialog);
+ dict.insert(TQSizeGrip::staticMetaObject(), myGtkWidget);
+ dict.insert(TQSlider::staticMetaObject(), myGtkScale);
+ dict.insert(TQSpinBox::staticMetaObject(), myGtkSpinButton);
+ dict.insert(TQSplitter::staticMetaObject(), myGtkPaned);
+ dict.insert(TQStatusBar::staticMetaObject(), myGtkStatusbar);
+ dict.insert(TQTabBar::staticMetaObject(), myGtkNotebook);
+ dict.insert(TQTabDialog::staticMetaObject(), myGtkNotebook);
+ dict.insert(TQTabWidget::staticMetaObject(), myGtkNotebook);
+ dict.insert(QTableView::staticMetaObject(), myGtkTable);
+ dict.insert(TQTextBrowser::staticMetaObject(), myGtkText);
+ dict.insert(TQTextView::staticMetaObject(), myGtkText);
+ dict.insert(TQToolBar::staticMetaObject(), myGtkToolbar);
+ dict.insert(TQToolButton::staticMetaObject(), myGtkButton);
+ dict.insert(TQVBox::staticMetaObject(), myGtkVBox);
+ dict.insert(TQVButtonGroup::staticMetaObject(), myGtkVButtonBox);
+ dict.insert(TQVGroupBox::staticMetaObject(), myGtkVBox);
+ dict.insert(TQWidget::staticMetaObject(), myGtkWidget);
+ dict.insert(TQWidgetStack::staticMetaObject(), myGtkWidget);
+ dict.insert(TQWizard::staticMetaObject(), myGtkWindow);
+ dict.insert(TQWorkspace::staticMetaObject(), myGtkWindow);
+
+ // stuff that we don't have meta data for, but want to know about
+ dict.insert(&listboxitem_ptr, myGtkListItem);
+ dict.insert(&listviewitem_ptr, myGtkTreeItem);
+ dict.insert(&menuitem_ptr, myGtkMenuItem);
+ dict.insert(&separator_ptr, myGtkSeparator);
+ dict.insert(&arrow_ptr, myGtkArrow);
+ dict.insert(&whatsthis_ptr, myGtkTipsQuery);
+ dict.insert(&checkmenuitem_ptr, myGtkCheckMenuItem);
+ dict.insert(&radiomenuitem_ptr, myGtkRadioMenuItem);
+ dict.insert(&eventbox_ptr, myGtkEventBox);
+
+ return myGtkObject;
+}
+
+
+KLegacyImageData *GtkObject::getImageData(KLegacyImageDataKey key, const TQString &detail) {
+ KLegacyImageData *imagedata = 0;
+
+ if (styleData()) {
+ QListIterator<KLegacyImageData> it(styleData()->imageList);
+
+ while ((imagedata = it.current()) != 0) {
+ ++it;
+
+ if ((((imagedata->key.data.function != 0) &&
+ (imagedata->key.data.function == key.data.function)) ||
+ (imagedata->key.data.function == 0)) &&
+
+ (((imagedata->key.data.state != 0) &&
+ (imagedata->key.data.state == key.data.state)) ||
+ (imagedata->key.data.state == 0)) &&
+
+ (((imagedata->key.data.shadow != 0) &&
+ (imagedata->key.data.shadow == key.data.shadow)) ||
+ (imagedata->key.data.shadow == 0)) &&
+
+ (((imagedata->key.data.orientation != 0) &&
+ (imagedata->key.data.orientation == key.data.orientation)) ||
+ (imagedata->key.data.orientation == 0)) &&
+
+ (((imagedata->key.data.arrowDirection != 0) &&
+ (imagedata->key.data.arrowDirection == key.data.arrowDirection)) ||
+ (imagedata->key.data.arrowDirection == 0)) &&
+
+ (((imagedata->key.data.gapSide != 0) &&
+ (imagedata->key.data.gapSide == key.data.gapSide)) ||
+ (imagedata->key.data.gapSide == 0)) &&
+
+ (((!imagedata->detail.isNull()) &&
+ (detail == imagedata->detail)) ||
+ (imagedata->detail.isNull()))) {
+ // we have a winner
+ break;
+ }
+ }
+ }
+
+ if ((! imagedata) && (parent())) {
+ imagedata = ((GtkObject *) parent())->getImageData(key, detail);
+ }
+
+ return imagedata;
+}
+
+
+KLegacyStyleData *GtkObject::styleData() {
+ if ((! d) && parent()) {
+ d = ((GtkObject *) parent())->styleData();
+ }
+
+ return d;
+}
+
+
+TQColor GtkObject::backColor(KLegacy::State s) {
+ if ((! styleData()->back[s].isValid()) && parent()) {
+ return ((GtkObject *) parent())->backColor(s);
+ }
+
+ if (styleData()->back[s].isValid())
+ return styleData()->back[s];
+
+ return white;
+}
+
+
+TQColor GtkObject::baseColor(KLegacy::State s) {
+ if ((! styleData()->base[s].isValid()) && parent()) {
+ return ((GtkObject *) parent())->baseColor(s);
+ }
+
+ if (styleData()->base[s].isValid())
+ return styleData()->base[s];
+
+ return white;
+}
+
+
+TQColor GtkObject::foreColor(KLegacy::State s) {
+ if ((! styleData()->fore[s].isValid()) && parent()) {
+ return ((GtkObject *) parent())->foreColor(s);
+ }
+
+ if (styleData()->fore[s].isValid())
+ return styleData()->fore[s];
+
+ return black;
+}
+
+
+TQFont *GtkObject::font() {
+ if ((! styleData()->fn) && parent()) {
+ return ((GtkObject *) parent())->font();
+ }
+
+ return styleData()->fn;
+}
+
+
+GtkObject *GtkObject::find(TQRegExp &r) const {
+ // if the regular expression matches the name of this widget, return
+ if (r.match(name()) != -1) {
+ return (GtkObject *) this;
+ }
+
+ // regex doesn't match us, and we have no children, return 0
+ if (! children()) return 0;
+
+ TQObject *o;
+ GtkObject *obj, *gobj;
+
+ TQObjectListIt ot(*children());
+
+ // search our children to see if any match the regex
+ while ((o = ot.current()) != 0) {
+ ++ot;
+
+ // this would be nice if moc could parse this file :/
+ //
+ // if (o->className() != "GtkObject") {
+ // tqDebug("object is not a GtkObject (className = '%s')",
+ // o->className());
+ // continue;
+ // }
+
+ obj = (GtkObject *) o;
+
+ // use obj->find(r) instead of r.match(obj->name()) so that this child's
+ // children will be searched as well... this allows us to search the entire
+ // object tree
+ if ((gobj = obj->find(r)) != 0) {
+ // found something!
+ return (GtkObject *) gobj;
+ }
+ }
+
+ // found nothing
+ return 0;
+}
+
+
+TQPixmap *GtkObject::draw(KLegacyImageDataKey key, int width, int height,
+ const TQString &detail)
+{
+ KLegacyImageData *imagedata = getImageData(key, detail);
+ if (! imagedata) {
+ return 0;
+ }
+
+ return draw(imagedata, width, height);
+}
+
+
+TQPixmap *GtkObject::draw(KLegacyImageData *imagedata, int width, int height) {
+ TQString pixmapKey;
+ TQTextOStream(&pixmapKey) << "$KLegacy_Image_" << styleData()->name << "_" <<
+ className() << "_" << width << "x" << height << "_" <<
+ imagedata->key.cachekey << "_" << (uint) imagedata->recolorable <<
+ (uint) imagedata->stretch << (uint) imagedata->overlayStretch;
+
+ TQPixmap *pixmap = TQPixmapCache::find(pixmapKey);
+ if (pixmap) {
+ return pixmap;
+ }
+
+ TQPixmap *main = 0, *overlay = 0;
+
+ if (! imagedata->file.isNull()) {
+ TQImage *image = imageCache->find(imagedata->file);
+ bool found = true;
+
+ if (! image) {
+ image = new TQImage(imagedata->file);
+
+ if (! image || image->isNull()) {
+ found = false;
+ } else {
+ imageCache->insert(imagedata->file, image);
+ }
+ }
+
+ if (found) {
+ int w = ((imagedata->stretch) ? width : image->width()),
+ h = ((imagedata->stretch) ? height : image->height());
+ main = drawImage(image, w, h, imagedata->border, imagedata->stretch);
+ }
+ }
+
+ if (! imagedata->overlayFile.isNull()) {
+ TQImage *image = imageCache->find(imagedata->overlayFile);
+ bool found = true;
+
+ if (! image) {
+ image = new TQImage(imagedata->overlayFile);
+
+ if (! image || image->isNull()) {
+ found = false;
+ } else {
+ imageCache->insert(imagedata->overlayFile, image);
+ }
+ }
+
+ if (found) {
+ int w = ((imagedata->overlayStretch) ? width : image->width()),
+ h = ((imagedata->overlayStretch) ? height : image->height());
+ overlay = drawImage(image, w, h, imagedata->overlayBorder,
+ imagedata->overlayStretch);
+ }
+ }
+
+ TQSize sz;
+ if (main) {
+ sz = sz.expandedTo(main->size());
+ }
+
+ if (overlay) {
+ sz = sz.expandedTo(overlay->size());
+ }
+
+ if (sz.isEmpty()) {
+ return (TQPixmap *) 0;
+ }
+
+ pixmap = new TQPixmap(sz);
+ pixmap->fill(TQColor(192,192,176));
+ TQPainter p(pixmap);
+
+ if (main && (! main->isNull())) {
+ p.drawTiledPixmap(0, 0, sz.width(), sz.height(), *main);
+ }
+
+ if (overlay && (! overlay->isNull())) {
+ TQPoint pt((sz.width() - overlay->width()) / 2,
+ (sz.height() - overlay->height()) / 2);
+ p.drawPixmap(pt, *overlay);
+ }
+
+ p.end();
+
+ if (main) {
+ if (main->mask() && (! main->mask()->isNull())) {
+ TQBitmap bm(sz);
+ TQPainter m(&bm);
+ TQRect r(0, 0, width, height);
+
+ m.drawTiledPixmap(r, *(main->mask()));
+ m.end();
+
+ pixmap->setMask(bm);
+ }
+ } else if (overlay) {
+ if (overlay->mask() && (! overlay->mask()->isNull())) {
+ TQBitmap bm(sz);
+ TQPainter m(&bm);
+ TQRect r((sz.width() - overlay->width()) / 2,
+ (sz.height() - overlay->height()) / 2,
+ sz.width(), sz.height());
+ m.drawTiledPixmap(r, *(overlay->mask()));
+ m.end();
+
+ pixmap->setMask(bm);
+ }
+ }
+
+ if (! TQPixmapCache::insert(pixmapKey, pixmap)) {
+ delete pixmap;
+ pixmap = (TQPixmap *) 0;
+ }
+
+ return pixmap;
+}
+
+
+class KLegacyStylePrivate : public KLegacy {
+private:
+ TQDict<KLegacyStyleData> styleDict;
+ TQStringList pixmapPath;
+ TQTextStream filestream;
+
+ TQFont oldfont;
+ TQPalette oldpalette;
+
+ // pointer to the widget under the pointer
+ TQGuardedPtr<TQWidget> lastWidget;
+
+ // current position of the mouse
+ TQPoint mousePos;
+ bool hovering;
+
+ TQPtrDict<GtkObject> gtkDict;
+ GtkObject *gtktree;
+
+ friend class KLegacyStyle;
+
+
+public:
+ KLegacyStylePrivate();
+ ~KLegacyStylePrivate();
+
+ // parse the filename passed
+ bool parse(const TQString &filename);
+
+ bool parseClass();
+ bool parseEngine(KLegacyStyleData *);
+ bool parseImage(KLegacyStyleData *);
+ bool parsePixmapPath();
+ bool parseStyle();
+};
+
+
+KLegacyStylePrivate::KLegacyStylePrivate()
+ : lastWidget(0), mousePos(-1, -1), hovering(false), gtktree(0)
+{
+ TQPixmapCache::setCacheLimit(8192);
+
+ if (! imageCache) {
+ imageCache = new TQDict<TQImage>(imageCacheSize);
+ CHECK_PTR(imageCache);
+
+ imageCache->setAutoDelete(true);
+ }
+
+ styleDict.setAutoDelete(true);
+
+ gtktree = initialize(gtkDict);
+ CHECK_PTR(gtktree);
+
+ if (! gtktree->d) {
+ gtktree->d = new KLegacyStyleData;
+ gtktree->d->name = "Default";
+ }
+
+ // get the path to this users .gtkrc
+ TQString gtkrcFilename = getenv("HOME");
+ gtkrcFilename += "/.gtkrc";
+
+ TQFile gtkrc(gtkrcFilename);
+
+ if (gtkrc.open(IO_ReadOnly)) {
+ filestream.setDevice(&gtkrc);
+
+ while (! filestream.atEnd()) {
+ TQString next;
+ filestream >> next;
+
+ if (next.isNull()) continue;
+
+ // skip comments
+ if (next[0] == '#') { filestream.readLine(); continue; }
+
+ if (next == "class" || next == "widget" || next == "widget_class") {
+ if (! parseClass())
+ tqWarning("\"class\" parse error");
+ } else if (next == "pixmap_path") {
+ if (! parsePixmapPath())
+ tqWarning("\"pixmap_path\" parse error");
+ } else if (next == "style") {
+ if (! parseStyle())
+ tqWarning("\"style\" parse error");
+ }
+ }
+
+ gtkrc.close();
+ } else
+ tqWarning("%s: failed to open", gtkrcFilename.latin1());
+}
+
+
+KLegacyStylePrivate::~KLegacyStylePrivate() {
+ if (imageCache) {
+ delete imageCache;
+ imageCache = 0;
+ }
+
+ if (gtktree) {
+ delete gtktree;
+ gtktree = 0;
+ }
+}
+
+
+bool KLegacyStylePrivate::parseClass() {
+ if (filestream.atEnd()) return false;
+
+ TQString classname, keyword, stylename;
+ filestream >> classname;
+ filestream >> keyword;
+ filestream >> stylename;
+
+ if (classname.isNull() || keyword.isNull() || stylename.isNull() ||
+ keyword != "style" ||
+ classname[0] != '\"' || classname[classname.length() - 1] != '\"' ||
+ stylename[0] != '\"' || stylename[stylename.length() - 1] != '\"')
+ return false;
+
+ classname = classname.mid(1, classname.length() - 2);
+ stylename = stylename.mid(1, stylename.length() - 2);
+
+ TQRegExp r(classname);
+ r.setWildcard(true);
+ GtkObject *obj = gtktree->find(r);
+
+ if (! obj) {
+ tqWarning("unknown object '%s'", classname.latin1());
+ return false;
+ }
+
+ KLegacyStyleData *styledata = styleDict.find(stylename);
+
+ if (! styledata) {
+ tqWarning("no such style '%s' for class '%s' (%p)", stylename.latin1(),
+ classname.latin1(), styledata);
+ return false;
+ }
+
+ obj->d = styledata;
+ styledata->ref++;
+
+ return true;
+}
+
+
+bool KLegacyStylePrivate::parseImage(KLegacyStyleData *styledata) {
+ if (filestream.atEnd()) {
+ tqWarning("parseImage: premature end of stream");
+ return false;
+ }
+
+ TQString next, equals, parameter;
+ filestream >> next;
+
+ // skip comments
+ while (next[0] == '#') {
+ filestream.readLine();
+ filestream >> next;
+ }
+
+ if (next.isNull() || next != "{") {
+ tqWarning("parseImage: expected '{' after 'image'\n"
+ " in style '%s', after processing %d previous images\n",
+ styledata->name.latin1(), styledata->imageList.count());
+ return false;
+ }
+
+ KLegacyImageData *imagedata = new KLegacyImageData;
+
+ int paren_count = 1;
+ while (paren_count) {
+ filestream >> next;
+ if (next.isNull()) continue;
+
+ // skip comments
+ if (next[0] == '#') {filestream.readLine(); continue; }
+
+ if (next == "arrow_direction") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=") continue;
+
+ if (parameter == "UP")
+ imagedata->key.data.arrowDirection = Qt::UpArrow + 1;
+ else if (parameter == "DOWN")
+ imagedata->key.data.arrowDirection = Qt::DownArrow + 1;
+ else if (parameter == "LEFT")
+ imagedata->key.data.arrowDirection = Qt::LeftArrow + 1;
+ else if (parameter == "RIGHT")
+ imagedata->key.data.arrowDirection = Qt::RightArrow + 1;
+ } else if (next == "border") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=" ||
+ parameter != "{")
+ continue;
+ TQString border =filestream.readLine();
+
+ int lp, rp, tp, bp, l, r, t, b;
+ lp = border.find(',');
+ rp = border.find(',', lp + 1);
+ tp = border.find(',', rp + 1);
+ bp = border.find('}', tp + 1);
+
+ l = border.left(lp).toUInt();
+ r = border.mid(lp + 1, rp - lp - 1).toUInt();
+ t = border.mid(rp + 1, tp - rp - 1).toUInt();
+ b = border.mid(tp + 1, bp - tp - 1).toUInt();
+
+ imagedata->border.setLeft(l);
+ imagedata->border.setRight(r);
+ imagedata->border.setTop(t);
+ imagedata->border.setBottom(b);
+ } else if (next == "detail") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=" ||
+ parameter[0] != '\"' || parameter[parameter.length() - 1] != '\"')
+ continue;
+
+ parameter = parameter.mid(1, parameter.length() - 2);
+ imagedata->detail = parameter;
+ } else if (next == "file") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=" ||
+ parameter[0] != '\"' || parameter[parameter.length() - 1] != '\"') {
+ tqWarning("image: file parameter malformed");
+ continue;
+ }
+
+ parameter = parameter.mid(1, parameter.length() - 2);
+
+ TQStringList::Iterator it;
+ for (it = pixmapPath.begin(); it != pixmapPath.end(); ++it) {
+ TQFileInfo fileinfo((*it) + parameter);
+
+ if (fileinfo.exists()) {
+ imagedata->file = fileinfo.filePath();
+ break;
+ }
+ }
+ } else if (next == "function") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=") continue;
+
+ if (parameter == "BOX")
+ imagedata->key.data.function = Box;
+ else if (parameter == "FLAT_BOX")
+ imagedata->key.data.function = FlatBox;
+ else if (parameter == "EXTENSION")
+ imagedata->key.data.function = Extension;
+ else if (parameter == "CHECK")
+ imagedata->key.data.function = Check;
+ else if (parameter == "OPTION")
+ imagedata->key.data.function = Option;
+ else if (parameter == "HLINE")
+ imagedata->key.data.function = HLine;
+ else if (parameter == "VLINE")
+ imagedata->key.data.function = VLine;
+ else if (parameter == "BOX_GAP")
+ imagedata->key.data.function = BoxGap;
+ else if (parameter == "SLIDER")
+ imagedata->key.data.function = Slider;
+ else if (parameter == "TAB")
+ imagedata->key.data.function = Tab;
+ else if (parameter == "ARROW")
+ imagedata->key.data.function = Arrow;
+ else if (parameter == "HANDLE")
+ imagedata->key.data.function = Handle;
+ else if (parameter == "SHADOW")
+ imagedata->key.data.function = FShadow;
+ else if (parameter == "FOCUS")
+ imagedata->key.data.function = Focus;
+ } else if (next == "gap_side" ) {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=") continue;
+
+ if (parameter == "TOP")
+ imagedata->key.data.gapSide = KLegacy::Top;
+ else if (parameter == "BOTTOM")
+ imagedata->key.data.gapSide = KLegacy::Bottom;
+ } else if (next == "orientation") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=") continue;
+
+ if (parameter == "VERTICAL")
+ imagedata->key.data.orientation = Qt::Vertical + 1;
+ else if (parameter == "HORIZONTAL")
+ imagedata->key.data.orientation = Qt::Horizontal + 1;
+ } else if (next == "overlay_border") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=" ||
+ parameter != "{")
+ continue;
+ TQString border = filestream.readLine();
+
+ int lp, rp, tp, bp, l, r, t, b;
+ lp = border.find(',');
+ rp = border.find(',', lp + 1);
+ tp = border.find(',', rp + 1);
+ bp = border.find('}', tp + 1);
+
+ l = border.left(lp).toUInt();
+ r = border.mid(lp + 1, rp - lp - 1).toUInt();
+ t = border.mid(rp + 1, tp - rp - 1).toUInt();
+ b = border.mid(tp + 1, bp - tp - 1).toUInt();
+
+ imagedata->overlayBorder.setLeft(l);
+ imagedata->overlayBorder.setRight(r);
+ imagedata->overlayBorder.setTop(t);
+ imagedata->overlayBorder.setBottom(b);
+ } else if (next == "overlay_file") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=" ||
+ parameter[0] != '\"' || parameter[parameter.length() - 1] != '\"') {
+ tqWarning("image: overlay_file parameter malformed");
+ continue;
+ }
+
+ parameter = parameter.mid(1, parameter.length() - 2);
+
+ TQStringList::Iterator it;
+ for (it = pixmapPath.begin(); it != pixmapPath.end(); ++it) {
+ TQFileInfo fileinfo((*it) + parameter);
+
+ if (fileinfo.exists()) {
+ imagedata->overlayFile = fileinfo.filePath();
+ break;
+ }
+ }
+ } else if (next == "overlay_stretch") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=") continue;
+
+ if (parameter == "TRUE")
+ imagedata->overlayStretch = true;
+ else
+ imagedata->overlayStretch = false;
+ } else if (next == "stretch") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=") continue;
+
+ if (parameter == "TRUE")
+ imagedata->stretch = true;
+ else
+ imagedata->stretch = false;
+ } else if (next == "shadow") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=") continue;
+
+ if (parameter == "NONE")
+ imagedata->key.data.shadow = NoShadow;
+ else if (parameter == "IN")
+ imagedata->key.data.shadow = In;
+ else if (parameter == "OUT")
+ imagedata->key.data.shadow = Out;
+ else if (parameter == "ETCHED_IN")
+ imagedata->key.data.shadow = EtchedIn;
+ else if (parameter == "ETCHED_OUT")
+ imagedata->key.data.shadow = EtchedOut;
+ } else if (next == "state") {
+ filestream >> equals;
+ filestream >> parameter;
+
+ if (equals.isNull() || parameter.isNull() || equals != "=") continue;
+
+ if (parameter == "NORMAL")
+ imagedata->key.data.state = Normal;
+ else if (parameter == "PRELIGHT")
+ imagedata->key.data.state = Prelight;
+ else if (parameter == "ACTIVE")
+ imagedata->key.data.state = Active;
+ else if (parameter == "INSENSITIVE")
+ imagedata->key.data.state = Insensitive;
+ else if (parameter == "SELECTED")
+ imagedata->key.data.state = Selected;
+ } else if (next == "{") paren_count++;
+ else if (next == "}") paren_count--;
+ }
+
+ styledata->imageList.append(imagedata);
+
+ return true;
+}
+
+
+bool KLegacyStylePrivate::parseEngine(KLegacyStyleData *styledata) {
+ if (filestream.atEnd()) return false;
+
+ TQString enginename, paren;
+ filestream >> enginename;
+ filestream >> paren;
+
+ if (enginename.isNull() || paren.isNull() ||
+ enginename[0] != '\"' || enginename[enginename.length() - 1] != '\"' ||
+ paren != "{") {
+ return false;
+ }
+
+ TQString next;
+ int paren_count = 1;
+ while (paren_count) {
+ filestream >> next;
+
+ // skip comments
+ if (next[0] == '#') {
+ filestream.readLine();
+ continue;
+ }
+
+ if (next == "image") {
+ if (! parseImage(styledata)) {
+ tqWarning("image parse error");
+ }
+ } else if (next == "{") {
+ paren_count++;
+ } else if (next == "}") {
+ paren_count--;
+ }
+ }
+
+ return true;
+}
+
+
+bool KLegacyStylePrivate::parsePixmapPath() {
+ if (filestream.atEnd()) {
+ return false;
+ }
+
+ TQString next;
+ filestream >> next;
+
+ if (next.isNull() || next[0] != '\"' || next[next.length() - 1] != '\"') {
+ return false;
+ }
+
+ next = next.mid(1, next.length() - 2);
+
+ int start = 0, end = next.find(":");
+ while (end != -1) {
+ TQString path(next.mid(start, end - start));
+
+ if (path[path.length() - 1] != '/') {
+ path += '/';
+ }
+
+ TQFileInfo fileinfo(path);
+ if (fileinfo.exists() && fileinfo.isDir()) {
+ pixmapPath.append(path);
+ }
+
+ start = end + 1;
+ end = next.find(":", start);
+ }
+
+ // get the straggler
+ end = next.length();
+ TQString path(next.mid(start, end - start));
+
+ if (path[path.length() - 1] != '/') {
+ path += '/';
+ }
+
+ TQFileInfo fileinfo(path);
+ if (fileinfo.exists() && fileinfo.isDir()) {
+ pixmapPath.append(path);
+ }
+
+ return true;
+}
+
+
+bool KLegacyStylePrivate::parseStyle() {
+ if (filestream.atEnd()) return false;
+
+ TQString stylename, paren;
+ filestream >> stylename;
+ filestream >> paren;
+
+ if (stylename.isNull() || paren.isNull() ||
+ stylename[0] != '\"' || stylename[stylename.length() - 1] != '\"')
+ return false;
+
+ stylename = stylename.mid(1, stylename.length() - 2);
+
+ if (paren == "=") {
+ TQString newstylename;
+ filestream >> newstylename;
+
+ if (newstylename.isNull() ||
+ newstylename[0] != '\"' || newstylename[newstylename.length() - 1] != '\"')
+ return false;
+
+ newstylename = newstylename.mid(1, newstylename.length() - 2);
+
+ KLegacyStyleData *styledata = styleDict.find(stylename);
+
+ if (! styledata) return false;
+
+ KLegacyStyleData *newstyledata = new KLegacyStyleData(*styledata);
+ newstyledata->name = newstylename;
+ styleDict.insert(newstylename, newstyledata);
+
+ return true;
+ } else if (paren != "{") {
+ tqWarning("parseStyle: expected '{' while parsing style %s",
+ stylename.latin1());
+ return false;
+ }
+
+ KLegacyStyleData *styledata = new KLegacyStyleData;
+ styledata->name = stylename;
+
+ TQString next, parameter;
+ int paren_count = 1;
+ while (paren_count) {
+ filestream >> next;
+
+ // skip comments
+ if (next[0] == '#') {
+ filestream.readLine();
+ continue;
+ }
+
+ if (next.left(5) == "base[") {
+ int l = next.find('['), r = next.find(']'), state;
+
+ if (l < 1 || r < 1 || r < l) continue;
+
+ TQString mode = next.mid(l + 1, r - l - 1);
+ if (mode == "ACTIVE")
+ state = Active;
+ else if (mode == "NORMAL")
+ state = Normal;
+ else if (mode == "INSENSITIVE")
+ state = Insensitive;
+ else if (mode == "PRELIGHT")
+ state = Prelight;
+ else if (mode == "SELECTED")
+ state = Selected;
+
+ filestream >> next;
+ filestream >> parameter;
+
+ if (next.isNull() || parameter.isNull() || next != "=") continue;
+
+ if (parameter[0] == '\"') { // assume color of the form "#rrggbb"
+ TQString colorname = parameter.mid(1, parameter.length() - 2);
+ if (colorname.isNull()) continue;
+
+ styledata->base[state].setNamedColor(colorname);
+ } else if (parameter == "{") { // assume color of the form { ri, gi, bi }
+ TQString color =filestream.readLine();
+
+ int rp, gp, bp;
+ float ri, gi, bi;
+
+ rp = color.find(',');
+ gp = color.find(',', rp + 1);
+ bp = color.find('}', gp + 1);
+
+ ri = color.left(rp).toFloat();
+ gi = color.mid(rp + 1, gp - rp - 1).toFloat();
+ bi = color.mid(gp + 1, bp - gp - 1).toFloat();
+
+ int red = (int) (255 * ri);
+ int green = (int) (255 * gi);
+ int blue = (int) (255 * bi);
+ styledata->base[state].setRgb(red, green, blue);
+ }
+ } else if (next.left(3) == "bg[") {
+ int l = next.find('['), r = next.find(']'), state;
+
+ if (l < 1 || r < 1 || r < l) continue;
+
+ TQString mode = next.mid(l + 1, r - l - 1);
+ if (mode == "ACTIVE")
+ state = Active;
+ else if (mode == "NORMAL")
+ state = Normal;
+ else if (mode == "INSENSITIVE")
+ state = Insensitive;
+ else if (mode == "PRELIGHT")
+ state = Prelight;
+ else if (mode == "SELECTED")
+ state = Selected;
+
+ filestream >> next;
+ filestream >> parameter;
+
+ if (next.isNull() || parameter.isNull() || next != "=") continue;
+
+ if (parameter[0] == '\"') { // assume color of the form "#rrggbb"
+ TQString colorname = parameter.mid(1, parameter.length() - 2);
+ if (colorname.isNull()) continue;
+
+ styledata->back[state].setNamedColor(colorname);
+ } else if (parameter == "{") { // assume color of the form { ri, gi, bi }
+ TQString color =filestream.readLine();
+
+ int rp, gp, bp;
+ float ri, gi, bi;
+
+ rp = color.find(',');
+ gp = color.find(',', rp + 1);
+ bp = color.find('}', gp + 1);
+
+ ri = color.left(rp).toFloat();
+ gi = color.mid(rp + 1, gp - rp - 1).toFloat();
+ bi = color.mid(gp + 1, bp - gp - 1).toFloat();
+
+ int red = (int) (255 * ri);
+ int green = (int) (255 * gi);
+ int blue = (int) (255 * bi);
+ styledata->back[state].setRgb(red, green, blue);
+ }
+ } else if (next == "engine") {
+ if (! parseEngine(styledata))
+ fprintf(stderr, "engine parse error\n");
+ } else if (next.left(3) == "fg[") {
+ int l = next.find('['), r = next.find(']'), state;
+
+ if (l < 1 || r < 1 || r < l) continue;
+
+ TQString mode = next.mid(l + 1, r - l - 1);
+ if (mode == "ACTIVE")
+ state = Active;
+ else if (mode == "NORMAL")
+ state = Normal;
+ else if (mode == "INSENSITIVE")
+ state = Insensitive;
+ else if (mode == "PRELIGHT")
+ state = Prelight;
+ else if (mode == "SELECTED")
+ state = Selected;
+
+ filestream >> next;
+ filestream >> parameter;
+
+ if (next.isNull() || parameter.isNull() || next != "=") continue;
+
+ if (parameter[0] == '\"') { // assume color of the form "#rrggbb"
+ TQString colorname = parameter.mid(1, parameter.length() - 2);
+ if (colorname.isNull()) continue;
+
+ styledata->fore[state].setNamedColor(colorname);
+ } else if (parameter == "{") { // assume color of the form { ri, gi, bi }
+ TQString color = filestream.readLine();
+
+ int rp, gp, bp;
+ float ri, gi, bi;
+
+ rp = color.find(',');
+ gp = color.find(',', rp + 1);
+ bp = color.find('}', gp + 1);
+
+ ri = color.left(rp).toFloat();
+ gi = color.mid(rp + 1, gp - rp - 1).toFloat();
+ bi = color.mid(gp + 1, bp - gp - 1).toFloat();
+
+ int red = (int) (255 * ri);
+ int green = (int) (255 * gi);
+ int blue = (int) (255 * bi);
+ styledata->fore[state].setRgb(red, green, blue);
+ }
+ } else if (next == "font") {
+ filestream >> next;
+ filestream >> parameter;
+
+ if (next.isNull() || parameter.isNull() || next != "=" ||
+ parameter[0] != '\"' || parameter[parameter.length() - 1] != '\"') {
+ tqWarning("font parameter malformed '%s'", parameter.latin1());
+ continue;
+ }
+
+ parameter = parameter.mid(1, parameter.length() - 2);
+
+ if (! styledata->fn) {
+ styledata->fn = new TQFont;
+ }
+
+ styledata->fn->setRawName(parameter);
+ } else if (next == "{") {
+ paren_count++;
+ } else if (next == "}") {
+ paren_count--;
+ }
+ }
+
+ styleDict.insert(styledata->name, styledata);
+
+ return true;
+}
+
+
+KLegacyStyle::KLegacyStyle(void) : TDEStyle() {
+ setButtonDefaultIndicatorWidth(6);
+ setScrollBarExtent(15, 15);
+ setButtonMargin(3);
+ setSliderThickness(15);
+
+ priv = new KLegacyStylePrivate;
+}
+
+
+KLegacyStyle::~KLegacyStyle(void) {
+ delete priv;
+}
+
+
+int KLegacyStyle::defaultFrameWidth() const {
+ return 2;
+}
+
+
+void KLegacyStyle::polish(TQApplication *app) {
+ priv->oldfont = app->font();
+ priv->oldpalette = app->palette();
+
+ GtkObject *gobj = priv->gtkDict.find(TQMainWindow::staticMetaObject());
+
+ if (gobj) {
+ if (gobj->font()) {
+ app->setFont(*gobj->font(), true);
+ }
+
+ TQPalette pal = app->palette();
+ TQBrush brush;
+
+ // background
+ brush = pal.brush(TQPalette::Active, TQColorGroup::Background);
+ brush.setColor(gobj->backColor(KLegacy::Active));
+ pal.setBrush(TQPalette::Active, TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Inactive, TQColorGroup::Background);
+ brush.setColor(gobj->backColor(KLegacy::Normal));
+ pal.setBrush(TQPalette::Inactive, TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Disabled, TQColorGroup::Background);
+ brush.setColor(gobj->backColor(KLegacy::Insensitive));
+ pal.setBrush(TQPalette::Disabled, TQColorGroup::Background, brush);
+
+ // foreground
+ brush = pal.brush(TQPalette::Active, TQColorGroup::Foreground);
+ brush.setColor(gobj->foreColor(KLegacy::Active));
+ pal.setBrush(TQPalette::Active, TQColorGroup::Foreground, brush);
+
+ brush = pal.brush(TQPalette::Inactive, TQColorGroup::Foreground);
+ brush.setColor(gobj->foreColor(KLegacy::Normal));
+ pal.setBrush(TQPalette::Inactive, TQColorGroup::Foreground, brush);
+
+ brush = pal.brush(TQPalette::Disabled, TQColorGroup::Foreground);
+ brush.setColor(gobj->foreColor(KLegacy::Insensitive));
+ pal.setBrush(TQPalette::Disabled, TQColorGroup::Foreground, brush);
+
+ // base
+ brush = pal.brush(TQPalette::Active, TQColorGroup::Base);
+ brush.setColor(gobj->baseColor(KLegacy::Normal));
+ pal.setBrush(TQPalette::Active, TQColorGroup::Base, brush);
+
+ brush = pal.brush(TQPalette::Inactive, TQColorGroup::Base);
+ brush.setColor(gobj->baseColor(KLegacy::Normal));
+ pal.setBrush(TQPalette::Inactive, TQColorGroup::Base, brush);
+
+ brush = pal.brush(TQPalette::Disabled, TQColorGroup::Base);
+ brush.setColor(gobj->baseColor(KLegacy::Normal));
+ pal.setBrush(TQPalette::Disabled, TQColorGroup::Base, brush);
+
+ // button
+ brush = pal.brush(TQPalette::Active, TQColorGroup::Button);
+ brush.setColor(gobj->backColor(KLegacy::Active));
+ pal.setBrush(TQPalette::Active, TQColorGroup::Button, brush);
+
+ brush = pal.brush(TQPalette::Normal, TQColorGroup::Button);
+ brush.setColor(gobj->backColor(KLegacy::Normal));
+ pal.setBrush(TQPalette::Normal, TQColorGroup::Button, brush);
+
+ brush = pal.brush(TQPalette::Disabled, TQColorGroup::Button);
+ brush.setColor(gobj->backColor(KLegacy::Insensitive));
+ pal.setBrush(TQPalette::Disabled, TQColorGroup::Button, brush);
+
+ // text
+ brush = pal.brush(TQPalette::Active, TQColorGroup::Text);
+ brush.setColor(gobj->foreColor(KLegacy::Active));
+ pal.setBrush(TQPalette::Active, TQColorGroup::Text, brush);
+
+ brush = pal.brush(TQPalette::Inactive, TQColorGroup::Text);
+ brush.setColor(gobj->foreColor(KLegacy::Normal));
+ pal.setBrush(TQPalette::Inactive, TQColorGroup::Text, brush);
+
+ brush = pal.brush(TQPalette::Disabled, TQColorGroup::Text);
+ brush.setColor(gobj->foreColor(KLegacy::Insensitive));
+ pal.setBrush(TQPalette::Disabled, TQColorGroup::Text, brush);
+
+ // highlight
+ brush = pal.brush(TQPalette::Active, TQColorGroup::Highlight);
+ brush.setColor(gobj->backColor(KLegacy::Selected));
+ pal.setBrush(TQPalette::Active, TQColorGroup::Highlight, brush);
+
+ brush = pal.brush(TQPalette::Active, TQColorGroup::Highlight);
+ brush.setColor(gobj->backColor(KLegacy::Selected));
+ pal.setBrush(TQPalette::Active, TQColorGroup::Highlight, brush);
+
+ brush = pal.brush(TQPalette::Active, TQColorGroup::Highlight);
+ brush.setColor(gobj->backColor(KLegacy::Selected));
+ pal.setBrush(TQPalette::Active, TQColorGroup::Highlight, brush);
+
+ // highlight text
+ brush = pal.brush(TQPalette::Active, TQColorGroup::HighlightedText);
+ brush.setColor(gobj->foreColor(KLegacy::Selected));
+ pal.setBrush(TQPalette::Active, TQColorGroup::HighlightedText, brush);
+
+ brush = pal.brush(TQPalette::Active, TQColorGroup::HighlightedText);
+ brush.setColor(gobj->foreColor(KLegacy::Active));
+ pal.setBrush(TQPalette::Active, TQColorGroup::HighlightedText, brush);
+
+ brush = pal.brush(TQPalette::Active, TQColorGroup::HighlightedText);
+ brush.setColor(gobj->foreColor(KLegacy::Active));
+ pal.setBrush(TQPalette::Active, TQColorGroup::HighlightedText, brush);
+
+ app->setPalette(pal, true);
+ }
+
+ qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &KLegacyStyle::drawMenuBarItem);
+
+ TDEStyle::polish(app);
+}
+
+
+void KLegacyStyle::polish(TQWidget *widget) {
+ if (qstrcmp(widget->name(), "qt_viewport") == 0 ||
+ widget->testWFlags(WType_Popup) ||
+ widget->inherits("KDesktop"))
+ return;
+
+ if (widget->backgroundMode() == TQWidget::PaletteBackground ||
+ widget->backgroundMode() == TQWidget::PaletteButton &&
+ (! widget->ownPalette()))
+ widget->setBackgroundMode(TQWidget::X11ParentRelative);
+
+ TQMetaObject *metaobject = 0;
+ TQString detail;
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+
+ bool eventFilter = false;
+ bool mouseTrack = false;
+ bool immediateRender = false;
+ bool bgPixmap = false;
+
+ if (widget->inherits(TQBUTTON_OBJECT_NAME_STRING)) {
+ metaobject = TQButton::staticMetaObject();
+ eventFilter = true;
+ }
+
+ if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING)) {
+ metaobject = TQComboBox::staticMetaObject();
+ eventFilter = true;
+ }
+
+ if (widget->inherits(TQSCROLLBAR_OBJECT_NAME_STRING)) {
+ metaobject = TQScrollBar::staticMetaObject();
+ eventFilter = true;
+ mouseTrack = true;
+ }
+
+ if (widget->inherits(TQMENUBAR_OBJECT_NAME_STRING)) {
+ eventFilter = true;
+ immediateRender = true;
+
+ metaobject = TQMenuBar::staticMetaObject();
+
+ detail = "menubar";
+ key.data.function = KLegacy::Box;
+ key.data.shadow = KLegacy::Out;
+ key.data.state = KLegacy::Normal;
+
+ ((TQMenuBar *) widget)->setFrameShape(TQFrame::StyledPanel);
+ ((TQMenuBar *) widget)->setLineWidth(0);
+ widget->setBackgroundMode(TQWidget::PaletteBackground);
+ }
+
+ if (widget->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) {
+ metaobject = TQToolBar::staticMetaObject();
+
+ eventFilter = true;
+ immediateRender = true;
+
+ detail = "menubar";
+ key.data.function = KLegacy::Box;
+ key.data.shadow = KLegacy::Out;
+ key.data.state = KLegacy::Normal;
+
+ widget->setBackgroundMode(TQWidget::PaletteBackground);
+ }
+
+ if (widget->inherits(TQLINEEDIT_OBJECT_NAME_STRING)) {
+ metaobject = TQLineEdit::staticMetaObject();
+
+ eventFilter = true;
+ immediateRender = true;
+
+ detail = "entry_bg";
+ key.data.function = KLegacy::FlatBox;
+ key.data.shadow = KLegacy::NoShadow;
+ key.data.state = (widget->isEnabled()) ? KLegacy::Normal : KLegacy::Insensitive;
+
+ widget->setBackgroundMode(TQWidget::PaletteBase);
+ }
+
+ if (widget->isTopLevel() || widget->inherits("QWorkspaceChild")) {
+ immediateRender = true;
+
+ bgPixmap = true;
+ metaobject = TQMainWindow::staticMetaObject();
+ key.cachekey = 0;
+ key.data.function = KLegacy::FlatBox;
+ detail = "base";
+ }
+
+ if (widget->inherits(TQPOPUPMENU_OBJECT_NAME_STRING)) {
+ tqDebug("polishing popup '%s'", widget->className());
+ metaobject = TQPopupMenu::staticMetaObject();
+ widget->setBackgroundMode(TQWidget::PaletteBackground);
+ }
+
+ GtkObject *gobj = gobj = priv->gtkDict.find(((metaobject) ? metaobject :
+ widget->metaObject()));
+
+ if (gobj) {
+ if (gobj->font() && (*gobj->font() != TQApplication::font()))
+ widget->setFont(*gobj->font());
+
+ if (immediateRender) {
+ TQPixmap *pix = gobj->draw(key, widget->width(), widget->height(), detail);
+
+ if (pix && ! pix->isNull()) {
+ if (! bgPixmap) {
+ TQPalette pal = widget->palette();
+ TQBrush brush;
+
+ // base
+ // active
+ brush = pal.brush(TQPalette::Active,
+ TQColorGroup::Base);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Active,
+ TQColorGroup::Base, brush);
+
+ // inactive
+ brush = pal.brush(TQPalette::Inactive,
+ TQColorGroup::Base);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Inactive,
+ TQColorGroup::Base, brush);
+
+ // disabled
+ brush = pal.brush(TQPalette::Disabled,
+ TQColorGroup::Base);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Disabled,
+ TQColorGroup::Base, brush);
+
+ // background - button
+ // active
+ brush = pal.brush(TQPalette::Active,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Active,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Active,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Active,
+ TQColorGroup::Button, brush);
+
+ // inactive
+ brush = pal.brush(TQPalette::Inactive,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Inactive,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Inactive,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Inactive,
+ TQColorGroup::Button, brush);
+
+ // disabled
+ brush = pal.brush(TQPalette::Disabled,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Disabled,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Disabled,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Disabled,
+ TQColorGroup::Button, brush);
+
+ widget->setPalette(pal);
+ } else
+ widget->setBackgroundPixmap(*pix);
+ }
+ }
+ }
+
+ if (eventFilter) {
+ widget->installEventFilter(this);
+ }
+
+ if (mouseTrack) {
+ widget->setMouseTracking(mouseTrack);
+ }
+
+ TDEStyle::polish(widget);
+}
+
+
+void KLegacyStyle::polishPopupMenu(TQPopupMenu *popup) {
+ TDEStyle::polishPopupMenu(popup);
+
+ popup->setMouseTracking(true);
+ popup->setCheckable(true);
+
+ popup->installEventFilter(this);
+}
+
+
+void KLegacyStyle::unPolish(TQWidget *widget) {
+ if (widget->inherits("KDesktop"))
+ return;
+
+ widget->setBackgroundOrigin(TQWidget::WidgetOrigin);
+ widget->setBackgroundPixmap(TQPixmap());
+ widget->removeEventFilter(this);
+ widget->unsetPalette();
+ widget->setAutoMask(false);
+ TDEStyle::unPolish(widget);
+}
+
+
+void KLegacyStyle::unPolish(TQApplication *app) {
+ app->setFont(priv->oldfont, true);
+ app->setPalette(priv->oldpalette, true);
+
+ qt_set_draw_menu_bar_impl(0);
+
+ TDEStyle::unPolish(app);
+}
+
+
+void KLegacyStyle::drawKMenuItem(TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g,
+ bool active, TQMenuItem *mi, TQBrush *)
+{
+ drawMenuBarItem(p, x, y, w, h, mi, (TQColorGroup &) g,
+ (mi) ? mi->isEnabled() : false, active);
+}
+
+
+void KLegacyStyle::drawMenuBarItem(TQPainter *p, int x, int y, int w, int h, TQMenuItem *mi,
+ TQColorGroup &g, bool enabled, bool active)
+{
+ if (enabled && active) {
+ GtkObject *gobj = priv->gtkDict.find(&menuitem_ptr);
+
+ if (gobj) {
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ key.data.state = KLegacy::Prelight;
+ key.data.shadow = KLegacy::Out;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "menuitem");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x, y, *pix);
+ }
+ }
+
+ drawItem(p, x, y, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine,
+ g, enabled, mi->pixmap(), mi->text(), -1, &g.buttonText());
+}
+
+
+void KLegacyStyle::drawButton(TQPainter *p, int x, int y , int w, int h,
+ const TQColorGroup &g, bool sunken, const TQBrush *fill)
+{
+ drawBevelButton(p, x, y, w, h, g, sunken, fill);
+}
+
+
+void KLegacyStyle::drawBevelButton(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup & g, bool sunken,
+ const TQBrush *fill)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQButton::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawBevelButton(p, x, y, w, h, g, sunken, fill);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ key.data.shadow = (sunken) ? KLegacy::In : KLegacy::Out;
+ key.data.state = (sunken) ? KLegacy::Active : KLegacy::Normal;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "button");
+
+ if (pix && (! pix->isNull()))
+ p->drawPixmap(x, y, *pix);
+ else
+ TDEStyle::drawBevelButton(p, x, y, w, h, g, sunken, fill);
+}
+
+
+void KLegacyStyle::drawPushButton(TQPushButton *btn, TQPainter *p) {
+ GtkObject *gobj = priv->gtkDict.find(TQPushButton::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawPushButton(btn, p);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+
+ TQColorGroup g = btn->colorGroup();
+ TQBrush fill = g.brush(TQColorGroup::Button);
+ int x1, y1, x2, y2;
+ btn->rect().coords(&x1, &y1, &x2, &y2);
+
+ if (btn->isDefault()) {
+ // draw default button
+ key.data.state = (btn->isEnabled()) ? KLegacy::Normal : KLegacy::Insensitive;
+ key.data.shadow = KLegacy::In;
+
+ TQPixmap *pix = gobj->draw(key, x2 -x1 + 1, y2 - y1 + 1, "buttondefault");
+
+ if (! pix)
+ pix = gobj->draw(key, x2 - x1 + 1, y2 - y1 + 1, "button");
+
+ if (pix)
+ p->drawPixmap(x1, y1, *pix);
+ else
+ TDEStyle::drawBevelButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1,
+ g, true, &fill);
+ }
+
+ int diw = buttonDefaultIndicatorWidth();
+ if (btn->isDefault() || btn->autoDefault()) {
+ x1 += diw;
+ y1 += diw;
+ x2 -= diw;
+ y2 -= diw;
+ }
+
+ if (btn->isOn() || btn->isDown()) {
+ key.data.state = KLegacy::Active;
+ key.data.shadow = KLegacy::In;
+ } else {
+ key.data.state = ((btn->isEnabled()) ?
+ ((static_cast<TQWidget *>( btn ) == priv->lastWidget) ? KLegacy::Prelight : KLegacy::Normal) :
+ KLegacy::Insensitive);
+ key.data.shadow = ((btn->isOn() || btn->isDown()) ?
+ KLegacy::In : KLegacy::Out);
+ }
+
+ TQPixmap *pix = gobj->draw(key, x2 - x1 + 1, y2 - y1 + 1, "button");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x1, y1, *pix);
+ else {
+ TDEStyle::drawBevelButton(p, x1, y1, x2 - x1 + 1, y2 - y1 + 1,
+ g, btn->isOn() || btn->isDown(), &fill);
+ }
+}
+
+
+void KLegacyStyle::drawIndicator(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, int state,
+ bool down, bool enabled)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQCheckBox::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawIndicator(p, x, y, w, h, g, state, down, enabled);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Check;
+ key.data.state = KLegacy::Normal;
+ key.data.shadow = ((state != TQButton::Off) || down) ? KLegacy::In : KLegacy::Out;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "checkbutton");
+
+ if (pix && (! pix->isNull()))
+ p->drawPixmap(x, y, *pix);
+ else
+ TDEStyle::drawIndicator(p, x, y, w, h, g, state, down, enabled);
+}
+
+
+void KLegacyStyle::drawIndicatorMask(TQPainter *p, int x, int y, int w, int h, int state) {
+ GtkObject *gobj = priv->gtkDict.find(TQCheckBox::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawIndicatorMask(p, x, y, w, h, state);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Check;
+ key.data.state = KLegacy::Normal;
+ key.data.shadow = (state != TQButton::Off) ? KLegacy::In : KLegacy::Out;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "checkbutton");
+
+ if (pix && pix->mask() && ! pix->mask()->isNull())
+ p->drawPixmap(x, y, *(pix->mask()));
+ else
+ TDEStyle::drawIndicatorMask(p, x, y, w, h, state);
+}
+
+
+TQSize KLegacyStyle::indicatorSize(void) const {
+ GtkObject *gobj = priv->gtkDict.find(TQCheckBox::staticMetaObject());
+
+ if (! gobj) return TDEStyle::indicatorSize();
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Check;
+ key.data.shadow = KLegacy::Out;
+ KLegacyImageData *id = gobj->getImageData(key, "checkbutton");
+
+ if (! id) return TDEStyle::indicatorSize();
+
+ TQString filename;
+ if (! id->file.isNull())
+ filename = id->file;
+ else if (! id->overlayFile.isNull())
+ filename = id->overlayFile;
+ else
+ return TDEStyle::indicatorSize();
+
+ TQImage *image = imageCache->find(filename);
+ if (! image) {
+ image = new TQImage(filename);
+
+ if (! image) return TDEStyle::indicatorSize();
+
+ imageCache->insert(filename, image);
+ }
+
+ return TQSize(image->width(), image->height());
+}
+
+
+void KLegacyStyle::drawExclusiveIndicator(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, bool on,
+ bool down, bool enabled)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQRadioButton::staticMetaObject());
+
+ if (! gobj) {
+ drawExclusiveIndicator(p, x, y, w, h, g, on, down, enabled);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Option;
+ key.data.state = KLegacy::Normal;
+ key.data.shadow = (on || down) ? KLegacy::In : KLegacy::Out;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "radiobutton");
+
+ if (pix && (! pix->isNull()))
+ p->drawPixmap(x, y, *pix);
+ else
+ TDEStyle::drawExclusiveIndicator(p, x, y, w, h, g, down, enabled);
+}
+
+
+void KLegacyStyle::drawExclusiveIndicatorMask(TQPainter *p, int x, int y, int w, int h,
+ bool on)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQRadioButton::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawExclusiveIndicatorMask(p, x, y, w, h, on);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Option;
+ key.data.state = KLegacy::Normal;
+ key.data.shadow = (on) ? KLegacy::In : KLegacy::Out;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "radiobutton");
+
+ if (pix && pix->mask() && ! pix->mask()->isNull())
+ p->drawPixmap(x, y, *(pix->mask()));
+ else
+ TDEStyle::drawExclusiveIndicatorMask(p, x, y, w, h, on);
+}
+
+
+TQSize KLegacyStyle::exclusiveIndicatorSize(void) const {
+ GtkObject *gobj = priv->gtkDict.find(TQRadioButton::staticMetaObject());
+
+ if (! gobj) {
+ return TDEStyle::indicatorSize();
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Option;
+ key.data.shadow = KLegacy::Out;
+ KLegacyImageData *id = gobj->getImageData(key, "radiobutton");
+
+ if (! id) return TDEStyle::indicatorSize();
+
+ TQString filename;
+ if (! id->file.isNull()) {
+ filename = id->file;
+ } else if (! id->overlayFile.isNull()) {
+ filename = id->overlayFile;
+ } else {
+ return TDEStyle::indicatorSize();
+ }
+
+ TQImage *image = imageCache->find(filename);
+ if (! image) {
+ image = new TQImage(filename);
+
+ if (! image) {
+ return TDEStyle::indicatorSize();
+ }
+
+ imageCache->insert(filename, image);
+ }
+
+ return TQSize(image->width(), image->height());
+}
+
+
+void KLegacyStyle::drawPopupMenuItem(TQPainter *p, bool checkable, int maxpmw, int tab,
+ TQMenuItem *mi, const TQPalette &pal, bool act,
+ bool enabled, int x, int y, int w, int h)
+{
+ const TQColorGroup & g = pal.active();
+ TQColorGroup itemg = (! enabled) ? pal.disabled() : pal.active();
+
+ if (checkable)
+ maxpmw = QMAX(maxpmw, 15);
+
+ int checkcol = maxpmw;
+
+ if (mi && mi->isSeparator()) {
+ p->setPen( g.dark() );
+ p->drawLine( x, y, x+w, y );
+ p->setPen( g.light() );
+ p->drawLine( x, y+1, x+w, y+1 );
+ return;
+ }
+
+ if ( act && enabled ) {
+ GtkObject *gobj = priv->gtkDict.find(&menuitem_ptr);
+
+ if (gobj) {
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ key.data.state = KLegacy::Prelight;
+ key.data.shadow = KLegacy::Out;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "menuitem");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x, y, *pix);
+ }
+ } else
+ p->fillRect(x, y, w, h, g.brush( TQColorGroup::Button ));
+
+ if ( !mi )
+ return;
+
+ if ( mi->isChecked() ) {
+ if ( mi->iconSet() ) {
+ qDrawShadePanel( p, x+2, y+2, checkcol, h-2*2,
+ g, true, 1, &g.brush( TQColorGroup::Midlight ) );
+ }
+ } else if ( !act ) {
+ p->fillRect(x+2, y+2, checkcol, h-2*2,
+ g.brush( TQColorGroup::Button ));
+ }
+
+ if ( mi->iconSet() ) { // draw iconset
+ TQIconSet::Mode mode = (enabled) ? TQIconSet::Normal : TQIconSet::Disabled;
+
+ if (act && enabled)
+ mode = TQIconSet::Active;
+
+ TQPixmap pixmap = mi->iconSet()->pixmap(TQIconSet::Small, mode);
+
+ int pixw = pixmap.width();
+ int pixh = pixmap.height();
+
+ TQRect cr( x + 2, y+2, checkcol, h-2*2 );
+ TQRect pmr( 0, 0, pixw, pixh );
+
+ pmr.moveCenter(cr.center());
+
+ p->setPen( itemg.text() );
+ p->drawPixmap( pmr.topLeft(), pixmap );
+
+ } else if (checkable) {
+ int mw = checkcol;
+ int mh = h - 4;
+
+ if (mi->isChecked())
+ drawCheckMark(p, x+2, y+2, mw, mh, itemg, act, ! enabled);
+ }
+
+ p->setPen( g.buttonText() );
+
+ TQColor discol;
+ if (! enabled) {
+ discol = itemg.text();
+ p->setPen( discol );
+ }
+
+ if (mi->custom()) {
+ p->save();
+ mi->custom()->paint(p, itemg, act, enabled, x + checkcol + 4, y + 2,
+ w - checkcol - tab - 3, h - 4);
+ p->restore();
+ }
+
+ TQString s = mi->text();
+ if ( !s.isNull() ) { // draw text
+ int t = s.find( '\t' );
+ int m = 2;
+ const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine;
+ if ( t >= 0 ) { // draw tab text
+ p->drawText( x+w-tab-2-2,
+ y+m, tab, h-2*m, text_flags, s.mid( t+1 ) );
+ }
+ p->drawText(x + checkcol + 4, y + 2, w - checkcol -tab - 3, h - 4,
+ text_flags, s, t);
+ } else if (mi->pixmap()) {
+ TQPixmap *pixmap = mi->pixmap();
+
+ if (pixmap->depth() == 1) p->setBackgroundMode(OpaqueMode);
+ p->drawPixmap(x + checkcol + 2, y + 2, *pixmap);
+ if (pixmap->depth() == 1) p->setBackgroundMode(TransparentMode);
+ }
+
+ if (mi->popup()) {
+ int hh = h / 2;
+
+ drawMenuArrow(p, RightArrow, (act) ? mi->isEnabled() : false,
+ x + w - hh - 6, y + (hh / 2), hh, hh, g, mi->isEnabled());
+ }
+}
+
+
+void KLegacyStyle::drawComboButton(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, bool sunken, bool editable,
+ bool enabled, const TQBrush *b)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQComboBox::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawComboButton(p, x, y, w, h, g, sunken, editable, enabled, b);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ key.data.state = KLegacy::Normal;
+ key.data.shadow = KLegacy::Out;
+
+ if (priv->lastWidget && priv->lastWidget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING))
+ key.data.state = KLegacy::Prelight;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "optionmenu");
+
+ if (pix && ! pix->isNull()) {
+ p->drawPixmap(x, y, *pix);
+ } else {
+ TDEStyle::drawComboButton(p, x, y, w, h, g, sunken, editable, enabled, b);
+ return;
+ }
+
+ TQRect rect = comboButtonRect(x, y, w, h);
+ int tw = w - rect.width() - rect.right() - rect.left();
+ int th = rect.height();
+
+ key.data.function = KLegacy::Tab;
+ key.data.state = KLegacy::Normal;
+ pix = gobj->draw(key, tw, th, "optionmenutab");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x + rect.width() + rect.left() + ((18 - pix->width()) / 2),
+ y + rect.y() + ((rect.height() - pix->height()) / 2), *pix);
+}
+
+
+TQRect KLegacyStyle::comboButtonRect(int x, int y, int w, int h) {
+ GtkObject *gobj = priv->gtkDict.find(TQComboBox::staticMetaObject());
+
+ if (! gobj) {
+ return TDEStyle::comboButtonRect(x, y, w, h);
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ KLegacyImageData *id = gobj->getImageData(key, "optionmenu");
+
+ if (! id) {
+ return TDEStyle::comboButtonRect(x, y, w, h);
+ }
+
+ return TQRect(x + id->border.left() + 1, y + id->border.top() + 1,
+ w - id->border.left() - id->border.right() - 18,
+ h - id->border.top() - id->border.bottom() - 2);
+}
+
+
+TQRect KLegacyStyle::comboButtonFocusRect(int x, int y, int w, int h) {
+ return comboButtonRect(x, y, w, h);
+}
+
+
+TQStyle::ScrollControl KLegacyStyle::scrollBarPointOver(const TQScrollBar *scrollbar,
+ int sliderStart, const TQPoint &p)
+{
+ return TQCommonStyle::scrollBarPointOver(scrollbar, sliderStart, p);
+}
+
+
+void KLegacyStyle::scrollBarMetrics(const TQScrollBar *scrollbar, int &sliderMin,
+ int &sliderMax, int &sliderLength, int &buttonDim)
+{
+ int maxLength;
+ int b = defaultFrameWidth();
+ int length = ((scrollbar->orientation() == TQScrollBar::Horizontal) ?
+ scrollbar->width() : scrollbar->height());
+ int extent = ((scrollbar->orientation() == TQScrollBar::Horizontal) ?
+ scrollbar->height() : scrollbar->width());
+
+ if (length > ((extent - (b * 2) - 1) * 2) + (b * 2))
+ buttonDim = extent - (b * 2);
+ else
+ buttonDim = ((length - (b * 2)) / 2) - 1;
+
+ sliderMin = b + buttonDim;
+ maxLength = length - (b * 2) - (buttonDim * 2);
+
+ if (scrollbar->maxValue() == scrollbar->minValue()) {
+ sliderLength = maxLength - 2;
+ } else {
+ uint range = scrollbar->maxValue() - scrollbar->minValue();
+
+ sliderLength = (scrollbar->pageStep() * maxLength) /
+ (range + scrollbar->pageStep());
+
+ if (sliderLength < buttonDim || range > (INT_MAX / 2))
+ sliderLength = buttonDim;
+ if (sliderLength >= maxLength)
+ sliderLength = maxLength - 2;
+ }
+
+ sliderMax = sliderMin + maxLength - sliderLength;
+
+ sliderMin += 1;
+ sliderMax -= 1;
+}
+
+
+void KLegacyStyle::drawScrollBarControls(TQPainter *p, const TQScrollBar *scrollbar,
+ int start, uint controls, uint active)
+{
+ if (! scrollbar->isVisible()) return;
+
+ GtkObject *gobj = priv->gtkDict.find(TQScrollBar::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawScrollBarControls(p, scrollbar, start, controls, active);
+ return;
+ }
+
+ KLegacyImageDataKey gkey;
+ gkey.cachekey = 0;
+ gkey.data.function = KLegacy::Box;
+ gkey.data.orientation = scrollbar->orientation() + 1;
+
+ KLegacyImageData *groove_id = gobj->getImageData(gkey, "trough");
+
+ if (! groove_id) {
+ TDEStyle::drawScrollBarControls(p, scrollbar, start, controls, active);
+ return;
+ }
+
+ int sliderMin;
+ int sliderMax;
+ int sliderLen;
+ int buttonDim;
+ scrollBarMetrics(scrollbar, sliderMin, sliderMax, sliderLen, buttonDim);
+
+ // the rectangle for the slider
+ TQRect slider(
+ // x
+ ((scrollbar->orientation() == Vertical) ?
+ defaultFrameWidth() : start),
+
+ // y
+ ((scrollbar->orientation() == Vertical) ?
+ start : defaultFrameWidth()),
+
+ // w
+ ((scrollbar->orientation() == Vertical) ?
+ buttonDim : sliderLen),
+
+ // h
+ ((scrollbar->orientation() == Vertical) ?
+ sliderLen : buttonDim));
+
+ KLegacyImageDataKey skey;
+ skey.cachekey = 0;
+ skey.data.function = KLegacy::Box;
+ skey.data.orientation = scrollbar->orientation() + 1;
+
+ if ((active & Slider) || (priv->hovering && slider.contains(priv->mousePos)))
+ skey.data.state = KLegacy::Prelight;
+ else
+ skey.data.state = KLegacy::Normal;
+
+ KLegacyImageData *slider_id = gobj->getImageData(skey, "slider");
+
+ if (! slider_id) {
+ TDEStyle::drawScrollBarControls(p, scrollbar, start, controls, active);
+ return;
+ }
+
+ TQPixmap *groove_pm = gobj->draw(groove_id, scrollbar->width(), scrollbar->height());
+
+ if ((! groove_pm) || (groove_pm->isNull())) {
+ groove_pm = 0;
+ }
+
+ TQPixmap *slider_pm = gobj->draw(slider_id, slider.width(), slider.height());
+
+ if ((! slider_pm) || (slider_pm->isNull())) {
+ slider_pm = 0;
+ }
+
+ TQPixmap buf(scrollbar->size());
+ {
+ TQPainter p2(&buf);
+
+ if (groove_pm) {
+ p2.drawTiledPixmap(scrollbar->rect(), *groove_pm);
+ }
+
+ if (slider_pm) {
+ p2.drawTiledPixmap(slider, *slider_pm);
+ }
+
+ // arrows
+ int x, y;
+ x = y = defaultFrameWidth();
+
+ drawArrow(&p2, ((scrollbar->orientation() == Vertical) ?
+ UpArrow : LeftArrow),
+ (active & SubLine), x, y,
+ buttonDim,
+ buttonDim,
+ scrollbar->colorGroup(), true);
+
+ if (scrollbar->orientation() == Vertical)
+ y = scrollbar->height() - buttonDim - defaultFrameWidth();
+ else
+ x = scrollbar->width() - buttonDim - defaultFrameWidth();
+
+ drawArrow(&p2, ((scrollbar->orientation() == Vertical) ?
+ DownArrow : RightArrow),
+ (active & AddLine), x, y,
+ buttonDim,
+ buttonDim,
+ scrollbar->colorGroup(), true);
+ }
+ p->drawPixmap(0, 0, buf);
+}
+
+
+void KLegacyStyle::drawSlider(TQPainter *p, int x, int y, int w, int h, const TQColorGroup &g,
+ Orientation orientation, bool tickAbove, bool tickBelow)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQSlider::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawSlider(p, x, y, w, h, g, orientation, tickAbove, tickBelow);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ key.data.shadow = KLegacy::Out;
+ key.data.state = KLegacy::Normal;
+ key.data.orientation = orientation + 1;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "slider");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x, y, *pix);
+ else
+ TDEStyle::drawSlider(p, x, y, w, h, g, orientation, tickAbove, tickBelow);
+}
+
+
+
+void KLegacyStyle::drawSliderGroove(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, QCOORD c, Orientation o)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQSlider::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawSliderGroove(p, x, y, w, h, g, c, o);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ key.data.shadow = KLegacy::In;
+ key.data.state = KLegacy::Active;
+ key.data.orientation = o + 1;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "trough");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x, y, *pix);
+ else
+ TDEStyle::drawSliderGroove(p, x, y, w, h, g, c, o);
+}
+
+
+void KLegacyStyle::drawArrow(TQPainter *p, ArrowType type, bool down,
+ int x, int y, int w, int h,
+ const TQColorGroup &g, bool enabled, const TQBrush *b)
+{
+ GtkObject *gobj = priv->gtkDict.find(&arrow_ptr);
+
+ if (! gobj) {
+ TDEStyle::drawArrow(p, type, down, x, y, w, h, g, enabled, b);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Arrow;
+ key.data.state = (down) ? KLegacy::Active : KLegacy::Normal;
+ key.data.shadow = (down) ? KLegacy::In : KLegacy::NoShadow;
+ key.data.arrowDirection = type + 1;
+
+ if ((! down) && priv->hovering &&
+ TQRect(x, y, w, h).contains(priv->mousePos)) {
+ key.data.state = KLegacy::Prelight;
+ }
+
+ TQPixmap *pix = gobj->draw(key, w, h, "arrow");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x, y, *pix);
+ else
+ TDEStyle::drawArrow(p, type, down, x, y, w, h, g, enabled, b);
+}
+
+
+void KLegacyStyle::drawMenuArrow(TQPainter *p, ArrowType type, bool down,
+ int x, int y, int w, int h,
+ const TQColorGroup &g, bool enabled, const TQBrush *b)
+{
+ GtkObject *gobj = priv->gtkDict.find(&menuitem_ptr);
+
+ if (! gobj) {
+ TDEStyle::drawArrow(p, type, down, x, y, w, h, g, enabled, b);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Arrow;
+ key.data.state = (down) ? KLegacy::Active : KLegacy::Normal;
+ key.data.shadow = (down) ? KLegacy::In : KLegacy::NoShadow;
+ key.data.arrowDirection = type + 1;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "arrow");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x + ((w - pix->width()) / 2),
+ y + ((h - pix->height()) / 2), *pix);
+ else
+ TDEStyle::drawArrow(p, type, down, x, y, w, h, g, enabled, b);
+}
+
+
+void KLegacyStyle::drawPanel(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, bool sunken, int, const TQBrush *brush)
+{
+ TDEStyle::drawPanel(p, x, y, w, h, g, sunken, 1, brush);
+}
+
+
+void KLegacyStyle::drawPopupPanel(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, int, const TQBrush *fill)
+{
+ TQBrush brush = (fill) ? *fill : g.brush(TQColorGroup::Background);
+
+ p->fillRect(x, y, w, h, brush);
+}
+
+
+void KLegacyStyle::drawCheckMark(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, bool activated, bool disabled)
+{
+ GtkObject *gobj = priv->gtkDict.find(&checkmenuitem_ptr);
+
+ if (! gobj) {
+ TDEStyle::drawCheckMark(p, x, y, w, h, g, activated, disabled);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Check;
+ key.data.shadow = (disabled) ? KLegacy::Out : KLegacy::In;
+
+ TQPixmap *pix = gobj->draw(key, w, h);
+
+ if (pix && (! pix->isNull())) {
+ x += (w - pix->width()) / 2;
+ y += (h - pix->height()) / 2;
+ p->drawPixmap(x, y, *pix);
+ } else {
+ TDEStyle::drawCheckMark(p, x, y, w, h, g, activated, disabled);
+ }
+}
+
+
+void KLegacyStyle::drawSplitter(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, Orientation orientation)
+{
+ if (orientation == Horizontal) {
+ int xpos = x + (w / 2);
+ int kpos = 10;
+ int ksize = splitterWidth() - 2;
+
+ qDrawShadeLine(p, xpos, kpos + ksize - 1, xpos, h, g);
+ drawBevelButton(p, xpos - (splitterWidth() / 2) + 1, kpos, ksize, ksize,
+ g, false, &g.brush(TQColorGroup::Button));
+ qDrawShadeLine(p, xpos, 0, xpos, kpos, g);
+ } else {
+ int ypos = y + (h / 2);
+ int kpos = w - 10 - splitterWidth();
+ int ksize = splitterWidth() - 2;
+
+ qDrawShadeLine(p, 0, ypos, kpos, ypos, g);
+ drawBevelButton(p, kpos, ypos - (splitterWidth() / 2) + 1, ksize, ksize,
+ g, false, &g.brush(TQColorGroup::Button));
+ qDrawShadeLine(p, kpos + ksize - 1, ypos, w, ypos, g);
+ }
+}
+
+
+void KLegacyStyle::drawTab(TQPainter *p, const TQTabBar *tabbar, TQTab *tab, bool selected)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQTabBar::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawTab(p, tabbar, tab, selected);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Extension;
+ key.data.state = (! selected) ? KLegacy::Active : KLegacy::Normal;
+ key.data.shadow = KLegacy::Out;
+ key.data.gapSide = (tabbar->shape() == TQTabBar::RoundedAbove ||
+ tabbar->shape() == TQTabBar::TriangularAbove) ?
+ KLegacy::Bottom : KLegacy::Top;
+
+ int ry = tab->r.top(), rh = tab->r.height();
+
+ if (! selected) {
+ rh -= 2;
+
+ if (tabbar->shape() == TQTabBar::RoundedAbove ||
+ tabbar->shape() == TQTabBar::TriangularAbove)
+ ry += 2;
+ }
+
+ TQPixmap *pix = gobj->draw(key, tab->r.width(), rh, "tab");
+
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(tab->r.left(), ry, *pix);
+ else
+ TDEStyle::drawTab(p, tabbar, tab, selected);
+}
+
+
+void KLegacyStyle::drawKBarHandle(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, TDEToolBarPos type, TQBrush *fill)
+{
+ GtkObject *gobj = priv->gtkDict.find(TQToolBar::staticMetaObject());
+
+ if (! gobj) {
+ TDEStyle::drawKBarHandle(p, x, y, w, h, g, type, fill);
+ return;
+ }
+
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Handle;
+ key.data.state = KLegacy::Normal;
+ key.data.shadow = KLegacy::Out;
+ key.data.orientation = (type == Left || type == Right) ?
+ Vertical + 1: Horizontal + 1;
+
+ TQPixmap *pix = gobj->draw(key, w, h, "handle");
+
+ if (pix && ! pix->isNull())
+ p->drawPixmap(x, y, *pix);
+}
+
+
+void KLegacyStyle::drawKickerHandle(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, TQBrush *fill)
+{
+ drawKBarHandle(p, x, y, w, h, g, Left, fill);
+}
+
+
+void KLegacyStyle::drawKickerAppletHandle(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, TQBrush *fill)
+{
+ drawKBarHandle(p, x, y, w, h, g, Left, fill);
+}
+
+
+void KLegacyStyle::drawKickerTaskButton(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, const TQString &title,
+ bool active, TQPixmap *icon, TQBrush *fill)
+{
+ drawBevelButton(p, x, y, w, h, g, active, fill);
+
+ const int pxWidth = 20;
+ int textPos = pxWidth;
+
+ TQRect br(buttonRect(x, y, w, h));
+
+ if (active)
+ p->translate(1,1);
+
+ if (icon && ! icon->isNull()) {
+ int dx = (pxWidth - icon->width()) / 2;
+ int dy = (h - icon->height()) / 2;
+
+ p->drawPixmap(br.x() + dx, dy, *icon);
+ }
+
+ TQString s(title);
+
+ static const TQString &modStr = TDEGlobal::staticQString(
+ TQString::fromUtf8("[") + i18n("modified") + TQString::fromUtf8("]"));
+
+ int modStrPos = s.find(modStr);
+
+ if (modStrPos != -1) {
+ s.remove(modStrPos, modStr.length()+1);
+
+ TQPixmap modPixmap = SmallIcon("modified");
+
+ int dx = (pxWidth - modPixmap.width()) / 2;
+ int dy = (h - modPixmap.height()) / 2;
+
+ p->drawPixmap(br.x() + textPos + dx, dy, modPixmap);
+
+ textPos += pxWidth;
+ }
+
+ if (! s.isEmpty()) {
+ if (p->fontMetrics().width(s) > br.width() - textPos) {
+ int maxLen = br.width() - textPos - p->fontMetrics().width("...");
+
+ while ( (! s.isEmpty()) && (p->fontMetrics().width(s) > maxLen))
+ s.truncate(s.length() - 1);
+
+ s.append("...");
+ }
+
+ p->setPen((active) ? g.foreground() : g.buttonText());
+
+ p->drawText(br.x() + textPos, -1, w - textPos, h, AlignVCenter | AlignLeft, s);
+ }
+}
+
+
+bool KLegacyStyle::eventFilter(TQObject *obj, TQEvent *e) {
+ switch (e->type()) {
+ case TQEvent::Resize:
+ {
+ TQWidget *w = (TQWidget *) obj;
+
+ if (w->inherits(TQPOPUPMENU_OBJECT_NAME_STRING) && w->width() < 700) {
+ GtkObject *gobj = priv->gtkDict.find(TQPopupMenu::staticMetaObject());
+
+ if (gobj) {
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ key.data.state = KLegacy::Normal;
+ key.data.shadow = KLegacy::Out;
+
+ TQPixmap *pix = gobj->draw(key, w->width(), w->height(), "menu");
+
+ if (pix && ! pix->isNull()) {
+ TQPalette pal = w->palette();
+
+ // active
+ TQBrush brush = pal.brush(TQPalette::Active,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Active,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Active,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Active,
+ TQColorGroup::Button, brush);
+
+ // inactive
+ brush = pal.brush(TQPalette::Inactive,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Inactive,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Inactive,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Inactive,
+ TQColorGroup::Button, brush);
+
+ // disabled
+ brush = pal.brush(TQPalette::Disabled,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Disabled,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Disabled,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Disabled,
+ TQColorGroup::Button, brush);
+
+ w->setPalette(pal);
+ }
+ }
+ } else if (w->isTopLevel() || w->inherits("QWorkspaceChild")) {
+ GtkObject *gobj = priv->gtkDict.find(TQMainWindow::staticMetaObject());
+
+ if (gobj) {
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::FlatBox;
+
+ TQPixmap *p = gobj->draw(key, w->width(), w->height(), "base");
+
+ if (p && (! p->isNull()))
+ w->setBackgroundPixmap(*p);
+ }
+ } else if (w->inherits(TQLINEEDIT_OBJECT_NAME_STRING)) {
+ GtkObject *gobj = priv->gtkDict.find(TQLineEdit::staticMetaObject());
+
+ if (gobj) {
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::FlatBox;
+ key.data.shadow = KLegacy::NoShadow;
+ key.data.state = (w->isEnabled()) ? KLegacy::Normal : KLegacy::Insensitive;
+
+ TQPixmap *pix = gobj->draw(key, w->width(), w->height(),
+ "entry_bg");
+
+ if (pix && (! pix->isNull())) {
+ TQPalette pal = w->palette();
+
+ // active
+ TQBrush brush = pal.brush(TQPalette::Active,
+ TQColorGroup::Base);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Active,
+ TQColorGroup::Base, brush);
+
+ // inactive
+ brush = pal.brush(TQPalette::Inactive,
+ TQColorGroup::Base);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Inactive,
+ TQColorGroup::Base, brush);
+
+ // disabled
+ brush = pal.brush(TQPalette::Disabled,
+ TQColorGroup::Base);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Disabled,
+ TQColorGroup::Base, brush);
+
+ w->setPalette(pal);
+ }
+ }
+ } else if (w->inherits(TQMENUBAR_OBJECT_NAME_STRING) ||
+ w->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) {
+ GtkObject *gobj = priv->gtkDict.find(TQMenuBar::staticMetaObject());
+
+ if (gobj) {
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::Box;
+ key.data.state = KLegacy::Normal;
+ key.data.shadow = KLegacy::Out;
+
+ TQPixmap *pix = gobj->draw(key, w->width(), w->height(),
+ "menubar");
+ if (pix && (! pix->isNull())) {
+ TQPalette pal = w->palette();
+
+ // active
+ TQBrush brush = pal.brush(TQPalette::Active,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Active,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Active,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Active,
+ TQColorGroup::Button, brush);
+
+ // inactive
+ brush = pal.brush(TQPalette::Inactive,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Inactive,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Inactive,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Inactive,
+ TQColorGroup::Button, brush);
+
+ // disabled
+ brush = pal.brush(TQPalette::Disabled,
+ TQColorGroup::Background);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Disabled,
+ TQColorGroup::Background, brush);
+
+ brush = pal.brush(TQPalette::Disabled,
+ TQColorGroup::Button);
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Disabled,
+ TQColorGroup::Button, brush);
+
+ w->setPalette(pal);
+ }
+ }
+ }
+
+ break;
+ }
+
+ case TQEvent::Enter:
+ {
+ if (obj->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING) ||
+ obj->inherits(TQCOMBOBOX_OBJECT_NAME_STRING) ||
+ obj->inherits(TQSLIDER_OBJECT_NAME_STRING) ||
+ obj->inherits(TQSCROLLBAR_OBJECT_NAME_STRING)) {
+ priv->lastWidget = (TQWidget *) obj;
+ priv->lastWidget->repaint(false);
+ } else if (obj->inherits(TQRADIOBUTTON_OBJECT_NAME_STRING)) {
+ TQWidget *w = (TQWidget *) obj;
+
+ if (! w->isTopLevel() && w->isEnabled()) {
+ GtkObject *gobj = priv->gtkDict.find(TQRadioButton::staticMetaObject());
+
+ if (gobj) {
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::FlatBox;
+
+ TQPixmap *pix = gobj->draw(key, w->width(), w->height());
+
+ if (pix && (! pix->isNull())) {
+ TQPalette pal = w->palette();
+ TQBrush brush = pal.brush(TQPalette::Normal,
+ TQColorGroup::Background);
+
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Normal,
+ TQColorGroup::Background, brush);
+
+ w->setPalette(pal);
+ w->setBackgroundMode(TQWidget::PaletteBackground);
+ w->setBackgroundOrigin(TQWidget::WidgetOrigin);
+ }
+ }
+ }
+ } else if (obj->inherits(TQCHECKBOX_OBJECT_NAME_STRING)) {
+ TQWidget *w = (TQWidget *) obj;
+
+ if (! w->isTopLevel() && w->isEnabled()) {
+ GtkObject *gobj = priv->gtkDict.find(TQCheckBox::staticMetaObject());
+
+ if (gobj) {
+ KLegacyImageDataKey key;
+ key.cachekey = 0;
+ key.data.function = KLegacy::FlatBox;
+
+ TQPixmap *pix = gobj->draw(key, w->width(), w->height());
+
+ if (pix && (! pix->isNull())) {
+ TQPalette pal = w->palette();
+ TQBrush brush = pal.brush(TQPalette::Normal,
+ TQColorGroup::Background);
+
+ brush.setPixmap(*pix);
+ pal.setBrush(TQPalette::Normal,
+ TQColorGroup::Background, brush);
+
+ w->setPalette(pal);
+ w->setBackgroundMode(TQWidget::PaletteBackground);
+ w->setBackgroundOrigin(TQWidget::WidgetOrigin);
+ }
+ }
+ }
+ }
+
+ break;
+ }
+
+ case TQEvent::Leave:
+ {
+ if (obj == priv->lastWidget) {
+ priv->lastWidget = 0;
+ ((TQWidget *) obj)->repaint(false);
+ } else if (obj->inherits(TQRADIOBUTTON_OBJECT_NAME_STRING) ||
+ obj->inherits(TQCHECKBOX_OBJECT_NAME_STRING)) {
+ TQWidget *w = (TQWidget *) obj;
+
+ if (! w->isTopLevel()) {
+ w->setBackgroundMode(TQWidget::X11ParentRelative);
+ w->setBackgroundOrigin(TQWidget::WidgetOrigin);
+ w->repaint(true);
+ }
+ }
+
+ break;
+ }
+
+ case TQEvent::MouseMove:
+ {
+ TQMouseEvent *me = (TQMouseEvent *) e;
+ priv->mousePos = me->pos();
+ if (obj->inherits(TQSCROLLBAR_OBJECT_NAME_STRING) &&
+ (! (me->state() & (LeftButton | MidButton | RightButton)))) {
+ priv->hovering = true;
+ ((TQWidget *) obj)->repaint(false);
+ priv->hovering = false;
+ }
+
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+
+ return TDEStyle::eventFilter(obj, e);
+}
diff --git a/tdestyles/klegacy/klegacystyle.h b/tdestyles/klegacy/klegacystyle.h
new file mode 100644
index 000000000..f82fd5d0a
--- /dev/null
+++ b/tdestyles/klegacy/klegacystyle.h
@@ -0,0 +1,148 @@
+/*
+
+ Copyright (c) 2000 KDE Project
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+ */
+
+#ifndef __KLegacyStyle_hh
+#define __KLegacyStyle_hh
+
+#include <tdestyle.h>
+
+// forward declaration
+class KLegacyStylePrivate;
+
+
+class Q_EXPORT KLegacyStyle : public TDEStyle {
+ Q_OBJECT
+public:
+ KLegacyStyle(void);
+ virtual ~KLegacyStyle(void);
+
+ virtual int defaultFrameWidth() const;
+
+ virtual void polish(TQApplication *);
+ virtual void polish(TQWidget *);
+ virtual void polishPopupMenu(TQPopupMenu *);
+ virtual void unPolish(TQWidget *);
+ virtual void unPolish(TQApplication *);
+
+ // combo box
+ virtual void drawComboButton(TQPainter *, int, int, int, int, const TQColorGroup &,
+ bool = false, bool = false, bool = true,
+ const TQBrush * = 0);
+ virtual TQRect comboButtonRect(int, int, int, int);
+ virtual TQRect comboButtonFocusRect(int, int, int, int);
+
+ // menubar items
+ virtual void drawMenuBarItem(TQPainter *, int, int, int, int, TQMenuItem *,
+ TQColorGroup &, bool, bool);
+ virtual void drawKMenuItem(TQPainter *, int, int, int, int, const TQColorGroup &, bool,
+ TQMenuItem *, TQBrush * = 0);
+
+ // toolbar stuffs
+ virtual void drawKBarHandle(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, TDEToolBarPos type, TQBrush *fill = 0);
+ virtual void drawKickerHandle(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, TQBrush *fill = 0);
+ virtual void drawKickerAppletHandle(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, TQBrush *fill = 0);
+ virtual void drawKickerTaskButton(TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, const TQString &title, bool active,
+ TQPixmap *icon = 0, TQBrush *fill = 0);
+
+ // arrows
+ virtual void drawArrow(TQPainter *, ArrowType, bool, int, int, int, int,
+ const TQColorGroup &, bool, const TQBrush * = 0);
+
+ // button stuffs
+ virtual void drawButton(TQPainter *, int, int, int, int, const TQColorGroup &g,
+ bool = false, const TQBrush * = 0);
+ virtual void drawPushButton(TQPushButton *, TQPainter *);
+ virtual void drawBevelButton(TQPainter *, int, int, int, int,
+ const TQColorGroup &, bool = false,
+ const TQBrush * = 0);
+
+ // indicators (TQCheckBox)
+ virtual void drawCheckMark(TQPainter *, int, int, int, int, const TQColorGroup &,
+ bool = false, bool = true);
+ virtual void drawIndicator(TQPainter *, int, int, int, int, const TQColorGroup &,
+ int, bool = false, bool = true);
+ virtual void drawIndicatorMask(TQPainter *, int, int, int, int, int);
+ virtual TQSize indicatorSize(void) const;
+
+ // exclusive indicators (TQRadioButton)
+ virtual void drawExclusiveIndicator(TQPainter *, int, int, int, int,
+ const TQColorGroup &, bool, bool = false,
+ bool = true);
+ virtual void drawExclusiveIndicatorMask(TQPainter *, int, int, int, int, bool);
+ virtual TQSize exclusiveIndicatorSize(void) const;
+
+ // popup menus
+ virtual void drawPopupPanel(TQPainter *, int, int, int, int, const TQColorGroup &,
+ int = 2, const TQBrush * = 0);
+ virtual void drawPopupMenuItem(TQPainter *, bool, int, int, TQMenuItem *,
+ const TQPalette &, bool, bool, int, int, int, int);
+
+
+ // scrollbars
+ virtual ScrollControl scrollBarPointOver(const TQScrollBar *, int, const TQPoint &);
+ virtual void scrollBarMetrics(const TQScrollBar *, int &, int &, int &, int &);
+ virtual void drawScrollBarControls(TQPainter *, const TQScrollBar *,
+ int, uint, uint);
+
+ // sliders
+ virtual void drawSlider(TQPainter *, int , int , int , int ,
+ const TQColorGroup &, Orientation, bool, bool);
+ virtual void drawSliderGroove(TQPainter *, int, int, int, int, const TQColorGroup &,
+ QCOORD, Orientation);
+
+ // panel
+ virtual void drawPanel(TQPainter *, int, int, int, int, const TQColorGroup &,
+ bool = false, int = 1, const TQBrush * = 0);
+
+ // splitters
+ virtual void drawSplitter(TQPainter *, int, int, int, int,
+ const TQColorGroup &, Orientation);
+
+ // tabs
+ virtual void drawTab(TQPainter *, const TQTabBar *, TQTab *, bool);
+
+
+protected:
+ bool eventFilter(TQObject *, TQEvent *);
+
+ void drawMenuArrow(TQPainter *, ArrowType, bool, int, int, int, int,
+ const TQColorGroup &, bool, const TQBrush * = 0);
+
+
+private:
+ KLegacyStylePrivate *priv;
+
+#if defined(TQ_DISABLE_COPY)
+ KLegacyStyle( const KLegacyStyle & );
+ KLegacyStyle& operator=( const KLegacyStyle & );
+#endif
+
+};
+
+
+#endif // __KLegacyStyle_hh
diff --git a/tdestyles/klegacy/plugin.cpp b/tdestyles/klegacy/plugin.cpp
new file mode 100644
index 000000000..558b54e73
--- /dev/null
+++ b/tdestyles/klegacy/plugin.cpp
@@ -0,0 +1,29 @@
+#include "klegacystyle.h"
+#include <tdelocale.h>
+
+extern "C" {
+ TDEStyle* allocate();
+ int minor_version();
+ int major_version();
+ const char *description();
+}
+
+TDEStyle* allocate()
+{
+ return(new KLegacyStyle());
+}
+
+int minor_version()
+{
+ return(0);
+}
+
+int major_version()
+{
+ return(1);
+}
+
+const char *description()
+{
+ return(i18n("KDE LegacyStyle plugin").utf8());
+}
diff --git a/tdestyles/kthemestyle/CMakeLists.txt b/tdestyles/kthemestyle/CMakeLists.txt
new file mode 100644
index 000000000..63d4cdf6f
--- /dev/null
+++ b/tdestyles/kthemestyle/CMakeLists.txt
@@ -0,0 +1,41 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions(
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdefx
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### kthemestyle ###############################
+
+set( target kthemestyle )
+
+set( ${target}_SRCS
+ kthemebase.cpp kthemestyle.cpp tdestyledirs.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdefx-shared tdecore-shared dl
+ DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
+)
diff --git a/tdestyles/kthemestyle/Makefile.am b/tdestyles/kthemestyle/Makefile.am
new file mode 100644
index 000000000..bc1b13e61
--- /dev/null
+++ b/tdestyles/kthemestyle/Makefile.am
@@ -0,0 +1,29 @@
+
+# This file is part of the KDE libraries
+# Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
+# (C) 1997 Stephan Kulow (coolo@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 as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# 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; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+AM_CPPFLAGS = -DQT_PLUGIN
+
+INCLUDES = -I$(top_srcdir)/tdefx $(all_includes)
+noinst_HEADERS = kthemestyle.h kthemebase.h tdestyledirs.h
+kde_style_LTLIBRARIES = kthemestyle.la
+kthemestyle_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+kthemestyle_la_LIBADD = ../../tdefx/libtdefx.la ../../tdecore/libtdecore.la -ldl $(LIB_QT)
+kthemestyle_la_SOURCES = kthemebase.cpp kthemestyle.cpp tdestyledirs.cpp
+kthemestyle_la_METASOURCES = AUTO
diff --git a/tdestyles/kthemestyle/kthemebase.cpp b/tdestyles/kthemestyle/kthemebase.cpp
new file mode 100644
index 000000000..8e1f5605f
--- /dev/null
+++ b/tdestyles/kthemestyle/kthemebase.cpp
@@ -0,0 +1,1828 @@
+/*
+ $Id$
+
+ This file is part of the KDE libraries
+ Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
+
+ KDE3 port (C) 2001-2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+ Port version 0.9.7
+
+ Palette setup code is from TDEApplication,
+ Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
+ Copyright (C) 1998, 1999, 2000 KDE Team
+
+ Includes code portions from the KDE HighColor style.
+
+ KDE3 HighColor Style
+ Copyright (C) 2001 Karol Szwed <gallium@kde.org>
+ (C) 2001 Fredrik H�glund <fredrik@kde.org>
+
+ Drawing routines adapted from the KDE2 HCStyle,
+ Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ (C) 2000 Dirk Mueller <mueller@kde.org>
+ (C) 2001 Martijn Klingens <klingens@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.
+*/
+
+#include "kthemebase.h"
+#include <kpixmapeffect.h>
+#include <tqimage.h>
+#include <tqpainter.h>
+#include <tqbitmap.h>
+#include <stdlib.h>
+
+#include <tqsettings.h>
+#include <tqapplication.h>
+#include <tqscrollbar.h>
+
+typedef TQMap<TQString, TQString> Prop;
+
+template class TQIntCache<KThemePixmap>
+;
+
+/*
+Bugs:
+Can't delete old slider image when calculating the rotated one for some reason.
+*/
+
+//Shamelessly stolen from TDEConfigBase
+static TQColor readColorEntry( TQSettings* s, const char *pKey,
+ const TQColor* pDefault )
+{
+ TQColor aRetColor;
+ int nRed = 0, nGreen = 0, nBlue = 0;
+
+ TQString aValue = s->readEntry( pKey );
+ if ( !aValue.isEmpty() )
+ {
+ if ( aValue.at( 0 ) == '#' )
+ {
+ aRetColor.setNamedColor( aValue );
+ }
+ else
+ {
+ bool bOK;
+ // find first part (red)
+ int nIndex = aValue.find( ',' );
+ if ( nIndex == -1 )
+ {
+ // return a sensible default -- Bernd
+ if ( pDefault )
+ aRetColor = *pDefault;
+ return aRetColor;
+ }
+
+ nRed = aValue.left( nIndex ).toInt( &bOK );
+
+ // find second part (green)
+ int nOldIndex = nIndex;
+ nIndex = aValue.find( ',', nOldIndex + 1 );
+
+ if ( nIndex == -1 )
+ {
+ // return a sensible default -- Bernd
+ if ( pDefault )
+ aRetColor = *pDefault;
+ return aRetColor;
+ }
+ nGreen = aValue.mid( nOldIndex + 1,
+ nIndex - nOldIndex - 1 ).toInt( &bOK );
+
+ // find third part (blue)
+ nBlue = aValue.right( aValue.length() - nIndex - 1 ).toInt( &bOK );
+
+ aRetColor.setRgb( nRed, nGreen, nBlue );
+ }
+ }
+ else
+ {
+
+ if ( pDefault )
+ aRetColor = *pDefault;
+ }
+
+ return aRetColor;
+}
+
+
+static const char * const widgetEntries[] =
+ { // unsunken widgets (see header)
+ "PushButton", "ComboBox", "HSBarSlider", "VSBarSlider", "Bevel", "ToolButton",
+ "ScrollButton", "HScrollDeco", "VScrollDeco", "ComboDeco", "MenuItem", "Tab",
+ "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight",
+ // sunken widgets
+ "PushButtonDown", "ComboBoxDown", "HSBarSliderDown", "VSBarSliderDown",
+ "BevelDown", "ToolButtonDown", "ScrollButtonDown", "HScrollDecoDown",
+ "VScrollDecoDown", "ComboDecoDown", "MenuItemDown", "TabDown", "SunkenArrowUp",
+ "SunkenArrowDown", "SunkenArrowLeft", "SunkenArrowRight",
+ // everything else
+ "HScrollGroove", "VScrollGroove", "Slider", "SliderGroove", "CheckBoxDown",
+ "CheckBox", "CheckBoxTri", "RadioDown", "Radio", "HBarHandle", "VBarHandle",
+ "ToolBar", "Splitter", "CheckMark", "MenuBar", "DisableArrowUp",
+ "DisableArrowDown", "DisableArrowLeft", "DisableArrowRight", "ProgressBar",
+ "ProgressBackground", "MenuBarItem", "Background", "RotSlider",
+ "RotInactiveTab", "RotActiveTab",
+ };
+
+#define INHERIT_ITEMS 16
+
+
+class KThemeBasePrivate
+{
+public:
+ /** Color overrides flags..*/
+ bool overrideForeground;
+ bool overrideBackground;
+ bool overrideSelectForeground;
+ bool overrideSelectBackground;
+ bool overrideWindowForeground;
+ bool overrideWindowBackground;
+
+ /**
+ * Colors to override defaults with..
+ */
+ TQColor overrideForegroundCol;
+ TQColor overrideBackgroundCol;
+ TQColor overrideSelectForegroundCol;
+ TQColor overrideSelectBackgroundCol;
+ TQColor overrideWindowForegroundCol;
+ TQColor overrideWindowBackgroundCol;
+
+ int contrast;
+
+
+ TQMap <TQString, TQMap<TQString, TQString> > props;
+
+ TQMap<const TQPixmap*, TQColor> colorCache;
+
+ /*
+ A heuristic routine that tries to determine the avergae color of the image
+ Wouldn't work for things like sliders, etc.
+ */
+ TQColor pixmapAveColor( const TQPixmap* p )
+ {
+ if ( colorCache.contains( p ) )
+ return colorCache[ p ];
+
+ TQImage to_ave = p->convertToImage();
+ double h = 0, s = 0, v = 0;
+ int count = 0;
+ int dh, ds, dv;
+ for ( int x = 0; x < p->width(); x++ )
+ {
+ TQColor pix( to_ave.pixel( x, p->height() / 2 ) );
+ pix.hsv( &dh, &ds, &dv );
+ h += dh;
+ s += ds;
+ v += dv;
+ count++;
+ }
+
+ for ( int y = 0; y < p->height(); y++ )
+ {
+ TQColor pix( to_ave.pixel( p->width() / 2, y ) );
+ pix.hsv( &dh, &ds, &dv );
+ h += dh;
+ s += ds;
+ v += dv;
+ count++;
+ }
+ colorCache[ p ] = TQColor( int( h / count + 0.5 ), int( s / count + 0.5 ), int( v / count + 0.5 ), TQColor::Hsv );
+ return colorCache[ p ];
+ }
+};
+
+
+
+// This is used to encode the keys. I used to use masks but I think this
+// bitfield is nicer :) I don't know why C++ coders don't use these more..
+// (mosfet)
+struct kthemeKeyData
+{
+unsigned int id :
+ 6;
+unsigned int width :
+ 12;
+unsigned int height :
+ 12;
+unsigned int border :
+ 1;
+unsigned int mask :
+ 1;
+};
+
+union kthemeKey{
+ kthemeKeyData data;
+ unsigned int cacheKey;
+};
+
+#define KDE_TQBITMAP_TO_TQPAINTDEVICE(x) TQT_TQPAINTDEVICE_CONST(static_cast<const TQPixmap*>(static_cast<const TQBitmap*>(x)))
+
+void KThemeBase::generateBorderPix( int i )
+{
+ // separate pixmap into separate components
+ if ( pbPixmaps[ i ] )
+ {
+ // evidently I have to do masks manually...
+ const TQBitmap * srcMask = pbPixmaps[ i ] ->mask();
+ TQBitmap destMask( pbWidth[ i ], pbWidth[ i ] );
+ TQPixmap tmp( pbWidth[ i ], pbWidth[ i ] );
+
+ bitBlt( TQT_TQPAINTDEVICE(&tmp), 0, 0, TQT_TQPAINTDEVICE(pbPixmaps[ i ]), 0, 0, pbWidth[ i ], pbWidth[ i ],
+ TQt::CopyROP, false );
+ if ( srcMask )
+ {
+ bitBlt( TQT_TQPAINTDEVICE(&destMask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0, pbWidth[ i ], pbWidth[ i ],
+ TQt::CopyROP, false );
+ tmp.setMask( destMask );
+ }
+ pbPixmaps[ i ] ->setBorder( KThemePixmap::TopLeft, tmp );
+
+ bitBlt( TQT_TQPAINTDEVICE(&tmp), 0, 0, TQT_TQPAINTDEVICE(pbPixmaps[ i ]), pbPixmaps[ i ] ->width() - pbWidth[ i ], 0,
+ pbWidth[ i ], pbWidth[ i ], TQt::CopyROP, false );
+ if ( srcMask )
+ {
+ bitBlt( TQT_TQPAINTDEVICE(&destMask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), pbPixmaps[ i ] ->width() - pbWidth[ i ],
+ 0, pbWidth[ i ], pbWidth[ i ], TQt::CopyROP, false );
+ tmp.setMask( destMask );
+ }
+ pbPixmaps[ i ] ->setBorder( KThemePixmap::TopRight, tmp );
+
+ bitBlt( TQT_TQPAINTDEVICE(&tmp), 0, 0, TQT_TQPAINTDEVICE(pbPixmaps[ i ]), 0, pbPixmaps[ i ] ->height() - pbWidth[ i ],
+ pbWidth[ i ], pbWidth[ i ], TQt::CopyROP, false );
+ if ( srcMask )
+ {
+ bitBlt( TQT_TQPAINTDEVICE(&destMask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, pbPixmaps[ i ] ->height() - pbWidth[ i ],
+ pbWidth[ i ], pbWidth[ i ], TQt::CopyROP, false );
+ tmp.setMask( destMask );
+ }
+ pbPixmaps[ i ] ->setBorder( KThemePixmap::BottomLeft, tmp );
+
+ bitBlt( TQT_TQPAINTDEVICE(&tmp), 0, 0, TQT_TQPAINTDEVICE(pbPixmaps[ i ]), pbPixmaps[ i ] ->width() - pbWidth[ i ],
+ pbPixmaps[ i ] ->height() - pbWidth[ i ], pbWidth[ i ], pbWidth[ i ],
+ TQt::CopyROP, false );
+ if ( srcMask )
+ {
+ bitBlt( TQT_TQPAINTDEVICE(&destMask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), pbPixmaps[ i ] ->width() - pbWidth[ i ],
+ pbPixmaps[ i ] ->height() - pbWidth[ i ], pbWidth[ i ], pbWidth[ i ],
+ TQt::CopyROP, false );
+ tmp.setMask( destMask );
+ }
+ pbPixmaps[ i ] ->setBorder( KThemePixmap::BottomRight, tmp );
+
+ tmp.resize( pbPixmaps[ i ] ->width() - pbWidth[ i ] * 2, pbWidth[ i ] );
+ destMask.resize( pbPixmaps[ i ] ->width() - pbWidth[ i ] * 2, pbWidth[ i ] );
+ bitBlt( TQT_TQPAINTDEVICE(&tmp), 0, 0, TQT_TQPAINTDEVICE(pbPixmaps[ i ]), pbWidth[ i ], 0,
+ pbPixmaps[ i ] ->width() - pbWidth[ i ] * 2, pbWidth[ i ], TQt::CopyROP, false );
+ if ( srcMask )
+ {
+ bitBlt( TQT_TQPAINTDEVICE(&destMask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), pbWidth[ i ], 0,
+ pbPixmaps[ i ] ->width() - pbWidth[ i ] * 2, pbWidth[ i ],
+ TQt::CopyROP, false );
+ tmp.setMask( destMask );
+ }
+ pbPixmaps[ i ] ->setBorder( KThemePixmap::Top, tmp );
+
+ bitBlt( TQT_TQPAINTDEVICE(&tmp), 0, 0, TQT_TQPAINTDEVICE(pbPixmaps[ i ]), pbWidth[ i ],
+ pbPixmaps[ i ] ->height() - pbWidth[ i ],
+ pbPixmaps[ i ] ->width() - pbWidth[ i ] * 2, pbWidth[ i ], TQt::CopyROP, false );
+ if ( srcMask )
+ {
+ bitBlt( TQT_TQPAINTDEVICE(&destMask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), pbWidth[ i ],
+ pbPixmaps[ i ] ->height() - pbWidth[ i ],
+ pbPixmaps[ i ] ->width() - pbWidth[ i ] * 2, pbWidth[ i ], TQt::CopyROP, false );
+ tmp.setMask( destMask );
+ }
+ pbPixmaps[ i ] ->setBorder( KThemePixmap::Bottom, tmp );
+
+ tmp.resize( pbWidth[ i ], pbPixmaps[ i ] ->height() - pbWidth[ i ] * 2 );
+ destMask.resize( pbWidth[ i ], pbPixmaps[ i ] ->height() - pbWidth[ i ] * 2 );
+ bitBlt( TQT_TQPAINTDEVICE(&tmp), 0, 0, TQT_TQPAINTDEVICE(pbPixmaps[ i ]), 0, pbWidth[ i ], pbWidth[ i ],
+ pbPixmaps[ i ] ->height() - pbWidth[ i ] * 2, TQt::CopyROP, false );
+ if ( srcMask )
+ {
+ bitBlt( TQT_TQPAINTDEVICE(&destMask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, pbWidth[ i ], pbWidth[ i ],
+ pbPixmaps[ i ] ->height() - pbWidth[ i ] * 2, TQt::CopyROP, false );
+ tmp.setMask( destMask );
+ }
+
+ pbPixmaps[ i ] ->setBorder( KThemePixmap::Left, tmp );
+
+ bitBlt( TQT_TQPAINTDEVICE(&tmp), 0, 0, TQT_TQPAINTDEVICE(pbPixmaps[ i ]), pbPixmaps[ i ] ->width() - pbWidth[ i ],
+ pbWidth[ i ], pbWidth[ i ], pbPixmaps[ i ] ->height() - pbWidth[ i ] * 2,
+ TQt::CopyROP, false );
+ if ( srcMask )
+ {
+ bitBlt( TQT_TQPAINTDEVICE(&destMask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), pbPixmaps[ i ] ->width() - pbWidth[ i ],
+ pbWidth[ i ], pbWidth[ i ], pbPixmaps[ i ] ->height() - pbWidth[ i ] * 2,
+ TQt::CopyROP, false );
+ tmp.setMask( destMask );
+ }
+ pbPixmaps[ i ] ->setBorder( KThemePixmap::Right, tmp );
+ }
+ else
+ tqWarning( "KThemeBase: Tried making border from empty pixmap\n" );
+}
+
+
+void KThemeBase::copyWidgetConfig( int sourceID, int destID, TQString *pixnames,
+ TQString *brdnames )
+{
+ scaleHints[ destID ] = scaleHints[ sourceID ];
+ gradients[ destID ] = gradients[ sourceID ];
+ blends[ destID ] = blends[ sourceID ];
+ bContrasts[ destID ] = bContrasts[ sourceID ];
+ borders[ destID ] = borders[ sourceID ];
+ highlights[ destID ] = highlights[ sourceID ];
+
+ if ( grLowColors[ sourceID ] )
+ grLowColors[ destID ] = new TQColor( *grLowColors[ sourceID ] );
+ else
+ grLowColors[ destID ] = NULL;
+
+ if ( grHighColors[ sourceID ] )
+ grHighColors[ destID ] = new TQColor( *grHighColors[ sourceID ] );
+ else
+ grHighColors[ destID ] = NULL;
+
+ if ( colors[ sourceID ] )
+ colors[ destID ] = new TQColorGroup( *colors[ sourceID ] );
+ else
+ colors[ destID ] = NULL;
+
+ // pixmap
+ pixnames[ destID ] = pixnames[ sourceID ];
+ duplicate[ destID ] = false;
+ pixmaps[ destID ] = NULL;
+ images[ destID ] = NULL;
+ if ( !pixnames[ destID ].isEmpty() )
+ {
+ if ( scaleHints[ sourceID ] == TileScale && blends[ sourceID ] == 0.0 )
+ {
+ pixmaps[ destID ] = pixmaps[ sourceID ];
+ duplicate[ destID ] = true;
+ }
+ if ( !duplicate[ destID ] )
+ {
+ pixmaps[ destID ] = loadPixmap( pixnames[ destID ] );
+ if ( scaleHints[ destID ] == TileScale && blends[ destID ] == 0.0 )
+ images[ destID ] = NULL;
+ else
+ images[ destID ] = loadImage( pixnames[ destID ] );
+ }
+ }
+
+ // border pixmap
+ pbDuplicate[ destID ] = false;
+ pbPixmaps[ destID ] = NULL;
+ pbWidth[ destID ] = pbWidth[ sourceID ];
+ brdnames[ destID ] = brdnames[ sourceID ];
+ if ( !brdnames[ destID ].isEmpty() )
+ {
+ pbPixmaps[ destID ] = pbPixmaps[ sourceID ];
+ pbDuplicate[ destID ] = true;
+ }
+
+ if ( sourceID == ActiveTab && destID == InactiveTab )
+ aTabLine = iTabLine;
+ else if ( sourceID == InactiveTab && destID == ActiveTab )
+ iTabLine = aTabLine;
+}
+
+void KThemeBase::readConfig( TQt::GUIStyle /*style*/ )
+{
+#define PREBLEND_ITEMS 12
+ static const WidgetType preBlend[] =
+ {
+ Slider, IndicatorOn, IndicatorOff,
+ ExIndicatorOn, ExIndicatorOff, HScrollDeco, VScrollDeco, HScrollDecoDown,
+ VScrollDecoDown, ComboDeco, ComboDecoDown, CheckMark
+ };
+
+ int i;
+ TQString tmpStr;
+ TQString pixnames[ WIDGETS ]; // used for duplicate check
+ TQString brdnames[ WIDGETS ];
+ bool loaded[ WIDGETS ]; // used for preloading for CopyWidget
+
+ TQSettings config;
+ if (configDirName.isEmpty() || configDirName == ".")
+ {
+ TDEStyleDirs::dirs()->addToSearch( "themerc", config );
+ }
+ else config.insertSearchPath( TQSettings::Unix, configDirName );
+
+ applyConfigFile( config );
+
+ d->contrast = config.readNumEntry( configFileName + "KDE/contrast", 7 );
+
+
+
+ for ( i = 0; i < INHERIT_ITEMS; ++i )
+ applyResourceGroup( &config, i );
+ for ( ; i < INHERIT_ITEMS*2; ++i )
+ {
+ if ( config.entryList( configFileName + widgetEntries[ i ] ).size() )
+ applyResourceGroup( &config, i );
+#ifndef Q_WS_QWS //FIXME
+
+ else
+ {
+ Prop& copyProp = d->props[ widgetEntries[ i ] ];
+ copyProp[ "CopyWidget" ] = TQString( widgetEntries[ i - INHERIT_ITEMS ] );
+ }
+#endif
+
+ }
+ for ( ; i < WIDGETS; ++i )
+ applyResourceGroup( &config, i );
+ applyMiscResourceGroup( &config );
+
+ // initialize defaults that may not be read
+ for ( i = 0; i < WIDGETS; ++i )
+ loaded[ i ] = false;
+ btnXShift = btnYShift = focus3DOffset = 0;
+ aTabLine = iTabLine = true;
+ roundedButton = roundedCombo = roundedSlider = focus3D = false;
+ splitterWidth = 10;
+
+ //Handle the rotated background separately..
+ d->props[ widgetEntries[ RotSliderGroove ] ] = d->props[ widgetEntries[ SliderGroove ] ];
+ d->props[ widgetEntries[ RotInactiveTab ] ] = d->props[ widgetEntries[ InactiveTab ] ];
+ d->props[ widgetEntries[ RotActiveTab ] ] = d->props[ widgetEntries[ ActiveTab ] ];
+
+ // misc items
+ readMiscResourceGroup();
+
+
+ for ( i = 0; i < WIDGETS; ++i )
+ readResourceGroup( i, pixnames, brdnames, loaded );
+
+ if ( pixmaps[ RotSliderGroove ] )
+ {
+ TQWMatrix r270; //TODO: 90 if reverse?
+ r270.rotate( 270 );
+ KThemePixmap* bf = new KThemePixmap( pixmaps[ RotSliderGroove ], pixmaps[ RotSliderGroove ] ->xForm( r270 ) ); //
+ pixmaps[ RotSliderGroove ] = bf;
+ if ( images[ RotSliderGroove ] )
+ {
+ delete images[ RotSliderGroove ];
+ images[ RotSliderGroove ] = new TQImage( bf->convertToImage() );
+ }
+ }
+
+ if ( pixmaps[ RotActiveTab ] )
+ {
+ TQWMatrix r180;
+ r180.rotate( 180 );
+ KThemePixmap* bf = new KThemePixmap( pixmaps[ RotActiveTab ], pixmaps[ RotActiveTab ] ->xForm( r180 ) );
+
+ pixmaps[ RotActiveTab ] = bf;
+ if ( images[ RotActiveTab ] )
+ {
+ delete images[ RotActiveTab ];
+ images[ RotActiveTab ] = new TQImage( bf->convertToImage() );
+ }
+ }
+
+ if ( pixmaps[ RotInactiveTab ] )
+ {
+ TQWMatrix r180;
+ r180.rotate( 180 );
+ KThemePixmap* bf = new KThemePixmap( pixmaps[ RotInactiveTab ], pixmaps[ RotInactiveTab ] ->xForm( r180 ) );
+
+ pixmaps[ RotInactiveTab ] = bf;
+ if ( images[ RotInactiveTab ] )
+ {
+ delete images[ RotInactiveTab ];
+ images[ RotInactiveTab ] = new TQImage( bf->convertToImage() );
+ }
+ }
+
+ // Handle preblend items
+ for ( i = 0; i < PREBLEND_ITEMS; ++i )
+ {
+ if ( pixmaps[ preBlend[ i ] ] != NULL && blends[ preBlend[ i ] ] != 0.0 )
+ blend( preBlend[ i ] );
+ }
+
+ d->props.clear();
+}
+
+KThemeBase::KThemeBase( const TQString& dir, const TQString & configFile )
+ : TDEStyle( FilledFrameWorkaround ), configFileName( configFile )
+{
+ d = new KThemeBasePrivate;
+ if ( configFileName.isEmpty() )
+ configFileName = "tdestylerc";
+
+
+ configDirName = dir;
+ //Strip of rc from the configFileName
+ if ( configFileName.endsWith( "rc" ) )
+ {
+ configFileName.truncate( configFileName.length() - 2 ); //Get rid of rc..
+ }
+ //else SCREAM!!
+
+
+ configFileName = "/" + configFileName + "/";
+
+ readConfig( TQt::WindowsStyle );
+ cache = new KThemeCache( cacheSize );
+
+ switch ( scrollBarLayout() )
+ {
+ case SBBottomLeft:
+ setScrollBarType( NextStyleScrollBar );
+ break;
+ case SBBottomRight:
+ setScrollBarType( PlatinumStyleScrollBar );
+ break;
+ case SBOpposite:
+ break;
+ //Do nothing, this type already set..
+ }
+ ;
+}
+
+void KThemeBase::applyConfigFile( TQSettings& config )
+{
+ TQStringList keys = config.entryList( configFileName );
+
+ if ( keys.contains( "foreground" ) )
+ {
+ d->overrideForeground = true;
+ d->overrideForegroundCol = readColorEntry( &config, ( configFileName + "foreground" ).latin1(), 0 );
+ }
+ else
+ d->overrideForeground = false;
+
+ if ( keys.contains( "background" ) )
+ {
+ d->overrideBackground = true;
+ d->overrideBackgroundCol = readColorEntry( &config, ( configFileName + "background" ).latin1(), 0 );
+ }
+ else
+ d->overrideBackground = false;
+
+
+
+ if ( keys.contains( "selectForeground" ) )
+ {
+ d->overrideSelectForeground = true;
+ d->overrideSelectForegroundCol = readColorEntry( &config, ( configFileName + "selectForeground" ).latin1(), 0 );
+ }
+ else
+ d->overrideSelectForeground = false;
+
+ if ( keys.contains( "selectBackground" ) )
+ {
+ d->overrideSelectBackground = true;
+ d->overrideSelectBackgroundCol = readColorEntry( &config, ( configFileName + "selectBackground" ).latin1(), 0 );
+ }
+ else
+ d->overrideSelectBackground = false;
+
+ if ( keys.contains( "windowBackground" ) )
+ {
+ d->overrideWindowBackground = true;
+ d->overrideWindowBackgroundCol = readColorEntry( &config, ( configFileName + "windowBackground" ).latin1(), 0 );
+ }
+ else
+ d->overrideWindowBackground = false;
+
+
+ if ( keys.contains( "windowForeground" ) )
+ {
+ d->overrideWindowForeground = true;
+ d->overrideWindowForegroundCol = readColorEntry( &config, ( configFileName + "windowForeground" ).latin1(), 0 );
+ }
+ else
+ d->overrideWindowForeground = false;
+
+
+#ifndef Q_WS_QWS //FIXME
+
+ for ( int input = 0; input < WIDGETS; ++input )
+ {
+ d->props.erase( widgetEntries[ input ] );
+ }
+ d->props.erase( "Misc" );
+#endif
+}
+
+KThemeBase::~KThemeBase()
+{
+ int i;
+ for ( i = 0; i < WIDGETS; ++i )
+ {
+ if ( !duplicate[ i ] )
+ {
+ if ( images[ i ] )
+ delete images[ i ];
+ if ( pixmaps[ i ] )
+ delete pixmaps[ i ];
+ }
+ if ( !pbDuplicate[ i ] && pbPixmaps[ i ] )
+ delete pbPixmaps[ i ];
+ if ( colors[ i ] )
+ delete( colors[ i ] );
+ if ( grLowColors[ i ] )
+ delete( grLowColors[ i ] );
+ if ( grHighColors[ i ] )
+ delete( grHighColors[ i ] );
+ }
+ TDEStyleDirs::release();
+ delete cache;
+ delete d;
+}
+
+TQImage* KThemeBase::loadImage( const TQString &name )
+{
+ TQImage * image = new TQImage;
+ TQString path = TDEStyleDirs::dirs()->findResource( "themepixmap",name );
+ image->load( path );
+ if ( !image->isNull() )
+ return ( image );
+ tqWarning( "KThemeBase: Unable to load image %s\n", name.latin1() );
+ delete image;
+ return ( NULL );
+}
+
+KThemePixmap* KThemeBase::loadPixmap( const TQString &name )
+{
+ KThemePixmap * pixmap = new KThemePixmap( false );
+ TQString path = TDEStyleDirs::dirs()->findResource( "themepixmap", name );
+ pixmap->load( path );
+ if ( !pixmap->isNull() )
+ return pixmap;
+ tqWarning( "KThemeBase: Unable to load pixmap %s\n", name.latin1() );
+ delete pixmap;
+ return ( NULL );
+}
+
+
+KThemePixmap* KThemeBase::scale( int w, int h, WidgetType widget ) const
+{
+ if ( scaleHints[ widget ] == FullScale )
+ {
+ if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w ||
+ pixmaps[ widget ] ->height() != h )
+ {
+ KThemePixmap * cachePix = cache->pixmap( w, h, widget );
+ if ( cachePix )
+ {
+ cachePix = new KThemePixmap( *cachePix );
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::FullScale,
+ widget );
+ else
+ tqWarning( "We would have inserted a null pixmap!\n" );
+ pixmaps[ widget ] = cachePix;
+ }
+ else
+ {
+ cache->insert( pixmaps[ widget ], KThemeCache::FullScale, widget );
+ TQImage tmpImg = images[ widget ] ->smoothScale( w, h );
+ pixmaps[ widget ] = new KThemePixmap;
+ pixmaps[ widget ] ->convertFromImage( tmpImg );
+ if ( blends[ widget ] != 0.0 )
+ blend( widget );
+ }
+ }
+ }
+ else if ( scaleHints[ widget ] == HorizontalScale )
+ {
+ if ( pixmaps[ widget ] ->width() != w )
+ {
+ KThemePixmap * cachePix = cache->horizontalPixmap( w, widget );
+ if ( cachePix )
+ {
+ cachePix = new KThemePixmap( *cachePix );
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::HorizontalScale, widget );
+ else
+ tqWarning( "We would have inserted a null pixmap!\n" );
+ pixmaps[ widget ] = cachePix;
+ }
+ else
+ {
+ cache->insert( pixmaps[ widget ], KThemeCache::HorizontalScale, widget );
+ TQImage tmpImg = images[ widget ] ->
+ smoothScale( w, images[ widget ] ->height() );
+ pixmaps[ widget ] = new KThemePixmap;
+ pixmaps[ widget ] ->convertFromImage( tmpImg );
+ if ( blends[ widget ] != 0.0 )
+ blend( widget );
+ }
+ }
+ }
+ else if ( scaleHints[ widget ] == VerticalScale )
+ {
+ if ( pixmaps[ widget ] ->height() != h )
+ {
+ KThemePixmap * cachePix = cache->verticalPixmap( w, widget );
+ if ( cachePix )
+ {
+ cachePix = new KThemePixmap( *cachePix );
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::VerticalScale, widget );
+ else
+ tqWarning( "We would have inserted a null pixmap!\n" );
+ pixmaps[ widget ] = cachePix;
+ }
+ else
+ {
+ cache->insert( pixmaps[ widget ], KThemeCache::VerticalScale, widget );
+ TQImage tmpImg =
+ images[ widget ] ->smoothScale( images[ widget ] ->width(), h );
+ pixmaps[ widget ] = new KThemePixmap;
+ pixmaps[ widget ] ->convertFromImage( tmpImg );
+ if ( blends[ widget ] != 0.0 )
+ blend( widget );
+ }
+ }
+ }
+ // If blended tile here so the blend is scaled properly
+ else if ( scaleHints[ widget ] == TileScale && blends[ widget ] != 0.0 )
+ {
+ if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w ||
+ pixmaps[ widget ] ->height() != h )
+ {
+ KThemePixmap * cachePix = cache->pixmap( w, h, widget );
+ if ( cachePix )
+ {
+ cachePix = new KThemePixmap( *cachePix );
+ cache->insert( pixmaps[ widget ], KThemeCache::FullScale, widget );
+ pixmaps[ widget ] = cachePix;
+ }
+ else
+ {
+ cache->insert( pixmaps[ widget ], KThemeCache::FullScale, widget );
+ TQPixmap tile;
+ tile.convertFromImage( *images[ widget ] );
+ pixmaps[ widget ] = new KThemePixmap;
+ pixmaps[ widget ] ->resize( w, h );
+ TQPainter p( pixmaps[ widget ] );
+ p.drawTiledPixmap( 0, 0, w, h, tile );
+ if ( blends[ widget ] != 0.0 )
+ blend( widget );
+ }
+ }
+ }
+ return ( pixmaps[ widget ] );
+}
+
+KThemePixmap* KThemeBase::scaleBorder( int w, int h, WidgetType widget ) const
+{
+ KThemePixmap * pixmap = NULL;
+ if ( !pbPixmaps[ widget ] && !pbWidth[ widget ] )
+ return ( NULL );
+ pixmap = cache->pixmap( w, h, widget, true );
+ if ( pixmap )
+ {
+ pixmap = new KThemePixmap( *pixmap );
+ }
+ else
+ {
+ pixmap = new KThemePixmap();
+ pixmap->resize( w, h );
+ TQBitmap mask;
+ mask.resize( w, h );
+ mask.fill( color0 );
+ TQPainter mPainter;
+ mPainter.begin( &mask );
+
+ TQPixmap *tmp = borderPixmap( widget ) ->border( KThemePixmap::TopLeft );
+ const TQBitmap *srcMask = tmp->mask();
+ int bdWidth = tmp->width();
+
+ bitBlt( TQT_TQPAINTDEVICE(pixmap), 0, 0, TQT_TQPAINTDEVICE(tmp), 0, 0, bdWidth, bdWidth,
+ TQt::CopyROP, false );
+ if ( srcMask )
+ bitBlt( TQT_TQPAINTDEVICE(&mask), 0, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0, bdWidth, bdWidth,
+ TQt::CopyROP, false );
+ else
+ mPainter.fillRect( 0, 0, bdWidth, bdWidth, color1 );
+
+
+ tmp = borderPixmap( widget ) ->border( KThemePixmap::TopRight );
+ srcMask = tmp->mask();
+ bitBlt( TQT_TQPAINTDEVICE(pixmap), w - bdWidth, 0, TQT_TQPAINTDEVICE(tmp), 0, 0, bdWidth,
+ bdWidth, TQt::CopyROP, false );
+ if ( srcMask )
+ bitBlt( TQT_TQPAINTDEVICE(&mask), w - bdWidth, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0, bdWidth,
+ bdWidth, TQt::CopyROP, false );
+ else
+ mPainter.fillRect( w - bdWidth, 0, bdWidth, bdWidth, color1 );
+
+ tmp = borderPixmap( widget ) ->border( KThemePixmap::BottomLeft );
+ srcMask = tmp->mask();
+ bitBlt( TQT_TQPAINTDEVICE(pixmap), 0, h - bdWidth, TQT_TQPAINTDEVICE(tmp), 0, 0, bdWidth,
+ bdWidth, TQt::CopyROP, false );
+ if ( srcMask )
+ bitBlt( TQT_TQPAINTDEVICE(&mask), 0, h - bdWidth, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0, bdWidth,
+ bdWidth, TQt::CopyROP, false );
+ else
+ mPainter.fillRect( 0, h - bdWidth, bdWidth, bdWidth, color1 );
+
+ tmp = borderPixmap( widget ) ->border( KThemePixmap::BottomRight );
+ srcMask = tmp->mask();
+ bitBlt( TQT_TQPAINTDEVICE(pixmap), w - bdWidth, h - bdWidth, TQT_TQPAINTDEVICE(tmp), 0, 0,
+ bdWidth, bdWidth, TQt::CopyROP, false );
+ if ( srcMask )
+ bitBlt( TQT_TQPAINTDEVICE(&mask), w - bdWidth, h - bdWidth, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0,
+ bdWidth, bdWidth, TQt::CopyROP, false );
+ else
+ mPainter.fillRect( w - bdWidth, h - bdWidth, bdWidth, bdWidth, color1 );
+
+ TQPainter p;
+ p.begin( pixmap );
+ if ( w - bdWidth * 2 > 0 )
+ {
+ tmp = borderPixmap( widget ) ->border( KThemePixmap::Top );
+ srcMask = tmp->mask();
+ p.drawTiledPixmap( bdWidth, 0, w - bdWidth * 2, bdWidth, *tmp );
+ if ( srcMask )
+ bitBlt( TQT_TQPAINTDEVICE(&mask), bdWidth, 0, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0,
+ w - bdWidth * 2, bdWidth, TQt::CopyROP, false );
+ else
+ mPainter.fillRect( bdWidth, 0, w - bdWidth * 2, bdWidth, color1 );
+
+ tmp = borderPixmap( widget ) ->border( KThemePixmap::Bottom );
+ srcMask = tmp->mask();
+ p.drawTiledPixmap( bdWidth, h - bdWidth, w - bdWidth * 2, bdWidth,
+ *tmp );
+ if ( srcMask )
+ bitBlt( TQT_TQPAINTDEVICE(&mask), bdWidth, h - bdWidth, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0,
+ w - bdWidth * 2, bdWidth, TQt::CopyROP, false );
+ else
+ mPainter.fillRect( bdWidth, h - bdWidth, w - bdWidth * 2, bdWidth,
+ color1 );
+ }
+ if ( h - bdWidth * 2 > 0 )
+ {
+ tmp = borderPixmap( widget ) ->border( KThemePixmap::Left );
+ srcMask = tmp->mask();
+ p.drawTiledPixmap( 0, bdWidth, bdWidth, h - bdWidth * 2, *tmp );
+ if ( srcMask )
+ bitBlt( TQT_TQPAINTDEVICE(&mask), 0, bdWidth, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0,
+ bdWidth, h - bdWidth * 2, TQt::CopyROP, false );
+ else
+ mPainter.fillRect( 0, bdWidth, bdWidth, h - bdWidth * 2, color1 );
+
+ tmp = borderPixmap( widget ) ->border( KThemePixmap::Right );
+ srcMask = tmp->mask();
+ p.drawTiledPixmap( w - bdWidth, bdWidth, bdWidth, h - bdWidth * 2,
+ *tmp );
+ if ( srcMask )
+ bitBlt( TQT_TQPAINTDEVICE(&mask), w - bdWidth, bdWidth, KDE_TQBITMAP_TO_TQPAINTDEVICE(srcMask), 0, 0,
+ bdWidth, h - bdWidth * 2, TQt::CopyROP, false );
+ else
+ mPainter.fillRect( w - bdWidth, bdWidth, bdWidth, h - bdWidth * 2, color1 );
+ }
+ p.end();
+ mPainter.end();
+ pixmap->setMask( mask );
+ cache->insert( pixmap, KThemeCache::FullScale, widget, true );
+ if ( !pixmap->mask() )
+ tqWarning( "No mask for border pixmap!\n" );
+ }
+ return ( pixmap );
+}
+
+
+KThemePixmap* KThemeBase::blend( WidgetType widget ) const
+{
+ KPixmapEffect::GradientType g;
+ switch ( gradients[ widget ] )
+ {
+ case GrHorizontal:
+ g = KPixmapEffect::HorizontalGradient;
+ break;
+ case GrVertical:
+ g = KPixmapEffect::VerticalGradient;
+ break;
+ case GrPyramid:
+ g = KPixmapEffect::PyramidGradient;
+ break;
+ case GrRectangle:
+ g = KPixmapEffect::RectangleGradient;
+ break;
+ case GrElliptic:
+ g = KPixmapEffect::EllipticGradient;
+ break;
+ default:
+ g = KPixmapEffect::DiagonalGradient;
+ break;
+ }
+ KPixmapEffect::blend( *pixmaps[ widget ], blends[ widget ], *grLowColors[ widget ],
+ g, false );
+ return ( pixmaps[ widget ] );
+}
+
+KThemePixmap* KThemeBase::gradient( int w, int h, WidgetType widget ) const
+{
+ if ( gradients[ widget ] == GrVertical )
+ {
+ if ( !pixmaps[ widget ] || pixmaps[ widget ] ->height() != h )
+ {
+ KThemePixmap * cachePix = cache->verticalPixmap( h, widget );
+ if ( cachePix )
+ {
+ cachePix = new KThemePixmap( *cachePix );
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::VerticalScale,
+ widget );
+ pixmaps[ widget ] = cachePix;
+ }
+ else
+ {
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::VerticalScale,
+ widget );
+ pixmaps[ widget ] = new KThemePixmap;
+ pixmaps[ widget ] ->resize( w, h );
+ KPixmapEffect::gradient( *pixmaps[ widget ], *grHighColors[ widget ],
+ *grLowColors[ widget ],
+ KPixmapEffect::VerticalGradient );
+ }
+ }
+ }
+ else if ( gradients[ widget ] == GrHorizontal )
+ {
+ if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w )
+ {
+ KThemePixmap * cachePix = cache->horizontalPixmap( w, widget );
+ if ( cachePix )
+ {
+ cachePix = new KThemePixmap( *cachePix );
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ],
+ KThemeCache::HorizontalScale, widget );
+ pixmaps[ widget ] = cachePix;
+ }
+ else
+ {
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ],
+ KThemeCache::HorizontalScale, widget );
+ pixmaps[ widget ] = new KThemePixmap;
+ pixmaps[ widget ] ->resize( w, h );
+ KPixmapEffect::gradient( *pixmaps[ widget ], *grHighColors[ widget ],
+ *grLowColors[ widget ],
+ KPixmapEffect::HorizontalGradient );
+ }
+ }
+ }
+ else if ( gradients[ widget ] == GrReverseBevel )
+ {
+ if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w ||
+ pixmaps[ widget ] ->height() != h )
+ {
+ KThemePixmap * cachePix = cache->pixmap( w, h, widget );
+ if ( cachePix )
+ {
+ cachePix = new KThemePixmap( *cachePix );
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::FullScale,
+ widget );
+ pixmaps[ widget ] = cachePix;
+ }
+ else
+ {
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::FullScale,
+ widget );
+ pixmaps[ widget ] = new KThemePixmap;
+ pixmaps[ widget ] ->resize( w, h );
+
+ KPixmap s;
+ int offset = decoWidth( widget );
+ s.resize( w - offset * 2, h - offset * 2 );
+ TQColor lc( *grLowColors[ widget ] );
+ TQColor hc( *grHighColors[ widget ] );
+ if ( bevelContrast( widget ) )
+ {
+ int bc = bevelContrast( widget );
+ // want single increments, not factors like light()/dark()
+ lc.setRgb( lc.red() - bc, lc.green() - bc, lc.blue() - bc );
+ hc.setRgb( hc.red() + bc, hc.green() + bc, hc.blue() + bc );
+ }
+ KPixmapEffect::gradient( *pixmaps[ widget ],
+ lc, hc,
+ KPixmapEffect::DiagonalGradient );
+ KPixmapEffect::gradient( s, *grHighColors[ widget ],
+ *grLowColors[ widget ],
+ KPixmapEffect::DiagonalGradient );
+ bitBlt( pixmaps[ widget ], offset, offset, &s, 0, 0, w - offset * 2,
+ h - offset * 2, TQt::CopyROP );
+ }
+ }
+ }
+ else
+ {
+ KPixmapEffect::GradientType g;
+ switch ( gradients[ widget ] )
+ {
+ case GrPyramid:
+ g = KPixmapEffect::PyramidGradient;
+ break;
+ case GrRectangle:
+ g = KPixmapEffect::RectangleGradient;
+ break;
+ case GrElliptic:
+ g = KPixmapEffect::EllipticGradient;
+ break;
+ default:
+ g = KPixmapEffect::DiagonalGradient;
+ break;
+ }
+ if ( !pixmaps[ widget ] || pixmaps[ widget ] ->width() != w ||
+ pixmaps[ widget ] ->height() != h )
+ {
+ KThemePixmap * cachePix = cache->pixmap( w, h, widget );
+ if ( cachePix )
+ {
+ cachePix = new KThemePixmap( *cachePix );
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::FullScale,
+ widget );
+ pixmaps[ widget ] = cachePix;
+ }
+ else
+ {
+ if ( pixmaps[ widget ] )
+ cache->insert( pixmaps[ widget ], KThemeCache::FullScale,
+ widget );
+ pixmaps[ widget ] = new KThemePixmap;
+ pixmaps[ widget ] ->resize( w, h );
+ KPixmapEffect::gradient( *pixmaps[ widget ], *grHighColors[ widget ],
+ *grLowColors[ widget ], g );
+ }
+ }
+ }
+ return ( pixmaps[ widget ] );
+}
+
+KThemePixmap* KThemeBase::scalePixmap( int w, int h, WidgetType widget ) const
+{
+
+ if ( gradients[ widget ] && blends[ widget ] == 0.0 )
+ return ( gradient( w, h, widget ) );
+
+ return ( scale( w, h, widget ) );
+}
+
+TQColorGroup* KThemeBase::makeColorGroup( const TQColor &fg, const TQColor &bg,
+ TQt::GUIStyle )
+{
+ if ( shading == Motif )
+ {
+ int highlightVal, lowlightVal;
+ highlightVal = 100 + ( 2 * d->contrast + 4 ) * 16 / 10;
+ lowlightVal = 100 + ( ( 2 * d->contrast + 4 ) * 10 );
+ return ( new TQColorGroup( fg, bg, bg.light( highlightVal ),
+ bg.dark( lowlightVal ), bg.dark( 120 ),
+ fg, TQApplication::palette().active().base() ) );
+ }
+ else
+ return ( new TQColorGroup( fg, bg, bg.light( 150 ), bg.dark(),
+ bg.dark( 120 ), fg,
+ TQApplication::palette().active().base() ) );
+}
+
+
+void KThemeBase::applyMiscResourceGroup( TQSettings *config )
+{
+#ifndef Q_WS_QWS //FIXME
+ d->props.erase( "Misc" ); // clear the old property
+
+ TQString base = configFileName + "Misc/";
+
+ Prop& prop = d->props[ "Misc" ];
+ TQString tmpStr;
+
+ tmpStr = config->readEntry( base + "SButtonPosition" );
+ if ( tmpStr == "BottomLeft" )
+ prop[ "SButtonPosition" ] = TQString::number( ( int ) SBBottomLeft );
+ else if ( tmpStr == "BottomRight" )
+ prop[ "SButtonPosition" ] = TQString::number( ( int ) SBBottomRight );
+ else
+ {
+ if ( tmpStr != "Opposite" && !tmpStr.isEmpty() )
+ tqWarning( "KThemeBase: Unrecognized sb button option %s, using Opposite.\n", tmpStr.latin1() );
+ ;
+ prop[ "SButtonPosition" ] = TQString::number( ( int ) SBOpposite );
+ }
+ tmpStr = config->readEntry( base + "ArrowType" );
+ if ( tmpStr == "Small" )
+ prop[ "ArrowType" ] = TQString::number( ( int ) SmallArrow );
+ else if ( tmpStr == "3D" )
+ prop[ "ArrowType" ] = TQString::number( ( int ) MotifArrow );
+ else
+ {
+ if ( tmpStr != "Normal" && !tmpStr.isEmpty() )
+ tqWarning( "KThemeBase: Unrecognized arrow option %s, using Normal.\n", tmpStr.latin1() );
+ prop[ "ArrowType" ] = TQString::number( ( int ) LargeArrow );
+ }
+ tmpStr = config->readEntry( base + "ShadeStyle" );
+ if ( tmpStr == "Motif" )
+ prop[ "ShadeStyle" ] = TQString::number( ( int ) Motif );
+ else if ( tmpStr == "Next" )
+ prop[ "ShadeStyle" ] = TQString::number( ( int ) Next );
+ else if ( tmpStr == "KDE" )
+ prop[ "ShadeStyle" ] = TQString::number( ( int ) KDE );
+ else
+ prop[ "ShadeStyle" ] = TQString::number( ( int ) Windows );
+
+ prop[ "FrameWidth" ] = TQString::number( config->readNumEntry( base + "FrameWidth", 2 ) );
+ prop[ "Cache" ] = TQString::number( config->readNumEntry( base + "Cache", 1024 ) );
+ prop[ "ScrollBarExtent" ] = TQString::number( config->readNumEntry( base + "ScrollBarExtent", 16 ) );
+#endif
+}
+
+static int readNumEntry( Prop& prop, TQString setting, int def )
+{
+ bool ok;
+ TQString s_val = prop[ setting ];
+ int val = s_val.toInt( &ok );
+ if ( ok )
+ return val;
+ return def;
+}
+
+static TQColor readColorEntry( Prop& prop, TQString setting, const TQColor& def )
+{
+ TQString s_val = prop[ setting ];
+ if ( !s_val.isEmpty() )
+ {
+ TQColor c( s_val );
+ return c;
+ }
+ return def;
+}
+
+void KThemeBase::readMiscResourceGroup()
+{
+#ifndef Q_WS_QWS //FIXME
+ Prop & prop = d->props[ "Misc" ];
+
+ sbPlacement = ( SButton ) readNumEntry( prop, "SButtonPosition",
+ ( int ) SBOpposite );
+ arrowStyle = ( ArrowStyle ) readNumEntry( prop, "ArrowType",
+ ( int ) LargeArrow );
+ shading = ( ShadeStyle ) readNumEntry( prop, "ShadeStyle", ( int ) Windows );
+ defaultFrame = readNumEntry( prop, "FrameWidth", 2 );
+ cacheSize = readNumEntry( prop, "Cache", 1024 );
+ sbExtent = readNumEntry( prop, "ScrollBarExtent", 16 );
+#endif
+}
+
+
+void KThemeBase::applyResourceGroup( TQSettings *config, int i )
+{
+#ifndef Q_WS_QWS //FIXME
+ TQString tmpStr;
+ int tmpVal;
+
+ // clear the old property
+ d->props.erase( widgetEntries[ i ] );
+
+ TQString base = configFileName + widgetEntries[ i ] + "/";
+
+ Prop& prop = d->props[ widgetEntries[ i ] ];
+
+ tmpStr = config->readEntry( base + "CopyWidget", "" );
+ prop[ "CopyWidget" ] = tmpStr;
+ if ( !tmpStr.isEmpty() )
+ {
+ return ;
+ }
+
+ tmpStr = config->readEntry( base + "Scale" );
+ if ( tmpStr == "Full" )
+ tmpVal = ( int ) FullScale;
+ else if ( tmpStr == "Horizontal" )
+ tmpVal = ( int ) HorizontalScale;
+ else if ( tmpStr == "Vertical" )
+ tmpVal = ( int ) VerticalScale;
+ else
+ {
+ if ( tmpStr != "Tile" && !tmpStr.isEmpty() )
+ tqWarning( "KThemeBase: Unrecognized scale option %s, using Tile.\n", tmpStr.latin1() );
+ tmpVal = ( int ) TileScale;
+ }
+ prop[ "ScaleHint" ] = TQString::number( tmpVal );
+
+ // Gradient type
+ tmpStr = config->readEntry( base + "Gradient" );
+ if ( tmpStr == "Diagonal" )
+ tmpVal = ( int ) GrDiagonal;
+ else if ( tmpStr == "Horizontal" )
+ tmpVal = ( int ) GrHorizontal;
+ else if ( tmpStr == "Vertical" )
+ tmpVal = ( int ) GrVertical;
+ else if ( tmpStr == "Pyramid" )
+ tmpVal = ( int ) GrPyramid;
+ else if ( tmpStr == "Rectangle" )
+ tmpVal = ( int ) GrRectangle;
+ else if ( tmpStr == "Elliptic" )
+ tmpVal = ( int ) GrElliptic;
+ else if ( tmpStr == "ReverseBevel" )
+ tmpVal = ( int ) GrReverseBevel;
+ else
+ {
+ if ( tmpStr != "None" && !tmpStr.isEmpty() )
+ tqWarning( "KThemeBase: Unrecognized gradient option %s, using None.\n", tmpStr.latin1() );
+ tmpVal = ( int ) GrNone;
+ }
+ prop[ "Gradient" ] = TQString::number( tmpVal );
+
+ // Blend intensity
+ tmpStr.setNum( config->readDoubleEntry( base + "BlendIntensity", 0.0 ) );
+ prop[ "Blend" ] = tmpStr;
+
+ // Bevel contrast
+ prop[ "BContrast" ] = TQString::number( config->readNumEntry( base + "BevelContrast", 0 ) );
+
+ // Border width
+ prop[ "Border" ] = TQString::number( config->readNumEntry( base + "Border", 1 ) );
+
+ // Highlight width
+ prop[ "Highlight" ] = TQString::number( config->readNumEntry( base + "Highlight", 1 ) );
+
+ TQStringList keys = config->entryList( base );
+
+ // Gradient low color or blend background
+ if ( keys.contains( "GradientLow" ) )
+ prop[ "GrLow" ] = readColorEntry( config, TQString( base + "GradientLow" ).latin1(),
+ &TQApplication::palette().active().background() ).name();
+
+ // Gradient high color
+ if ( keys.contains( "GradientHigh" ) )
+ prop[ "GrHigh" ] = readColorEntry( config, TQString( base + "GradientHigh" ).latin1(),
+ &TQApplication::palette().active().foreground() ).name();
+
+ // Extended color attributes
+ if ( keys.contains( "Foreground" ) || keys.contains( "Background" ) )
+ {
+ TQColor fg, bg;
+ if ( keys.contains( "Background" ) )
+ bg = readColorEntry( config, TQString( base + "Background" ).latin1(), &bg );
+ if ( keys.contains( "Foreground" ) )
+ fg = readColorEntry( config, TQString( base + "Foreground" ).latin1(), &fg );
+ prop[ "Foreground" ] = fg.name();
+ prop[ "Background" ] = bg.name();
+
+ }
+ else
+ colors[ i ] = NULL;
+
+ // Pixmap
+ tmpStr = config->readEntry( base + "Pixmap", "" );
+ if ( !tmpStr.isEmpty() )
+ prop[ "Pixmap" ] = tmpStr;
+ // Pixmap border
+ tmpStr = config->readEntry( base + "PixmapBorder", "" );
+ if ( !tmpStr.isEmpty() )
+ {
+ prop[ "PixmapBorder" ] = tmpStr;
+ prop[ "PixmapBWidth" ] = TQString::number(
+ config->readNumEntry( base + "PixmapBWidth", 0 ) );
+ }
+
+ // Various widget specific settings. This was more efficient when bunched
+ // together in the misc group, but this makes an easier to read config.
+ if ( i == SliderGroove )
+ prop[ "SmallGroove" ] = TQString::number(
+ config->readBoolEntry( base + "SmallGroove", false ) );
+ else if ( i == ActiveTab || i == InactiveTab )
+ prop[ "BottomLine" ] = TQString::number(
+ config->readBoolEntry( base + "BottomLine", true ) );
+ else if ( i == Splitter )
+ prop[ "Width" ] = TQString::number( config->readNumEntry( base + "Width", 10 ) );
+ else if ( i == ComboBox || i == ComboBoxDown )
+ {
+ if ( keys.contains( "Round" ) )
+ prop[ "Round" ] = TQString::number( config->readBoolEntry( base + "Round", false ) );
+ else
+ prop[ "Round" ] = "5000"; // invalid, used w/multiple groups
+
+ }
+ else if ( i == PushButton || i == PushButtonDown )
+ {
+ if ( keys.contains( "XShift" ) )
+ prop[ "XShift" ] = TQString::number( config->readNumEntry( base + "XShift", 0 ) );
+ else
+ prop[ "XShift" ] = "5000";
+ if ( keys.contains( "YShift" ) )
+ prop[ "YShift" ] = TQString::number( config->readNumEntry( base + "YShift", 0 ) );
+ else
+ prop[ "YShift" ] = "5000";
+ if ( keys.contains( "3DFocusRect" ) )
+ prop[ "3DFRect" ] = TQString::number( config->
+ readBoolEntry( base + "3DFocusRect", false ) );
+ else
+ prop[ "3DFRect" ] = "5000";
+ if ( keys.contains( "3DFocusOffset" ) )
+ prop[ "3DFOffset" ] = TQString::number( config->
+ readBoolEntry( base + "3DFocusOffset", 0 ) );
+ else
+ prop[ "3DFOffset" ] = "5000";
+ if ( keys.contains( "Round" ) )
+ prop[ "Round" ] = TQString::number( config->readBoolEntry( base + "Round", false ) );
+ else
+ prop[ "Round" ] = "5000";
+ }
+#endif
+}
+
+void KThemeBase::readResourceGroup( int i, TQString *pixnames, TQString *brdnames,
+ bool *loadArray )
+{
+#ifndef Q_WS_QWS //FIXME
+ if ( loadArray[ i ] == true )
+ {
+ return ; // already been preloaded.
+ }
+
+ int tmpVal;
+ Prop prop = d->props[ widgetEntries[ i ] ];
+ TQString tmpStr;
+
+ tmpStr = prop[ "CopyWidget" ];
+ if ( !tmpStr.isEmpty() )
+ { // Duplicate another widget's config
+ int sIndex;
+ loadArray[ i ] = true;
+ for ( sIndex = 0; sIndex < WIDGETS; ++sIndex )
+ {
+ if ( tmpStr == widgetEntries[ sIndex ] )
+ {
+ if ( !loadArray[ sIndex ] ) // hasn't been loaded yet
+ readResourceGroup( sIndex, pixnames, brdnames,
+ loadArray );
+ break;
+ }
+ }
+ if ( loadArray[ sIndex ] )
+ {
+ copyWidgetConfig( sIndex, i, pixnames, brdnames );
+ }
+ else
+ tqWarning( "KThemeBase: Unable to identify source widget for %s\n", widgetEntries[ i ] );
+ return ;
+ }
+ // special inheritance for disabled arrows (these are tri-state unlike
+ // the rest of what we handle).
+ for ( tmpVal = DisArrowUp; tmpVal <= DisArrowRight; ++tmpVal )
+ {
+ if ( tmpVal == i )
+ {
+ tmpStr = prop[ "Pixmap" ];
+ if ( tmpStr.isEmpty() )
+ {
+ copyWidgetConfig( ArrowUp + ( tmpVal - DisArrowUp ), i, pixnames,
+ brdnames );
+ return ;
+ }
+ }
+ }
+
+ // Scale hint
+ scaleHints[ i ] = ( ScaleHint ) readNumEntry( prop, "ScaleHint", ( int ) TileScale );
+ gradients[ i ] = ( Gradient ) readNumEntry( prop, "Gradient", ( int ) GrNone );
+
+ // Blend intensity
+ tmpStr = prop[ "Blend" ];
+ if ( tmpStr.isEmpty() )
+ tmpStr = TQString::fromLatin1( "0.0" );
+ blends[ i ] = tmpStr.toFloat();
+
+ // Bevel contrast
+ bContrasts[ i ] = readNumEntry( prop, "BContrast", 0 );
+
+ // Border width
+ borders[ i ] = readNumEntry( prop, "Border", 1 );
+
+ // Highlight width
+ highlights[ i ] = readNumEntry( prop, "Highlight", 1 );
+
+ // Gradient low color or blend background
+ if ( gradients[ i ] != GrNone || blends[ i ] != 0.0 )
+ grLowColors[ i ] =
+ new TQColor( readColorEntry( prop, "GrLow",
+ TQApplication::palette().active().
+ background() ) );
+ else
+ grLowColors[ i ] = NULL;
+
+ // Gradient high color
+ if ( gradients[ i ] != GrNone )
+ grHighColors[ i ] =
+ new TQColor( readColorEntry( prop, "GrHigh",
+ TQApplication::palette().active().
+ background() ) );
+ else
+ grHighColors[ i ] = NULL;
+
+ // Extended color attributes
+ TQColor fg, bg;
+ fg = readColorEntry( prop, "Foreground", fg );
+ bg = readColorEntry( prop, "Background", bg );
+ if ( fg.isValid() || bg.isValid() )
+ {
+ if ( !fg.isValid() )
+ fg = TQApplication::palette().active().foreground();
+ if ( !bg.isValid() )
+ bg = TQApplication::palette().active().background();
+ colors[ i ] = makeColorGroup( fg, bg, TQt::WindowsStyle );
+ }
+ else
+ colors[ i ] = NULL;
+
+ // Pixmap
+ int existing;
+ tmpStr = prop[ "Pixmap" ];
+ pixnames[ i ] = tmpStr;
+ duplicate[ i ] = false;
+ pixmaps[ i ] = NULL;
+ images[ i ] = NULL;
+ // Scan for duplicate pixmaps(two identical pixmaps, tile scale, no blend,
+ // no pixmapped border)
+ if ( !tmpStr.isEmpty() )
+ {
+ for ( existing = 0; existing < i; ++existing )
+ {
+ if ( tmpStr == pixnames[ existing ] && scaleHints[ i ] == TileScale &&
+ scaleHints[ existing ] == TileScale && blends[ existing ] == 0.0 &&
+ blends[ i ] == 0.0 )
+ {
+ pixmaps[ i ] = pixmaps[ existing ];
+ duplicate[ i ] = true;
+ break;
+ }
+ }
+ }
+ // load
+ if ( !duplicate[ i ] && !tmpStr.isEmpty() )
+ {
+ pixmaps[ i ] = loadPixmap( tmpStr );
+ // load and save images for scaled/blended widgets for speed.
+ if ( scaleHints[ i ] == TileScale && blends[ i ] == 0.0 )
+ images[ i ] = NULL;
+ else
+ images[ i ] = loadImage( tmpStr );
+ }
+
+ // Pixmap border
+ tmpStr = prop[ "PixmapBorder" ];
+ brdnames[ i ] = tmpStr;
+ pbDuplicate[ i ] = false;
+ pbPixmaps[ i ] = NULL;
+ pbWidth[ i ] = 0;
+ if ( !tmpStr.isEmpty() )
+ {
+ pbWidth[ i ] = readNumEntry( prop, "PixmapBWidth", 0 );
+ if ( pbWidth[ i ] == 0 )
+ {
+ tqWarning( "KThemeBase: No border width specified for pixmapped border widget %s\n",
+ widgetEntries[ i ] );
+ tqWarning( "KThemeBase: Using default of 2.\n" );
+ pbWidth[ i ] = 2;
+ }
+ // duplicate check
+ for ( existing = 0; existing < i; ++existing )
+ {
+ if ( tmpStr == brdnames[ existing ] )
+ {
+ pbPixmaps[ i ] = pbPixmaps[ existing ];
+ pbDuplicate[ i ] = true;
+ break;
+ }
+ }
+ }
+ // load
+ if ( !pbDuplicate[ i ] && !tmpStr.isEmpty() )
+ pbPixmaps[ i ] = loadPixmap( tmpStr );
+
+ if ( pbPixmaps[ i ] && !pbDuplicate[ i ] )
+ generateBorderPix( i );
+
+ // Various widget specific settings. This was more efficient when bunched
+ // together in the misc group, but this makes an easier to read config.
+ if ( i == SliderGroove )
+ roundedSlider = readNumEntry( prop, "SmallGroove", false );
+ else if ( i == ActiveTab )
+ aTabLine = readNumEntry( prop, "BottomLine", true );
+ else if ( i == InactiveTab )
+ iTabLine = readNumEntry( prop, "BottomLine", true );
+ else if ( i == Splitter )
+ splitterWidth = readNumEntry( prop, "Width", 10 );
+ else if ( i == ComboBox || i == ComboBoxDown )
+ {
+ tmpVal = readNumEntry( prop, "Round", 5000 );
+ if ( tmpVal != 5000 )
+ roundedCombo = tmpVal;
+ }
+ else if ( i == PushButton || i == PushButtonDown )
+ {
+ tmpVal = readNumEntry( prop, "XShift", 0 );
+ if ( tmpVal != 5000 )
+ btnXShift = tmpVal;
+ tmpVal = readNumEntry( prop, "YShift", 0 );
+ if ( tmpVal != 5000 )
+ btnYShift = tmpVal;
+ tmpVal = readNumEntry( prop, "3DFRect", false );
+ if ( tmpVal != 5000 )
+ focus3D = tmpVal;
+ tmpVal = readNumEntry( prop, "3DFOffset", 0 );
+ if ( tmpVal != 5000 )
+ focus3DOffset = tmpVal;
+ tmpVal = readNumEntry( prop, "Round", false );
+ if ( tmpVal != 5000 )
+ roundedButton = tmpVal;
+ }
+ loadArray[ i ] = true;
+#endif
+}
+
+
+TQPalette KThemeBase::overridePalette( const TQPalette& pal )
+{
+
+ //Read current settings for colors..
+ TQColor background = pal.active().background();
+ TQColor foreground = pal.active().foreground();
+ TQColor button = background; //CHECKME
+ TQColor highlight = pal.active().highlight();
+ TQColor highlightedText = pal.active().highlightedText(); //CHECKME
+ TQColor base = pal.active().base(); //config->readColorEntry( "windowBackground", &white );
+ TQColor baseText = pal.active().text(); //CHECKME
+
+ //See whether there are any immediate overrides.
+ if ( d->overrideBackground )
+ background = d->overrideBackgroundCol;
+
+ if ( d->overrideForeground )
+ foreground = d->overrideForegroundCol;
+
+ if ( d->overrideSelectBackground )
+ highlight = d->overrideSelectBackgroundCol;
+ if ( d->overrideSelectForeground )
+ highlightedText = d->overrideSelectForegroundCol;
+
+ if ( d->overrideWindowBackground )
+ base = d->overrideWindowBackgroundCol;
+ if ( d->overrideWindowForeground )
+ baseText = d->overrideWindowForegroundCol;
+
+ //Now, try to get the button color from the pixmap
+ if ( uncached( Bevel ) )
+ button = d->pixmapAveColor( uncached( Bevel ) );
+
+ TQColor buttonText = foreground;
+
+ int highlightVal, lowlightVal;
+ highlightVal = 100 + ( 2 * d->contrast + 4 ) * 16 / 10;
+ lowlightVal = 100 + ( 2 * d->contrast + 4 ) * 10;
+
+
+ if ( isPixmap( Background ) || isColor( Background ) )
+ {
+ if ( isColor( Background ) )
+ {
+ background = colorGroup( pal.active(), Background )
+ ->background();
+ }
+ if ( isPixmap( Background ) )
+ {
+ background = d->pixmapAveColor( uncached( Background ) );
+ }
+
+
+ TQColorGroup pre( foreground, button, background.light( highlightVal ),
+ background.dark( lowlightVal ), background.dark( 120 ),
+ baseText, buttonText /*CHECKME: BrightText*/, base, background );
+
+ buttonText = colorGroup( pre, PushButton ) ->foreground();
+ }
+
+ TQColor disfg = foreground;
+ int h, s, v;
+ disfg.hsv( &h, &s, &v );
+ if ( v > 128 )
+ // dark bg, light fg - need a darker disabled fg
+ disfg = disfg.dark( lowlightVal );
+ else if ( disfg != black )
+ // light bg, dark fg - need a lighter disabled fg - but only if !black
+ disfg = disfg.light( highlightVal );
+ else
+ // black fg - use darkgray disabled fg
+ disfg = Qt::darkGray;
+
+
+ TQColorGroup disabledgrp( disfg, background, //TODO:Convert this to the new ctor.
+ background.light( highlightVal ),
+ background.dark( lowlightVal ),
+ background.dark( 120 ),
+ background.dark( 120 ), base );
+
+
+ TQColorGroup colgrp( foreground, button, background.light( highlightVal ),
+ background.dark( lowlightVal ), background.dark( 120 ),
+ baseText, buttonText /*CHECKME: BrightText*/, base, background );
+
+
+
+ colgrp.setColor( TQColorGroup::Highlight, highlight );
+ colgrp.setColor( TQColorGroup::HighlightedText, highlightedText );
+ colgrp.setColor( TQColorGroup::ButtonText, buttonText );
+ colgrp.setColor( TQColorGroup::Midlight, button.light( 110 ) );
+
+
+ disabledgrp.setColor( TQColorGroup::Base, base );
+ disabledgrp.setColor( TQColorGroup::Button, button );
+ disabledgrp.setColor( TQColorGroup::ButtonText, buttonText );
+ disabledgrp.setColor( TQColorGroup::Midlight, button.light( 110 ) );
+
+ TQPalette newPal( colgrp, disabledgrp, colgrp );
+
+ return newPal;
+
+}
+
+KThemePixmap::KThemePixmap( bool timer )
+ : KPixmap()
+{
+ if ( timer )
+ {
+ t = new TQTime;
+ t->start();
+ }
+ else
+ t = NULL;
+ int i;
+ for ( i = 0; i < 8; ++i )
+ b[ i ] = NULL;
+}
+
+KThemePixmap::KThemePixmap( const KThemePixmap &p )
+ : KPixmap( p )
+{
+ if ( p.t )
+ {
+ t = new TQTime;
+ t->start();
+ }
+ else
+ t = NULL;
+ int i;
+ for ( i = 0; i < 8; ++i )
+ if ( p.b[ i ] )
+ b[ i ] = new TQPixmap( *p.b[ i ] );
+ else
+ b[ i ] = NULL;
+}
+
+KThemePixmap::KThemePixmap( const KThemePixmap &p, const TQPixmap &p2 )
+ : KPixmap( p2 )
+{
+ if ( p.t )
+ {
+ t = new TQTime;
+ t->start();
+ }
+ else
+ t = NULL;
+ int i;
+ for ( i = 0; i < 8; ++i )
+ if ( p.b[ i ] )
+ b[ i ] = new TQPixmap( *p.b[ i ] );
+ else
+ b[ i ] = NULL;
+}
+
+
+
+KThemePixmap::~KThemePixmap()
+{
+ if ( t )
+ delete t;
+ int i;
+ for ( i = 0; i < 8; ++i )
+ if ( b[ i ] )
+ delete b[ i ];
+}
+
+KThemeCache::KThemeCache( int maxSize, TQObject *parent, const char *name )
+ : TQObject( parent, name )
+{
+ cache.setMaxCost( maxSize * 1024 );
+ cache.setAutoDelete( true );
+ flushTimer.start( 300000 ); // 5 minutes
+ connect( &flushTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( flushTimeout() ) );
+}
+
+void KThemeCache::flushTimeout()
+{
+ TQIntCacheIterator<KThemePixmap> it( cache );
+ while ( it.current() )
+ {
+ if ( it.current() ->isOld() )
+ cache.remove( it.currentKey() );
+ else
+ ++it;
+ }
+}
+
+KThemePixmap* KThemeCache::pixmap( int w, int h, int widgetID, bool border,
+ bool mask )
+{
+
+ kthemeKey key;
+ key.cacheKey = 0; // shut up, gcc
+ key.data.id = widgetID;
+ key.data.width = w;
+ key.data.height = h;
+ key.data.border = border;
+ key.data.mask = mask;
+
+ KThemePixmap *pix = cache.find( ( unsigned long ) key.cacheKey );
+ if ( pix )
+ pix->updateAccessed();
+ return ( pix );
+}
+
+KThemePixmap* KThemeCache::horizontalPixmap( int w, int widgetID )
+{
+ kthemeKey key;
+ key.cacheKey = 0; // shut up, gcc
+ key.data.id = widgetID;
+ key.data.width = w;
+ key.data.height = 0;
+ key.data.border = false;
+ key.data.mask = false;
+ KThemePixmap *pix = cache.find( ( unsigned long ) key.cacheKey );
+ if ( pix )
+ pix->updateAccessed();
+ return ( pix );
+}
+
+KThemePixmap* KThemeCache::verticalPixmap( int h, int widgetID )
+{
+ kthemeKey key;
+ key.cacheKey = 0; // shut up, gcc
+ key.data.id = widgetID;
+ key.data.width = 0;
+ key.data.height = h;
+ key.data.border = false;
+ key.data.mask = false;
+ KThemePixmap *pix = cache.find( ( unsigned long ) key.cacheKey );
+ if ( pix )
+ pix->updateAccessed();
+ return ( pix );
+}
+
+bool KThemeCache::insert( KThemePixmap *pixmap, ScaleHint scale, int widgetID,
+ bool border, bool mask )
+{
+ kthemeKey key;
+ key.cacheKey = 0; // shut up, gcc
+ key.data.id = widgetID;
+ key.data.width = ( scale == FullScale || scale == HorizontalScale ) ?
+ pixmap->width() : 0;
+ key.data.height = ( scale == FullScale || scale == VerticalScale ) ?
+ pixmap->height() : 0;
+ key.data.border = border;
+ key.data.mask = mask;
+
+ if ( cache.find( ( unsigned long ) key.cacheKey, true ) != NULL )
+ {
+ return ( true ); // a pixmap of this scale is already in there
+ }
+ return ( cache.insert( ( unsigned long ) key.cacheKey, pixmap,
+ pixmap->width() * pixmap->height() * pixmap->depth() / 8 ) );
+}
+
+
+
+
+#include "kthemebase.moc"
diff --git a/tdestyles/kthemestyle/kthemebase.h b/tdestyles/kthemestyle/kthemebase.h
new file mode 100644
index 000000000..01ecab138
--- /dev/null
+++ b/tdestyles/kthemestyle/kthemebase.h
@@ -0,0 +1,865 @@
+/*
+ $Id$
+
+ This file is part of the KDE libraries
+ Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
+
+ KDE3 port (C) 2001 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+ Palette setup code is from TDEApplication,
+Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
+Copyright (C) 1998, 1999, 2000 KDE Team
+
+
+ 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 KTHEMEBASE_H
+#define KTHEMEBASE_H
+
+#include <tqtimer.h>
+#include <tqdatetime.h>
+#include <kpixmap.h>
+#include <tqintcache.h>
+#include <tqstring.h>
+#include <tdestyle.h>
+#include <tqsettings.h>
+#include <tqpalette.h> // for QColorGroup
+#include "tdestyledirs.h"
+#include <tqmap.h>
+
+class TQImage;
+
+
+
+/**
+ * This class adds simple time management to KPixmap for use in flushing
+ * KThemeCache.
+ *
+ * @author Daniel M. Duley <mosfet@kde.org>
+ */
+class KThemePixmap : public KPixmap
+{
+public:
+ enum BorderType{Top = 0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft,
+ BottomRight};
+
+ KThemePixmap( bool timer = true );
+ KThemePixmap( const KThemePixmap &p );
+ KThemePixmap( const KThemePixmap &p, const TQPixmap& rp );
+ ~KThemePixmap();
+ TQPixmap* border( BorderType type );
+ void setBorder( BorderType type, const TQPixmap &p );
+ void updateAccessed();
+ bool isOld();
+protected:
+ TQTime *t;
+ TQPixmap *b[ 8 ];
+
+private:
+ class KThemePixmapPrivate;
+ KThemePixmapPrivate *d;
+};
+
+inline TQPixmap* KThemePixmap::border( BorderType type )
+{
+ return ( b[ type ] );
+}
+
+inline void KThemePixmap::setBorder( BorderType type, const TQPixmap &p )
+{
+ if ( b[ type ] )
+ {
+ tqWarning( "KThemePixmap: Overwriting existing border!" );
+ delete( b[ type ] );
+ }
+ b[ type ] = new TQPixmap( p );
+}
+
+inline void KThemePixmap::updateAccessed()
+{
+ if ( t )
+ t->start();
+}
+
+inline bool KThemePixmap::isOld()
+{
+ return ( t ? t->elapsed() >= 300000 : false );
+}
+
+/**
+ * A very simple pixmap cache for theme plugins. TQPixmapCache is not used
+ * since it uses TQString keys which are not needed. All the information we
+ * need can be encoded in a numeric key. Using TQIntCache instead allows us to
+ * skip the string operations.
+ *
+ * This class is mostly just inline methods that do bit operations on a key
+ * composed of the widget ID, width and/or height, and then calls
+ * TQIntCache::find().
+ *
+ * One other thing to note is that full, horizontal, and vertically scaled
+ * pixmaps are not used interchangeably. For example, if you insert a fully
+ * scaled pixmap that is 32x32 then request a horizontally scaled pixmap with
+ * a width of 32, they will not match. This is because a pixmap that has been
+ * inserted into the cache has already been scaled at some point and it is
+ * very likely the vertical height was not originally 32. Thus the pixmap
+ * will be wrong when drawn, even though the horizontal width matches.
+ *
+ * @author Daniel M. Duley <mosfet@kde.org>
+ *
+ */
+class KThemeCache : public TQObject
+{
+ Q_OBJECT
+public:
+ /**
+ * The scale hints supported by the cache. Note that Tiled is not here
+ * since tiled pixmaps are kept only once in KThemeBase.
+ */
+ enum ScaleHint{FullScale, HorizontalScale, VerticalScale};
+ /**
+ * The constructor.
+ *
+ * @param maxSize The maximum size of the cache in kilobytes.
+ * @param parent The parent object.
+ * @param name The name of the object.
+ */
+ KThemeCache( int maxSize, TQObject *parent = 0, const char *name = 0 );
+ /**
+ * Inserts a new pixmap into the cache.
+ *
+ * @param pixmap The pixmap to insert.
+ * @param scale The scaling type of the pixmap.
+ * @param widgetID The widget ID of the pixmap, usually from KThemeBase's
+ * WidgetType enum.
+ * @param border True if the pixmap has a border.
+ * @param mask True if the pixmap has a mask.
+ *
+ * @return True if the insert was successful, false otherwise.
+ */
+ bool insert( KThemePixmap *pixmap, ScaleHint scale, int widgetID,
+ bool border = false, bool mask = false );
+ /**
+ * Returns a fully scaled pixmap.
+ *
+ * @param w The pixmap width to search for.
+ * @param h The pixmap height to search for.
+ * @param widgetID The widget ID to search for.
+ * @param border True if the pixmap has a border.
+ * @param mask True if the pixmap has a mask.
+ *
+ * @return True if a pixmap matching the width, height, and widget ID of
+ * the pixmap exists, NULL otherwise.
+ */
+ KThemePixmap* pixmap( int w, int h, int widgetID, bool border = false,
+ bool mask = false );
+ /**
+ * Returns a horizontally scaled pixmap.
+ *
+ * @param w The pixmap width to search for.
+ * @param widgetID The widget ID to search for.
+ *
+ * @return True if a pixmap matching the width and widget ID of
+ * the pixmap exists, NULL otherwise.
+ */
+ KThemePixmap* horizontalPixmap( int w, int widgetID );
+ /**
+ * Returns a vertically scaled pixmap.
+ *
+ * @param h The pixmap height to search for.
+ * @param widgetID The widget ID to search for.
+ *
+ * @return True if a pixmap matching the height and widget ID of
+ * the pixmap exists, NULL otherwise.
+ */
+ KThemePixmap* verticalPixmap( int h, int widgetID );
+protected slots:
+ void flushTimeout();
+protected:
+ TQIntCache<KThemePixmap> cache;
+ TQTimer flushTimer;
+
+private:
+ class KThemeCachePrivate;
+ KThemeCachePrivate *d;
+};
+
+
+
+class KThemeBasePrivate;
+/**
+ * This is a base class for KDE themed styles. It implements a cache,
+ * configuration file parsing, pixmap scaling, gradients, and a lot
+ * of inline methods for accessing user specified parameters.
+ *
+ * Note that this class *does not* actually implement any themes. It just
+ * provides the groundwork for doing so. The only reason to use this class
+ * directly is if you plan to reimplement all of the widgets. Otherwise,
+ * refer to KThemeStyle for a fully themed style you can derive from.
+ *
+ * @author Daniel M. Duley <mosfet@kde.org>
+ */
+class KThemeBase: public TDEStyle
+{
+ Q_OBJECT
+public:
+ /**
+ * Constructs a new KThemeBase object.
+ */
+ KThemeBase( const TQString &dirs, const TQString &configFile );
+ ~KThemeBase();
+ /**
+ * Describes if a pixmap should be scaled fully, horizontally, vertically,
+ * or not at all and tiled.
+ */
+ enum ScaleHint{FullScale, HorizontalScale, VerticalScale, TileScale};
+ /**
+ * The default arrow types.
+ */
+ enum ArrowStyle{MotifArrow, LargeArrow, SmallArrow};
+ /**
+ * The default frame shading styles.
+ */
+ enum ShadeStyle{Motif, Windows, Next, KDE};
+ /**
+ * The default scrollbar button layout. BottomLeft is like what Next
+ * uses, BottomRight is like Platinum, and Opposite it like Windows and
+ * Motif.
+ */
+ enum SButton{SBBottomLeft, SBBottomRight, SBOpposite};
+ /**
+ * The gradient types. Horizontal is left to right, Vertical is top to
+ * bottom, and diagonal is upper-left to bottom-right.
+ */
+ enum Gradient{GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid,
+ GrRectangle, GrElliptic, GrReverseBevel};
+ /**
+ * This provides a list of widget types that KThemeBase recognizes.
+ */
+ /* Internal note: The order here is important. Some widgets inherit
+ * properties. This is usually for when you have two settings for the
+ * same widget, ie: on(sunken), and off. The on settings will inherit
+ * the properties of the off one when nothing is specified in the config.
+ *
+ * In order to be able to handle this while still having everything in
+ * one group that is easy to loop from we have the following order:
+ * unsunked(off) items, sunken(on)items, and then the ones that don't
+ * matter. INHERIT_ITEMS define the number of widgets that have inheritence
+ * so if 0 == PushButtonOff then INHERIT_ITEMS should == PushButtonOn
+ * and so on. WIDGETS define the total number of widgets.
+ */
+ enum WidgetType{
+ // Off (unsunken widgets)
+ PushButton = 0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel,
+ ToolButton, ScrollButton, HScrollDeco, VScrollDeco,
+ ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft,
+ ArrowRight,
+ // On (sunken widgets)
+ PushButtonDown, ComboBoxDown, HScrollBarSliderDown,
+ VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown,
+ HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown,
+ ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft,
+ SunkenArrowRight,
+ // Everything else (indicators must have separate settings)
+ HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn,
+ IndicatorOff, IndicatorTri, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle,
+ ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown,
+ DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem,
+ Background, RotSliderGroove, RotInactiveTab, RotActiveTab, WIDGETS};
+
+ /**
+ * The scaling type specified by the TDEConfig file.
+ *
+ * @param widget A Widgets enum value.
+ *
+ * @return A ScaleHint enum value.
+ */
+ ScaleHint scaleHint( WidgetType widget ) const;
+ /**
+ * The gradient type specified by the TDEConfig file.
+ *
+ * @param widget A Widgets enum value.
+ *
+ * @return A Gradient enum value.
+ */
+ Gradient gradientHint( WidgetType widget ) const;
+ /**
+ * The color group specified for a given widget.
+ * If a color group is set in the theme configuration
+ * that is used, otherwise defaultColor is returned.
+ *
+ * @param defaultGroup The colorGroup to set if one is available.
+ *
+ * @param widget The widget whose color group to retrieve.
+ *
+ */
+ const TQColorGroup* colorGroup( const TQColorGroup &defaultGroup,
+ WidgetType widget ) const;
+
+ TQBrush pixmapBrush( const TQColorGroup &group, TQColorGroup::ColorRole role,
+ int w, int h, WidgetType widget );
+ /**
+ * True if the widget has a pixmap or gradient specified.
+ */
+ bool isPixmap( WidgetType widget ) const;
+ /**
+ * True if the widget has a color group specified.
+ */
+ bool isColor( WidgetType widget ) const;
+ /**
+ * True if the user specified a 3D focus rectangle
+ */
+ bool is3DFocus() const;
+ /**
+ * If the user specified a 3D focus rectangle, they may also specify an
+ * offset from the default rectangle to use when drawing it. This returns
+ * the specified offset.
+ */
+ int focusOffset() const;
+ /**
+ * The border width of the specified widget.
+ */
+ int borderWidth( WidgetType widget ) const;
+ /**
+ * Pixmap border width of the specified widget.
+ */
+ int pixBorderWidth( WidgetType widget ) const;
+ /**
+ * Returns the border pixmap if enabled for the specified widget. This
+ * will contain the originial pixmap, plus the edges separated in
+ * KThemePixmap::border() if valid. If invalid it will return NULL.
+ */
+ KThemePixmap* borderPixmap( WidgetType widget ) const;
+ /**
+ * The highlight width of the specified widget.
+ */
+ int highlightWidth( WidgetType widget ) const;
+ /**
+ * The border plus highlight width of the widget.
+ */
+ int decoWidth( WidgetType widget ) const;
+ /**
+ * The extent (width for vertical, height for horizontal) requested
+ * for the scrollbars.
+ */
+ int getSBExtent() const;
+ /**
+ * The scrollbar button layout.
+ */
+ SButton scrollBarLayout() const;
+ /**
+ * The arrow type.
+ */
+ ArrowStyle arrowType() const;
+ /**
+ * The shading type.
+ */
+ ShadeStyle shade() const;
+ /**
+ * The frame width.
+ */
+ int frameWidth() const;
+ /**
+ * The splitter width.
+ */
+ int splitWidth() const;
+ /**
+ * The contrast for some bevel effects such as reverse gradient.
+ */
+ int bevelContrast( WidgetType widget ) const;
+ /**
+ * The button text X shift.
+ */
+ int buttonXShift() const;
+ /**
+ * The button text Y shift.
+ */
+ int buttonYShift() const;
+ /**
+ * Returns either the slider length of the slider pixmap if available,
+ * otherwise the length specified in the config file.
+ */
+ int sliderButtonLength() const;
+ /**
+ * True if rounded buttons are requested.
+ */
+ bool roundButton() const;
+ /**
+ * True if rounded comboboxes are requested.
+ */
+ bool roundComboBox() const;
+ /**
+ * True if rounded slider grooves are requested.
+ */
+ bool roundSlider() const;
+ /**
+ * True if a line should be drawn on the bottom of active tabs.
+ */
+ bool activeTabLine() const;
+ /**
+ * True if a line should be drawn on the bottom of inactive tabs.
+ */
+ bool inactiveTabLine() const;
+ /**
+ * Returns the current uncached pixmap for the given widget. This will
+ * usually be either the last scaled or gradient pixmap if those have
+ * been specified in the config file, the original pixmap if not, or NULL
+ * if no pixmap has been specified.
+ */
+ KThemePixmap* uncached( WidgetType widget ) const;
+ /**
+ * Returns the pixmap for the given widget at the specified width and
+ * height. This will return NULL if no pixmap or gradient is specified.
+ * It may also return a different sized pixmap if the scaling
+ * is set to Tiled. When using this method, you should call it using
+ * the needed width and height then use TQPainter::drawTiledPixmap to
+ * paint it. Doing this, if the pixmap is scaled it will be the proper
+ * size, otherwise it will be tiled.
+ *
+ * @param w Requested width.
+ * @param h Requested height.
+ * @param widget Widget type.
+ * @return The pixmap or NULL if one is not specified.
+ */
+ virtual KThemePixmap *scalePixmap( int w, int h, WidgetType widget ) const;
+protected:
+ /**
+ * This method reads a configuration file and sets things up so
+ * overrideColorGroup works. Modiying user's config files within
+ * a style is evil, IMHO (SadEagle). On the other hand, this will
+ * make it simply ignore settings.
+ *
+ * @param config The configuration file to apply.
+ */
+ void applyConfigFile( TQSettings & config );
+
+ /*
+ * Generates a new palette based on the values for which have been specified explicitly
+ * in the .themerc file.
+ */
+ TQPalette overridePalette( const TQPalette& pal );
+
+ /**
+ * Returns a TQImage for the given widget if the widget is scaled, NULL
+ * otherwise. QImages of the original pixmap are stored for scaled
+ * widgets in order to facilitate fast and accurate smooth-scaling. This
+ * also saves us a conversion from a pixmap to an image then back again.
+ */
+ TQImage* image( WidgetType widget ) const;
+ /**
+ * Returns the gradient high color if one is specified, NULL otherwise.
+ */
+ TQColor* gradientHigh( WidgetType widget ) const;
+ /**
+ * Returns the gradient low color if one is specified, NULL otherwise.
+ */
+ TQColor* gradientLow( WidgetType widget ) const;
+ /**
+ * Reads in all the configuration file entries supported.
+ *
+ * @param colorStyle The style for the color groups. In KDE, colors were
+ * calculated a little differently for Motif vs Windows styles. This
+ * is obsolete.
+ */
+ void readConfig( TQt::GUIStyle colorStyle = TQt::WindowsStyle );
+ void readWidgetConfig( int i, TQSettings *config, TQString *pixnames,
+ TQString *brdnames, bool *loadArray );
+ void copyWidgetConfig( int sourceID, int destID, TQString *pixnames,
+ TQString *brdnames );
+ /**
+ * Makes a full color group based on the given foreground and background
+ * colors. This is the same code used by KDE (kapp.cpp) in previous
+ * versions.
+ */
+ TQColorGroup* makeColorGroup( const TQColor &fg, const TQColor &bg,
+ TQt::GUIStyle style = TQt::WindowsStyle );
+ KThemePixmap* scale( int w, int h, WidgetType widget ) const;
+ KThemePixmap* scaleBorder( int w, int h, WidgetType type ) const;
+ KThemePixmap* gradient( int w, int h, WidgetType widget ) const ;
+ KThemePixmap* blend( WidgetType widget ) const;
+ void generateBorderPix( int i );
+ void applyResourceGroup( TQSettings *config, int i );
+ void applyMiscResourceGroup( TQSettings *config );
+ void readResourceGroup( int i, TQString *pixnames, TQString *brdnames,
+ bool *loadArray );
+ void readMiscResourceGroup();
+ /**
+ * Attempts to load a pixmap from the default KThemeBase locations.
+ */
+ KThemePixmap* loadPixmap( const TQString &name );
+ /**
+ * Attempts to load a image from the default KThemeBase locations.
+ */
+ TQImage* loadImage( const TQString &name );
+
+
+ /**
+ These are included for fuuture extension purposes..
+ */
+ virtual int pixelMetric ( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget * widget = 0 ) const
+ {
+ return TDEStyle::pixelMetric( metric, ceData, elementFlags, widget );
+ }
+
+ virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & cg,
+ SFlags flags = Style_Default,
+ const TQStyleOption& option = TQStyleOption::Default ) const
+ {
+ TDEStyle::tqdrawPrimitive ( pe, p, ceData, elementFlags, r, cg,
+ flags, option );
+ }
+
+
+ virtual void drawControl( TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags how = Style_Default,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const
+ {
+ TDEStyle::drawControl( element, p, ceData, elementFlags,
+ r, cg, how, opt, widget );
+ }
+
+ virtual void drawControlMask( TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const
+ {
+ TDEStyle::drawControlMask( element, p, ceData, elementFlags, r, opt, widget );
+ }
+
+
+ virtual 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& opt = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const
+ {
+ TDEStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, controls, active, opt, widget );
+ }
+
+
+ virtual void drawTDEStylePrimitive( TDEStylePrimitive kpe,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags = Style_Default,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const
+ {
+ TDEStyle::drawTDEStylePrimitive( kpe,
+ p, ceData, elementFlags, r,
+ cg, flags, opt, widget );
+ }
+
+
+ virtual int styleHint( StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ TQStyleHintReturn* returnData = 0,
+ const TQWidget *widget = 0 ) const
+ {
+ return TDEStyle::styleHint( sh,
+ ceData,
+ elementFlags,
+ opt,
+ returnData,
+ widget );
+ }
+
+ virtual TQSize sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentsSize,
+ const TQStyleOption& opt = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const
+ {
+ return TDEStyle::sizeFromContents( contents,
+ ceData, elementFlags, contentsSize, opt, widget );
+ }
+
+private:
+ KThemeBasePrivate *d;
+
+ SButton sbPlacement;
+ ArrowStyle arrowStyle;
+ ShadeStyle shading;
+ int defaultFrame;
+ int btnXShift, btnYShift;
+ int sliderLen;
+ int splitterWidth;
+ int focus3DOffset;
+ int sbExtent;
+ bool smallGroove;
+ bool roundedButton, roundedCombo, roundedSlider;
+ bool aTabLine, iTabLine;
+ bool focus3D;
+ KThemeCache *cache;
+ int cacheSize;
+ TQString configFileName;
+ TQString configDirName;
+
+ /**
+ * The theme pixmaps. Many of these may be NULL if no pixmap is specified.
+ * There may also be duplicate pixmap pointers if more than one widget
+ * uses the same tiled pixmap. If a pixmap is tiled, it is kept here and
+ * this acts as a cache. Otherwise this will hold whatever the last scaled
+ * pixmap was.
+ */
+ mutable KThemePixmap *pixmaps[ WIDGETS ];
+ /**
+ * The theme images. These are for scaled images and are kept in order
+ * to maintain fast smoothscaling.
+ */
+ mutable TQImage *images[ WIDGETS ];
+ /**
+ * The border widths
+ */
+ mutable unsigned char borders[ WIDGETS ];
+ /**
+ * The highlight widths
+ */
+ mutable unsigned char highlights[ WIDGETS ];
+ /**
+ * The scale hints for pixmaps and gradients.
+ */
+ mutable ScaleHint scaleHints[ WIDGETS ];
+ /**
+ * All the color groups.
+ */
+ mutable TQColorGroup *colors[ WIDGETS ];
+ /**
+ * Gradient low colors (or blend background).
+ */
+ mutable TQColor *grLowColors[ WIDGETS ];
+ /**
+ * Gradient high colors.
+ */
+ mutable TQColor *grHighColors[ WIDGETS ];
+ /**
+ * Gradient types.
+ */
+ mutable Gradient gradients[ WIDGETS ];
+ /**
+ * Blend intensity factors
+ */
+ mutable float blends[ WIDGETS ];
+ /**
+ * Bevel contrasts
+ */
+ mutable unsigned char bContrasts[ WIDGETS ];
+ /**
+ * Duplicate pixmap entries (used during destruction).
+ */
+ mutable bool duplicate[ WIDGETS ];
+ /**
+ * Pixmapped border widths
+ */
+ mutable int pbWidth[ WIDGETS ];
+ /**
+ * Pixmapped borders
+ */
+ mutable KThemePixmap *pbPixmaps[ WIDGETS ];
+ /**
+ * Duplicate border pixmapped border entries
+ */
+ mutable bool pbDuplicate[ WIDGETS ];
+
+};
+
+inline bool KThemeBase::isPixmap( WidgetType widget ) const
+{
+ return ( pixmaps[ widget ] != NULL || gradients[ widget ] != GrNone );
+}
+
+inline bool KThemeBase::isColor( WidgetType widget ) const
+{
+ return ( colors[ widget ] != NULL );
+}
+
+inline bool KThemeBase::is3DFocus() const
+{
+ return ( focus3D );
+}
+
+inline int KThemeBase::focusOffset() const
+{
+ return ( focus3DOffset );
+}
+
+inline int KThemeBase::bevelContrast( WidgetType widget ) const
+{
+ return ( bContrasts[ widget ] );
+}
+
+inline KThemeBase::ScaleHint KThemeBase::scaleHint( WidgetType widget ) const
+{
+ return ( ( widget < WIDGETS ) ? scaleHints[ widget ] : TileScale );
+}
+
+inline KThemeBase::Gradient KThemeBase::gradientHint( WidgetType widget ) const
+{
+ return ( ( widget < WIDGETS ) ? gradients[ widget ] : GrNone );
+}
+
+inline KThemePixmap* KThemeBase::uncached( WidgetType widget ) const
+{
+ return ( pixmaps[ widget ] );
+}
+
+inline TQBrush KThemeBase::pixmapBrush( const TQColorGroup &group,
+ TQColorGroup::ColorRole role,
+ int w, int h, WidgetType widget )
+{
+ if ( pixmaps[ widget ] || images[ widget ] )
+ return ( TQBrush( group.color( role ), *scalePixmap( w, h, widget ) ) );
+ else
+ return ( group.color( role ) );
+}
+
+inline const TQColorGroup* KThemeBase::colorGroup( const TQColorGroup &defaultGroup,
+ WidgetType widget ) const
+{
+ return ( ( colors[ widget ] ) ? colors[ widget ] : &defaultGroup );
+}
+
+inline int KThemeBase::borderWidth( WidgetType widget ) const
+{
+ return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] );
+}
+
+inline int KThemeBase::pixBorderWidth( WidgetType widget ) const
+{
+ return ( pbWidth[ widget ] );
+}
+
+inline int KThemeBase::highlightWidth( WidgetType widget ) const
+{
+ return ( pbWidth[ widget ] ? 0 : highlights[ widget ] );
+}
+
+inline int KThemeBase::decoWidth( WidgetType widget ) const
+{
+ return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] + highlights[ widget ] );
+}
+
+inline TQColor* KThemeBase::gradientHigh( WidgetType widget ) const
+{
+ return ( grHighColors[ widget ] );
+}
+
+inline TQColor* KThemeBase::gradientLow( WidgetType widget ) const
+{
+ return ( grLowColors[ widget ] );
+}
+
+inline TQImage* KThemeBase::image( WidgetType widget ) const
+{
+ return ( images[ widget ] );
+}
+
+inline KThemeBase::SButton KThemeBase::scrollBarLayout() const
+{
+ return ( sbPlacement );
+}
+
+inline KThemeBase::ArrowStyle KThemeBase::arrowType() const
+{
+ return ( arrowStyle );
+}
+
+inline KThemeBase::ShadeStyle KThemeBase::shade() const
+{
+ return ( shading );
+}
+
+inline int KThemeBase::frameWidth() const
+{
+ return ( defaultFrame );
+}
+
+inline int KThemeBase::buttonXShift() const
+{
+ return ( btnXShift );
+}
+
+inline int KThemeBase::splitWidth() const
+{
+ return ( splitterWidth );
+}
+
+inline int KThemeBase::buttonYShift() const
+{
+ return ( btnYShift );
+}
+
+inline int KThemeBase::sliderButtonLength() const
+{
+ if ( isPixmap( Slider ) )
+ return ( uncached( Slider ) ->width() );
+ else
+ return ( sliderLen );
+}
+
+inline bool KThemeBase::roundButton() const
+{
+ return ( roundedButton );
+}
+
+inline bool KThemeBase::roundComboBox() const
+{
+ return ( roundedCombo );
+}
+
+inline bool KThemeBase::roundSlider() const
+{
+ return ( roundedSlider );
+}
+
+inline bool KThemeBase::activeTabLine() const
+{
+ return ( aTabLine );
+}
+
+inline bool KThemeBase::inactiveTabLine() const
+{
+ return ( iTabLine );
+}
+
+inline int KThemeBase::getSBExtent() const
+{
+ return ( sbExtent );
+}
+
+inline KThemePixmap* KThemeBase::borderPixmap( WidgetType widget ) const
+{
+ return ( pbPixmaps[ widget ] );
+}
+
+#endif
diff --git a/tdestyles/kthemestyle/kthemestyle.cpp b/tdestyles/kthemestyle/kthemestyle.cpp
new file mode 100644
index 000000000..27f9ca325
--- /dev/null
+++ b/tdestyles/kthemestyle/kthemestyle.cpp
@@ -0,0 +1,2459 @@
+/*
+ $Id$
+
+ This file is part of the KDE libraries
+ Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
+
+ KDE3 port (C) 2001-2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+Port version 0.9.7
+
+ Includes code portions from the dotNET style, and the KDE HighColor style.
+
+ dotNET Style
+ Copyright (C) 2001, Chris Lee <lee@azsites.com>
+ Carsten Pfeiffer <pfeiffer@kde.org>
+
+ KDE3 HighColor Style
+ Copyright (C) 2001 Karol Szwed <gallium@kde.org>
+ (C) 2001 Fredrik H�glund <fredrik@kde.org>
+
+ Drawing routines adapted from the KDE2 HCStyle,
+ Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ (C) 2000 Dirk Mueller <mueller@kde.org>
+ (C) 2001 Martijn Klingens <klingens@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.
+*/
+
+#include "kthemestyle.h"
+#include "kthemebase.h"
+#include <tqstyleplugin.h>
+#include <tqstylefactory.h>
+#include <kimageeffect.h>
+
+#include <tqbitmap.h>
+#include <tqcheckbox.h>
+#include <tqlabel.h>
+#define INCLUDE_MENUITEM_DEF
+#include <tqmenudata.h>
+#include <tqpopupmenu.h>
+#include <tqpalette.h>
+#include <tqtabbar.h>
+#include <tqtoolbutton.h>
+#include <tdeglobalsettings.h>
+#include <kdrawutil.h>
+#include <tqdrawutil.h>
+#include <tqprogressbar.h>
+#include <tqdir.h>
+#include <tqapplication.h>
+#include <tqmenubar.h>
+#include <tqrangecontrol.h>
+#include <tqslider.h>
+#include <tqtooltip.h>
+#include <tqobjectlist.h>
+#include <tqradiobutton.h>
+#include <tqstatusbar.h>
+#include "tdestyledirs.h"
+
+#include <tqimage.h>
+
+#include <limits.h>
+
+#ifdef __GLIBC__
+#include <dlfcn.h>
+#endif
+
+static const TQCOORD u_arrow[] = { -1, -3, 0, -3, -2, -2, 1, -2, -3, -1, 2, -1, -4, 0, 3, 0, -4, 1, 3, 1};
+static const TQCOORD d_arrow[] = { -4, -2, 3, -2, -4, -1, 3, -1, -3, 0, 2, 0, -2, 1, 1, 1, -1, 2, 0, 2};
+static const TQCOORD l_arrow[] = { -3, -1, -3, 0, -2, -2, -2, 1, -1, -3, -1, 2, 0, -4, 0, 3, 1, -4, 1, 3};
+static const TQCOORD r_arrow[] = { -2, -4, -2, 3, -1, -4, -1, 3, 0, -3, 0, 2, 1, -2, 1, 1, 2, -1, 2, 0};
+
+const TQCOORD win_style_u_arrow[] = { 0, -2, 0, -2, -1, -1, 1, -1, -2, 0, 2, 0, -3, 1, 3, 1 };
+const TQCOORD win_style_d_arrow[] = { -3, -2, 3, -2, -2, -1, 2, -1, -1, 0, 1, 0, 0, 1, 0, 1 };
+const TQCOORD win_style_l_arrow[] = { 1, -3, 1, -3, 0, -2, 1, -2, -1, -1, 1, -1, -2, 0, 1, 0, -1, 1, 1, 1, 0, 2, 1, 2, 1, 3, 1, 3 };
+const TQCOORD win_style_r_arrow[] = { -2, -3, -2, -3, -2, -2, -1, -2, -2, -1, 0, -1, -2, 0, 1, 0, -2, 1, 0, 1, -2, 2, -1, 2, -2, 3, -2, 3 };
+
+
+#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2)
+
+
+static const int itemFrame = 2;
+static const int itemHMargin = 3;
+static const int itemVMargin = 1;
+static const int arrowHMargin = 6;
+static const int rightBorder = 12;
+
+
+/*
+BUGS:
+Sliders flash a bit -- anything else?
+
+TODO:
+Nicer disabled buttons.
+Sliders are not disabled properly
+*/
+
+
+class KThemeStylePlugin : public TQStylePlugin
+{
+public:
+
+ KThemeStylePlugin()
+ {
+#ifdef __GLIBC__
+ dlopen("kthemestyle.so",RTLD_LAZY);
+ //####### Keep reference count up so tdecore w. fast-malloc doesn't get unloaded
+ //####### (Fixes exit crashes with qt-only apps that occur on Linux)
+ //####### This should be rethought after 3.0,
+ //####### as it relies on the implementation-specific behavior
+ //####### of the glibc libdl (finding already loaded libraries based on the
+ //####### soname)
+#endif
+ }
+
+ ~KThemeStylePlugin()
+ {}
+
+ TQStringList keys() const
+ {
+ TQSettings cfg;
+ TDEStyleDirs::dirs()->addToSearch( "config", cfg );
+
+ TQStringList keys;
+ bool ok;
+
+ keys = cfg.readListEntry( "/kthemestyle/themes", &ok);
+ if ( !ok )
+ tqWarning( "KThemeStyle cache seems corrupt!\n" ); //Too bad one can't i18n this :-(
+
+ return keys;
+ }
+
+ TQStyle* create( const TQString& key )
+ {
+ TQSettings cfg;
+ TDEStyleDirs::dirs()->addToSearch( "config", cfg );
+
+ TQString file = cfg.readEntry( "/kthemestyle/" + key + "/file" );
+ if ( !key.isEmpty() )
+ {
+ TQFileInfo fi( file );
+ return new KThemeStyle( fi.dirPath(), fi.fileName() );
+ }
+
+ return 0;
+ }
+};
+
+KDE_Q_EXPORT_PLUGIN( KThemeStylePlugin )
+
+
+void kDrawWindowsArrow ( TQPainter *p, const TQStyleControlElementData &ceData, const TQStyle::ControlElementFlags elementFlags, const TQStyle* style, TQStyle::PrimitiveElement pe, bool down,
+ int x, int y, int w, int h,
+ const TQColorGroup &cg, bool enabled )
+{
+ TQPointArray a;
+ switch ( pe )
+ {
+ case TQStyle::PE_ArrowUp:
+ a.setPoints( TQCOORDARRLEN( win_style_u_arrow ), win_style_u_arrow );
+ break;
+
+ case TQStyle::PE_ArrowDown:
+ a.setPoints( TQCOORDARRLEN( win_style_d_arrow ), win_style_d_arrow );
+ break;
+
+ case TQStyle::PE_ArrowLeft:
+ a.setPoints( TQCOORDARRLEN( win_style_l_arrow ), win_style_l_arrow );
+ break;
+ default:
+ a.setPoints( TQCOORDARRLEN( win_style_r_arrow ), win_style_r_arrow );
+ }
+
+ p->save();
+ if ( down )
+ {
+ p->translate( style->pixelMetric( TQStyle::PM_ButtonShiftHorizontal, ceData, elementFlags ),
+ style->pixelMetric( TQStyle::PM_ButtonShiftVertical, ceData, elementFlags ) );
+ }
+
+ if ( enabled )
+ {
+ a.translate( x + w / 2, y + h / 2 );
+ p->setPen( cg.buttonText() );
+ p->drawLineSegments( a );
+ }
+ else
+ {
+ a.translate( x + w / 2 + 1, y + h / 2 + 1 );
+ p->setPen( cg.light() );
+ p->drawLineSegments( a );
+ a.translate( -1, -1 );
+ p->setPen( cg.mid() );
+ p->drawLineSegments( a );
+ }
+
+ p->restore();
+
+}
+
+
+
+TQSize KThemeStyle::sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentSize,
+ const TQStyleOption& opt,
+ const TQWidget* widget ) const
+{
+ switch ( contents )
+ {
+ // PUSHBUTTON SIZE
+ // ------------------------------------------------------------------
+ case CT_PushButton:
+ {
+ const TQPushButton * button = ( const TQPushButton* ) widget;
+ int w = contentSize.width();
+ int h = contentSize.height();
+ int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget );
+ int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
+
+ w += bm + fw + 6; // ### Add 6 to make way for bold font.
+ h += bm + fw;
+
+ // Ensure we stick to standard width and heights.
+ if ( button->isDefault() || button->autoDefault() )
+ {
+ if ( w < 80 && !button->text().isEmpty() )
+ w = 80;
+ }
+
+ if ( h < 22 )
+ h = 22;
+
+ return TQSize( w, h );
+ }
+
+ // POPUPMENU ITEM SIZE
+ // -----------------------------------------------------------------
+ case CT_PopupMenuItem:
+ {
+ if ( ! widget || opt.isDefault() )
+ return contentSize;
+
+ const TQPopupMenu *popup = ( const TQPopupMenu * ) widget;
+ bool checkable = popup->isCheckable();
+ TQMenuItem *mi = opt.menuItem();
+ int maxpmw = opt.maxIconWidth();
+ int w = contentSize.width(), h = contentSize.height();
+
+ if ( mi->custom() )
+ {
+ w = mi->custom() ->sizeHint().width();
+ h = mi->custom() ->sizeHint().height();
+ if ( ! mi->custom() ->fullSpan() )
+ h += 2 * itemVMargin + 2 * itemFrame;
+ }
+ else if ( mi->widget() )
+ {}
+ else if ( mi->isSeparator() )
+ {
+ w = 10; // Arbitrary
+ h = 2;
+ }
+ else
+ {
+ if ( mi->pixmap() )
+ h = QMAX( h, mi->pixmap() ->height() + 2 * itemFrame );
+ else
+ h = QMAX( h, popup->fontMetrics().height()
+ + 2 * itemVMargin + 2 * itemFrame );
+
+ if ( mi->iconSet() )
+ h = QMAX( h, mi->iconSet() ->pixmap(
+ TQIconSet::Small, TQIconSet::Normal ).height() +
+ 2 * itemFrame );
+ }
+
+ if ( ! mi->text().isNull() && mi->text().find( '\t' ) >= 0 )
+ w += 12;
+ else if ( mi->popup() )
+ w += 2 * arrowHMargin;
+
+ if ( maxpmw )
+ w += maxpmw + 6;
+ if ( checkable && maxpmw < 20 )
+ w += 20 - maxpmw;
+ if ( checkable || maxpmw > 0 )
+ w += 12;
+
+ w += rightBorder;
+
+ return TQSize( w, h );
+ }
+
+ default:
+ return KThemeBase::sizeFromContents( contents, ceData, elementFlags, contentSize, opt, widget );
+ }
+}
+
+
+TQRect KThemeStyle::subRect(SubRect sr, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget* widget) const
+{
+ if (sr == SR_CheckBoxFocusRect)
+ {
+ const TQCheckBox* cb = static_cast<const TQCheckBox*>(widget);
+
+ //Only checkbox, no label
+ if (cb->text().isEmpty() && (cb->pixmap() == 0) )
+ {
+ TQRect bounding = cb->rect();
+
+ int cw = pixelMetric(PM_IndicatorWidth, ceData, elementFlags, widget);
+ int ch = pixelMetric(PM_IndicatorHeight, ceData, elementFlags, widget);
+
+ TQRect checkbox(bounding.x() + 2, bounding.y() + 2 + (bounding.height() - ch)/2, cw - 4, ch - 4);
+
+ return checkbox;
+ }
+ }
+ return TDEStyle::subRect(sr, ceData, elementFlags, widget);
+}
+
+int KThemeStyle::pixelMetric ( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget * widget ) const
+{
+ switch ( metric )
+ {
+ case PM_MenuBarFrameWidth:
+ return 1;
+ case PM_DefaultFrameWidth:
+ return ( frameWidth() );
+
+ case PM_ButtonMargin:
+ return decoWidth( PushButton ) > decoWidth( PushButtonDown ) ?
+ 3 + decoWidth( PushButton ) : 3 + decoWidth( PushButtonDown );
+
+ case PM_ScrollBarExtent:
+ case PM_SliderThickness: //Should this be 16 always?
+ return getSBExtent();
+
+ case PM_ButtonDefaultIndicator:
+ return 0;
+
+ case PM_ButtonShiftHorizontal:
+ return buttonXShift();
+
+ case PM_ButtonShiftVertical:
+ return buttonYShift();
+
+ case PM_ExclusiveIndicatorWidth:
+ if ( isPixmap( ExIndicatorOn ) )
+ return ( uncached( ExIndicatorOn ) ->size().width() );
+ else
+ return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
+
+ case PM_ExclusiveIndicatorHeight:
+ if ( isPixmap( ExIndicatorOn ) )
+ return ( uncached( ExIndicatorOn ) ->size().height() );
+ else
+ return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
+
+
+ case PM_IndicatorWidth:
+ if ( isPixmap( IndicatorOn ) )
+ return ( uncached( IndicatorOn ) ->size().width() );
+ else
+ return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
+
+ case PM_IndicatorHeight:
+ if ( isPixmap( IndicatorOn ) )
+ return ( uncached( IndicatorOn ) ->size().height() );
+ else
+ return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
+
+ case PM_SliderLength:
+ return ( sliderButtonLength() );
+
+ case PM_SplitterWidth:
+ return ( splitWidth() );
+
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ return 0;
+
+ default:
+ return KThemeBase::pixelMetric ( metric, ceData, elementFlags, widget );
+ }
+}
+
+
+
+KThemeStyle::KThemeStyle( const TQString& configDir, const TQString &configFile )
+ : KThemeBase( configDir, configFile ), paletteSaved( false ), polishLock( false ), menuCache( 0 ), vsliderCache( 0 ),
+ brushHandle( 0 ), brushHandleSet( false ), kickerMode( false )
+{
+ mtfstyle = TQStyleFactory::create( "Motif" );
+ if ( !mtfstyle )
+ mtfstyle = TQStyleFactory::create( *( TQStyleFactory::keys().begin() ) );
+}
+
+KThemeStyle::~KThemeStyle()
+{
+ delete vsliderCache;
+ delete menuCache;
+
+}
+
+
+void KThemeStyle::applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags, void *ptr )
+{
+ if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
+ TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
+ if (!qstrcmp(app->argv()[0], "kicker")) {
+ kickerMode = true;
+ }
+ }
+}
+
+
+void KThemeStyle::polish( TQPalette &p )
+{
+ if ( polishLock )
+ {
+ return ; //Palette polishing disabled ...
+ }
+
+
+
+ if ( !paletteSaved )
+ {
+ oldPalette = p;
+ paletteSaved = true;
+ }
+
+ p = overridePalette( p );
+
+ if ( isPixmap( Background ) )
+ {
+ TQBrush bgBrush( p.color( TQPalette::Normal,
+ TQColorGroup::Background ),
+ *uncached( Background ) );
+ brushHandle = uncached( Background )->handle();
+ brushHandleSet = true;
+ p.setBrush( TQColorGroup::Background, bgBrush );
+ }
+
+}
+
+void KThemeStyle::paletteChanged()
+{
+ TQPalette p = TQApplication::palette();
+ polish( p );
+ TQApplication::setPalette( p );
+}
+
+
+void KThemeStyle::applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags, void *ptr )
+{
+ if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
+ TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
+ app->setPalette( oldPalette, true );
+ }
+}
+
+bool KThemeStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
+{
+ if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
+ TQObject* object = reinterpret_cast<TQObject*>(source);
+
+ if( object->inherits("KActiveLabel"))
+ {
+ if(event->type() == TQEvent::Move || event->type() == TQEvent::Resize ||
+ event->type() == TQEvent::Show)
+ {
+ TQWidget *w = TQT_TQWIDGET(object);
+ TQPoint pos(0, 0);
+ pos = w->mapTo(w->topLevelWidget(), pos);
+ TQPixmap pix(uncached( Background )->size());
+ TQPainter p;
+ p.begin(&pix);
+ p.drawTiledPixmap(0, 0,
+ uncached( Background )->width(),
+ uncached( Background )->height() ,
+ *uncached( Background ),
+ pos.x(), pos.y());
+ p.end();
+ TQPalette pal(w->palette());
+ TQBrush brush( pal.color( TQPalette::Normal,
+ TQColorGroup::Background),
+ pix );
+ pal.setBrush(TQColorGroup::Base, brush);
+ w->setPalette(pal);
+ }
+ }
+ if (!qstrcmp(object->name(), "kde toolbar widget") && object->inherits(TQLABEL_OBJECT_NAME_STRING))
+ {
+ TQWidget* lb = TQT_TQWIDGET(object);
+ if (lb->backgroundMode() == TQt::PaletteButton)
+ lb->setBackgroundMode(TQt::PaletteBackground);
+ removeObjectEventHandler(ceData, elementFlags, source, this);
+ }
+ }
+
+ return TDEStyle::objectEventHandler(ceData, elementFlags, source, event);
+}
+
+void KThemeStyle::polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr )
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
+
+ if (::tqqt_cast<TQStatusBar*>(w))
+ w->setPaletteBackgroundColor(TQApplication::palette().color(TQPalette::Normal, TQColorGroup::Background));
+
+ if (::tqqt_cast<TQLabel*>(w) && !qstrcmp(w->name(), "kde toolbar widget"))
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+
+ if (w->backgroundPixmap() && !w->isTopLevel() &&
+ (!kickerMode ||
+ (!w->inherits("TaskBar") && !w->inherits("TaskBarContainer") && !w->inherits("TaskbarApplet") && !w->inherits("ContainerArea") && !w->inherits("AppletHandle"))))
+ {
+ //The brushHandle check verifies that the bg pixmap is actually the brush..
+ if (!brushHandleSet || brushHandle == w->backgroundPixmap()->handle())
+ {
+ w->setBackgroundOrigin( TQWidget::WindowOrigin );
+ }
+ }
+
+ if (w->inherits("KActiveLabel"))
+ {
+ if (uncached( Background ))
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+
+ if ( w->inherits( "QTipLabel" ) )
+ {
+ polishLock = true;
+
+ TQColorGroup clrGroup( Qt::black, TQColor( 255, 255, 220 ),
+ TQColor( 96, 96, 96 ), Qt::black, Qt::black,
+ Qt::black, TQColor( 255, 255, 220 ) );
+ TQPalette toolTip ( clrGroup, clrGroup, clrGroup );
+
+ TQToolTip::setPalette( toolTip );
+ polishLock = false;
+ }
+
+ if ( w->inherits( "KonqIconViewWidget" ) ) //Konqueror background hack/workaround
+ {
+ w->setPalette( oldPalette );
+ return ;
+ }
+
+ if ( ::tqqt_cast<TQMenuBar*>(w) )
+ {
+ w->setBackgroundMode( TQWidget::NoBackground );
+ }
+ else if ( w->inherits( "TDEToolBarSeparator" ) || w->inherits( "QToolBarSeparator" ) )
+ {
+ w->setBackgroundMode( TQWidget::PaletteBackground );
+ }
+ else if ( ::tqqt_cast<TQPopupMenu*>(w) )
+ {
+ popupPalette = w->palette();
+ if ( isColor( MenuItem ) || isColor( MenuItemDown ) )
+ {
+ TQPalette newPal( w->palette() );
+ if ( isColor( MenuItem ) )
+ {
+ newPal.setActive( *colorGroup( newPal.active(), MenuItem ) );
+ newPal.setDisabled( *colorGroup( newPal.active(), MenuItem ) );
+ }
+ if ( isColor( MenuItemDown ) )
+ {
+ newPal.setActive( *colorGroup( newPal.active(), MenuItemDown ) );
+ }
+ w->setPalette( newPal );
+ }
+
+ w->setBackgroundMode( TQWidget::NoBackground );
+ }
+ else if ( ::tqqt_cast<TQCheckBox*>(w) )
+ {
+ if ( isColor( IndicatorOff ) || isColor( IndicatorOn ) )
+ {
+ TQPalette newPal( w->palette() );
+ if ( isColor( IndicatorOff ) )
+ {
+ newPal.setActive( *colorGroup( newPal.active(), IndicatorOff ) );
+ newPal.setDisabled( *colorGroup( newPal.active(), IndicatorOff ) );
+ }
+ if ( isColor( IndicatorOn ) )
+ newPal.setActive( *colorGroup( newPal.active(), IndicatorOn ) );
+ w->setPalette( newPal );
+ }
+ }
+ else if ( ::tqqt_cast<TQRadioButton*>(w) )
+ {
+ if ( isColor( ExIndicatorOff ) || isColor( ExIndicatorOn ) )
+ {
+ TQPalette newPal( w->palette() );
+ if ( isColor( ExIndicatorOff ) )
+ {
+ newPal.setActive( *colorGroup( newPal.active(), ExIndicatorOff ) );
+ newPal.setDisabled( *colorGroup( newPal.active(),
+ ExIndicatorOff ) );
+ }
+ if ( isColor( ExIndicatorOn ) )
+ newPal.setActive( *colorGroup( newPal.active(), ExIndicatorOn ) );
+ w->setPalette( newPal );
+ }
+ }
+ }
+
+ TDEStyle::polish( ceData, elementFlags, ptr );
+}
+
+void KThemeStyle::unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr )
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *w = reinterpret_cast<TQWidget*>(ptr);
+
+ if (w->backgroundPixmap() && !w->isTopLevel())
+ {
+ //The brushHandle check verifies that the bg pixmap is actually the brush..
+ if (!brushHandleSet || brushHandle ==w->backgroundPixmap()->handle())
+ {
+ w->setBackgroundOrigin( TQWidget::WidgetOrigin );
+ }
+ }
+
+ //Toolbar labels should nornally be PaletteButton
+ if ( ::tqqt_cast<TQLabel*>(w) && !qstrcmp(w->name(), "kde toolbar widget"))
+ w->setBackgroundMode( TQWidget::PaletteButton );
+
+ //The same for menu bars, popup menus
+ else if ( ::tqqt_cast<TQMenuBar*>(w) || ::tqqt_cast<TQPopupMenu*>(w) )
+ w->setBackgroundMode( TQWidget::PaletteButton );
+
+ //For toolbar internal separators, return to button, too (can't use tqqt_cast here since don't have access to the class)
+ else if ( w->inherits( "TDEToolBarSeparator" ) || w->inherits( "QToolBarSeparator" ) )
+ w->setBackgroundMode( TQWidget::PaletteButton );
+
+ //For scrollbars, we don't do much, since the widget queries the style on the switch
+
+ //Drop some custom palettes. ### this really should check the serial number to be 100% correct.
+ if ( ::tqqt_cast<TQPopupMenu*>(w) || ::tqqt_cast<TQCheckBox*>(w) || ::tqqt_cast<TQRadioButton*>(w) || ::tqqt_cast<TQStatusBar*>(w) )
+ w->unsetPalette();
+ }
+
+ TDEStyle::unPolish( ceData, elementFlags, ptr );
+}
+
+
+void KThemeStyle::drawBaseButton( TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, bool sunken, bool
+ rounded, WidgetType type ) const
+{
+ int offset = borderPixmap( type ) ? 0 : decoWidth( type ) ; //##### This is wrong, but the code relies on it..
+ TQPen oldPen = p->pen();
+
+ // handle reverse bevel here since it uses decowidth differently
+ if ( gradientHint( type ) == GrReverseBevel )
+ {
+ int i;
+ bitBlt( p->device(), x, y, TQT_TQPAINTDEVICE(scalePixmap( w, h, type )), 0, 0, w, h,
+ TQt::CopyROP, true );
+ p->setPen( g.text() );
+ for ( i = 0; i < borderWidth( type ); ++i, ++x, ++y, w -= 2, h -= 2 )
+ p->drawRect( x, y, w, h );
+ }
+ // same with KDE style borders
+ else if ( !borderPixmap( type ) && shade() == KDE )
+ {
+ kDrawBeButton( p, x, y, w, h, g, sunken );
+ if ( isPixmap( type ) )
+ p->drawTiledPixmap( x + 4, y + 4, w - 6, h - 6,
+ *scalePixmap( w - 6, h - 6,
+ type ) );
+ else
+ p->fillRect( x + 4, y + 4, w - 6, h - offset * 6,
+ g.brush( TQColorGroup::Button ) );
+
+ }
+ else
+ {
+ if ( ( w - offset * 2 ) > 0 && ( h - offset * 2 ) > 0 )
+ {
+ if ( isPixmap( type ) )
+ if ( rounded )
+ p->drawTiledPixmap( x, y, w, h, *scalePixmap( w, h, type ) );
+ else
+ p->drawTiledPixmap( x + offset, y + offset, w - offset * 2,
+ h - offset * 2,
+ *scalePixmap( w - offset * 2, h - offset * 2,
+ type ) );
+ else if ( 1 ) //##### TODO - Get this optimization working... !borderPixmap( type ) || (( w - decoWidth(type) * 2 ) > 0 && ( h - decoWidth(type) * 2 ) > 0) )
+ //Sometimes border covers the whole thing - in that case, avoid drawing the base.
+ {
+ p->fillRect( x + offset, y + offset, w - offset * 2, h - offset * 2,
+ g.brush( TQColorGroup::Button ) );
+ }
+ }
+ if ( borderPixmap( type ) )
+ {
+ bitBlt( p->device(), x, y, TQT_TQPAINTDEVICE(scaleBorder( w, h, type )), 0, 0, w, h,
+ TQt::CopyROP, false );
+ }
+ else
+ drawShade( p, x, y, w, h, g, sunken, rounded,
+ highlightWidth( type ), borderWidth( type ), shade() );
+ }
+ p->setPen( oldPen );
+}
+
+void KThemeStyle::drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & g_base,
+ SFlags flags, const TQStyleOption & opt ) const
+{
+ bool handled = false;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ bool sunken = ( flags & Style_Sunken );
+ bool enabled = ( flags & Style_Enabled );
+ bool down = ( flags & Style_Down );
+ bool on = flags & Style_On;
+ bool active = flags & Style_Active;
+ TQColorGroup g = g_base;
+
+ switch ( pe )
+ {
+ case PE_ArrowUp:
+ case PE_ArrowDown:
+ case PE_ArrowRight:
+ case PE_ArrowLeft:
+ {
+ TQRect r( x, y, w, h );
+ if ( r.width() > 12 )
+ {
+ r.setRect( r.x() + ( r.width() - 12 ) / 2, r.y(), 12, r.height() );
+ }
+ if ( r.height() > 12 )
+ {
+ r.setRect( r.x(), r.y() + ( r.height() - 12 ) / 2, r.width(), 12 );
+ }
+ r.rect( &x, &y, &w, &h );
+ // Handles pixmapped arrows. A little inefficient because you can specify
+ // some as pixmaps and some as default types.
+ WidgetType widget;
+ switch ( pe )
+ {
+ case PE_ArrowUp:
+ widget = enabled ? down ? SunkenArrowUp : ArrowUp : DisArrowUp;
+ break;
+ case PE_ArrowDown:
+ widget = enabled ? down ? SunkenArrowDown : ArrowDown : DisArrowDown;
+ break;
+ case PE_ArrowLeft:
+ widget = enabled ? down ? SunkenArrowLeft : ArrowLeft : DisArrowLeft;
+ break;
+ case PE_ArrowRight:
+ default:
+ widget = enabled ? down ? SunkenArrowRight : ArrowRight : DisArrowRight;
+ break;
+ }
+ if ( isPixmap( widget ) )
+ {
+ bitBlt( p->device(), x + ( w - uncached( widget ) ->width() ) / 2,
+ y + ( h - uncached( widget ) ->height() ) / 2,
+ uncached( widget ) );
+
+ return ;
+ }
+ const TQColorGroup *cg = colorGroup( g, widget );
+ // Standard arrow types
+ if ( arrowType() == MotifArrow )
+ {
+ mtfstyle->drawPrimitive( pe, p, ceData, elementFlags, r, g, flags, opt );
+
+ handled = true;
+ }
+ else if ( arrowType() == SmallArrow )
+ {
+ // #### FIXME: This should be like the Platinum style - uses HighColor look for now
+ TQPointArray a;
+
+ switch ( pe )
+ {
+ case PE_ArrowUp:
+ a.setPoints( TQCOORDARRLEN( u_arrow ), u_arrow );
+ break;
+
+ case PE_ArrowDown:
+ a.setPoints( TQCOORDARRLEN( d_arrow ), d_arrow );
+ break;
+
+ case PE_ArrowLeft:
+ a.setPoints( TQCOORDARRLEN( l_arrow ), l_arrow );
+ break;
+
+ default:
+ a.setPoints( TQCOORDARRLEN( r_arrow ), r_arrow );
+ }
+
+ p->save();
+
+ if ( flags & Style_Down )
+ p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
+ pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
+
+ if ( flags & Style_Enabled )
+ {
+ a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
+ p->setPen( cg->buttonText() );
+ p->drawLineSegments( a );
+ }
+ else
+ {
+ a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 );
+ p->setPen( cg->mid() );
+ p->drawLineSegments( a );
+ }
+ p->restore();
+ }
+ else
+ {
+ TQPointArray a;
+ int x2 = x + w - 1, y2 = y + h - 1;
+ switch ( pe )
+ {
+ case PE_ArrowUp:
+ a.setPoints( 4, x, y2, x2, y2, x + w / 2, y, x, y2 );
+ break;
+ case PE_ArrowDown:
+ a.setPoints( 4, x, y, x2, y, x + w / 2, y2, x, y );
+ break;
+ case PE_ArrowLeft:
+ a.setPoints( 4, x2, y, x2, y2, x, y + h / 2, x2, y );
+ break;
+ default:
+ a.setPoints( 4, x, y, x, y2, x2, y + h / 2, x, y );
+ break;
+ }
+ TQBrush oldBrush = p->brush();
+ TQPen oldPen = p->pen();
+ p->setBrush( cg->brush( TQColorGroup::Shadow ) );
+ p->setPen( cg->shadow() );
+ p->drawPolygon( a );
+ p->setBrush( oldBrush );
+ p->setPen( oldPen );
+ handled = true;
+ }
+ break;
+
+ }
+ case PE_HeaderSectionMenu:
+ case PE_HeaderSection:
+ {
+ sunken = false; //Never mind this one
+ }
+ case PE_ButtonBevel:
+ {
+ WidgetType type = ( sunken || on || down ) ? BevelDown : Bevel;
+ drawBaseButton( p, x, y, w, h, *colorGroup( g, type ), ( sunken || on || down ), false, type );
+ handled = true;
+ break;
+ }
+ case PE_ButtonCommand:
+ {
+ drawBaseButton( p, x, y, w, h, g, ( sunken || on || down ), roundButton(), ( sunken || on || down ) ?
+ PushButtonDown : PushButton );
+ handled = true;
+ break;
+ }
+ case PE_PanelDockWindow:
+ {
+ drawBaseButton( p, x, y, w, h, *colorGroup( g, ToolBar ), false, false,
+ ToolBar );
+ handled = true;
+ break;
+ }
+ case PE_CheckMark:
+ {
+ if ( isPixmap( CheckMark ) )
+ {
+ if ( flags & Style_Enabled || flags & Style_On )
+ bitBlt( p->device(), x + ( w - uncached( CheckMark ) ->width() ) / 2,
+ y + ( h - uncached( CheckMark ) ->height() ) / 2,
+ uncached( CheckMark ) );
+ handled = true;
+ }
+ else //Small hack to ensure the checkmark gets painter proper color..
+ {
+ g.setColor( TQColorGroup::Text, g.buttonText() );
+ }
+ break;
+ }
+ case PE_ExclusiveIndicator:
+ {
+ if ( isPixmap( ( flags & Style_On || flags & Style_Down ) ? ExIndicatorOn : ExIndicatorOff ) )
+ {
+ p->drawPixmap( x, y, *uncached( ( flags & Style_On || flags & Style_Down ) ? ExIndicatorOn :
+ ExIndicatorOff ) );
+ handled = true;
+ }
+
+ break;
+ }
+ case PE_ExclusiveIndicatorMask:
+ {
+ if ( isPixmap( ( flags & Style_On || flags & Style_Down ) ? ExIndicatorOn : ExIndicatorOff ) )
+ {
+ const TQBitmap * mask = uncached( ( flags & Style_On || flags & Style_Down ) ? ExIndicatorOn : ExIndicatorOff ) ->mask();
+ if ( mask )
+ {
+ p->setPen( Qt::color1 );
+ p->drawPixmap( x, y, *mask );
+ }
+ else
+ p->fillRect( x, y, w, h, TQBrush( color1, SolidPattern ) );
+ handled = true;
+ }
+ break;
+ }
+
+ case PE_IndicatorMask:
+ {
+ if ( isPixmap( ( flags & Style_On ) ? IndicatorOn : IndicatorOff ) )
+ {
+ const TQBitmap * mask = uncached( ( flags & Style_On ) ? IndicatorOn :
+ IndicatorOff ) ->mask();
+ if ( mask )
+ {
+ p->setPen( Qt::color1 );
+ p->drawPixmap( x, y, *mask );
+ }
+ else
+ p->fillRect( x, y, w, h, TQBrush( color1, SolidPattern ) );
+ handled = true;
+ }
+ break;
+ }
+ case PE_Indicator:
+ {
+ if ( isPixmap( ( flags & Style_On || flags & Style_Down ) ?
+ IndicatorOn : IndicatorOff ) )
+ {
+ p->drawPixmap( x, y, *uncached( ( flags & Style_On || flags & Style_Down ) ?
+ IndicatorOn : IndicatorOff ) );
+ handled = true;
+ }
+ break;
+ }
+ case PE_Splitter:
+ {
+ drawBaseButton( p, x, y, w, h, *colorGroup( g, Splitter ), false, false,
+ Splitter );
+ handled = true;
+ break;
+ }
+ case PE_FocusRect:
+ {
+ if ( is3DFocus() )
+ {
+ p->setPen( g.dark() );
+ int i = focusOffset();
+ p->drawLine( r.x() + i, r.y() + 1 + i, r.x() + i, r.bottom() - 1 - i );
+ p->drawLine( r.x() + 1 + i, r.y() + i, r.right() - 1 - i, r.y() + i );
+ p->setPen( g.light() );
+ p->drawLine( r.right() - i, r.y() + 1 + i, r.right() - i, r.bottom() - 1 - i );
+ p->drawLine( r.x() + 1 + i, r.bottom() - i, r.right() - 1 - i, r.bottom() - i );
+ handled = true;
+ }
+ else
+ {
+ handled = true;
+ p->drawWinFocusRect(r);
+ }
+ break;
+ }
+ case PE_PanelMenuBar:
+ {
+ TQPixmap* cache = makeMenuBarCache(w, h);
+ p->drawPixmap( x, y, *cache);
+ handled = true;
+ break;
+ }
+ case PE_ScrollBarAddPage:
+ case PE_ScrollBarSubPage:
+ {
+ WidgetType widget = ( flags & Style_Horizontal ) ? HScrollGroove : VScrollGroove;
+
+ if ( !isPixmap( widget ) )
+ {
+ p->fillRect( r, colorGroup( g, widget ) ->brush( TQColorGroup::Background ) );
+ // Do the borders and frame
+ drawShade( p, r.x(), r.y(), r.width(),
+ r.height(), *colorGroup( g, widget ), true, false,
+ highlightWidth( widget ), borderWidth( widget ), shade() );
+ }
+ else
+ {
+ // If the groove is pixmapped we make a full-sized image (it gets
+ // cached) then bitBlt it to the appropriate rect.
+ p->drawTiledPixmap( r.x(), r.y(), r.width(), r.height(),
+ *scalePixmap( r.width(), r.height(),
+ widget ) );
+ drawShade( p, r.x(), r.y(), r.width(),
+ r.height(), *colorGroup( g, widget ), true, false,
+ highlightWidth( widget ), borderWidth( widget ), shade() );
+ }
+
+ handled = true;
+ break;
+ }
+ case PE_ScrollBarAddLine:
+ {
+ bool horizontal = ( flags & Style_Horizontal );
+ drawBaseButton( p, r.x(), r.y(), r.width(), r.height(),
+ *colorGroup( g, down ? ScrollButtonDown : ScrollButton ),
+ down, false, down ? ScrollButtonDown : ScrollButton );
+
+ drawPrimitive( ( horizontal ) ? PE_ArrowRight : PE_ArrowDown, p, ceData, elementFlags ,
+ TQRect( r.x() + 3, r.y() + 3, r.width() - 6, r.height() - 6 ),
+ *colorGroup( g, down ? ScrollButtonDown : ScrollButton ),
+ flags );
+
+ handled = true;
+ break;
+ }
+ case PE_ScrollBarSubLine:
+ {
+ bool horizontal = ( flags & Style_Horizontal );
+ drawBaseButton( p, r.x(), r.y(), r.width(), r.height(),
+ *colorGroup( g, down ? ScrollButtonDown : ScrollButton ),
+ down, false, down ? ScrollButtonDown : ScrollButton );
+
+ drawPrimitive( ( horizontal ) ? PE_ArrowLeft : PE_ArrowUp, p, ceData, elementFlags ,
+ TQRect( r.x() + 3, r.y() + 3, r.width() - 6, r.height() - 6 ),
+ *colorGroup( g, down ? ScrollButtonDown : ScrollButton ),
+ flags );
+ handled = true;
+ break;
+ }
+ case PE_ScrollBarSlider:
+ {
+ bool active = ( flags & Style_Active ) || ( flags & Style_Down ); //activeControl == TQStyle::AddLine;
+ bool horizontal = ( flags & Style_Horizontal );
+ int offsetH = horizontal ? 0: decoWidth(VScrollGroove) ;
+ int offsetV = horizontal ? decoWidth(HScrollGroove):0;
+
+ WidgetType widget = horizontal ?
+ active ? HScrollBarSliderDown : HScrollBarSlider :
+ active ? VScrollBarSliderDown : VScrollBarSlider;
+ drawBaseButton( p, r.x()+offsetH, r.y()+offsetV, r.width()-2*offsetH,
+ r.height()-2*offsetV, *colorGroup( g, widget ), active, false,
+ widget );
+
+ int spaceW = horizontal ? r.width() - decoWidth( widget ) - 4 :
+ r.width();
+ int spaceH = horizontal ? r.height() :
+ r.height() - decoWidth( widget ) - 4;
+
+ widget = active ? horizontal ? HScrollDecoDown : VScrollDecoDown :
+ horizontal ? HScrollDeco : VScrollDeco;
+ if ( isPixmap( widget ) )
+ {
+ if ( spaceW >= uncached( widget ) ->width() &&
+ spaceH >= uncached( widget ) ->height() )
+ {
+ bitBlt( p->device(),
+ r.x() + ( r.width() - uncached( widget ) ->width() ) / 2,
+ r.y() + ( r.height() - uncached( widget ) ->height() ) / 2,
+ uncached( widget ) );
+ }
+ }
+ handled = true;
+ break;
+
+ }
+
+ case PE_MenuItemIndicatorFrame:
+ {
+ // Draw nothing
+ break;
+ }
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ bool reverse = TQApplication::reverseLayout();
+
+ int cx = reverse ? x + w - checkcol : x;
+ TQRect cr = visualRect( TQRect( x, y, checkcol, h ), r );
+ const TQColorGroup& cg_ours = *colorGroup( g_base, active ? MenuItemDown : MenuItem );
+ drawBaseButton( p, cr.x(), cr.y(), cr.width(), cr.height(), *colorGroup( cg_ours, BevelDown ), true, false, BevelDown );
+ break;
+ }
+ case PE_MenuItemIndicatorCheck:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ bool reverse = TQApplication::reverseLayout();
+
+ int cx = reverse ? x + w - checkcol : x;
+ TQRect cr = visualRect( TQRect( x, y, checkcol, h ), r );
+ const TQColorGroup& cg_ours = *colorGroup( g_base, active ? MenuItemDown : MenuItem );
+
+ SFlags cflags = Style_Default;
+ cflags |= active ? Style_Enabled : Style_On;
+
+ drawPrimitive( PE_CheckMark, p, ceData, elementFlags, TQRect( x + itemFrame, y + itemFrame, checkcol - itemFrame * 2, h - itemFrame * 2 ), cg_ours, cflags );
+ break;
+ }
+ default:
+ handled = false;
+ }
+
+ if ( !handled )
+ KThemeBase::drawPrimitive ( pe, p, ceData, elementFlags, r, g,
+ flags, opt );
+}
+
+
+
+TQPixmap* KThemeStyle::makeMenuBarCache(int w, int h) const
+{
+ if (menuCache)
+ {
+ if (menuCache->width() != w || menuCache->height() != h )
+ {
+ delete menuCache;
+ }
+ else
+ return menuCache;
+ }
+
+ const TQColorGroup *g = colorGroup( TQApplication::palette().active(), MenuBar);
+
+ menuCache = new TQPixmap ( w, h );
+ TQPainter p(menuCache);
+ drawBaseButton( &p, 0, 0, w, h, *g, false, false, MenuBar );
+ p.end();
+ return menuCache;
+}
+
+
+void KThemeStyle::drawControl( ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags how ,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ bool handled = false;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+
+ switch ( element )
+ {
+ case CE_PushButton:
+ {
+ const TQPushButton * btn = ( const TQPushButton* ) widget;
+ bool sunken = btn->isOn() || btn->isDown();
+ int diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, btn );
+ drawBaseButton( p, diw, diw, w - 2 * diw, h - 2 * diw,
+ *colorGroup( btn->colorGroup(), sunken ? PushButtonDown :
+ PushButton ), sunken, roundButton(),
+ sunken ? PushButtonDown : PushButton );
+ // TODO if diw, draw fancy default button indicator
+ handled = true;
+ break;
+ }
+ case CE_PushButtonLabel:
+ {
+ const TQPushButton* button = ( const TQPushButton* ) widget;
+ bool active = button->isOn() || button->isDown();
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ // Shift button contents if pushed.
+ if ( active )
+ {
+ x += pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags, widget );
+ y += pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags, widget );
+ how |= Style_Sunken;
+ }
+
+ // Does the button have a popup menu?
+ if ( button->isMenuButton() )
+ {
+ int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
+ drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect( x + w - dx - 2, y + 2, dx, h - 4 ),
+ cg, how, opt );
+ w -= dx;
+ }
+
+ // Draw the icon if there is one
+ if ( button->iconSet() && !button->iconSet() ->isNull() )
+ {
+ TQIconSet::Mode mode = TQIconSet::Disabled;
+ TQIconSet::State state = TQIconSet::Off;
+
+ if ( button->isEnabled() )
+ mode = button->hasFocus() ? TQIconSet::Active : TQIconSet::Normal;
+ if ( button->isToggleButton() && button->isOn() )
+ state = TQIconSet::On;
+
+ TQPixmap pixmap = button->iconSet() ->pixmap( TQIconSet::Small, mode, state );
+
+ // Center the iconset if there's no text or pixmap
+ if (button->text().isEmpty() && !button->pixmap())
+ p->drawPixmap( x + (w - pixmap.width()) / 2,
+ y + (h - pixmap.height()) / 2, pixmap );
+ else
+ p->drawPixmap( x + 4, y + (h - pixmap.height()) / 2, pixmap );
+
+ int pw = pixmap.width();
+ x += pw + 4;
+ w -= pw + 4;
+ }
+
+ // Make the label indicate if the button is a default button or not
+ if ( active || button->isDefault() && button->isEnabled() )
+ {
+ // Draw "fake" bold text - this enables the font metrics to remain
+ // the same as computed in TQPushButton::sizeHint(), but gives
+ // a reasonable bold effect.
+ int i;
+
+ // Text shadow
+ for ( i = 0; i < 2; i++ )
+ drawItem( p, TQRect( x + i + 1, y + 1, w, h ), AlignCenter | ShowPrefix,
+ button->colorGroup(), button->isEnabled(), NULL,
+ button->text(), -1,
+ active ? &button->colorGroup().dark() : &button->colorGroup().mid() );
+
+ // Normal Text
+ for ( i = 0; i < 2; i++ )
+ drawItem( p, TQRect( x + i, y, w, h ), AlignCenter | ShowPrefix,
+ button->colorGroup(), true, i == 0 ? button->pixmap() : NULL,
+ button->text(), -1,
+ active ? &button->colorGroup().light() : &button->colorGroup().buttonText() );
+ }
+ else
+ {
+ if ( button->isEnabled() )
+ {
+ drawItem( p, TQRect( x, y, w, h ), AlignCenter | ShowPrefix, button->colorGroup(),
+ true, button->pixmap(), button->text(), -1,
+ active ? &button->colorGroup().light() : &button->colorGroup().buttonText() );
+ }
+ else
+ {
+ //TODO: Handle reversed
+ drawItem( p, TQRect( x + 1, y + 1, w, h ), AlignCenter | ShowPrefix, button->colorGroup(),
+ true, button->pixmap(), button->text(), -1,
+ &button->colorGroup().light() );
+
+ drawItem( p, TQRect( x, y, w, h ), AlignCenter | ShowPrefix, button->colorGroup(),
+ true, button->pixmap(), button->text(), -1,
+ &button->colorGroup().buttonText() );
+ }
+ }
+
+ // Draw a focus rect if the button has focus
+ if ( how & Style_HasFocus )
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
+ TQStyle::visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ),
+ cg, how );
+ handled = true;
+ break;
+ }
+
+ case CE_MenuBarEmptyArea:
+ {
+ //Expand to cover entire region
+ drawPrimitive(PE_PanelMenuBar, p, ceData, elementFlags,
+ TQRect(0,0,r.width()+r.x()*2, r.height()+r.y()*2),
+ cg, Style_Default);
+ handled = true;
+ break;
+ }
+
+ case CE_TabBarTab:
+ {
+ TQTabBar::Shape tbs = ceData.tabBarData.shape;
+ bool selected = how & Style_Selected;
+ WidgetType widget = selected ? ActiveTab : InactiveTab;
+ const TQColorGroup *cg = colorGroup( ceData.colorGroup, widget );
+ int i;
+ int x2 = x + w - 1, y2 = y + h - 1;
+ int bWidth = borderWidth( widget );
+ int hWidth = highlightWidth( widget );
+ handled = true;
+ if ( tbs == TQTabBar::RoundedAbove || tbs == TQTabBar::TriangularAbove )
+ {
+ if ( !selected )
+ {
+ p->fillRect( x, y, x2 - x + 1, 2,
+ ceData.palette.active().brush( TQColorGroup::Background ) );
+ y += 2;
+ }
+ p->setPen( cg->text() );
+ i = 0;
+ if ( i < bWidth )
+ {
+ p->drawLine( x, y + 1, x, y2 );
+ p->drawLine( x2, y + 1, x2, y2 );
+ p->drawLine( x + 1, y, x2 - 1, y );
+ if ( selected ? activeTabLine() : inactiveTabLine() )
+ {
+ p->drawLine( x, y2, x2, y2 );
+ --y2;
+ }
+ ++i, ++x, ++y, --x2;
+ }
+ for ( ; i < bWidth; ++i, ++x, ++y, --x2 )
+ {
+ p->drawLine( x, y, x, y2 );
+ p->drawLine( x2, y, x2, y2 );
+ p->drawLine( x, y, x2, y );
+ if ( selected ? activeTabLine() : inactiveTabLine() )
+ {
+ p->drawLine( x, y2, x2, y2 );
+ --y2;
+ }
+ }
+ i = 0;
+ if ( i < hWidth && bWidth == 0 )
+ {
+ p->setPen( cg->light() );
+ p->drawLine( x, y + 1, x, y2 );
+ p->drawLine( x + 1, y, x2 - 1, y );
+ p->setPen( cg->dark() );
+ p->drawLine( x2, y + 1, x2, y2 );
+ if ( selected ? activeTabLine() : inactiveTabLine() )
+ {
+ p->drawLine( x, y2, x2, y2 );
+ --y2;
+ }
+ ++i, ++x, ++y, --x2;
+ }
+ for ( ; i < hWidth; ++i, ++x, ++y, --x2 )
+ {
+ p->setPen( cg->light() );
+ p->drawLine( x, y, x, y2 );
+ p->drawLine( x, y, x2, y );
+ p->setPen( cg->dark() );
+ p->drawLine( x2, y + 1, x2, y2 );
+ if ( selected ? activeTabLine() : inactiveTabLine() )
+ {
+ p->drawLine( x, y2, x2, y2 );
+ --y2;
+ }
+ }
+ if ( isPixmap( widget ) )
+ p->drawTiledPixmap( x, y, x2 - x + 1, y2 - y + 1,
+ *scalePixmap( x2 - x + 1, y2 - y + 1, widget ) );
+ else
+ p->fillRect( x, y, x2 - x + 1, y2 - y + 1, cg->background() );
+ }
+ else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ||
+ ceData.tabBarData.shape == TQTabBar::TriangularBelow )
+ {
+ if ( widget == ActiveTab )
+ widget = RotActiveTab;
+ else
+ widget = RotInactiveTab;
+
+ if ( !selected )
+ {
+ p->fillRect( x, y2 - 2, x2 - x + 1, 2,
+ ceData.palette.active().brush( TQColorGroup::Background ) );
+ y2 -= 2;
+ }
+ p->setPen( cg->text() );
+ i = 0;
+ if ( i < bWidth )
+ {
+ p->drawLine( x, y, x, y2 - 1 );
+ p->drawLine( x2, y, x2, y2 - 1 );
+ p->drawLine( x + 1, y2, x2 - 1, y2 );
+ if ( selected ? activeTabLine() : inactiveTabLine() )
+ {
+ p->drawLine( x, y, x2, y );
+ ++y;
+ }
+ }
+ for ( ; i < bWidth; ++i, ++x, --x2, --y2 )
+ {
+ p->drawLine( x, y, x, y2 );
+ p->drawLine( x2, y, x2, y2 );
+ p->drawLine( x, y2, x2, y2 );
+ if ( selected ? activeTabLine() : inactiveTabLine() )
+ {
+ p->drawLine( x, y, x2, y );
+ ++y;
+ }
+ }
+ i = 0;
+ if ( i < hWidth && bWidth == 0 )
+ {
+ p->setPen( cg->dark() );
+ p->drawLine( x + 1, y2, x2 - 1, y2 );
+ p->drawLine( x2, y, x2, y2 - 1 );
+ p->setPen( cg->light() );
+ p->drawLine( x, y, x, y2 - 1 );
+ if ( selected ? activeTabLine() : inactiveTabLine() )
+ {
+ p->drawLine( x, y, x2, y );
+ ++y;
+ }
+ ++i, ++x, --x2, --y2;
+ }
+ for ( ; i < hWidth; ++i, ++x, --x2, --y2 )
+ {
+ p->setPen( cg->dark() );
+ p->drawLine( x, y2, x2, y2 );
+ p->drawLine( x2, y, x2, y2 );
+ p->setPen( cg->light() );
+ p->drawLine( x, y, x, y2 );
+ if ( selected ? activeTabLine() : inactiveTabLine() )
+ {
+ p->drawLine( x, y, x2, y );
+ ++y;
+ }
+ }
+ if ( isPixmap( widget ) )
+ p->drawTiledPixmap( x, y, x2 - x + 1, y2 - y + 1,
+ *scalePixmap( x2 - x + 1, y2 - y + 1, widget ) );
+ else
+ p->fillRect( x, y, x2 - x + 1, y2 - y + 1, cg->background() );
+ }
+ break;
+ }
+ case CE_MenuBarItem:
+ {
+
+ r.rect( &x, &y, &w, &h );
+ TQMenuItem *mi = opt.menuItem();
+ TQMenuBar *mb = ( TQMenuBar* ) widget;
+ TQRect pr = mb->rect();
+ bool active = how & Style_Active;
+ //bool focused = how & Style_HasFocus;
+ const TQColorGroup *g = colorGroup( cg, active ? MenuBarItem : MenuBar );
+ TQColor btext = g->buttonText();
+
+ TQPixmap* cache = makeMenuBarCache(pr.width(), pr.height());
+
+ TQPixmap buf( w, pr.height() );
+
+ bitBlt(&buf, 0, 0, cache, x, y, w, pr.height());
+ TQPainter p2( &buf );
+
+ if ( active )
+ {
+ drawBaseButton( &p2, 0, 0, w, h, *g, false, false, MenuBarItem );
+ }
+
+ p2.end();
+ p->drawPixmap( x, y, buf, 0, 0, w, h );
+
+ drawItem( p, TQRect(x,y,w,h), AlignCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine,
+ *g, mi->isEnabled(), mi->pixmap(), mi->text(),
+ -1, &btext );
+ handled = true;
+ break;
+ }
+ case CE_PopupMenuItem:
+ {
+ bool separator = false;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ TQMenuItem *mi = opt.menuItem();
+ if ( mi )
+ {
+ separator = mi->isSeparator();
+ }
+
+ int tab = opt.tabWidth();
+ int checkcol = opt.maxIconWidth();
+ bool enabled = (mi? mi->isEnabled():true);
+ bool checkable = (elementFlags & CEF_IsCheckable);
+ bool active = how & Style_Active;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags, TQStyleOption::Default, 0, 0 );
+ bool reverse = TQApplication::reverseLayout();
+
+ const TQColorGroup& cg_ours = *colorGroup( cg, active ? MenuItemDown : MenuItem );
+ //TQColor btext = cg_ours.buttonText();
+
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ // Are we a menu item separator?
+ if ( separator )
+ {
+ p->setPen( cg_ours.dark() );
+ p->drawLine( x, y, x + w, y );
+ p->setPen( cg_ours.light() );
+ p->drawLine( x, y + 1, x + w, y + 1 );
+ break;
+ }
+
+ // Draw the menu item background
+ if ( active )
+ drawBaseButton( p, x, y, w, h, cg_ours, true, false, MenuItemDown );
+ else
+ {
+ drawShade( p, x, y, w, h, *colorGroup( cg_ours, MenuItem ), false, false,
+ highlightWidth( MenuItem ), borderWidth( MenuItem ),
+ shade() );
+ int dw = decoWidth( MenuItem );
+ if ( !isPixmap( MenuItem ) )
+ {
+ p->fillRect(
+ x + dw, y + dw, w - dw * 2, h - dw * 2,
+ cg_ours.brush( TQColorGroup::Background ) );
+ //cg.brush( TQColorGroup::Background ));
+ //colorGroup( cg_ours, MenuItem ) ->brush( TQColorGroup::Background ) );
+ }
+ else
+ {
+ // process inactive item pixmaps as one large item
+ p->drawTiledPixmap( x + dw, y + dw, w - dw * 2, h - dw * 2, *scalePixmap
+ ( w, p->window().height(), MenuItem ),
+ x, y );
+ }
+ }
+
+ if (!mi)
+ break;
+
+ // Do we have an icon?
+ if ( mi->iconSet() )
+ {
+ TQIconSet::Mode mode;
+ TQRect cr = visualRect( TQRect( x, y, checkcol, h ), r );
+
+ // Select the correct icon from the iconset
+ if ( active )
+ mode = enabled ? TQIconSet::Active : TQIconSet::Disabled;
+ else
+ mode = enabled ? TQIconSet::Normal : TQIconSet::Disabled;
+
+ // Do we have an icon and are checked at the same time?
+ // Then draw a "pressed" background behind the icon
+ if ( checkable && mi->isChecked() ) //!active && -- ??
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, how, opt);
+
+ // Draw the icon
+ TQPixmap pixmap = mi->iconSet() ->pixmap( TQIconSet::Small, mode );
+ int pixw = pixmap.width();
+ int pixh = pixmap.height();
+ TQRect pmr( 0, 0, pixw, pixh );
+ pmr.moveCenter( cr.center() );
+ p->setPen( cg_ours.highlightedText() );
+ p->drawPixmap( pmr.topLeft(), pixmap );
+ }
+
+ // Are we checked? (This time without an icon)
+ else if ( checkable && mi->isChecked() )
+ {
+ // We only have to draw the background if the menu item is inactive -
+ // if it's active the "pressed" background is already drawn
+ //if ( ! active )
+ // qDrawShadePanel( p, cx, y, checkcol, h, cg_ours, true, 1,
+ // &cg_ours.brush(TQColorGroup::Midlight) );
+
+ // Draw the checkmark
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, how, opt);
+ }
+
+ // Time to draw the menu item label...
+ int xm = itemFrame + checkcol + itemHMargin; // X position margin
+
+ int xp = reverse ? // X position
+ x + tab + rightBorder + itemHMargin + itemFrame - 1 :
+ x + xm;
+
+ int offset = reverse ? -1 : 1; // Shadow offset for etched text
+
+ // Label width (minus the width of the accelerator portion)
+ int tw = w - xm - tab - arrowHMargin - itemHMargin * 3 - itemFrame + 1;
+
+ // Set the color for enabled and disabled text
+ // (used for both active and inactive menu items)
+ p->setPen( enabled ? cg_ours.buttonText() : cg_ours.mid() );
+
+ // This color will be used instead of the above if the menu item
+ // is active and disabled at the same time. (etched text)
+ TQColor discol = cg_ours.mid();
+
+ // Does the menu item draw it's own label?
+ if ( mi->custom() )
+ {
+ int m = itemVMargin;
+ // Save the painter state in case the custom
+ // paint method changes it in some way
+ p->save();
+
+ // Draw etched text if we're inactive and the menu item is disabled
+ if ( etchtext && !enabled && !active )
+ {
+ p->setPen( cg_ours.light() );
+ mi->custom() ->paint( p, cg_ours, active, enabled, xp + offset, y + m + 1, tw, h - 2 * m );
+ p->setPen( discol );
+ }
+ mi->custom() ->paint( p, cg_ours, active, enabled, xp, y + m, tw, h - 2 * m );
+ p->restore();
+ }
+ else
+ {
+ // The menu item doesn't draw it's own label
+ TQString s = mi->text();
+
+ // Does the menu item have a text label?
+ if ( !s.isNull() )
+ {
+ int t = s.find( '\t' );
+ int m = itemVMargin;
+ int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ text_flags |= reverse ? AlignRight : AlignLeft;
+
+ // Does the menu item have a tabstop? (for the accelerator text)
+ if ( t >= 0 )
+ {
+ int tabx = reverse ? x + rightBorder + itemHMargin + itemFrame :
+ x + w - tab - rightBorder - itemHMargin - itemFrame;
+
+
+ // Draw the right part of the label (accelerator text)
+ if ( etchtext && !enabled && !active )
+ {
+ // Draw etched text if we're inactive and the menu item is disabled
+ p->setPen( cg_ours.light() );
+ p->drawText( tabx + offset, y + m + 1, tab, h - 2 * m, text_flags, s.mid( t + 1 ) );
+ p->setPen( discol );
+ }
+ p->drawText( tabx, y + m, tab, h - 2 * m, text_flags, s.mid( t + 1 ) );
+ s = s.left( t );
+ }
+
+
+ // Draw the left part of the label (or the whole label
+ // if there's no accelerator)
+ if ( etchtext && !enabled && !active )
+ {
+ // Etched text again for inactive disabled menu items...
+ p->setPen( cg_ours.light() );
+ p->drawText( xp + offset, y + m + 1, tw, h - 2 * m, text_flags, s, t );
+ p->setPen( discol );
+ }
+
+ p->drawText( xp, y + m, tw, h - 2 * m, text_flags, s, t );
+
+ }
+
+ // The menu item doesn't have a text label
+ // Check if it has a pixmap instead
+ else if ( mi->pixmap() )
+ {
+ TQPixmap * pixmap = mi->pixmap();
+
+ // Draw the pixmap
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::OpaqueMode );
+
+ int diffw = ( ( w - pixmap->width() ) / 2 )
+ + ( ( w - pixmap->width() ) % 2 );
+ p->drawPixmap( x + diffw, y + itemFrame, *pixmap );
+
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::TransparentMode );
+ }
+ }
+
+ // Does the menu item have a submenu?
+ if ( mi->popup() )
+ {
+ PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
+ int dim = 10 - itemFrame; //We're not very useful to inherit off, so just hardcode..
+ TQRect vr = visualRect( TQRect( x + w - arrowHMargin - itemFrame - dim,
+ y + h / 2 - dim / 2, dim, dim ), r );
+
+ // Draw an arrow at the far end of the menu item
+ if ( active )
+ {
+ if ( enabled )
+ discol = cg_ours.buttonText();
+
+ TQColorGroup g2( discol, cg_ours.highlight(), white, white,
+ enabled ? white : discol, discol, white );
+
+ drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled | Style_Down );
+ }
+ else
+ drawPrimitive( arrow, p, ceData, elementFlags, vr, cg_ours,
+ enabled ? Style_Enabled : Style_Default );
+ }
+ handled = true;
+ break;
+ }
+ case CE_ProgressBarGroove:
+ {
+ TQBrush bg;
+ const TQColorGroup * cg2 = colorGroup( cg, ProgressBg );
+ qDrawWinPanel( p, r, *cg2, true );
+ bg.setColor( cg2->color( TQColorGroup::Background ) );
+ if ( isPixmap( ProgressBg ) )
+ bg.setPixmap( *uncached( ProgressBg ) );
+ p->fillRect( x + 2, y + 2, w - 4, h - 4, bg );
+
+ handled = true;
+ break;
+ }
+ case CE_ProgressBarContents:
+ {
+ const TQProgressBar* pb = (const TQProgressBar*)widget;
+ TQRect cr = subRect(SR_ProgressBarContents, ceData, elementFlags, widget);
+ double progress = pb->progress();
+ bool reverse = TQApplication::reverseLayout();
+ int steps = pb->totalSteps();
+
+ int pstep = 0;
+
+ if (!cr.isValid())
+ return;
+
+ // Draw progress bar
+ if (progress > 0 || steps == 0)
+ {
+ double pg = (steps == 0) ? 0.1 : progress / steps;
+ int width = QMIN(cr.width(), (int)(pg * cr.width()));
+ if (steps == 0)
+ { //Busy indicator
+
+ if (width < 1) width = 1; //A busy indicator with width 0 is kind of useless
+
+ int remWidth = cr.width() - width; //Never disappear completely
+ if (remWidth <= 0) remWidth = 1; //Do something non-crashy when too small...
+
+ pstep = int(progress) % ( 2 * remWidth );
+
+ if ( pstep > remWidth )
+ {
+ //Bounce about.. We're remWidth + some delta, we want to be remWidth - delta...
+ // - ( (remWidth + some delta) - 2* remWidth ) = - (some deleta - remWidth) = remWidth - some delta..
+ pstep = - (pstep - 2 * remWidth );
+ }
+ }
+
+ if ( !reverse )
+ drawBaseButton( p, x + pstep, y, width, h, *colorGroup( cg, ProgressBar ), false, false, ProgressBar );
+ else
+ {
+ //TODO:Optimize
+ TQPixmap buf( width, h );
+ TQPainter p2( &buf );
+ drawBaseButton( &p2, 0, 0, width, h, *colorGroup( cg, ProgressBar ), false, false, ProgressBar );
+ p2.end();
+ TQPixmap mirroredPix = TQPixmap( TQImage(buf.convertToImage()).mirror( true, false ) );
+ bitBlt( p->device(), x + w - width - pstep, y, &mirroredPix );
+ }
+ }
+
+ handled = true;
+ break;
+ }
+ default:
+ handled = false;
+ };
+
+ if ( !handled )
+ KThemeBase::drawControl( element,
+ p, ceData, elementFlags, r, cg, how, opt, widget );
+}
+
+
+void KThemeStyle::drawControlMask( ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& opt,
+ const TQWidget *widget ) const
+{
+ bool handled = false;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ switch ( element )
+ {
+ case CE_PushButton:
+ {
+ //Is this correct?
+ drawBaseMask( p, x, y, w, h, roundButton() );
+ handled = true;
+ break;
+ }
+ default:
+ handled = false;
+ };
+
+ if ( !handled )
+ KThemeBase::drawControlMask( element,
+ p, ceData, elementFlags, r, opt, widget );
+
+}
+
+
+void KThemeStyle::drawTDEStylePrimitive( TDEStylePrimitive kpe,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt,
+ const TQWidget* widget ) const
+{
+ bool handled = false;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ switch ( kpe )
+ {
+ case KPE_SliderGroove:
+ {
+ if ( !roundSlider() )
+ {
+ const TQSlider * slider = ( const TQSlider* ) widget;
+ bool horizontal = slider->orientation() == Qt::Horizontal;
+ if ( horizontal )
+ {
+ drawBaseButton( p, x, y, w, h, *colorGroup( cg, SliderGroove ), true,
+ false, SliderGroove );
+ }
+ else
+ {
+ drawBaseButton( p, x, y, w, h, *colorGroup( cg, RotSliderGroove ), true,
+ false, RotSliderGroove );
+ }
+ }
+ else
+ {
+ //This code is from HighColorDefault..
+ const TQSlider* slider = ( const TQSlider* ) widget;
+ bool horizontal = slider->orientation() == Qt::Horizontal;
+ int gcenter = ( horizontal ? r.height() : r.width() ) / 2;
+
+ TQRect gr;
+ if ( horizontal )
+ gr = TQRect( r.x(), r.y() + gcenter - 3, r.width(), 7 );
+ else
+ gr = TQRect( r.x() + gcenter - 3, r.y(), 7, r.height() );
+
+ int x, y, w, h;
+ gr.rect( &x, &y, &w, &h );
+ int x2 = x + w - 1;
+ int y2 = y + h - 1;
+
+ // Draw the slider groove.
+ p->setPen( cg.dark() );
+ p->drawLine( x + 2, y, x2 - 2, y );
+ p->drawLine( x, y + 2, x, y2 - 2 );
+ p->fillRect( x + 2, y + 2, w - 4, h - 4,
+ slider->isEnabled() ? cg.dark() : cg.mid() );
+ p->setPen( cg.shadow() );
+ p->drawRect( x + 1, y + 1, w - 2, h - 2 );
+ p->setPen( cg.light() );
+ p->drawPoint( x + 1, y2 - 1 );
+ p->drawPoint( x2 - 1, y2 - 1 );
+ p->drawLine( x2, y + 2, x2, y2 - 2 );
+ p->drawLine( x + 2, y2, x2 - 2, y2 );
+ }
+ handled = true;
+ break;
+ }
+ case KPE_SliderHandle:
+ {
+ if ( isPixmap( Slider ) )
+ {
+ const TQSlider * slider = ( const TQSlider* ) widget;
+ bool horizontal = slider->orientation() == Qt::Horizontal;
+ if ( horizontal )
+ {
+ bitBlt( p->device(), x, y + ( h - uncached( Slider ) ->height() ) / 2,
+ uncached( Slider ) );
+ }
+ else
+ {
+ if ( !vsliderCache )
+ {
+ TQWMatrix r270;
+ r270.rotate( 270 );
+ vsliderCache = new TQPixmap( uncached( Slider ) ->xForm( r270 ) );
+ if ( uncached( Slider ) ->mask() )
+ vsliderCache->setMask( uncached( Slider ) ->mask() ->xForm( r270 ) );
+ }
+ bitBlt( p->device(), x + ( w - vsliderCache->width() ) / 2, y,
+ vsliderCache );
+ }
+ }
+ else
+ {
+ //This code again from HighColor..
+ //...except sans the gradient..
+ const TQSlider* slider = ( const TQSlider* ) widget;
+ bool horizontal = slider->orientation() == Qt::Horizontal;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int x2 = x + w - 1;
+ int y2 = y + h - 1;
+
+ p->setPen( cg.mid() );
+ p->drawLine( x + 1, y, x2 - 1, y );
+ p->drawLine( x, y + 1, x, y2 - 1 );
+ p->setPen( cg.shadow() );
+ p->drawLine( x + 1, y2, x2 - 1, y2 );
+ p->drawLine( x2, y + 1, x2, y2 - 1 );
+
+ p->setPen( cg.light() );
+ p->drawLine( x + 1, y + 1, x2 - 1, y + 1 );
+ p->drawLine( x + 1, y + 1, x + 1, y2 - 1 );
+ p->setPen( cg.dark() );
+ p->drawLine( x + 2, y2 - 1, x2 - 1, y2 - 1 );
+ p->drawLine( x2 - 1, y + 2, x2 - 1, y2 - 1 );
+ p->setPen( cg.midlight() );
+ p->drawLine( x + 2, y + 2, x2 - 2, y + 2 );
+ p->drawLine( x + 2, y + 2, x + 2, y2 - 2 );
+ p->setPen( cg.mid() );
+ p->drawLine( x + 3, y2 - 2, x2 - 2, y2 - 2 );
+ p->drawLine( x2 - 2, y + 3, x2 - 2, y2 - 2 );
+ p->fillRect( TQRect( x + 3, y + 3, w - 6, h - 6 ),
+ cg.button() );
+
+ // Paint riffles
+ if ( horizontal )
+ {
+ p->setPen( cg.light() );
+ p->drawLine( x + 5, y + 4, x + 5, y2 - 4 );
+ p->drawLine( x + 8, y + 4, x + 8, y2 - 4 );
+ p->drawLine( x + 11, y + 4, x + 11, y2 - 4 );
+ p->setPen( slider->isEnabled() ? cg.shadow() : cg.mid() );
+ p->drawLine( x + 6, y + 4, x + 6, y2 - 4 );
+ p->drawLine( x + 9, y + 4, x + 9, y2 - 4 );
+ p->drawLine( x + 12, y + 4, x + 12, y2 - 4 );
+ }
+ else
+ {
+ p->setPen( cg.light() );
+ p->drawLine( x + 4, y + 5, x2 - 4, y + 5 );
+ p->drawLine( x + 4, y + 8, x2 - 4, y + 8 );
+ p->drawLine( x + 4, y + 11, x2 - 4, y + 11 );
+ p->setPen( slider->isEnabled() ? cg.shadow() : cg.mid() );
+ p->drawLine( x + 4, y + 6, x2 - 4, y + 6 );
+ p->drawLine( x + 4, y + 9, x2 - 4, y + 9 );
+ p->drawLine( x + 4, y + 12, x2 - 4, y + 12 );
+ }
+ }
+ handled = true;
+ break;
+ }
+ //case KPE_DockWindowHandle:
+ case KPE_ToolBarHandle:
+ case KPE_GeneralHandle:
+ {
+ if ( w > h )
+ drawBaseButton( p, x, y, w, h, *colorGroup( cg, HBarHandle ), false, false,
+ HBarHandle );
+ else
+ drawBaseButton( p, x, y, w, h, *colorGroup( cg, VBarHandle ), false, false,
+ VBarHandle );
+
+ handled = true;
+ break;
+ }
+ default:
+ handled = false;
+
+ }
+
+ if ( !handled )
+ {
+ KThemeBase::drawTDEStylePrimitive( kpe, p, ceData, elementFlags,
+ r, cg, flags, opt, widget );
+ }
+
+}
+
+
+
+
+void KThemeStyle::drawComplexControl ( TQ_ComplexControl control, TQPainter * p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQRect & r, const TQColorGroup & g, SFlags how ,
+ SCFlags controls, SCFlags active,
+ const TQStyleOption & opt, const TQWidget * widget ) const
+{
+ bool handled = false;
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ bool down = how & Style_Down;
+ bool on = how & Style_On;
+
+ // bool enabled = ( how & Style_Enabled );
+
+ switch ( control )
+ {
+ case CC_ToolButton:
+ {
+ const TQToolButton * toolbutton = ( const TQToolButton * ) widget;
+ TQRect button, menu;
+ button = querySubControlMetrics( control, ceData, elementFlags, SC_ToolButton, opt, widget );
+ menu = querySubControlMetrics( control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget );
+
+
+ if ( controls & SC_ToolButton )
+ {
+ WidgetType widget = ( down || on ) ? ToolButtonDown : ToolButton;
+
+ drawBaseButton( p, button.x(), button.y(), button.width(), button.height(), *colorGroup( g, widget ), down || on, false,
+ widget );
+
+ // int m = decoWidth( widget );
+ }
+
+ if ( controls & SC_ToolButtonMenu )
+ {
+ drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, menu, g, how );
+ /* if ( enabled )
+ kDrawWindowsArrow(p, ceData, elementFlags, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(),
+ g, true );
+ else
+ kDrawWindowsArrow(p, ceData, elementFlags, this, PE_ArrowDown, false, menu.x(), menu.y(), menu.width(), menu.height(),
+ g, false );*/
+ }
+
+ if ( toolbutton->hasFocus() && !toolbutton->focusProxy() )
+ {
+ TQRect fr = toolbutton->rect();
+ fr.addCoords( 3, 3, -3, -3 );
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, g );
+ }
+
+ handled = true;
+ break;
+ }
+
+ case CC_ComboBox:
+ {
+ if ( controls & SC_ComboBoxFrame )
+ {
+ //TODO: Anyway of detecting when the popup is there -- would look nicer if sunken then too..
+ bool sunken = ( active == SC_ComboBoxArrow );
+ //No frame, edit box and button for now?
+ WidgetType widget = sunken ? ComboBoxDown : ComboBox;
+ drawBaseButton( p, x, y, w, h, *colorGroup( g, widget ), sunken,
+ roundComboBox(), widget );
+
+ controls ^= SC_ComboBoxFrame;
+ }
+
+ if ( controls & SC_ComboBoxArrow )
+ {
+ bool sunken = ( active == SC_ComboBoxArrow );
+ TQRect ar = TQStyle::visualRect(
+ querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget ),
+ ceData, elementFlags );
+ ar.rect( &x, &y, &w, &h );
+ WidgetType widget = sunken ? ComboBoxDown : ComboBox;
+
+ if ( !sunken && isPixmap( ComboDeco ) )
+ bitBlt( p->device(),
+ x + ( w - uncached( ComboDeco ) ->width() - decoWidth( ComboBox ) / 2 ),
+ y + ( h - uncached( ComboDeco ) ->height() ) / 2,
+ uncached( ComboDeco ) );
+ else if ( sunken && isPixmap( ComboDecoDown ) )
+ bitBlt( p->device(),
+ x + ( w - uncached( ComboDecoDown ) ->width() - decoWidth( ComboBoxDown ) ) / 2,
+ y + ( h - uncached( ComboDecoDown ) ->height() ) / 2,
+ uncached( ComboDecoDown ) );
+ else
+ {
+
+ mtfstyle->drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect( x, y, w, h ), *colorGroup( g, widget ), sunken ? ( how | Style_Sunken ) : how, opt );
+ qDrawShadeRect( p, x, y, w, h, *colorGroup( g, widget ) ); //w-14, y+7+(h-15), 10, 3,
+ }
+ controls ^= SC_ComboBoxArrow;
+ }
+ break;
+ }
+ case CC_ScrollBar:
+ {
+ const TQScrollBar *sb = ( const TQScrollBar* ) widget;
+ bool maxedOut = ( sb->minValue() == sb->maxValue() );
+ bool horizontal = ( sb->orientation() == Qt::Horizontal );
+ SFlags sflags = ( ( horizontal ? Style_Horizontal : Style_Default ) |
+ ( maxedOut ? Style_Default : Style_Enabled ) );
+
+ //Here, we don't do add page, subpage, etc.,
+ TQRect addline, subline, subline2, groove, slider;
+ subline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget );
+ addline = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget );
+ groove = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarGroove, opt, widget );
+
+ slider = querySubControlMetrics( control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget );
+ subline2 = addline;
+
+ TQPixmap buf( sb->width(), sb->height() );
+ TQPainter p2( &buf );
+
+ if ( groove.isValid() )
+ {
+ p2.fillRect( groove, TQColor( 255, 0, 0 ) );
+ drawPrimitive( PE_ScrollBarSubPage, &p2, ceData, elementFlags, groove, g,
+ sflags | ( ( active == SC_ScrollBarSubPage ) ?
+ Style_Down : Style_Default ) );
+ }
+
+
+ // Draw the up/left button set
+ if ( subline.isValid() )
+ {
+ drawPrimitive( PE_ScrollBarSubLine, &p2, ceData, elementFlags, subline, g,
+ sflags | ( active == SC_ScrollBarSubLine ?
+ Style_Down : Style_Default ) );
+ }
+
+ if ( addline.isValid() )
+ drawPrimitive( PE_ScrollBarAddLine, &p2, ceData, elementFlags, addline, g,
+ sflags | ( ( active == SC_ScrollBarAddLine ) ?
+ Style_Down : Style_Default ) );
+
+ if ( slider.isValid() )
+ { //(controls & SC_ScrollBarSlider) &&
+ drawPrimitive( PE_ScrollBarSlider, &p2, ceData, elementFlags, slider, g,
+ sflags | ( ( active == SC_ScrollBarSlider ) ?
+ Style_Down : Style_Default ) );
+ // Draw focus rect
+ if ( sb->hasFocus() )
+ {
+ TQRect fr( slider.x() + 2, slider.y() + 2,
+ slider.width() - 5, slider.height() - 5 );
+ drawPrimitive( PE_FocusRect, &p2, ceData, elementFlags, fr, g, Style_Default );
+ }
+ p2.end();
+ bitBlt( p->device(), x, y, &buf );
+ handled = true;
+
+ }
+ break;
+ }
+ default:
+ handled = false;
+ }
+
+ if ( !handled )
+ {
+ KThemeBase::drawComplexControl ( control, p, ceData, elementFlags,
+ r, g, how ,
+ controls, active,
+ opt, widget );
+ }
+
+}
+
+
+void KThemeStyle::drawBaseMask( TQPainter *p, int x, int y, int w, int h,
+ bool round ) const
+{
+ // round edge fills
+ static const TQCOORD btm_left_fill[] =
+ {
+ 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4, 1,
+ 1, 2, 2, 2, 3, 2, 4, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 4
+ };
+
+ static const TQCOORD btm_right_fill[] =
+ {
+ 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 0, 1, 1, 1, 2, 1, 3, 1, 4,
+ 1, 0, 2, 1, 2, 2, 2, 3, 2, 0, 3, 1, 3, 2, 3, 0, 4, 1, 4
+ };
+
+ static const TQCOORD top_left_fill[] =
+ {
+ 3, 0, 4, 0, 2, 1, 3, 1, 4, 1, 1, 2, 2, 2, 3, 2, 4, 2, 0, 3,
+ 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4
+ };
+
+ static const TQCOORD top_right_fill[] =
+ {
+ 0, 0, 1, 0, 0, 1, 1, 1, 2, 1, 0, 2, 1, 2, 2, 2, 3, 2, 0,
+ 3, 1, 3, 2, 3, 3, 3, 4, 3, 0, 4, 1, 4, 2, 4, 3, 4, 4, 4
+ };
+
+ TQBrush fillBrush( color1, SolidPattern );
+ p->setPen( color1 );
+ if ( round && w > 19 && h > 19 )
+ {
+ int x2 = x + w - 1;
+ int y2 = y + h - 1;
+ TQPointArray a( TQCOORDARRLEN( top_left_fill ), top_left_fill );
+ a.translate( 1, 1 );
+ p->drawPoints( a );
+ a.setPoints( TQCOORDARRLEN( btm_left_fill ), btm_left_fill );
+ a.translate( 1, h - 6 );
+ p->drawPoints( a );
+ a.setPoints( TQCOORDARRLEN( top_right_fill ), top_right_fill );
+ a.translate( w - 6, 1 );
+ p->drawPoints( a );
+ a.setPoints( TQCOORDARRLEN( btm_right_fill ), btm_right_fill );
+ a.translate( w - 6, h - 6 );
+ p->drawPoints( a );
+
+ p->fillRect( x + 6, y, w - 12, h, fillBrush );
+ p->fillRect( x, y + 6, x + 6, h - 12, fillBrush );
+ p->fillRect( x2 - 6, y + 6, x2, h - 12, fillBrush );
+ p->drawLine( x + 6, y, x2 - 6, y );
+ p->drawLine( x + 6, y2, x2 - 6, y2 );
+ p->drawLine( x, y + 6, x, y2 - 6 );
+ p->drawLine( x2, y + 6, x2, y2 - 6 );
+
+ }
+ else
+ p->fillRect( x, y, w, h, fillBrush );
+}
+
+int KThemeStyle::styleHint( StyleHint sh, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQStyleOption &opt, TQStyleHintReturn *shr, const TQWidget *w ) const
+{
+ switch ( sh )
+ {
+ case SH_EtchDisabledText:
+ case SH_Slider_SnapToValue:
+ case SH_PrintDialog_RightAlignButtons:
+ case SH_FontDialog_SelectAssociatedText:
+ case SH_PopupMenu_AllowActiveAndDisabled:
+ case SH_MenuBar_AltKeyNavigation:
+ case SH_MenuBar_MouseTracking:
+ case SH_PopupMenu_MouseTracking:
+ case SH_ComboBox_ListMouseTracking:
+ return 1;
+
+ case SH_GUIStyle:
+ return WindowsStyle;
+
+ case SH_ScrollBar_BackgroundMode:
+ return NoBackground;
+
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int checkcol = opt.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ return checkcol;
+ break;
+ }
+
+ default:
+ return KThemeBase::styleHint( sh, ceData, elementFlags, opt, shr, w );
+ };
+}
+
+
+
+/* This is where we draw the borders and highlights. The new round button
+ * code is a pain in the arse. We don't want to be calculating arcs so
+ * use a whole lotta QPointArray's ;-) The code is made a lot more complex
+ * because you can have variable width border and highlights...
+ * I may want to cache this if round buttons are used, but am concerned
+ * about excessive cache misses. This is a memory/speed tradeoff that I
+ * have to test.
+ */
+void KThemeStyle::drawShade( TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, bool sunken, bool rounded,
+ int hWidth, int bWidth, ShadeStyle style ) const
+{
+ int i, sc, bc, x2, y2;
+ TQPen highPen, lowPen;
+
+ if ( style == Motif )
+ {
+ highPen.setColor( sunken ? g.dark() : g.light() );
+ lowPen.setColor( sunken ? g.light() : g.dark() );
+ }
+ else
+ {
+ highPen.setColor( sunken ? g.shadow() : g.light() );
+ lowPen.setColor( sunken ? g.light() : g.shadow() );
+ }
+
+ // Advanced round buttons
+ if ( rounded && w > 19 && h > 19 )
+ {
+ x2 = x + w - 1, y2 = y + h - 1;
+ TQPointArray bPntArray, hPntArray, lPntArray;
+ TQPointArray bLineArray, hLineArray, lLineArray;
+ // borders
+ for ( i = 0, bc = 0; i < bWidth; ++i )
+ {
+ bPntArray.putPoints( bc, 24, x + 4, y + 1, x + 5, y + 1, x + 3, y + 2, x + 2, y + 3,
+ x + 1, y + 4, x + 1, y + 5, x + 1, y2 - 5, x + 1, y2 - 4, x + 2, y2 - 3,
+ x2 - 5, y + 1, x2 - 4, y + 1, x2 - 3, y + 2, x2 - 5, y2 - 1,
+ x2 - 4, y2 - 1, x2 - 3, y2 - 2, x2 - 2, y2 - 3, x2 - 1, y2 - 5,
+ x2 - 1, y2 - 4, x + 3, y2 - 2, x + 4, y2 - 1, x + 5, y2 - 1,
+ x2 - 2, y + 3, x2 - 1, y + 4, x2 - 1, y + 5 );
+ bc += 24;
+ // ellispe edges don't match exactly, so fill in blanks
+ if ( i < bWidth - 1 || hWidth != 0 )
+ {
+ bPntArray.putPoints( bc, 20, x + 6, y + 1, x + 4, y + 2, x + 3, y + 3,
+ x + 2, y + 4, x + 1, y + 6, x2 - 6, y + 1, x2 - 4, y + 2,
+ x2 - 3, y + 3, x + 2, y2 - 4, x + 1, y2 - 6, x2 - 6, y2 - 1,
+ x2 - 4, y2 - 2, x2 - 3, y2 - 3, x2 - 2, y2 - 4, x2 - 1, y2 - 6,
+ x + 6, y2 - 1, x + 4, y2 - 2, x + 3, y2 - 3, x2 - 1, y + 6,
+ x2 - 2, y + 4 );
+ bc += 20;
+ }
+ bLineArray.putPoints( i * 8, 8, x + 6, y, x2 - 6, y, x, y + 6, x, y2 - 6,
+ x + 6, y2, x2 - 6, y2, x2, y + 6, x2, y2 - 6 );
+ ++x, ++y;
+ --x2, --y2;
+ }
+ // highlights
+ for ( i = 0, sc = 0; i < hWidth; ++i )
+ {
+ hPntArray.putPoints( sc, 12, x + 4, y + 1, x + 5, y + 1, // top left
+ x + 3, y + 2, x + 2, y + 3, x + 1, y + 4, x + 1, y + 5,
+ x + 1, y2 - 5, x + 1, y2 - 4, x + 2, y2 - 3, // half corners
+ x2 - 5, y + 1, x2 - 4, y + 1, x2 - 3, y + 2 );
+ lPntArray.putPoints( sc, 12, x2 - 5, y2 - 1, x2 - 4, y2 - 1, // btm right
+ x2 - 3, y2 - 2, x2 - 2, y2 - 3, x2 - 1, y2 - 5, x2 - 1, y2 - 4,
+ x + 3, y2 - 2, x + 4, y2 - 1, x + 5, y2 - 1, //half corners
+ x2 - 2, y + 3, x2 - 1, y + 4, x2 - 1, y + 5 );
+ sc += 12;
+ if ( i < hWidth - 1 )
+ {
+ hPntArray.putPoints( sc, 10, x + 6, y + 1, x + 4, y + 2, // top left
+ x + 3, y + 3, x + 2, y + 4, x + 1, y + 6,
+ x2 - 6, y + 1, x2 - 4, y + 2, // half corners
+ x2 - 3, y + 3, x + 2, y2 - 4, x + 1, y2 - 6 );
+ lPntArray.putPoints( sc, 10, x2 - 6, y2 - 1, x2 - 4, y2 - 2, // btm right
+ x2 - 3, y2 - 3, x2 - 2, y2 - 4, x2 - 1, y2 - 6,
+ x + 6, y2 - 1, x + 4, y2 - 2, // half corners
+ x + 3, y2 - 3, x2 - 1, y + 6, x2 - 2, y + 4 );
+ sc += 10;
+ }
+ hLineArray.putPoints( i * 4, 4, x + 6, y, x2 - 6, y, x, y + 6, x, y2 - 6 );
+ lLineArray.putPoints( i * 4, 4, x + 6, y2, x2 - 6, y2, x2, y + 6, x2, y2 - 6 );
+ ++x, ++y;
+ --x2, --y2;
+ }
+ p->setPen( Qt::black );
+ p->drawPoints( bPntArray );
+ p->drawLineSegments( bLineArray );
+ p->setPen( highPen );
+ p->drawPoints( hPntArray );
+ p->drawLineSegments( hLineArray );
+ p->setPen( lowPen );
+ p->drawPoints( lPntArray );
+ p->drawLineSegments( lLineArray );
+ }
+ // Rectangular buttons
+ else
+ {
+ TQPointArray highShade( hWidth * 4 );
+ TQPointArray lowShade( hWidth * 4 );
+
+ p->setPen( g.shadow() );
+ for ( i = 0; i < bWidth && w > 2 && h > 2; ++i, ++x, ++y, w -= 2, h -= 2 )
+ p->drawRect( x, y , w, h );
+
+ if ( !hWidth )
+ return ;
+
+ x2 = x + w - 1, y2 = y + h - 1;
+ for ( i = 0; i < hWidth; ++i, ++x, ++y, --x2, --y2 )
+ {
+ highShade.putPoints( i * 4, 4, x, y, x2, y, x, y, x, y2 );
+ lowShade.putPoints( i * 4, 4, x, y2, x2, y2, x2, y, x2, y2 );
+ }
+ if ( style == Windows && hWidth > 1 )
+ {
+ p->setPen( highPen );
+ p->drawLineSegments( highShade, 0, 2 );
+ p->setPen( lowPen );
+ p->drawLineSegments( lowShade, 0, 2 );
+
+ p->setPen( ( sunken ) ? g.dark() : g.mid() );
+ p->drawLineSegments( highShade, 4 );
+ p->setPen( ( sunken ) ? g.mid() : g.dark() );
+ p->drawLineSegments( lowShade, 4 );
+ }
+ else
+ {
+ p->setPen( ( sunken ) ? g.dark() : g.light() );
+ p->drawLineSegments( highShade );
+ p->setPen( ( sunken ) ? g.light() : g.dark() );
+ p->drawLineSegments( lowShade );
+ }
+ }
+}
+
+
+
+
+int KThemeStyle::popupMenuItemHeight( bool /*checkable*/, TQMenuItem *mi,
+ const TQFontMetrics &fm )
+{
+ int h2, h = 0;
+ int offset = QMAX( decoWidth( MenuItemDown ), decoWidth( MenuItem ) ) + 4;
+
+ if ( mi->isSeparator() )
+ return ( 2 );
+ if ( mi->isChecked() )
+ h = isPixmap( CheckMark ) ? uncached( CheckMark ) ->height() + offset :
+ offset + 16;
+ if ( mi->pixmap() )
+ {
+ h2 = mi->pixmap() ->height() + offset;
+ h = h2 > h ? h2 : h;
+ }
+ if ( mi->iconSet() )
+ {
+ h2 = mi->iconSet() ->
+ pixmap( TQIconSet::Small, TQIconSet::Normal ).height() + offset;
+ h = h2 > h ? h2 : h;
+ }
+ h2 = fm.height() + offset;
+ h = h2 > h ? h2 : h;
+ return ( h );
+}
+
+#include "kthemestyle.moc"
+// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent on;
diff --git a/tdestyles/kthemestyle/kthemestyle.h b/tdestyles/kthemestyle/kthemestyle.h
new file mode 100644
index 000000000..ca112ed14
--- /dev/null
+++ b/tdestyles/kthemestyle/kthemestyle.h
@@ -0,0 +1,242 @@
+/*
+$Id$
+
+This file is part of the KDE libraries
+Copyright (C) 1999 Daniel M. Duley <mosfet@kde.org>
+
+KDE3 port (C) 2001-2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+Port version 0.9.7
+
+Includes code portions from the dotNET style, and the KDE HighColor style.
+
+dotNET Style
+ Copyright (C) 2001, Chris Lee <lee@azsites.com>
+ Carsten Pfeiffer <pfeiffer@kde.org>
+
+KDE3 HighColor Style
+Copyright (C) 2001 Karol Szwed <gallium@kde.org>
+ (C) 2001 Fredrik H�glund <fredrik@kde.org>
+
+Drawing routines adapted from the KDE2 HCStyle,
+Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ (C) 2000 Dirk Mueller <mueller@kde.org>
+ (C) 2001 Martijn Klingens <klingens@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 KTHEMESTYLE_H
+#define KTHEMESTYLE_H
+
+#include <tqglobal.h>
+
+#include "kthemebase.h"
+#include <tqwindowdefs.h>
+#include <tqobject.h>
+#include <tqbutton.h>
+#include <tqpushbutton.h>
+#include <tqscrollbar.h>
+#include <tqtabbar.h>
+#include <tqstring.h>
+#include <tqintdict.h>
+#include <tqmap.h>
+
+
+/**
+ * KDE themed styles.
+ *
+ * It provides methods for
+ * drawing most widgets with user-specified borders, highlights, pixmaps,
+ * etc. It also handles various other settings such as scrollbar types,
+ * rounded buttons, and shading types. For a full list of parameters this
+ * class handles refer to the KDE theme configuration documentation.
+ *
+ */
+
+class KThemeStyle: public KThemeBase
+{
+ Q_OBJECT
+public:
+ /**
+ * Constructs a new KThemeStyle object.
+ *
+ * @param configDir The directory which has the TDEConfig file.
+ * @param configFile A TDEConfig file to use as the theme configuration.
+ * Defaults to ~/.tderc.
+ */
+ KThemeStyle( const TQString& configDir, const TQString &configFile = TQString::null );
+ ~KThemeStyle();
+
+ virtual int pixelMetric ( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget * widget = 0 ) const;
+
+ virtual void drawPrimitive ( PrimitiveElement pe, TQPainter * p, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect & r, const TQColorGroup & cg,
+ SFlags flags = Style_Default,
+ const TQStyleOption& = TQStyleOption::Default ) const;
+
+ virtual void drawControl( ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags how = Style_Default,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const;
+
+ virtual void drawControlMask( ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const;
+
+
+ virtual 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;
+
+ virtual 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;
+
+
+ virtual int styleHint( StyleHint sh,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption& = TQStyleOption::Default,
+ TQStyleHintReturn* returnData = 0,
+ const TQWidget *widget = 0 ) const;
+
+ virtual TQSize sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentsSize,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const;
+
+ virtual TQRect subRect(SubRect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *) const;
+
+ virtual void polish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
+ virtual void unPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
+ virtual bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
+ /**
+ * By default this just sets the background brushes to the pixmapped
+ * background.
+ */
+ virtual void applicationPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
+ virtual void applicationUnPolish( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void * );
+
+ /** \internal */
+ // to make it possible for derived classes to overload this function
+ virtual void polish( TQPalette& pal );
+
+ /**
+ * This is a convenience method for drawing widgets with
+ * borders, highlights, pixmaps, colors, etc...
+ * You specify the widget type and it will draw it according to the
+ * config file settings.
+ *
+ * @param x The x coordinate of the button's upper left hand corner.
+ * @param y The y coordinate of the buttons' upper left hand corner.
+ * @param w The button width.
+ * @param h The button height.
+ * @param p The TQPainter to draw on.
+ * @param g The color group to use.
+ * @param sunken The button is drawn with a sunken style if @p true
+ * @param rounded @p true if the widget is rounded, @p false if rectangular.
+ * @param type The widget type to paint.
+ */
+ virtual void drawBaseButton( TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, bool sunken = false,
+ bool rounded = false, WidgetType type = Bevel ) const;
+ /**
+ * Draw a mask with for widgets that may be rounded.
+ *
+ *Currently used
+ * by pushbuttons and comboboxes.
+ *
+ * @param p The TQPainter to draw on.
+ * @param x The x coordinate of the widget's upper left hand corner.
+ * @param y The y coordinate of the widget's upper left hand corner.
+ * @param w The widget width.
+ * @param h The widget height.
+ * @param rounded @p true if the widget is rounded, @p false if rectangular.
+ */
+ virtual void drawBaseMask( TQPainter *p, int x, int y, int w, int h,
+ bool rounded ) const;
+
+
+
+ /**
+ * Draw a shaded rectangle using the given style.
+ *
+ * @param p The painter to draw on.
+ * @param g The color group to use.
+ * @param x The x coordinate of the rectangle's upper left hand corner.
+ * @param y The y coordinate of the rectangle's upper left hand corner.
+ * @param w The rectangle width.
+ * @param h The rectangle height.
+ * @param sunken Draws a sunken style if @p true.
+ * @param rounded Draws a rounded shape if @p true. Requires bWidth to be
+ * at least 1.
+ * @param hWidth The highlight width.
+ * @param bWidth The border width.
+ * @param style The shading style to use.
+ */
+ virtual void drawShade( TQPainter *p, int x, int y, int w, int h,
+ const TQColorGroup &g, bool sunken, bool rounded,
+ int hWidth, int bWidth, ShadeStyle style ) const;
+ int popupMenuItemHeight( bool checkable, TQMenuItem *mi,
+ const TQFontMetrics &fm );
+
+protected:
+ TQPalette oldPalette, popupPalette, indiPalette, exIndiPalette;
+ bool paletteSaved;
+ bool polishLock;
+ TQStyle *mtfstyle;
+
+ TQPixmap* makeMenuBarCache(int w, int h) const;
+
+ mutable TQPixmap* menuCache;
+ mutable TQPixmap* vsliderCache;
+
+ Qt::HANDLE brushHandle;
+ bool brushHandleSet;
+ bool kickerMode;
+
+protected slots:
+ void paletteChanged();
+
+
+
+};
+
+
+#endif
diff --git a/tdestyles/kthemestyle/tdestyledirs.cpp b/tdestyles/kthemestyle/tdestyledirs.cpp
new file mode 100644
index 000000000..9f795e1e2
--- /dev/null
+++ b/tdestyles/kthemestyle/tdestyledirs.cpp
@@ -0,0 +1,48 @@
+/*
+ $Id$
+
+ Simple helper routines for style's use of TDEStandardDirs with TQSettings, etc.
+
+ 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.
+
+
+ This file is part of the KDE libraries
+*/
+
+#include <tqfile.h>
+#include <kstandarddirs.h>
+#include "tdestyledirs.h"
+
+TDEStyleDirs* TDEStyleDirs::instance = 0;
+
+TDEStyleDirs::TDEStyleDirs()
+{
+ addResourceType( "themepixmap", TDEStandardDirs::kde_default( "data" ) + "tdestyle/pixmaps/" );
+ addResourceType( "themerc", TDEStandardDirs::kde_default( "data" ) + "tdestyle/themes/" );
+}
+
+TDEStyleDirs::~TDEStyleDirs()
+{
+}
+
+void TDEStyleDirs::addToSearch( const char* type, TQSettings& s ) const
+{
+ const TQStringList & dirs = resourceDirs(type);
+ for ( int c = dirs.size()-1; c >= 0 ; c-- )
+ {
+ s.insertSearchPath( TQSettings::Unix, dirs[ c ]);
+ }
+}
+
diff --git a/tdestyles/kthemestyle/tdestyledirs.h b/tdestyles/kthemestyle/tdestyledirs.h
new file mode 100644
index 000000000..2a42fd2ba
--- /dev/null
+++ b/tdestyles/kthemestyle/tdestyledirs.h
@@ -0,0 +1,82 @@
+/*
+ $Id$
+
+ This file is part of the KDE libraries
+ (c) 2002 Maksim Orlovich <mo002j@mail.rochester.edu>,
+
+ 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 TDESTYLE_DIRS_H
+#define TDESTYLE_DIRS_H
+
+
+#include <tqsettings.h>
+#include <tqstringlist.h>
+#include <kstandarddirs.h>
+
+/**
+* @short Access to the standard KDE directories for the pixmap style
+* @author Maksim Orlovich<mo002j@mail.rochester.edu> is responsible for this file,
+ but all the interesting work is done by TDEStandardDirs
+* @version $Id$
+*
+* This class provides a this wrapper for styles around TDEStandardDirs,
+* permitting integration with TQSettings and easy loading of pixmaps
+*
+* It add share/apps/tdestyle/themes as "themerc",
+* share/apps/tdestyle/pixmaps "themepixmap"
+*/
+class TDEStyleDirs: public TDEStandardDirs
+{
+public:
+ static TDEStyleDirs* dirs()
+ {
+ if ( !instance)
+ instance = new TDEStyleDirs;
+ return instance;
+ }
+
+ static void release()
+ {
+ delete instance;
+ instance = 0;
+ }
+
+ /**
+ Adds all of KDE directories of type type to the seach path of q.
+
+ For example, when one does the following:
+ TQSettings settings;
+ TDEStyleDirs dirs;
+ dirs.addToSearch("config",settings);
+
+ The one can do settings.readEntry("tdestyle/TDE/WidgetStyle") to access a settings in tdestylerc.
+ */
+ void addToSearch( const char* type, TQSettings& q) const; //Better name?
+
+protected:
+ static TDEStyleDirs* instance;
+ /**
+ Creates an instance of the class, and calculates the path information.
+ */
+ TDEStyleDirs();
+ TDEStyleDirs(const TDEStyleDirs&);
+ TDEStyleDirs& operator= (const TDEStyleDirs&);
+
+ virtual ~TDEStyleDirs();
+};
+
+#endif
diff --git a/tdestyles/light/CMakeLists.txt b/tdestyles/light/CMakeLists.txt
new file mode 100644
index 000000000..af512b94f
--- /dev/null
+++ b/tdestyles/light/CMakeLists.txt
@@ -0,0 +1,41 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions(
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdefx
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### light #####################################
+
+set( target light )
+
+set( ${target}_SRCS
+ light.cpp lightstyle-v2.cpp lightstyle-v3.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdefx-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
+)
diff --git a/tdestyles/light/Makefile.am b/tdestyles/light/Makefile.am
new file mode 100644
index 000000000..8233d22df
--- /dev/null
+++ b/tdestyles/light/Makefile.am
@@ -0,0 +1,29 @@
+
+# This file is part of the KDE libraries
+# Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
+# (C) 1997 Stephan Kulow (coolo@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 as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# 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; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+AM_CPPFLAGS = -DQT_PLUGIN
+
+INCLUDES = -I$(top_srcdir)/tdefx $(all_includes)
+noinst_HEADERS = lightstyle-v2.h lightstyle-v3.h
+kde_style_LTLIBRARIES = light.la
+light_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+light_la_LIBADD = $(LIB_QT) ../../tdefx/libtdefx.la
+light_la_SOURCES = light.cpp lightstyle-v2.cpp lightstyle-v3.cpp
+light_la_METASOURCES = AUTO
diff --git a/tdestyles/light/light.cpp b/tdestyles/light/light.cpp
new file mode 100644
index 000000000..17ecde9fc
--- /dev/null
+++ b/tdestyles/light/light.cpp
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2000-2001 Trolltech AS (info@trolltech.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include <tqstyleplugin.h>
+#include <tqimage.h>
+#include <tqapplication.h>
+
+#include "lightstyle-v2.h"
+#include "lightstyle-v3.h"
+
+class LightStylePlugin : public TQStylePlugin
+{
+public:
+ LightStylePlugin();
+
+ TQStringList keys() const;
+ TQStyle *create(const TQString &);
+};
+
+LightStylePlugin::LightStylePlugin()
+ : TQStylePlugin()
+{
+}
+
+TQStringList LightStylePlugin::keys() const
+{
+ TQStringList list;
+ list << "Light, 2nd revision";
+ list << "Light, 3rd revision";
+ return list;
+}
+
+TQStyle *LightStylePlugin::create(const TQString &s)
+{
+ if (s.lower() == "light, 2nd revision")
+ return new LightStyleV2;
+ if (s.lower() == "light, 3rd revision")
+ return new LightStyleV3;
+ return 0;
+}
+
+KDE_Q_EXPORT_PLUGIN( LightStylePlugin )
diff --git a/tdestyles/light/lightstyle-v2.cpp b/tdestyles/light/lightstyle-v2.cpp
new file mode 100644
index 000000000..0d343f778
--- /dev/null
+++ b/tdestyles/light/lightstyle-v2.cpp
@@ -0,0 +1,1679 @@
+/*
+ Copyright (c) 2000-2001 Trolltech AS (info@trolltech.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include "lightstyle-v2.h"
+
+#include "tqmenubar.h"
+#include "tqapplication.h"
+#include "tqpainter.h"
+#include "tqpalette.h"
+#include "tqframe.h"
+#include "tqpushbutton.h"
+#include "tqdrawutil.h"
+#include "tqprogressbar.h"
+#include "tqscrollbar.h"
+#include "tqtabbar.h"
+#include "tqguardedptr.h"
+#include "tqlayout.h"
+#include "tqlineedit.h"
+#include "tqimage.h"
+#include "tqcombobox.h"
+#include "tqslider.h"
+#include "tqstylefactory.h"
+
+
+class LightStyleV2Private
+{
+public:
+ LightStyleV2Private()
+ : ref(1)
+ {
+ basestyle = TQStyleFactory::create( "Windows" );
+ if ( ! basestyle )
+ basestyle = TQStyleFactory::create( TQStyleFactory::keys().first() );
+ if ( ! basestyle )
+ tqFatal( "LightStyle: couldn't find a basestyle!" );
+ }
+
+ ~LightStyleV2Private()
+ {
+ delete basestyle;
+ }
+
+ TQStyle *basestyle;
+ int ref;
+};
+
+static LightStyleV2Private *singleton = 0;
+
+
+LightStyleV2::LightStyleV2()
+ : TDEStyle(AllowMenuTransparency)
+{
+ if (! singleton)
+ singleton = new LightStyleV2Private;
+ else
+ singleton->ref++;
+}
+
+LightStyleV2::~LightStyleV2()
+{
+ if (singleton && --singleton->ref <= 0) {
+ delete singleton;
+ singleton = 0;
+ }
+}
+
+void LightStyleV2::polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr )
+{
+ TDEStyle::polishPopupMenu(ceData, elementFlags, ptr);
+}
+
+static void drawLightBevel(TQPainter *p, const TQRect &r, const TQColorGroup &cg,
+ TQStyle::SFlags flags, const TQBrush *fill = 0)
+{
+ TQRect br = r;
+ bool sunken = (flags & (TQStyle::Style_Down | TQStyle::Style_On |
+ TQStyle::Style_Sunken));
+
+ p->setPen(cg.dark());
+ p->drawRect(r);
+
+ if (flags & (TQStyle::Style_Down | TQStyle::Style_On |
+ TQStyle::Style_Sunken | TQStyle::Style_Raised)) {
+ // button bevel
+ if (sunken)
+ p->setPen(cg.mid());
+ else
+ p->setPen(cg.light());
+
+ p->drawLine(r.x() + 1, r.y() + 2,
+ r.x() + 1, r.y() + r.height() - 3); // left
+ p->drawLine(r.x() + 1, r.y() + 1,
+ r.x() + r.width() - 2, r.y() + 1); // top
+
+ if (sunken)
+ p->setPen(cg.light());
+ else
+ p->setPen(cg.mid());
+
+ p->drawLine(r.x() + r.width() - 2, r.y() + 2,
+ r.x() + r.width() - 2, r.y() + r.height() - 3); // right
+ p->drawLine(r.x() + 1, r.y() + r.height() - 2,
+ r.x() + r.width() - 2, r.y() + r.height() - 2); // bottom
+
+ br.addCoords(2, 2, -2, -2);
+ } else
+ br.addCoords(1, 1, -1, -1);
+
+ // fill
+ if (fill) p->fillRect(br, *fill);
+}
+
+void LightStyleV2::drawPrimitive( TQ_PrimitiveElement pe,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption &data ) const
+{
+ switch (pe) {
+ case PE_HeaderSectionMenu:
+ case PE_HeaderSection:
+ {
+ flags = ((flags | Style_Sunken) ^ Style_Sunken) | Style_Raised;
+ //Don't show pressed too often (as in light 3)
+ TQBrush fill(cg.background());
+ if (flags & TQStyle::Style_Enabled)
+ fill.setColor(cg.button());
+
+ drawLightBevel(p, r, cg, flags, &fill);
+ p->setPen( cg.buttonText() );
+ break;
+ }
+
+ case PE_ButtonCommand:
+ case PE_ButtonBevel:
+ case PE_ButtonTool:
+ {
+ const TQBrush *fill;
+ if (flags & TQStyle::Style_Enabled) {
+ if (flags & (TQStyle::Style_Down |
+ TQStyle::Style_On |
+ TQStyle::Style_Sunken))
+ fill = &cg.brush(TQColorGroup::Midlight);
+ else
+ fill = &cg.brush(TQColorGroup::Button);
+ } else
+ fill = &cg.brush(TQColorGroup::Background);
+ drawLightBevel(p, r, cg, flags, fill);
+ break;
+ }
+
+ case PE_ButtonDropDown:
+ {
+ TQBrush thefill;
+ bool sunken =
+ (flags & (TQStyle::Style_Down | TQStyle::Style_On | TQStyle::Style_Sunken));
+
+ if (flags & TQStyle::Style_Enabled) {
+ if (sunken)
+ thefill = cg.brush(TQColorGroup::Midlight);
+ else
+ thefill = cg.brush(TQColorGroup::Button);
+ } else
+ thefill = cg.brush(TQColorGroup::Background);
+
+ p->setPen(cg.dark());
+ p->drawLine(r.topLeft(), r.topRight());
+ p->drawLine(r.topRight(), r.bottomRight());
+ p->drawLine(r.bottomRight(), r.bottomLeft());
+
+ if (flags & (TQStyle::Style_Down | TQStyle::Style_On |
+ TQStyle::Style_Sunken | TQStyle::Style_Raised)) {
+ // button bevel
+ if (sunken)
+ p->setPen(cg.mid());
+ else
+ p->setPen(cg.light());
+
+ p->drawLine(r.x(), r.y() + 2,
+ r.x(), r.y() + r.height() - 3); // left
+ p->drawLine(r.x(), r.y() + 1,
+ r.x() + r.width() - 2, r.y() + 1); // top
+
+ if (sunken)
+ p->setPen(cg.light());
+ else
+ p->setPen(cg.mid());
+
+ p->drawLine(r.x() + r.width() - 2, r.y() + 2,
+ r.x() + r.width() - 2, r.y() + r.height() - 3); // right
+ p->drawLine(r.x() + 1, r.y() + r.height() - 2,
+ r.x() + r.width() - 2, r.y() + r.height() - 2); // bottom
+ }
+
+ p->fillRect(r.x() + 1, r.y() + 2, r.width() - 3, r.height() - 4, thefill);
+ break;
+ }
+
+ case PE_ButtonDefault:
+ p->setPen(cg.dark());
+ p->setBrush(cg.light());
+ p->drawRect(r);
+ break;
+
+ case PE_Indicator:
+ const TQBrush *fill;
+ if (! (flags & Style_Enabled))
+ fill = &cg.brush(TQColorGroup::Background);
+ else if (flags & Style_Down)
+ fill = &cg.brush(TQColorGroup::Mid);
+ else
+ fill = &cg.brush(TQColorGroup::Base);
+ drawLightBevel(p, r, cg, flags | Style_Sunken, fill);
+
+ p->setPen(cg.text());
+ if (flags & Style_NoChange) {
+ p->drawLine(r.x() + 3, r.y() + r.height() / 2,
+ r.x() + r.width() - 4, r.y() + r.height() / 2);
+ p->drawLine(r.x() + 3, r.y() + 1 + r.height() / 2,
+ r.x() + r.width() - 4, r.y() + 1 + r.height() / 2);
+ p->drawLine(r.x() + 3, r.y() - 1 + r.height() / 2,
+ r.x() + r.width() - 4, r.y() - 1 + r.height() / 2);
+ } else if (flags & Style_On) {
+ p->drawLine(r.x() + 4, r.y() + 3,
+ r.x() + r.width() - 4, r.y() + r.height() - 5);
+ p->drawLine(r.x() + 3, r.y() + 3,
+ r.x() + r.width() - 4, r.y() + r.height() - 4);
+ p->drawLine(r.x() + 3, r.y() + 4,
+ r.x() + r.width() - 5, r.y() + r.height() - 4);
+ p->drawLine(r.x() + 3, r.y() + r.height() - 5,
+ r.x() + r.width() - 5, r.y() + 3);
+ p->drawLine(r.x() + 3, r.y() + r.height() - 4,
+ r.x() + r.width() - 4, r.y() + 3);
+ p->drawLine(r.x() + 4, r.y() + r.height() - 4,
+ r.x() + r.width() - 4, r.y() + 4);
+ }
+
+ break;
+
+ case PE_ExclusiveIndicator:
+ {
+ TQRect br = r, // bevel rect
+ cr = r, // contents rect
+ ir = r; // indicator rect
+ br.addCoords(1, 1, -1, -1);
+ cr.addCoords(2, 2, -2, -2);
+ ir.addCoords(3, 3, -3, -3);
+
+ p->fillRect(r, cg.brush(TQColorGroup::Background));
+
+ p->setPen(cg.dark());
+ p->drawArc(r, 0, 16*360);
+ p->setPen(cg.mid());
+ p->drawArc(br, 45*16, 180*16);
+ p->setPen(cg.light());
+ p->drawArc(br, 235*16, 180*16);
+
+ p->setPen(flags & Style_Down ? cg.mid() :
+ (flags & Style_Enabled ? cg.base() : cg.background()));
+ p->setBrush(flags & Style_Down ? cg.mid() :
+ (flags & Style_Enabled ? cg.base() : cg.background()));
+ p->drawEllipse(cr);
+
+ if (flags & Style_On) {
+ p->setBrush(cg.text());
+ p->drawEllipse(ir);
+ }
+
+ break;
+ }
+
+ case PE_DockWindowHandle:
+ {
+ TQString title;
+ bool drawTitle = false;
+ if ( p && p->device()->devType() == TQInternal::Widget ) {
+ TQWidget *w = (TQWidget *) p->device();
+ TQWidget *p = w->parentWidget();
+ if (p->inherits(TQDOCKWINDOW_OBJECT_NAME_STRING) && ! p->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) {
+ drawTitle = true;
+ title = p->caption();
+ }
+ }
+
+ flags |= Style_Raised;
+ if (flags & Style_Horizontal) {
+ if (drawTitle) {
+ TQPixmap pm(r.height(), r.width());
+ TQPainter p2(&pm);
+ p2.fillRect(0, 0, pm.width(), pm.height(),
+ cg.brush(TQColorGroup::Highlight));
+ p2.setPen(cg.highlightedText());
+ p2.drawText(0, 0, pm.width(), pm.height(), AlignCenter, title);
+ p2.end();
+
+ TQWMatrix m;
+ m.rotate(270.0);
+ pm = pm.xForm(m);
+ p->drawPixmap(r.x(), r.y(), pm);
+ } else {
+ p->fillRect(r, cg.background());
+ p->setPen(cg.mid().dark());
+ p->drawLine(r.right() - 6, r.top() + 2,
+ r.right() - 6, r.bottom() - 2);
+ p->drawLine(r.right() - 3, r.top() + 2,
+ r.right() - 3, r.bottom() - 2);
+ p->setPen(cg.light());
+ p->drawLine(r.right() - 5, r.top() + 2,
+ r.right() - 5, r.bottom() - 2);
+ p->drawLine(r.right() - 2, r.top() + 2,
+ r.right() - 2, r.bottom() - 2);
+ }
+ } else {
+ if (drawTitle) {
+ p->fillRect(r, cg.brush(TQColorGroup::Highlight));
+ p->setPen(cg.highlightedText());
+ p->drawText(r, AlignCenter, title);
+ } else {
+ p->fillRect(r, cg.background());
+ p->setPen(cg.mid().dark());
+ p->drawLine(r.left() + 2, r.bottom() - 6,
+ r.right() - 2, r.bottom() - 6);
+ p->drawLine(r.left() + 2, r.bottom() - 3,
+ r.right() - 2, r.bottom() - 3);
+ p->setPen(cg.light());
+ p->drawLine(r.left() + 2, r.bottom() - 5,
+ r.right() - 2, r.bottom() - 5);
+ p->drawLine(r.left() + 2, r.bottom() - 2,
+ r.right() - 2, r.bottom() - 2);
+ }
+ }
+ break;
+ }
+
+ case PE_DockWindowSeparator:
+ {
+ if (r.width() > 20 || r.height() > 20) {
+ if (flags & Style_Horizontal) {
+ p->setPen(cg.mid().dark(120));
+ p->drawLine(r.left() + 1, r.top() + 6, r.left() + 1, r.bottom() - 6);
+ p->setPen(cg.light());
+ p->drawLine(r.left() + 2, r.top() + 6, r.left() + 2, r.bottom() - 6);
+ } else {
+ p->setPen(cg.mid().dark(120));
+ p->drawLine(r.left() + 6, r.top() + 1, r.right() - 6, r.top() + 1);
+ p->setPen(cg.light());
+ p->drawLine(r.left() + 6, r.top() + 2, r.right() - 6, r.top() + 2);
+ }
+ } else
+ TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
+ break;
+ }
+
+ case PE_Splitter:
+ if (flags & Style_Horizontal)
+ flags &= ~Style_Horizontal;
+ else
+ flags |= Style_Horizontal;
+ // fall through intended
+
+ case PE_DockWindowResizeHandle:
+ {
+ p->fillRect(r, cg.background());
+ if (flags & Style_Horizontal) {
+ p->setPen(cg.highlight().light());
+ p->drawLine(r.left() + 1, r.top() + 1, r.right() - 1, r.top() + 1);
+ p->setPen(cg.highlight());
+ p->drawLine(r.left() + 1, r.top() + 2, r.right() - 1, r.top() + 2);
+ p->setPen(cg.highlight().dark());
+ p->drawLine(r.left() + 1, r.top() + 3, r.right() - 1, r.top() + 3);
+ } else {
+ p->setPen(cg.highlight().light());
+ p->drawLine(r.left() + 1, r.top() + 1, r.left() + 1, r.bottom() - 1);
+ p->setPen(cg.highlight());
+ p->drawLine(r.left() + 2, r.top() + 1, r.left() + 2, r.bottom() - 1);
+ p->setPen(cg.highlight().dark());
+ p->drawLine(r.left() + 3, r.top() + 1, r.left() + 3, r.bottom() - 1);
+ }
+ break;
+ }
+
+ case PE_Panel:
+ case PE_PanelPopup:
+ case PE_PanelLineEdit:
+ case PE_PanelTabWidget:
+ case PE_WindowFrame:
+ {
+ int lw = data.isDefault() ?
+ pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) : data.lineWidth();
+
+ if ( ! ( flags & Style_Sunken ) )
+ flags |= Style_Raised;
+ if (lw == 2)
+ drawLightBevel(p, r, cg, flags);
+ else
+ TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
+ break;
+ }
+
+ case PE_PanelDockWindow:
+ {
+ int lw = data.isDefault() ?
+ pixelMetric(PM_DockWindowFrameWidth, ceData, elementFlags) : data.lineWidth();
+
+ if (lw == 2)
+ drawLightBevel(p, r, cg, flags | Style_Raised,
+ &cg.brush(TQColorGroup::Button));
+ else
+ TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
+ break;
+ }
+
+ case PE_PanelMenuBar:
+ {
+ int lw = data.isDefault() ?
+ pixelMetric(PM_MenuBarFrameWidth, ceData, elementFlags) : data.lineWidth();
+
+ if (lw == 2)
+ drawLightBevel(p, r, cg, flags, &cg.brush(TQColorGroup::Button));
+ else
+ TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
+ break;
+ }
+
+ case PE_ScrollBarSubLine:
+ {
+ TQRect fr = r, ar = r;
+ TQ_PrimitiveElement pe;
+
+ p->setPen(cg.dark());
+ if (flags & Style_Horizontal) {
+ p->drawLine(r.topLeft(), r.topRight());
+ fr.addCoords(0, 1, 0, 0);
+ ar.addCoords(0, 1, 0, 0);
+ pe = PE_ArrowLeft;
+ } else {
+ p->drawLine(r.topLeft(), r.bottomLeft());
+ fr.addCoords(1, 0, 0, 0);
+ ar.addCoords(2, 0, 0, 0);
+ pe = PE_ArrowUp;
+ }
+
+ p->fillRect(fr, cg.brush((flags & Style_Down) ?
+ TQColorGroup::Midlight :
+ TQColorGroup::Background));
+ drawPrimitive(pe, p, ceData, elementFlags, ar, cg, flags);
+ break;
+ }
+
+ case PE_ScrollBarAddLine:
+ {
+ TQRect fr = r, ar = r;
+ TQ_PrimitiveElement pe;
+
+ p->setPen(cg.dark());
+ if (flags & Style_Horizontal) {
+ p->drawLine(r.topLeft(), r.topRight());
+ fr.addCoords(0, 1, 0, 0);
+ ar.addCoords(0, 1, 0, 0);
+ pe = PE_ArrowRight;
+ } else {
+ p->drawLine(r.topLeft(), r.bottomLeft());
+ fr.addCoords(1, 0, 0, 0);
+ ar.addCoords(2, 0, 0, 0);
+ pe = PE_ArrowDown;
+ }
+
+ p->fillRect(fr, cg.brush((flags & Style_Down) ?
+ TQColorGroup::Midlight :
+ TQColorGroup::Background));
+ drawPrimitive(pe, p, ceData, elementFlags, ar, cg, flags);
+ break;
+ }
+
+ case PE_ScrollBarSubPage:
+ case PE_ScrollBarAddPage:
+ {
+ TQRect fr = r;
+
+ p->setPen(cg.dark());
+ if (flags & Style_Horizontal) {
+ p->drawLine(r.topLeft(), r.topRight());
+ p->setPen(cg.background());
+ p->drawLine(r.left(), r.top() + 1, r.right(), r.top() + 1);
+ p->drawLine(r.left(), r.bottom(), r.right(), r.bottom());
+ fr.addCoords(0, 2, 0, -1);
+ } else {
+ p->drawLine(r.topLeft(), r.bottomLeft());
+ p->setPen(cg.background());
+ p->drawLine(r.left() + 1, r.top(), r.left() + 1, r.bottom());
+ fr.addCoords(2, 0, 0, 0);
+ }
+
+ p->fillRect(fr, cg.brush((flags & Style_Down) ?
+ TQColorGroup::Midlight :
+ TQColorGroup::Mid));
+ break;
+ }
+
+ case PE_ScrollBarSlider:
+ {
+ TQRect fr = r;
+
+ p->setPen(cg.dark());
+ if (flags & Style_Horizontal) {
+ p->drawLine(r.topLeft(), r.topRight());
+ p->setPen(cg.background());
+ p->drawLine(r.left(), r.bottom(), r.right(), r.bottom());
+ p->drawLine(r.left(), r.top() + 1, r.right(), r.top() + 1);
+ fr.addCoords(0, 2, 0, -1);
+ } else {
+ p->drawLine(r.topLeft(), r.bottomLeft());
+ p->setPen(cg.background());
+ p->drawLine(r.right(), r.top(), r.right(), r.bottom());
+ p->drawLine(r.left() + 1, r.top(), r.left() + 1, r.bottom());
+ fr.addCoords(2, 0, -1, 0);
+ }
+
+ drawLightBevel(p, fr, cg, ((flags | Style_Down) ^ Style_Down) |
+ ((flags & Style_Enabled) ? Style_Raised : Style_Default),
+ &cg.brush(TQColorGroup::Button));
+ break;
+ }
+
+ case PE_FocusRect:
+ {
+ p->setBrush(NoBrush);
+ if (flags & Style_FocusAtBorder)
+ p->setPen(cg.shadow());
+ else
+ p->setPen(cg.dark());
+ p->drawRect(r);
+ break;
+ }
+
+ case PE_ProgressBarChunk:
+ p->fillRect(r.x(), r.y() + 2, r.width(), r.height() - 4, cg.highlight());
+ break;
+
+ case PE_MenuItemIndicatorFrame:
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL);
+ TQRect cr(r.left(), r.top(), checkcol, r.height());
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ }
+ qDrawShadePanel(p, cr, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
+ }
+ break;
+ case PE_MenuItemIndicatorCheck:
+ {
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL);
+ TQRect cr(r.left(), r.top(), checkcol, r.height());
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ }
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, (flags & Style_Enabled) | Style_On);
+ }
+ break;
+
+ default:
+ if (pe == PE_HeaderArrow) {
+ if (flags & Style_Down)
+ pe = PE_ArrowDown;
+ else
+ pe = PE_ArrowUp;
+ }
+
+
+ if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) {
+ TQPointArray a;
+
+ switch ( pe ) {
+ case PE_ArrowUp:
+ a.setPoints( 7, -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2 );
+ break;
+
+ case PE_ArrowDown:
+ a.setPoints( 7, -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1 );
+ break;
+
+ case PE_ArrowRight:
+ a.setPoints( 7, -2,-3, -2,3, -1,-2, -1,2, 0,-1, 0,1, 1,0 );
+ break;
+
+ case PE_ArrowLeft:
+ a.setPoints( 7, 0,-3, 0,3, -1,-2, -1,2, -2,-1, -2,1, -3,0 );
+ break;
+
+ default:
+ break;
+ }
+
+ if (a.isNull())
+ return;
+
+ p->save();
+ if ( flags & Style_Enabled ) {
+ a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
+ p->setPen( cg.buttonText() );
+ p->drawLineSegments( a, 0, 3 ); // draw arrow
+ p->drawPoint( a[6] );
+ } else {
+ a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 );
+ p->setPen( cg.light() );
+ p->drawLineSegments( a, 0, 3 ); // draw arrow
+ p->drawPoint( a[6] );
+ a.translate( -1, -1 );
+ p->setPen( cg.mid() );
+ p->drawLineSegments( a, 0, 3 ); // draw arrow
+ p->drawPoint( a[6] );
+ }
+ p->restore();
+ } else
+ TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
+ break;
+ }
+}
+
+void LightStyleV2::drawControl( TQ_ControlElement control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ switch (control) {
+ case CE_TabBarTab:
+ {
+ bool below = false;
+ TQRect tr(r);
+ TQRect fr(r);
+
+ tr.addCoords(0, 0, 0, -1);
+ fr.addCoords(2, 2, -2, -2);
+
+ if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow || ceData.tabBarData.shape == TQTabBar::TriangularBelow) {
+ tr = r; tr.addCoords(0, 1, 0, 0);
+ fr = r; fr.addCoords(2, 2,-2, -4);
+ below = true;
+ }
+
+ if (! (flags & Style_Selected)) {
+ if (below) {
+ tr.addCoords(0, 0, 0, -1);
+ tr.addCoords(0, 0, 0, -1);
+ } else {
+ tr.addCoords(0, 1, 0, 0);
+ fr.addCoords(0, 1, 0, 0);
+ }
+
+ p->setPen(cg.dark());
+ p->drawRect(tr);
+
+ if (tr.left() == 0)
+ if (below)
+ p->drawPoint(tr.left(), tr.top() - 1);
+ else
+ p->drawPoint(tr.left(), tr.bottom() + 1);
+
+ p->setPen(cg.light());
+ if (below) {
+ p->drawLine(tr.left() + 1, tr.top() + 1,
+ tr.left() + 1, tr.bottom() - 2);
+ p->drawLine(tr.left() + 1, tr.bottom() - 1,
+ tr.right() - 1, tr.bottom() - 1);
+ } else {
+ p->drawLine(tr.left() + 1, tr.bottom() - 1,
+ tr.left() + 1, tr.top() + 2);
+ p->drawLine(tr.left() + 1, tr.top() + 1,
+ tr.right() - 1, tr.top() + 1);
+ }
+
+ if (below) {
+ if (tr.left() == 0)
+ p->drawLine(tr.left() + 1, tr.top() - 1,
+ tr.right(), tr.top() - 1);
+ else
+ {
+ p->setPen(cg.mid()); //To match lower border of the frame
+ p->drawLine(tr.left(), tr.top() - 1,
+ tr.right(), tr.top() - 1);
+ }
+ } else {
+ if (tr.left() == 0)
+ p->drawLine(tr.left() + 1, tr.bottom() + 1,
+ tr.right(), tr.bottom() + 1);
+ else
+ p->drawLine(tr.left(), tr.bottom() + 1,
+ tr.right(), tr.bottom() + 1);
+ }
+
+ p->setPen(cg.mid());
+
+ if (below) {
+ p->drawLine(tr.right() - 1, tr.bottom() - 2,
+ tr.right() - 1, tr.top() + 1);
+ } else {
+ p->drawLine(tr.right() - 1, tr.top() + 2,
+ tr.right() - 1, tr.bottom() - 1);
+ }
+ } else {
+ p->setPen(cg.dark());
+ if (tr.left() == 0)
+ if (below)
+ p->drawLine(tr.left(), tr.top() - 1,
+ tr.left(), tr.bottom() - 1);
+ else
+ p->drawLine(tr.left(), tr.bottom() + 1,
+ tr.left(), tr.top() + 1);
+ else
+ if (below)
+ p->drawLine(tr.left(), tr.bottom(),
+ tr.left(), tr.top() + 1);
+ else
+ p->drawLine(tr.left(), tr.bottom(),
+ tr.left(), tr.top() + 1);
+
+ if (below) {
+ p->drawLine(tr.left(), tr.bottom(),
+ tr.right(), tr.bottom());
+ p->drawLine(tr.right(), tr.bottom() - 1,
+ tr.right(), tr.top());
+
+ } else {
+ p->drawLine(tr.left(), tr.top(),
+ tr.right(), tr.top());
+ p->drawLine(tr.right(), tr.top() + 1,
+ tr.right(), tr.bottom());
+ }
+
+ p->setPen(cg.light());
+ if (tr.left() == 0)
+ if (below)
+ p->drawLine(tr.left() + 1, tr.top() - 2,
+ tr.left() + 1, tr.bottom() - 2);
+ else
+ p->drawLine(tr.left() + 1, tr.bottom() + 2,
+ tr.left() + 1, tr.top() + 2);
+ else {
+ if (below) {
+ p->drawLine(tr.left() + 1, tr.top(),
+ tr.left() + 1, tr.bottom() - 2);
+ p->drawPoint(tr.left(), tr.top() - 1);
+
+ } else {
+ p->drawLine(tr.left() + 1, tr.bottom(),
+ tr.left() + 1, tr.top() + 2);
+ p->drawPoint(tr.left(), tr.bottom() + 1);
+ }
+ }
+
+ if (below) {
+ p->drawLine(tr.left() + 1, tr.bottom() - 1,
+ tr.right() - 1, tr.bottom() - 1);
+ p->drawPoint(tr.right(), tr.top() - 1);
+
+ p->setPen(cg.mid());
+ p->drawLine(tr.right() - 1, tr.bottom() - 2,
+ tr.right() - 1, tr.top());
+ } else {
+ p->drawLine(tr.left() + 1, tr.top() + 1,
+ tr.right() - 1, tr.top() + 1);
+ p->drawPoint(tr.right(), tr.bottom() + 1);
+
+ p->setPen(cg.mid());
+ p->drawLine(tr.right() - 1, tr.top() + 2,
+ tr.right() - 1, tr.bottom());
+ }
+ }
+
+ p->fillRect(fr, ((flags & Style_Selected) ?
+ cg.background() : cg.mid()));
+ break;
+ }
+
+ case CE_PopupMenuItem:
+ {
+ if (data.isDefault())
+ break;
+
+ TQMenuItem *mi = data.menuItem();
+ int tab = data.tabWidth();
+ int maxpmw = data.maxIconWidth();
+
+ if ( mi && mi->isSeparator() ) {
+ // draw separator (bg first, though)
+ if ( !ceData.bgPixmap.isNull() )
+ p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
+ else
+ p->fillRect(r, cg.brush(TQColorGroup::Button));
+
+ p->setPen(cg.mid().dark(120));
+ p->drawLine(r.left() + 12, r.top() + 1,
+ r.right() - 12, r.top() + 1);
+ p->setPen(cg.light());
+ p->drawLine(r.left() + 12, r.top() + 2,
+ r.right() - 12, r.top() + 2);
+ break;
+ }
+
+ if (flags & Style_Active)
+ qDrawShadePanel(p, r, cg, true, 1,
+ &cg.brush(TQColorGroup::Midlight));
+ else if ( !ceData.bgPixmap.isNull() )
+ p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
+ else
+ p->fillRect(r, cg.brush(TQColorGroup::Button));
+
+ if ( !mi )
+ break;
+
+ maxpmw = QMAX(maxpmw, 16);
+
+ TQRect cr, ir, tr, sr;
+ // check column
+ cr.setRect(r.left(), r.top(), maxpmw, r.height());
+ // submenu indicator column
+ sr.setCoords(r.right() - maxpmw, r.top(), r.right(), r.bottom());
+ // tab/accelerator column
+ tr.setCoords(sr.left() - tab - 4, r.top(), sr.left(), r.bottom());
+ // item column
+ ir.setCoords(cr.right() + 4, r.top(), tr.right() - 4, r.bottom());
+
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ sr = visualRect( sr, r );
+ tr = visualRect( tr, r );
+ ir = visualRect( ir, r );
+ }
+
+ if (mi->isChecked() &&
+ ! (flags & Style_Active) &
+ (flags & Style_Enabled))
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, data);
+
+ if (mi->iconSet()) {
+ TQIconSet::Mode mode =
+ (flags & Style_Enabled) ? TQIconSet::Normal : TQIconSet::Disabled;
+ if ((flags & Style_Active) && (flags & Style_Enabled))
+ mode = TQIconSet::Active;
+ TQPixmap pixmap;
+ if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
+ pixmap =
+ mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On );
+ else
+ pixmap =
+ mi->iconSet()->pixmap( TQIconSet::Small, mode );
+ TQRect pmr(TQPoint(0, 0), pixmap.size());
+ pmr.moveCenter(cr.center());
+ p->setPen(cg.text());
+ p->drawPixmap(pmr.topLeft(), pixmap);
+ } else if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, data);
+
+ TQColor textcolor;
+ TQColor embosscolor;
+ if (flags & Style_Active) {
+ if (! (flags & Style_Enabled))
+ textcolor = cg.midlight().dark();
+ else
+ textcolor = cg.buttonText();
+ embosscolor = cg.midlight().light();
+ } else if (! (flags & Style_Enabled)) {
+ textcolor = cg.text();
+ embosscolor = cg.light();
+ } else
+ textcolor = embosscolor = cg.buttonText();
+ p->setPen(textcolor);
+
+ if (mi->custom()) {
+ p->save();
+ if (! (flags & Style_Enabled)) {
+ p->setPen(cg.light());
+ mi->custom()->paint(p, cg, flags & Style_Active,
+ flags & Style_Enabled,
+ ir.x() + 1, ir.y() + 1,
+ ir.width() - 1, ir.height() - 1);
+ p->setPen(textcolor);
+ }
+ mi->custom()->paint(p, cg, flags & Style_Active,
+ flags & Style_Enabled,
+ ir.x(), ir.y(),
+ ir.width(), ir.height());
+ p->restore();
+ }
+
+ TQString text = mi->text();
+ if (! text.isNull()) {
+ int t = text.find('\t');
+
+ // draw accelerator/tab-text
+ if (t >= 0) {
+ int alignFlag = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ alignFlag |= ( reverse ? AlignLeft : AlignRight );
+ if (! (flags & Style_Enabled)) {
+ p->setPen(embosscolor);
+ tr.moveBy(1, 1);
+ p->drawText(tr, alignFlag, text.mid(t + 1));
+ tr.moveBy(-1, -1);
+ p->setPen(textcolor);
+ }
+
+ p->drawText(tr, alignFlag, text.mid(t + 1));
+ }
+
+ int alignFlag = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ alignFlag |= ( reverse ? AlignRight : AlignLeft );
+
+ if (! (flags & Style_Enabled)) {
+ p->setPen(embosscolor);
+ ir.moveBy(1, 1);
+ p->drawText(ir, alignFlag, text, t);
+ ir.moveBy(-1, -1);
+ p->setPen(textcolor);
+ }
+
+ p->drawText(ir, alignFlag, text, t);
+ } else if (mi->pixmap()) {
+ TQPixmap pixmap = *mi->pixmap();
+ if (pixmap.depth() == 1)
+ p->setBackgroundMode(Qt::OpaqueMode);
+ p->drawPixmap(ir.x(), ir.y() + (ir.height() - pixmap.height()) / 2, pixmap);
+ if (pixmap.depth() == 1)
+ p->setBackgroundMode(Qt::TransparentMode);
+ }
+
+ if (mi->popup())
+ drawPrimitive( (reverse ? PE_ArrowLeft : PE_ArrowRight), p, ceData, elementFlags, sr, cg, flags);
+ break;
+ }
+
+ case CE_MenuBarEmptyArea:
+ {
+ p->fillRect(r, cg.brush(TQColorGroup::Button));
+ break;
+ }
+
+ case CE_DockWindowEmptyArea:
+ {
+ p->fillRect(r, cg.brush(TQColorGroup::Button));
+ break;
+ }
+
+
+ case CE_MenuBarItem:
+ {
+ if (flags & Style_Active)
+ qDrawShadePanel(p, r, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
+ else
+ p->fillRect(r, cg.brush(TQColorGroup::Button));
+
+ if (data.isDefault())
+ break;
+
+ TQMenuItem *mi = data.menuItem();
+ drawItem(p, r, AlignCenter | ShowPrefix | DontClip | SingleLine, cg,
+ flags & Style_Enabled, mi->pixmap(), mi->text(), -1,
+ &cg.buttonText());
+ break;
+ }
+
+ case CE_ProgressBarGroove:
+ drawLightBevel(p, r, cg, Style_Sunken, &cg.brush(TQColorGroup::Background));
+ break;
+
+ default:
+ TQCommonStyle::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget);
+ break;
+ }
+}
+
+void LightStyleV2::drawControlMask( TQ_ControlElement control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ switch (control) {
+ case CE_PushButton:
+ p->fillRect(r, color1);
+ break;
+
+ default:
+ TQCommonStyle::drawControlMask(control, p, ceData, elementFlags, r, data, widget);
+ break;
+ }
+}
+
+TQRect LightStyleV2::subRect(SubRect subrect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ TQRect rect, wrect(ceData.rect);
+
+ switch (subrect) {
+ case SR_PushButtonFocusRect:
+ {
+ int dbw1 = 0, dbw2 = 0;
+ if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) {
+ dbw1 = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
+ dbw2 = dbw1 * 2;
+ }
+
+ rect.setRect(wrect.x() + 3 + dbw1,
+ wrect.y() + 3 + dbw1,
+ wrect.width() - 6 - dbw2,
+ wrect.height() - 6 - dbw2);
+ break;
+ }
+
+ default:
+ rect = TQCommonStyle::subRect(subrect, ceData, elementFlags, widget);
+ }
+
+ return rect;
+}
+
+void LightStyleV2::drawComplexControl( TQ_ComplexControl control,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect& r,
+ const TQColorGroup& cg,
+ SFlags flags,
+ SCFlags controls,
+ SCFlags active,
+ const TQStyleOption &data,
+ const TQWidget* widget ) const
+{
+ switch (control) {
+ case CC_ComboBox:
+ {
+ const TQComboBox *combobox = (const TQComboBox *) widget;
+ TQRect frame, arrow, field;
+ frame =
+ TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxFrame, data, widget),
+ ceData, elementFlags);
+ arrow =
+ TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxArrow, data, widget),
+ ceData, elementFlags);
+ field =
+ TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxEditField, data, widget),
+ ceData, elementFlags);
+
+ if ((controls & SC_ComboBoxFrame) && frame.isValid())
+ drawLightBevel(p, frame, cg, flags | Style_Raised,
+ &cg.brush(TQColorGroup::Button));
+
+ if ((controls & SC_ComboBoxArrow) && arrow.isValid()) {
+ if (active == SC_ComboBoxArrow)
+ p->fillRect(arrow, cg.brush(TQColorGroup::Mid));
+ arrow.addCoords(4, 2, -2, -2);
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags);
+ }
+
+ if ((controls & SC_ComboBoxEditField) && field.isValid()) {
+ p->setPen(cg.dark());
+ if (elementFlags & CEF_IsEditable) {
+ field.addCoords(-1, -1, 1, 1);
+ p->drawRect(field);
+ } else
+ p->drawLine(field.right() + 1, field.top(),
+ field.right() + 1, field.bottom());
+
+ if (flags & Style_HasFocus) {
+ if (! (elementFlags & CEF_IsEditable)) {
+ p->fillRect( field, cg.brush( TQColorGroup::Highlight ) );
+ TQRect fr =
+ TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ),
+ ceData, elementFlags );
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg,
+ flags | Style_FocusAtBorder,
+ TQStyleOption(cg.highlight()));
+ }
+
+ p->setPen(cg.highlightedText());
+ } else
+ p->setPen(cg.buttonText());
+ }
+
+ break;
+ }
+
+ case CC_SpinWidget:
+ {
+ const TQSpinWidget *spinwidget = (const TQSpinWidget *) widget;
+ TQRect frame, up, down;
+
+ frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags,
+ SC_SpinWidgetFrame, data, widget);
+ up = ceData.spinWidgetData.upRect;
+ down = ceData.spinWidgetData.downRect;
+
+ if ((controls & SC_SpinWidgetFrame) && frame.isValid())
+ drawLightBevel(p, frame, cg, flags | Style_Sunken,
+ &cg.brush(TQColorGroup::Base));
+
+ if ((controls & SC_SpinWidgetUp) && up.isValid()) {
+ TQ_PrimitiveElement pe = PE_SpinWidgetUp;
+ if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus )
+ pe = PE_SpinWidgetPlus;
+
+ p->setPen(cg.dark());
+ p->drawLine(up.topLeft(), up.bottomLeft());
+
+ up.addCoords(1, 0, 0, 0);
+ p->fillRect(up, cg.brush(TQColorGroup::Button));
+ if (active == SC_SpinWidgetUp)
+ p->setPen(cg.mid());
+ else
+ p->setPen(cg.light());
+ p->drawLine(up.left(), up.top(),
+ up.right() - 1, up.top());
+ p->drawLine(up.left(), up.top() + 1,
+ up.left(), up.bottom() - 1);
+ if (active == SC_SpinWidgetUp)
+ p->setPen(cg.light());
+ else
+ p->setPen(cg.mid());
+ p->drawLine(up.right(), up.top(),
+ up.right(), up.bottom());
+ p->drawLine(up.left(), up.bottom(),
+ up.right() - 1, up.bottom());
+
+ up.addCoords(1, 0, 0, 0);
+ drawPrimitive(pe, p, ceData, elementFlags, up, cg, flags |
+ ((active == SC_SpinWidgetUp) ?
+ Style_On | Style_Sunken : Style_Raised));
+ }
+
+ if ((controls & SC_SpinWidgetDown) && down.isValid()) {
+ TQ_PrimitiveElement pe = PE_SpinWidgetDown;
+ if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus )
+ pe = PE_SpinWidgetMinus;
+
+ p->setPen(cg.dark());
+ p->drawLine(down.topLeft(), down.bottomLeft());
+
+ down.addCoords(1, 0, 0, 0);
+ p->fillRect(down, cg.brush(TQColorGroup::Button));
+ if (active == SC_SpinWidgetDown)
+ p->setPen(cg.mid());
+ else
+ p->setPen(cg.light());
+ p->drawLine(down.left(), down.top(),
+ down.right() - 1, down.top());
+ p->drawLine(down.left(), down.top() + 1,
+ down.left(), down.bottom() - 1);
+ if (active == SC_SpinWidgetDown)
+ p->setPen(cg.light());
+ else
+ p->setPen(cg.mid());
+ p->drawLine(down.right(), down.top(),
+ down.right(), down.bottom());
+ p->drawLine(down.left(), down.bottom(),
+ down.right() - 1, down.bottom());
+
+ down.addCoords(1, 0, 0, 0);
+ drawPrimitive(pe, p, ceData, elementFlags, down, cg, flags |
+ ((active == SC_SpinWidgetDown) ?
+ Style_On | Style_Sunken : Style_Raised));
+ }
+
+ break;
+ }
+
+ case CC_ScrollBar:
+ {
+ TQRect addline, subline, subline2, addpage, subpage, slider, first, last;
+ bool maxedOut = (ceData.minSteps == ceData.maxSteps);
+
+ subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, data, widget);
+ addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, data, widget);
+ subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, data, widget);
+ addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, data, widget);
+ slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, data, widget);
+ first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, data, widget);
+ last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, data, widget);
+
+ subline2 = addline;
+ if (ceData.orientation == TQt::Horizontal)
+ subline2.moveBy(-addline.width(), 0);
+ else
+ subline2.moveBy(0, -addline.height());
+
+ if ((controls & SC_ScrollBarSubLine) && subline.isValid()) {
+ drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
+ Style_Enabled | ((active == SC_ScrollBarSubLine) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+
+ if (subline2.isValid())
+ drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg,
+ Style_Enabled | ((active == SC_ScrollBarSubLine) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ }
+ if ((controls & SC_ScrollBarAddLine) && addline.isValid())
+ drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg,
+ Style_Enabled | ((active == SC_ScrollBarAddLine) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
+ drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg,
+ Style_Enabled | ((active == SC_ScrollBarSubPage) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarAddPage) && addpage.isValid())
+ drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg,
+ ((maxedOut) ? Style_Default : Style_Enabled) |
+ ((active == SC_ScrollBarAddPage) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarFirst) && first.isValid())
+ drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg,
+ Style_Enabled | ((active == SC_ScrollBarFirst) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarLast) && last.isValid())
+ drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg,
+ Style_Enabled | ((active == SC_ScrollBarLast) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarSlider) && slider.isValid()) {
+ drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
+ Style_Enabled | ((active == SC_ScrollBarSlider) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+
+ // ### perhaps this should not be able to accept focus if maxedOut?
+ if (elementFlags & CEF_HasFocus) {
+ TQRect fr(slider.x() + 2, slider.y() + 2,
+ slider.width() - 5, slider.height() - 5);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default);
+ }
+ }
+
+ break;
+ }
+
+ case CC_Slider:
+ {
+ TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
+ data, widget),
+ handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
+ data, widget);
+
+ if ((controls & SC_SliderGroove) && groove.isValid()) {
+ if (flags & Style_HasFocus)
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg );
+
+ if (ceData.orientation == TQt::Horizontal) {
+ int dh = (groove.height() - 5) / 2;
+ groove.addCoords(0, dh, 0, -dh);
+ } else {
+ int dw = (groove.width() - 5) / 2;
+ groove.addCoords(dw, 0, -dw, 0);
+ }
+
+ drawLightBevel(p, groove, cg, ((flags | Style_Raised) ^ Style_Raised) |
+ ((flags & Style_Enabled) ? Style_Sunken : Style_Default),
+ &cg.brush(TQColorGroup::Midlight));
+ }
+
+ if ((controls & SC_SliderHandle) && handle.isValid()) {
+ drawLightBevel(p, handle, cg, ((flags | Style_Down) ^ Style_Down) |
+ ((flags & Style_Enabled) ? Style_Raised : Style_Default),
+ &cg.brush(TQColorGroup::Button));
+
+ }
+
+ if (controls & SC_SliderTickmarks)
+ TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
+ SC_SliderTickmarks, active, data, widget );
+ break;
+ }
+
+ case CC_ListView:
+ // use the base style for CC_ListView
+ singleton->basestyle->drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
+ controls, active, data, widget);
+ break;
+
+ default:
+ TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
+ controls, active, data, widget);
+ break;
+ }
+}
+
+TQRect LightStyleV2::querySubControlMetrics( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl sc,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ TQRect ret;
+
+ switch (control) {
+ case CC_ScrollBar:
+ {
+ int sliderstart = ceData.startStep;
+ int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget);
+ int maxlen = ((ceData.orientation == TQt::Horizontal) ?
+ ceData.rect.width() : ceData.rect.height()) - (sbextent * 3);
+ int sliderlen;
+
+ // calculate slider length
+ if (ceData.maxSteps != ceData.minSteps) {
+ uint range = ceData.maxSteps - ceData.minSteps;
+ sliderlen = (ceData.pageStep * maxlen) /
+ (range + ceData.pageStep);
+
+ int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
+ if ( sliderlen < slidermin || range > INT_MAX / 2 )
+ sliderlen = slidermin;
+ if ( sliderlen > maxlen )
+ sliderlen = maxlen;
+ } else
+ sliderlen = maxlen;
+
+ switch (sc) {
+ case SC_ScrollBarSubLine:
+ // top/left button
+ ret.setRect(0, 0, sbextent, sbextent);
+ break;
+
+ case SC_ScrollBarAddLine:
+ // bottom/right button
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(ceData.rect.width() - sbextent, 0, sbextent, sbextent);
+ else
+ ret.setRect(0, ceData.rect.height() - sbextent, sbextent, sbextent);
+ break;
+
+ case SC_ScrollBarSubPage:
+ // between top/left button and slider
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(sbextent, 0, sliderstart - sbextent, sbextent);
+ else
+ ret.setRect(0, sbextent, sbextent, sliderstart - sbextent);
+ break;
+
+ case SC_ScrollBarAddPage:
+ // between bottom/right button and slider
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(sliderstart + sliderlen, 0,
+ maxlen - sliderstart - sliderlen + sbextent, sbextent);
+ else
+ ret.setRect(0, sliderstart + sliderlen,
+ sbextent, maxlen - sliderstart - sliderlen + sbextent);
+ break;
+
+ case SC_ScrollBarGroove:
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(sbextent, 0, ceData.rect.width() - sbextent * 3,
+ ceData.rect.height());
+ else
+ ret.setRect(0, sbextent, ceData.rect.width(),
+ ceData.rect.height() - sbextent * 3);
+ break;
+
+ case SC_ScrollBarSlider:
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(sliderstart, 0, sliderlen, sbextent);
+ else
+ ret.setRect(0, sliderstart, sbextent, sliderlen);
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+ }
+
+ default:
+ ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget);
+ break;
+ }
+
+ return ret;
+}
+
+TQStyle::SubControl LightStyleV2::querySubControl( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQPoint &pos,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ TQStyle::SubControl ret = TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, data, widget);
+
+ // this is an ugly hack, but i really don't care, it's the quickest way to
+ // enabled the third button
+ if (control == CC_ScrollBar &&
+ ret == SC_None)
+ ret = SC_ScrollBarSubLine;
+
+ return ret;
+}
+
+int LightStyleV2::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQWidget *widget ) const
+{
+ int ret;
+
+ switch (metric) {
+ case PM_ButtonMargin:
+ ret = 4;
+ break;
+
+ case PM_ButtonShiftHorizontal:
+ case PM_ButtonShiftVertical:
+ ret = 0;
+ break;
+
+ case PM_ButtonDefaultIndicator:
+ case PM_DefaultFrameWidth:
+ ret = 2;
+ break;
+
+ case PM_IndicatorWidth:
+ case PM_IndicatorHeight:
+ case PM_ExclusiveIndicatorWidth:
+ case PM_ExclusiveIndicatorHeight:
+ ret = 13;
+ break;
+
+ case PM_TabBarTabOverlap:
+ ret = 0;
+ break;
+
+ case PM_ScrollBarExtent:
+ case PM_ScrollBarSliderMin:
+ ret = 14;
+ break;
+
+ case PM_MenuBarFrameWidth:
+ ret = 1;
+ break;
+
+ case PM_ProgressBarChunkWidth:
+ ret = 1;
+ break;
+
+ case PM_DockWindowSeparatorExtent:
+ ret = 4;
+ break;
+
+ case PM_SplitterWidth:
+ ret = 6;
+ break;
+
+
+ case PM_SliderLength:
+ case PM_SliderControlThickness:
+ ret = singleton->basestyle->pixelMetric( metric, ceData, elementFlags, widget );
+ break;
+
+ case PM_MaximumDragDistance:
+ ret = -1;
+ break;
+
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ ret = 0;
+ break;
+
+ default:
+ ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
+ break;
+ }
+
+ return ret;
+}
+
+TQSize LightStyleV2::sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentsSize,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ TQSize ret;
+
+ switch (contents) {
+ case CT_PushButton:
+ {
+ const TQPushButton *button = (const TQPushButton *) widget;
+ ret = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, data, widget );
+ int w = ret.width(), h = ret.height();
+
+ // only expand the button if we are displaying text...
+ if ( ! button->text().isEmpty() ) {
+ if ( (elementFlags & CEF_IsDefault) || button->autoDefault() ) {
+ // default button minimum size
+ if ( w < 80 )
+ w = 80;
+ if ( h < 25 )
+ h = 25;
+ } else {
+ // regular button minimum size
+ if ( w < 76 )
+ w = 76;
+ if ( h < 21 )
+ h = 21;
+ }
+ }
+
+ ret = TQSize( w, h );
+ break;
+ }
+
+ case CT_PopupMenuItem:
+ {
+ if (data.isDefault())
+ break;
+
+ TQMenuItem *mi = data.menuItem();
+ int maxpmw = data.maxIconWidth();
+ int w = contentsSize.width(), h = contentsSize.height();
+
+ if (mi->custom()) {
+ w = mi->custom()->sizeHint().width();
+ h = mi->custom()->sizeHint().height();
+ if (! mi->custom()->fullSpan() && h < 22)
+ h = 22;
+ } else if(mi->widget()) {
+ } else if (mi->isSeparator()) {
+ w = 10;
+ h = 4;
+ } else {
+ // check is at least 16x16
+ if (h < 16)
+ h = 16;
+ if (mi->pixmap())
+ h = QMAX(h, mi->pixmap()->height());
+ else if (! mi->text().isNull())
+ h = QMAX(h, TQFontMetrics(ceData.font).height() + 2);
+ if (mi->iconSet() != 0)
+ h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small,
+ TQIconSet::Normal).height());
+ h += 2;
+ }
+
+ // check | 4 pixels | item | 8 pixels | accel | 4 pixels | check
+
+ // check is at least 16x16
+ maxpmw = QMAX(maxpmw, 16);
+ w += (maxpmw * 2) + 8;
+
+ if (! mi->text().isNull() && mi->text().find('\t') >= 0)
+ w += 8;
+
+ ret = TQSize(w, h);
+ break;
+ }
+ case CT_ProgressBar:
+ {
+ //If we have to display the indicator, and we do it on RHS, give some more room
+ //for it. This tries to match the logic and the spacing in SR_ProgressBarGroove/Contents
+ //sizing in TQCommonStyle.
+ if (ceData.percentageVisible &&
+ ((elementFlags & CEF_IndicatorFollowsStyle) || ! (elementFlags & CEF_CenterIndicator)))
+ {
+ int addw = TQFontMetrics(ceData.font).width("100%") + 6;
+ return TQSize(contentsSize.width() + addw, contentsSize.height());
+ }
+ else
+ return contentsSize; //Otherwise leave unchanged
+
+ break;
+ }
+
+ default:
+ ret = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget);
+ break;
+ }
+
+ return ret;
+}
+
+int LightStyleV2::styleHint( TQ_StyleHint stylehint,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption &option,
+ TQStyleHintReturn* returnData,
+ const TQWidget *widget ) const
+{
+ int ret;
+
+ switch (stylehint) {
+ case SH_EtchDisabledText:
+ case SH_Slider_SnapToValue:
+ case SH_PrintDialog_RightAlignButtons:
+ case SH_FontDialog_SelectAssociatedText:
+ case SH_MenuBar_AltKeyNavigation:
+ case SH_MenuBar_MouseTracking:
+ case SH_PopupMenu_MouseTracking:
+ case SH_ComboBox_ListMouseTracking:
+ case SH_ScrollBar_MiddleClickAbsolutePosition:
+ ret = 1;
+ break;
+
+ case SH_MainWindow_SpaceBelowMenuBar:
+ ret = 0;
+ break;
+
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int maxpmw = option.maxIconWidth();
+ maxpmw = QMAX(maxpmw, 16);
+
+ ret = maxpmw;
+ }
+ break;
+
+ default:
+ ret = TQCommonStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
+ break;
+ }
+
+ return ret;
+}
+
+TQPixmap LightStyleV2::stylePixmap( StylePixmap stylepixmap,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ return singleton->basestyle->stylePixmap( stylepixmap, ceData, elementFlags, data, widget );
+}
+#include "lightstyle-v2.moc"
diff --git a/tdestyles/light/lightstyle-v2.h b/tdestyles/light/lightstyle-v2.h
new file mode 100644
index 000000000..90b3e89c9
--- /dev/null
+++ b/tdestyles/light/lightstyle-v2.h
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2000-2001 Trolltech AS (info@trolltech.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef LIGHTSTYLE_V2_H
+#define LIGHTSTYLE_V2_H
+
+
+#include <tdestyle.h>
+
+
+#ifdef QT_PLUGIN
+# define Q_EXPORT_STYLE_LIGHT_V2
+#else
+# define Q_EXPORT_STYLE_LIGHT_V2 Q_EXPORT
+#endif // QT_PLUGIN
+
+
+class Q_EXPORT_STYLE_LIGHT_V2 LightStyleV2 : public TDEStyle
+{
+ Q_OBJECT
+
+public:
+ LightStyleV2();
+ virtual ~LightStyleV2();
+
+ void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr );
+
+ void drawPrimitive(TQ_PrimitiveElement, TQPainter *, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &,
+ SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default ) const;
+
+ void drawControl(TQ_ControlElement, TQPainter *, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &,
+ const TQColorGroup &, SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
+ void drawControlMask(TQ_ControlElement, TQPainter *, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0) const;
+
+ TQRect subRect(SubRect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *) const;
+
+ void drawComplexControl(TQ_ComplexControl, TQPainter *, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &,
+ const TQColorGroup &, SFlags = Style_Default,
+ SCFlags = SC_All, SCFlags = SC_None,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
+
+ TQRect querySubControlMetrics(TQ_ComplexControl, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, SubControl,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
+
+ SubControl querySubControl(TQ_ComplexControl, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQPoint &,
+ const TQStyleOption &data = TQStyleOption::Default, const TQWidget * = 0 ) const;
+
+ int pixelMetric(PixelMetric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const;
+
+ TQSize sizeFromContents(ContentsType, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQSize &,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 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& = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const;
+};
+
+
+#endif // LIGHTSTYLE_V2_H
diff --git a/tdestyles/light/lightstyle-v3.cpp b/tdestyles/light/lightstyle-v3.cpp
new file mode 100644
index 000000000..735bd3169
--- /dev/null
+++ b/tdestyles/light/lightstyle-v3.cpp
@@ -0,0 +1,1912 @@
+/*
+ Copyright (c) 2000-2001 Trolltech AS (info@trolltech.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include "lightstyle-v3.h"
+
+#include "tqmenubar.h"
+#include "tqapplication.h"
+#include "tqcheckbox.h"
+#include "tqpainter.h"
+#include "tqpalette.h"
+#include "tqframe.h"
+#include "tqpushbutton.h"
+#include "tqdrawutil.h"
+#include "tqprogressbar.h"
+#include "tqscrollbar.h"
+#include "tqtabbar.h"
+#include "tqguardedptr.h"
+#include "tqlayout.h"
+#include "tqlineedit.h"
+#include "tqimage.h"
+#include "tqcombobox.h"
+#include "tqslider.h"
+#include "tqstylefactory.h"
+
+
+// The Light Style, 3rd revision
+
+LightStyleV3::LightStyleV3()
+ : TDEStyle(AllowMenuTransparency)
+{
+ basestyle = TQStyleFactory::create( "Windows" );
+ if ( ! basestyle )
+ basestyle = TQStyleFactory::create( TQStyleFactory::keys().first() );
+ if ( ! basestyle )
+ tqFatal( "LightStyle: couldn't find a basestyle!" );
+}
+
+LightStyleV3::~LightStyleV3()
+{
+ delete basestyle;
+}
+
+void LightStyleV3::polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr )
+{
+ TDEStyle::polishPopupMenu(ceData, elementFlags, ptr);
+ // empty to satisy pure virtual requirements
+}
+
+/*
+ A LightBevel looks like this:
+
+ EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
+ ESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSE
+ ESBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBSE
+ ESBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBSE
+ ESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSE
+ EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
+
+ where:
+ E is the sunken etching ( optional, not drawn by default )
+ S is the border (optional, drawn by default )
+ B is the bevel (draw with the line width, minus the width of
+ the etching and border )
+ F is the fill ( optional, not drawn by default )
+*/
+static void drawLightEtch( TQPainter *p,
+ const TQRect &rect,
+ const TQColor &color,
+ bool sunken )
+{
+ TQPointArray pts( 4 );
+
+ pts.setPoint( 0, rect.left(), rect.bottom() - 1);
+ pts.setPoint( 1, rect.left(), rect.top() );
+ pts.setPoint( 2, rect.left() + 1, rect.top() );
+ pts.setPoint( 3, rect.right(), rect.top() );
+ p->setPen( sunken ? color.dark( 115 ) : color.light( 115 ) );
+ p->drawLineSegments( pts );
+
+ pts.setPoint( 0, rect.left(), rect.bottom() );
+ pts.setPoint( 1, rect.right(), rect.bottom() );
+ pts.setPoint( 2, rect.right(), rect.bottom() - 1 );
+ pts.setPoint( 3, rect.right(), rect.top() + 1 );
+ p->setPen( sunken ? color.light( 115 ) : color.dark( 115 ) );
+ p->drawLineSegments( pts );
+}
+
+static void drawLightBevel( TQPainter *p,
+ const TQRect &rect,
+ const TQColorGroup &cg,
+ TQStyle::SFlags flags,
+ int linewidth,
+ bool etch = false, // light sunken bevel around border
+ bool border = true, // rectangle around bevel
+ const TQBrush *fill = 0 ) // contents fill
+{
+ TQRect br = rect;
+ bool bevel = ( flags & ( TQStyle::Style_Down | TQStyle::Style_On |
+ TQStyle::Style_Sunken | TQStyle::Style_Raised ) );
+ bool sunken = (flags & (TQStyle::Style_Down | TQStyle::Style_On |
+ TQStyle::Style_Sunken));
+
+ if ( etch && linewidth > 0 ) {
+ drawLightEtch( p, br, cg.background(), true );
+ linewidth--;
+ br.addCoords( 1, 1, -1, -1 );
+ }
+
+ if ( ! br.isValid() )
+ return;
+ if ( border && linewidth > 0 ) {
+ p->setPen( cg.dark() );
+ p->drawRect( br );
+ linewidth--;
+ br.addCoords( 1, 1, -1, -1 );
+ }
+
+ if ( ! br.isValid() )
+ return;
+ if ( bevel && linewidth > 0 ) {
+ // draw a bevel
+ int x, y, w, h;
+ br.rect( &x, &y, &w, &h );
+
+ // copied form qDrawShadePanel - just changed the highlight colors...
+ TQPointArray a( 4*linewidth );
+ if ( sunken )
+ p->setPen( border ? cg.mid() : cg.dark() );
+ else
+ p->setPen( cg.light() );
+ int x1, y1, x2, y2;
+ int i;
+ int n = 0;
+ x1 = x;
+ y1 = y2 = y;
+ x2 = x+w-2;
+ for ( i=0; i<linewidth; i++ ) { // top shadow
+ a.setPoint( n++, x1, y1++ );
+ a.setPoint( n++, x2--, y2++ );
+ }
+ x2 = x1;
+ y1 = y+h-2;
+ for ( i=0; i<linewidth; i++ ) { // left shadow
+ a.setPoint( n++, x1++, y1 );
+ a.setPoint( n++, x2++, y2-- );
+ }
+ p->drawLineSegments( a );
+ n = 0;
+ if ( sunken )
+ p->setPen( cg.light() );
+ else
+ p->setPen( border ? cg.mid() : cg.dark() );
+ x1 = x;
+ y1 = y2 = y+h-1;
+ x2 = x+w-1;
+ for ( i=0; i<linewidth; i++ ) { // bottom shadow
+ a.setPoint( n++, x1++, y1-- );
+ a.setPoint( n++, x2, y2-- );
+ }
+ x1 = x2;
+ y1 = y;
+ y2 = y+h-linewidth-1;
+ for ( i=0; i<linewidth; i++ ) { // right shadow
+ a.setPoint( n++, x1--, y1++ );
+ a.setPoint( n++, x2--, y2 );
+ }
+ p->drawLineSegments( a );
+
+ br.addCoords( linewidth, linewidth, -linewidth, -linewidth );
+ }
+
+ // fill
+ if ( fill )
+ p->fillRect( br, *fill );
+}
+
+void LightStyleV3::drawPrimitive( TQ_PrimitiveElement pe,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption &data ) const
+{
+ TQRect br = r;
+ const TQBrush *fill = 0;
+
+ switch (pe) {
+ case PE_HeaderSectionMenu:
+ case PE_HeaderSection:
+ // don't draw any headers sunken
+ flags = ((flags | Style_Sunken) ^ Style_Sunken) | Style_Raised;
+
+ p->setPen( cg.background() );
+ // hard border at the bottom/right of the header
+ if ( flags & Style_Horizontal ) {
+ p->drawLine( br.bottomLeft(), br.bottomRight() );
+ br.addCoords( 0, 0, 0, -1 );
+ } else {
+ p->drawLine( br.topRight(), br.bottomRight() );
+ br.addCoords( 0, 0, -1, 0 );
+ }
+
+ // draw the header ( just an etching )
+ if ( ! br.isValid() )
+ break;
+ drawLightEtch( p, br, ( ( flags & Style_Down ) ?
+ cg.midlight() : cg.button() ),
+ ( flags & Style_Down ) );
+ br.addCoords( 1, 1, -1, -1 );
+
+ // fill the header
+ if ( ! br.isValid() )
+ break;
+ p->fillRect( br, cg.brush( ( flags & Style_Down ) ?
+ TQColorGroup::Midlight : TQColorGroup::Button ) );
+
+ // the taskbuttons in kicker seem to allow the style to set the pencolor
+ // here, which will be used to draw the text for focused window buttons...
+ // how utterly silly
+ p->setPen( cg.buttonText() );
+ break;
+
+ case PE_ButtonCommand:
+ {
+ TQRect br = r;
+
+ if (flags & TQStyle::Style_Enabled) {
+ if (flags & (TQStyle::Style_Down |
+ TQStyle::Style_On |
+ TQStyle::Style_Sunken))
+ fill = &cg.brush(TQColorGroup::Midlight);
+ else
+ fill = &cg.brush(TQColorGroup::Button);
+ } else
+ fill = &cg.brush(TQColorGroup::Background);
+
+ bool etch = true;
+ if ( flags & Style_ButtonDefault ) {
+ etch = false;
+ br.addCoords( 1, 1, -1, -1 );
+ }
+ drawLightBevel( p, br, cg, flags,
+ pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) + ( etch ? 1 : 0 ),
+ etch, true, fill );
+ break;
+ }
+
+ case PE_ButtonBevel:
+ case PE_ButtonTool:
+ if (flags & TQStyle::Style_Enabled) {
+ if (flags & (TQStyle::Style_Down |
+ TQStyle::Style_On |
+ TQStyle::Style_Sunken))
+ fill = &cg.brush(TQColorGroup::Midlight);
+ else
+ fill = &cg.brush(TQColorGroup::Button);
+ } else
+ fill = &cg.brush(TQColorGroup::Background);
+ drawLightBevel( p, r, cg, flags, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ),
+ false, true, fill );
+ break;
+
+ case PE_ButtonDropDown:
+ {
+ TQBrush thefill;
+ bool sunken =
+ (flags & (TQStyle::Style_Down | TQStyle::Style_On | TQStyle::Style_Sunken));
+
+ if (flags & TQStyle::Style_Enabled) {
+ if (sunken)
+ thefill = cg.brush(TQColorGroup::Midlight);
+ else
+ thefill = cg.brush(TQColorGroup::Button);
+ } else
+ thefill = cg.brush(TQColorGroup::Background);
+
+ p->setPen( cg.dark() );
+ p->drawLine(r.topLeft(), r.topRight());
+ p->drawLine(r.topRight(), r.bottomRight());
+ p->drawLine(r.bottomRight(), r.bottomLeft());
+
+ if (flags & (TQStyle::Style_Down | TQStyle::Style_On |
+ TQStyle::Style_Sunken | TQStyle::Style_Raised)) {
+ // button bevel
+ if (sunken)
+ p->setPen(cg.mid());
+ else
+ p->setPen(cg.light());
+
+ p->drawLine(r.x(), r.y() + 2,
+ r.x(), r.y() + r.height() - 3); // left
+ p->drawLine(r.x(), r.y() + 1,
+ r.x() + r.width() - 2, r.y() + 1); // top
+
+ if (sunken)
+ p->setPen(cg.light());
+ else
+ p->setPen(cg.mid());
+
+ p->drawLine(r.x() + r.width() - 2, r.y() + 2,
+ r.x() + r.width() - 2, r.y() + r.height() - 3); // right
+ p->drawLine(r.x() + 1, r.y() + r.height() - 2,
+ r.x() + r.width() - 2, r.y() + r.height() - 2); // bottom
+ }
+
+ p->fillRect(r.x() + 1, r.y() + 2, r.width() - 3, r.height() - 4, thefill);
+ break;
+ }
+
+ case PE_ButtonDefault:
+ p->setPen( cg.shadow() );
+ p->drawRect( r );
+ break;
+
+ case PE_Indicator:
+ const TQBrush *fill;
+ if (! (flags & Style_Enabled))
+ fill = &cg.brush(TQColorGroup::Background);
+ else if (flags & Style_Down)
+ fill = &cg.brush(TQColorGroup::Mid);
+ else
+ fill = &cg.brush(TQColorGroup::Base);
+ drawLightBevel( p, r, cg, flags | Style_Sunken, 2, true, true, fill );
+
+ p->setPen(cg.text());
+ if (flags & Style_NoChange) {
+ p->drawLine(r.x() + 3, r.y() + r.height() / 2,
+ r.x() + r.width() - 4, r.y() + r.height() / 2);
+ p->drawLine(r.x() + 3, r.y() + 1 + r.height() / 2,
+ r.x() + r.width() - 4, r.y() + 1 + r.height() / 2);
+ p->drawLine(r.x() + 3, r.y() - 1 + r.height() / 2,
+ r.x() + r.width() - 4, r.y() - 1 + r.height() / 2);
+ } else if (flags & Style_On) {
+ p->drawLine(r.x() + 4, r.y() + 3,
+ r.x() + r.width() - 4, r.y() + r.height() - 5);
+ p->drawLine(r.x() + 3, r.y() + 3,
+ r.x() + r.width() - 4, r.y() + r.height() - 4);
+ p->drawLine(r.x() + 3, r.y() + 4,
+ r.x() + r.width() - 5, r.y() + r.height() - 4);
+ p->drawLine(r.x() + 3, r.y() + r.height() - 5,
+ r.x() + r.width() - 5, r.y() + 3);
+ p->drawLine(r.x() + 3, r.y() + r.height() - 4,
+ r.x() + r.width() - 4, r.y() + 3);
+ p->drawLine(r.x() + 4, r.y() + r.height() - 4,
+ r.x() + r.width() - 4, r.y() + 4);
+ }
+
+ break;
+
+ case PE_ExclusiveIndicator:
+ {
+ TQRect br = r, // bevel rect
+ lr = r, // outline rect
+ cr = r, // contents rect
+ ir = r; // indicator rect
+ lr.addCoords( 1, 1, -1, -1 );
+ cr.addCoords( 2, 2, -2, -2 );
+ ir.addCoords( 3, 3, -3, -3 );
+
+ p->fillRect( r, cg.brush( TQColorGroup::Background ) );
+
+ p->setPen( flags & Style_Down ? cg.mid() :
+ ( flags & Style_Enabled ? cg.base() : cg.background() ) );
+ p->setBrush( flags & Style_Down ? cg.mid() :
+ ( flags & Style_Enabled ? cg.base() : cg.background() ) );
+ p->drawEllipse( lr );
+
+ p->setPen( cg.background().dark( 115 ) );
+ p->drawArc( br, 45*16, 180*16 );
+ p->setPen( cg.background().light( 115 ) );
+ p->drawArc( br, 235*16, 180*16 );
+
+ p->setPen( cg.dark() );
+ p->drawArc( lr, 0, 16*360 );
+
+ if ( flags & Style_On ) {
+ p->setPen( flags & Style_Down ? cg.mid() :
+ ( flags & Style_Enabled ? cg.base() : cg.background() ) );
+ p->setBrush( cg.text() );
+ p->drawEllipse( ir );
+ }
+
+ break;
+ }
+
+ case PE_DockWindowHandle:
+ {
+ TQString title;
+ bool drawTitle = false;
+ if ( p && p->device()->devType() == TQInternal::Widget ) {
+ TQWidget *w = (TQWidget *) p->device();
+ TQWidget *p = w->parentWidget();
+ if (p->inherits(TQDOCKWINDOW_OBJECT_NAME_STRING) && ! p->inherits(TQTOOLBAR_OBJECT_NAME_STRING)) {
+ drawTitle = true;
+ title = p->caption();
+ }
+ }
+
+ flags |= Style_Raised;
+ if (flags & Style_Horizontal) {
+ if (drawTitle) {
+ TQPixmap pm(r.height(), r.width());
+ TQPainter p2(&pm);
+ p2.fillRect(0, 0, pm.width(), pm.height(),
+ cg.brush(TQColorGroup::Highlight));
+ p2.setPen(cg.highlightedText());
+ p2.drawText(0, 0, pm.width(), pm.height(), AlignCenter, title);
+ p2.end();
+
+ TQWMatrix m;
+ m.rotate(270.0);
+ pm = pm.xForm(m);
+ p->drawPixmap(r.x(), r.y(), pm);
+ } else {
+ for ( int i = r.left() - 1; i < r.right(); i += 3 ) {
+ p->setPen( cg.midlight() );
+ p->drawLine( i, r.top(), i, r.bottom() );
+ p->setPen( cg.background() );
+ p->drawLine( i + 1, r.top(), i + 1, r.bottom() );
+ p->setPen( cg.mid() );
+ p->drawLine( i + 2, r.top(), i + 2, r.bottom() );
+ }
+ }
+ } else {
+ if (drawTitle) {
+ p->fillRect(r, cg.brush(TQColorGroup::Highlight));
+ p->setPen(cg.highlightedText());
+ p->drawText(r, AlignCenter, title);
+ } else {
+ for ( int i = r.top() - 1; i < r.bottom(); i += 3 ) {
+ p->setPen( cg.midlight() );
+ p->drawLine( r.left(), i, r.right(), i );
+ p->setPen( cg.background() );
+ p->drawLine( r.left(), i + 1, r.right(), i + 1);
+ p->setPen( cg.mid() );
+ p->drawLine( r.left(), i + 2, r.right(), i + 2 );
+ }
+
+ }
+ }
+ break;
+ }
+
+ case PE_DockWindowSeparator:
+ {
+ if (flags & Style_Horizontal) {
+ int hw = r.width() / 2;
+ p->setPen( cg.mid() );
+ p->drawLine( hw, r.top() + 6, hw, r.bottom() - 6 );
+ p->setPen( cg.light() );
+ p->drawLine( hw + 1, r.top() + 6, hw + 1, r.bottom() - 6 );
+ } else {
+ int hh = r.height() / 2;
+ p->setPen( cg.mid() );
+ p->drawLine( r.left() + 6, hh, r.right() - 6, hh );
+ p->setPen( cg.light() );
+ p->drawLine( r.left() + 6, hh + 1, r.right() - 6, hh + 1 );
+ }
+ break;
+ }
+
+ case PE_Splitter:
+ if (flags & Style_Horizontal)
+ flags &= ~Style_Horizontal;
+ else
+ flags |= Style_Horizontal;
+ // fall through intended
+
+ case PE_DockWindowResizeHandle:
+ {
+ TQRect br = r;
+
+ p->setPen( cg.shadow() );
+ p->drawRect( br );
+
+ br.addCoords( 1, 1, -1, -1 );
+
+ if ( ! br.isValid() )
+ break;
+ p->setPen( cg.light() );
+ p->drawLine( br.left(), br.top(), br.right() - 1, br.top() );
+ p->drawLine( br.left(), br.top() + 1, br.left(), br.bottom() );
+ p->setPen( cg.mid() );
+ p->drawLine( br.bottomLeft(), br.bottomRight() );
+ p->drawLine( br.right(), br.top(), br.right(), br.bottom() - 1 );
+
+ br.addCoords( 1, 1, -1, -1 );
+
+ if ( ! br.isValid() )
+ break;
+ p->fillRect( br, cg.brush( TQColorGroup::Button ) );
+ break;
+ }
+
+ case PE_PanelPopup:
+ drawLightBevel( p, r, cg, flags,
+ ( data.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) :
+ data.lineWidth() ), false, true );
+ break;
+
+ case PE_Panel:
+ case PE_PanelLineEdit:
+ case PE_PanelTabWidget:
+ case PE_WindowFrame:
+ {
+ TQRect br = r;
+
+ int cover = 0;
+ int reallw = ( data.isDefault() ?
+ pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) : data.lineWidth() );
+ cover = reallw - 1;
+
+ if ( ! ( flags & Style_Sunken ) )
+ flags |= Style_Raised;
+ drawLightBevel( p, br, cg, flags, 1, false, false );
+ br.addCoords( 1, 1, -1, -1 );
+
+ while ( cover-- > 0 ) {
+ TQPointArray pts( 8 );
+ pts.setPoint( 0, br.left(), br.bottom() - 1);
+ pts.setPoint( 1, br.left(), br.top() );
+ pts.setPoint( 2, br.left() + 1, br.top() );
+ pts.setPoint( 3, br.right(), br.top() );
+ pts.setPoint( 4, br.left(), br.bottom() );
+ pts.setPoint( 5, br.right(), br.bottom() );
+ pts.setPoint( 6, br.right(), br.bottom() - 1 );
+ pts.setPoint( 7, br.right(), br.top() + 1 );
+ p->setPen( cg.background() );
+ p->drawLineSegments( pts );
+
+ br.addCoords( 1, 1, -1, -1 );
+ }
+ break;
+ }
+
+ case PE_PanelDockWindow:
+ drawLightBevel( p, r, cg, flags, ( data.isDefault() ?
+ pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags) :
+ data.lineWidth() ), false, false,
+ &cg.brush( TQColorGroup::Button ) );
+ break;
+
+ case PE_PanelMenuBar:
+ drawLightBevel( p, r, cg, flags, ( data.isDefault() ?
+ pixelMetric(PM_MenuBarFrameWidth, ceData, elementFlags) :
+ data.lineWidth() ), false, false,
+ &cg.brush( TQColorGroup::Button ) );
+ break;
+
+ case PE_ScrollBarSubLine:
+ {
+ TQRect br = r;
+ TQ_PrimitiveElement pe;
+
+ p->setPen( cg.background() );
+ if (flags & Style_Horizontal) {
+ pe = PE_ArrowLeft;
+ p->drawLine( br.topLeft(), br.topRight() );
+ br.addCoords( 0, 1, 0, 0 );
+ } else {
+ pe = PE_ArrowUp;
+ p->drawLine( br.topLeft(), br.bottomLeft() );
+ br.addCoords( 1, 0, 0, 0 );
+ }
+
+ if ( ! br.isValid() )
+ break;
+ drawLightEtch( p, br, cg.button(), false );
+ br.addCoords( 1, 1, -1, -1 );
+
+ if ( ! br.isValid() )
+ break;
+ p->fillRect( br, cg.brush( ( flags & Style_Down ) ?
+ TQColorGroup::Midlight :
+ TQColorGroup::Button ) );
+ br.addCoords( 2, 2, -2, -2 );
+
+ if ( ! br.isValid() )
+ break;
+ drawPrimitive( pe, p, ceData, elementFlags, br, cg, flags );
+ break;
+ }
+
+ case PE_ScrollBarAddLine:
+ {
+ TQRect br = r;
+ TQ_PrimitiveElement pe;
+
+ p->setPen( cg.background() );
+ if (flags & Style_Horizontal) {
+ pe = PE_ArrowRight;
+ p->drawLine( br.topLeft(), br.topRight() );
+ br.addCoords( 0, 1, 0, 0 );
+ } else {
+ pe = PE_ArrowDown;
+ p->drawLine( br.topLeft(), br.bottomLeft() );
+ br.addCoords( 1, 0, 0, 0 );
+ }
+
+ if ( ! br.isValid() )
+ break;
+ drawLightEtch( p, br, cg.button(), false );
+ br.addCoords( 1, 1, -1, -1 );
+
+ if ( ! br.isValid() )
+ break;
+ p->fillRect( br, cg.brush( ( flags & Style_Down ) ?
+ TQColorGroup::Midlight :
+ TQColorGroup::Button ) );
+ br.addCoords( 2, 2, -2, -2 );
+
+ if ( ! br.isValid() )
+ break;
+ drawPrimitive( pe, p, ceData, elementFlags, br, cg, flags );
+ break;
+ }
+
+ case PE_ScrollBarSubPage:
+ {
+ TQRect br = r;
+
+ p->setPen( cg.background() );
+ if (flags & Style_Horizontal) {
+ p->drawLine( br.topLeft(), br.topRight() );
+ br.addCoords( 0, 1, 0, 0 );
+ } else {
+ p->drawLine( br.topLeft(), br.bottomLeft() );
+ br.addCoords( 1, 0, 0, 0 );
+ }
+
+ if ( ! br.isValid() )
+ break;
+ drawLightEtch( p, br, cg.button(), false );
+ br.addCoords( 1, 1, -1, -1 );
+
+ if ( ! br.isValid() )
+ break;
+ p->fillRect( br, cg.brush( ( flags & Style_Down ) ?
+ TQColorGroup::Midlight :
+ TQColorGroup::Button ) );
+ break;
+ }
+
+ case PE_ScrollBarAddPage:
+ {
+ TQRect br = r;
+
+ p->setPen( cg.background() );
+ if (flags & Style_Horizontal) {
+ p->drawLine( br.topLeft(), br.topRight() );
+ br.addCoords( 0, 1, 0, 0 );
+ } else {
+ p->drawLine( br.topLeft(), br.bottomLeft() );
+ br.addCoords( 1, 0, 0, 0 );
+ }
+
+ if ( ! br.isValid() )
+ break;
+ drawLightEtch( p, br, cg.button(), false );
+ br.addCoords( 1, 1, -1, -1 );
+
+ if ( ! br.isValid() )
+ break;
+ p->fillRect( br, cg.brush( ( flags & Style_Down ) ?
+ TQColorGroup::Midlight :
+ TQColorGroup::Button ) );
+ break;
+ }
+
+ case PE_ScrollBarSlider:
+ {
+ TQRect br = r;
+
+ p->setPen( cg.background() );
+ if (flags & Style_Horizontal) {
+ p->drawLine( br.topLeft(), br.topRight() );
+ br.addCoords( 0, 1, 0, 0 );
+ } else {
+ p->drawLine( br.topLeft(), br.bottomLeft() );
+ br.addCoords( 1, 0, 0, 0 );
+ }
+
+ if ( ! br.isValid() )
+ break;
+ p->setPen( cg.highlight().light() );
+ p->drawLine( br.topLeft(), br.topRight() );
+ p->drawLine( br.left(), br.top() + 1, br.left(), br.bottom() - 1 );
+
+ p->setPen( cg.highlight().dark() );
+ p->drawLine( br.left(), br.bottom(), br.right() - 1, br.bottom() );
+ p->drawLine( br.topRight(), br.bottomRight() );
+ br.addCoords( 1, 1, -1, -1 );
+
+ p->fillRect( br, cg.brush( TQColorGroup::Highlight ) );
+ break;
+ }
+
+ case PE_FocusRect:
+ p->setBrush( NoBrush );
+ if ( flags & Style_FocusAtBorder )
+ p->setPen( cg.shadow() );
+ else
+ p->setPen( cg.dark() );
+ p->drawRect( r );
+ break;
+
+ case PE_ProgressBarChunk:
+ p->fillRect(r.x(), r.y() + 2, r.width(), r.height() - 4, cg.highlight());
+ break;
+
+ case PE_MenuItemIndicatorFrame:
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL);
+ TQRect cr(r.left(), r.top(), checkcol, r.height());
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ }
+ qDrawShadePanel(p, cr, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
+ }
+ break;
+ case PE_MenuItemIndicatorCheck:
+ {
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, data, NULL, NULL);
+ TQRect cr(r.left(), r.top(), checkcol, r.height());
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ }
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, cr, cg, (flags & Style_Enabled) | Style_On);
+ }
+ break;
+
+ default:
+ if (pe == PE_HeaderArrow) {
+ if (flags & Style_Down)
+ pe = PE_ArrowDown;
+ else
+ pe = PE_ArrowUp;
+ }
+
+ if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft) {
+ TQPointArray a;
+
+ switch ( pe ) {
+ case PE_ArrowUp:
+ a.setPoints( 7, -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2 );
+ break;
+
+ case PE_ArrowDown:
+ a.setPoints( 7, -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1 );
+ break;
+
+ case PE_ArrowRight:
+ a.setPoints( 7, -2,-3, -2,3, -1,-2, -1,2, 0,-1, 0,1, 1,0 );
+ break;
+
+ case PE_ArrowLeft:
+ a.setPoints( 7, 0,-3, 0,3, -1,-2, -1,2, -2,-1, -2,1, -3,0 );
+ break;
+
+ default:
+ break;
+ }
+
+ if (a.isNull())
+ return;
+
+ p->save();
+ if ( flags & Style_Enabled ) {
+ a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
+ p->setPen( cg.buttonText() );
+ p->drawLineSegments( a, 0, 3 ); // draw arrow
+ p->drawPoint( a[6] );
+ } else {
+ a.translate( r.x() + r.width() / 2 + 1, r.y() + r.height() / 2 + 1 );
+ p->setPen( cg.light() );
+ p->drawLineSegments( a, 0, 3 ); // draw arrow
+ p->drawPoint( a[6] );
+ a.translate( -1, -1 );
+ p->setPen( cg.mid() );
+ p->drawLineSegments( a, 0, 3 ); // draw arrow
+ p->drawPoint( a[6] );
+ }
+ p->restore();
+ } else
+ TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, data);
+ break;
+ }
+}
+
+void LightStyleV3::drawControl( TQ_ControlElement control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ switch (control) {
+ case CE_TabBarTab:
+ {
+ TQRect br = r;
+
+ if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) {
+ if ( ! ( flags & Style_Selected ) ) {
+ p->setPen( cg.background() );
+ p->drawLine( br.left(), br.bottom(),
+ br.right(), br.bottom() );
+ p->setPen( cg.light() );
+ p->drawLine( br.left(), br.bottom() - 1,
+ br.right(), br.bottom() - 1);
+ br.addCoords( 0, 2, -1, -2 );
+ if ( br.left() == 0 )
+ p->drawPoint( br.left(), br.bottom() + 2 );
+ } else {
+ p->setPen( cg.background() );
+ p->drawLine( br.bottomLeft(), br.bottomRight() );
+ if ( br.left() == 0 ) {
+ p->setPen( cg.light() );
+ p->drawPoint( br.bottomLeft() );
+ }
+ br.addCoords( 0, 0, 0, -1 );
+ }
+
+ p->setPen( cg.light() );
+ p->drawLine( br.bottomLeft(), br.topLeft() );
+ p->drawLine( br.topLeft(), br.topRight() );
+ p->setPen( cg.dark() );
+ p->drawLine( br.right(), br.top() + 1, br.right(), br.bottom() );
+
+ if ( flags & Style_Selected )
+ {
+ p->fillRect( br.right() - 3, br.top() + 1, 3, br.height() - 1, cg.brush(TQColorGroup::Highlight));
+ br.addCoords( 1, 1, -4, 0 );
+ }
+ else
+ br.addCoords( 1, 1, -1, 0 );
+ p->fillRect( br, cg.background() );
+ } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) {
+ if ( ! ( flags & Style_Selected ) ) {
+ p->setPen( cg.background() );
+ p->drawLine( br.left(), br.top(),
+ br.right(), br.top() );
+ p->setPen( cg.dark() );
+ p->drawLine( br.left(), br.top() + 1,
+ br.right(), br.top() + 1);
+ br.addCoords( 0, 2, -1, -2 );
+ if ( br.left() == 0 ) {
+ p->setPen( cg.light() );
+ p->drawPoint( br.left(), br.top() - 2 );
+ }
+ } else {
+ p->setPen( cg.background() );
+ p->drawLine( br.topLeft(), br.topRight() );
+ if ( br.left() == 0 ) {
+ p->setPen( cg.light() );
+ p->drawPoint( br.topLeft() );
+ }
+ br.addCoords( 0, 1, 0, 0 );
+ }
+
+ p->setPen( cg.light() );
+ p->drawLine( br.topLeft(), br.bottomLeft() );
+ p->setPen( cg.dark() );
+ p->drawLine( br.bottomLeft(), br.bottomRight() );
+ p->drawLine( br.right(), br.top(), br.right(), br.bottom() - 1 );
+ br.addCoords( 1, 0, -1, -1 );
+
+ if ( flags & Style_Selected )
+ {
+ p->fillRect( br.right() - 2, br.top(), 3, br.height(), cg.brush(TQColorGroup::Highlight));
+ br.addCoords( 1, 0, -3, -1 );
+ }
+ else
+ br.addCoords( 1, 0, -1, -1 );
+
+ p->fillRect( br, cg.background() );
+ } else
+ TQCommonStyle::drawControl( control, p, ceData, elementFlags, r, cg, flags, data, widget );
+ break;
+ }
+
+ case CE_PopupMenuItem:
+ {
+ if (data.isDefault())
+ break;
+
+ TQMenuItem *mi = data.menuItem();
+ int tab = data.tabWidth();
+ int maxpmw = data.maxIconWidth();
+
+ if ( mi && mi->isSeparator() ) {
+ if ( !ceData.bgPixmap.isNull() )
+ p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
+ else
+ p->fillRect(r, cg.brush(TQColorGroup::Button));
+ p->setPen( cg.mid() );
+ p->drawLine(r.left() + 12, r.top() + 1,
+ r.right() - 12, r.top() + 1);
+ p->setPen( cg.light() );
+ p->drawLine(r.left() + 12, r.top() + 2,
+ r.right() - 12, r.top() + 2);
+ break;
+ }
+
+ if (flags & Style_Active)
+ qDrawShadePanel(p, r, cg, true, 1,
+ &cg.brush(TQColorGroup::Midlight));
+ else if ( !ceData.bgPixmap.isNull() )
+ p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
+ else
+ p->fillRect(r, cg.brush(TQColorGroup::Button));
+
+ if ( !mi )
+ break;
+
+ maxpmw = QMAX(maxpmw, 16);
+
+ TQRect cr, ir, tr, sr;
+ // check column
+ cr.setRect(r.left(), r.top(), maxpmw, r.height());
+ // submenu indicator column
+ sr.setCoords(r.right() - maxpmw, r.top(), r.right(), r.bottom());
+ // tab/accelerator column
+ tr.setCoords(sr.left() - tab - 4, r.top(), sr.left(), r.bottom());
+ // item column
+ ir.setCoords(cr.right() + 4, r.top(), tr.right() - 4, r.bottom());
+
+ bool reverse = TQApplication::reverseLayout();
+ if ( reverse ) {
+ cr = visualRect( cr, r );
+ sr = visualRect( sr, r );
+ tr = visualRect( tr, r );
+ ir = visualRect( ir, r );
+ }
+
+ if (mi->isChecked() &&
+ ! (flags & Style_Active) &
+ (flags & Style_Enabled))
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, data);
+
+ if (mi->iconSet()) {
+ TQIconSet::Mode mode =
+ (flags & Style_Enabled) ? TQIconSet::Normal : TQIconSet::Disabled;
+ if ((flags & Style_Active) && (flags & Style_Enabled))
+ mode = TQIconSet::Active;
+ TQPixmap pixmap;
+ if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
+ pixmap =
+ mi->iconSet()->pixmap( TQIconSet::Small, mode, TQIconSet::On );
+ else
+ pixmap =
+ mi->iconSet()->pixmap( TQIconSet::Small, mode );
+ TQRect pmr(TQPoint(0, 0), pixmap.size());
+ pmr.moveCenter(cr.center());
+ p->setPen(cg.text());
+ p->drawPixmap(pmr.topLeft(), pixmap);
+ } else if ((elementFlags & CEF_IsCheckable) && mi->isChecked())
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, data);
+
+ TQColor textcolor;
+ TQColor embosscolor;
+ if (flags & Style_Active) {
+ if (! (flags & Style_Enabled))
+ textcolor = cg.midlight().dark();
+ else
+ textcolor = cg.buttonText();
+ embosscolor = cg.midlight().light();
+ } else if (! (flags & Style_Enabled)) {
+ textcolor = cg.text();
+ embosscolor = cg.light();
+ } else
+ textcolor = embosscolor = cg.buttonText();
+ p->setPen(textcolor);
+
+ if (mi->custom()) {
+ p->save();
+ if (! (flags & Style_Enabled)) {
+ p->setPen(cg.light());
+ mi->custom()->paint(p, cg, flags & Style_Active,
+ flags & Style_Enabled,
+ ir.x() + 1, ir.y() + 1,
+ ir.width() - 1, ir.height() - 1);
+ p->setPen(textcolor);
+ }
+ mi->custom()->paint(p, cg, flags & Style_Active,
+ flags & Style_Enabled,
+ ir.x(), ir.y(),
+ ir.width(), ir.height());
+ p->restore();
+ }
+
+ TQString text = mi->text();
+ if (! text.isNull()) {
+ int t = text.find('\t');
+
+ // draw accelerator/tab-text
+ if (t >= 0) {
+ int alignFlag = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ alignFlag |= ( reverse ? AlignLeft : AlignRight );
+ if (! (flags & Style_Enabled)) {
+ p->setPen(embosscolor);
+ tr.moveBy(1, 1);
+ p->drawText(tr, alignFlag, text.mid(t + 1));
+ tr.moveBy(-1, -1);
+ p->setPen(textcolor);
+ }
+
+ p->drawText(tr, alignFlag, text.mid(t + 1));
+ }
+
+ int alignFlag = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ alignFlag |= ( reverse ? AlignRight : AlignLeft );
+
+ if (! (flags & Style_Enabled)) {
+ p->setPen(embosscolor);
+ ir.moveBy(1, 1);
+ p->drawText(ir, alignFlag, text, t);
+ ir.moveBy(-1, -1);
+ p->setPen(textcolor);
+ }
+
+ p->drawText(ir, alignFlag, text, t);
+ } else if (mi->pixmap()) {
+ TQPixmap pixmap = *mi->pixmap();
+ if (pixmap.depth() == 1)
+ p->setBackgroundMode(Qt::OpaqueMode);
+ p->drawPixmap(ir.x(), ir.y() + (ir.height() - pixmap.height()) / 2, pixmap);
+ if (pixmap.depth() == 1)
+ p->setBackgroundMode(Qt::TransparentMode);
+ }
+
+ if (mi->popup())
+ drawPrimitive( (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight),
+ p, ceData, elementFlags, sr, cg, flags);
+ break;
+ }
+
+ case CE_MenuBarEmptyArea:
+ {
+ p->fillRect(r, cg.brush(TQColorGroup::Button));
+ break;
+ }
+
+ case CE_MenuBarItem:
+ {
+ if ( flags & Style_Active )
+ qDrawShadePanel(p, r, cg, true, 1, &cg.brush(TQColorGroup::Midlight));
+ else
+ p->fillRect( r, cg.brush( TQColorGroup::Button ) );
+
+ if (data.isDefault())
+ break;
+
+ TQMenuItem *mi = data.menuItem();
+ drawItem(p, r, AlignCenter | ShowPrefix | DontClip | SingleLine, cg,
+ flags & Style_Enabled, mi->pixmap(), mi->text(), -1,
+ &cg.buttonText());
+ break;
+ }
+
+ case CE_ProgressBarGroove:
+ drawLightBevel( p, r, cg, Style_Sunken, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ),
+ true, true, &cg.brush( TQColorGroup::Background ) );
+ break;
+
+ default:
+ TQCommonStyle::drawControl(control, p, ceData, elementFlags, r, cg, flags, data, widget);
+ break;
+ }
+}
+
+void LightStyleV3::drawControlMask( TQ_ControlElement control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ switch (control) {
+ case CE_PushButton:
+ p->fillRect(r, color1);
+ break;
+
+ default:
+ TQCommonStyle::drawControlMask(control, p, ceData, elementFlags, r, data, widget);
+ break;
+ }
+}
+
+TQRect LightStyleV3::subRect(SubRect subrect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ TQRect rect;
+
+ switch (subrect) {
+ case SR_PushButtonFocusRect:
+ {
+ rect = TQCommonStyle::subRect( SR_PushButtonContents, ceData, elementFlags, widget );
+ int bm = pixelMetric( PM_ButtonMargin, ceData, elementFlags, widget ), hbm = bm / 2;
+ rect.addCoords( hbm, hbm, -hbm, -hbm );
+ break;
+ }
+
+ case SR_ComboBoxFocusRect:
+ {
+ rect = TQCommonStyle::subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget );
+ rect.addCoords( -1, -1, 1, 1 );
+ break;
+ }
+
+ case SR_CheckBoxFocusRect:
+ {
+ const TQCheckBox* cb = static_cast<const TQCheckBox*>(widget);
+
+ //Only checkbox, no label
+ if (cb->text().isEmpty() && (cb->pixmap() == 0) )
+ {
+ TQRect bounding = cb->rect();
+ TQRect checkbox(bounding.x(), bounding.y() + (bounding.height() - 13)/2,
+ 13, 13);
+
+ return checkbox;
+ }
+ //Fallthrough intentional
+ }
+
+
+ default:
+ rect = TQCommonStyle::subRect(subrect, ceData, elementFlags, widget);
+ break;
+ }
+
+ return rect;
+}
+
+void LightStyleV3::drawComplexControl( TQ_ComplexControl control,
+ TQPainter* p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect& r,
+ const TQColorGroup& cg,
+ SFlags flags,
+ SCFlags controls,
+ SCFlags active,
+ const TQStyleOption &data,
+ const TQWidget* widget ) const
+{
+ switch (control) {
+ case CC_ComboBox:
+ {
+ const TQComboBox *combobox = (const TQComboBox *) widget;
+ TQRect frame, arrow, field;
+ frame =
+ TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxFrame, data, widget),
+ ceData, elementFlags);
+ arrow =
+ TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxArrow, data, widget),
+ ceData, elementFlags);
+ field =
+ TQStyle::visualRect(querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
+ SC_ComboBoxEditField, data, widget),
+ ceData, elementFlags);
+
+ if ((controls & SC_ComboBoxFrame) && frame.isValid())
+ drawPrimitive( PE_Panel, p, ceData, elementFlags, frame, cg, flags | Style_Sunken );
+
+ if ((controls & SC_ComboBoxArrow) && arrow.isValid()) {
+ drawLightEtch( p, arrow, cg.button(), ( active == SC_ComboBoxArrow ) );
+ arrow.addCoords( 1, 1, -1, -1 );
+ p->fillRect( arrow, cg.brush( TQColorGroup::Button ) );
+ arrow.addCoords(3, 1, -1, -1);
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags);
+ }
+
+ if ((controls & SC_ComboBoxEditField) && field.isValid()) {
+ if (flags & Style_HasFocus) {
+ if (! (elementFlags & CEF_IsEditable)) {
+ TQRect fr =
+ TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ),
+ ceData, elementFlags );
+ p->fillRect( fr, cg.brush( TQColorGroup::Highlight ) );
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg,
+ flags | Style_FocusAtBorder,
+ TQStyleOption(cg.highlight()));
+ }
+
+ p->setPen(cg.highlightedText());
+ } else {
+ p->fillRect( field, ( ( flags & Style_Enabled ) ?
+ cg.brush( TQColorGroup::Base ) :
+ cg.brush( TQColorGroup::Background ) ) );
+ p->setPen( cg.text() );
+ }
+ }
+
+ break;
+ }
+
+ case CC_SpinWidget:
+ {
+ const TQSpinWidget *spinwidget = (const TQSpinWidget *) widget;
+ TQRect frame, up, down;
+
+ frame = querySubControlMetrics((TQ_ComplexControl)CC_SpinWidget, ceData, elementFlags,
+ SC_SpinWidgetFrame, data, widget);
+ up = ceData.spinWidgetData.upRect;
+ down = ceData.spinWidgetData.downRect;
+
+ if ((controls & SC_SpinWidgetFrame) && frame.isValid())
+ drawPrimitive( PE_Panel, p, ceData, elementFlags, frame, cg, flags | Style_Sunken );
+
+ if ((controls & SC_SpinWidgetUp) && up.isValid()) {
+ TQ_PrimitiveElement pe = PE_SpinWidgetUp;
+ if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus )
+ pe = PE_SpinWidgetPlus;
+
+ p->setPen( cg.background() );
+ p->drawLine( up.topLeft(), up.bottomLeft() );
+
+ up.addCoords( 1, 0, 0, 0 );
+ p->fillRect( up, cg.brush( TQColorGroup::Button ) );
+ drawLightEtch( p, up, cg.button(), ( active == SC_SpinWidgetUp ) );
+
+ up.addCoords( 1, 0, 0, 0 );
+ drawPrimitive(pe, p, ceData, elementFlags, up, cg, flags |
+ ((active == SC_SpinWidgetUp) ?
+ Style_On | Style_Sunken : Style_Raised));
+ }
+
+ if ((controls & SC_SpinWidgetDown) && down.isValid()) {
+ TQ_PrimitiveElement pe = PE_SpinWidgetDown;
+ if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus )
+ pe = PE_SpinWidgetMinus;
+
+ p->setPen( cg.background() );
+ p->drawLine( down.topLeft(), down.bottomLeft() );
+
+ down.addCoords( 1, 0, 0, 0 );
+ p->fillRect( down, cg.brush( TQColorGroup::Button ) );
+ drawLightEtch( p, down, cg.button(), ( active == SC_SpinWidgetDown ) );
+
+ down.addCoords( 1, 0, 0, 0 );
+ drawPrimitive(pe, p, ceData, elementFlags, down, cg, flags |
+ ((active == SC_SpinWidgetDown) ?
+ Style_On | Style_Sunken : Style_Raised));
+ }
+
+ break;
+ }
+
+ case CC_ScrollBar:
+ {
+ TQRect addline, subline, subline2, addpage, subpage, slider, first, last;
+ bool maxedOut = (ceData.minSteps == ceData.maxSteps);
+
+ subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, data, widget);
+ addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, data, widget);
+ subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, data, widget);
+ addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, data, widget);
+ slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, data, widget);
+ first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, data, widget);
+ last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, data, widget);
+
+ subline2 = addline;
+ if (ceData.orientation == TQt::Horizontal)
+ subline2.moveBy(-addline.width(), 0);
+ else
+ subline2.moveBy(0, -addline.height());
+
+ if ((controls & SC_ScrollBarSubLine) && subline.isValid()) {
+ drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
+ Style_Enabled | ((active == SC_ScrollBarSubLine) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+
+ if (subline2.isValid())
+ drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline2, cg,
+ Style_Enabled | ((active == SC_ScrollBarSubLine) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ }
+ if ((controls & SC_ScrollBarAddLine) && addline.isValid())
+ drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg,
+ Style_Enabled | ((active == SC_ScrollBarAddLine) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
+ drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg,
+ Style_Enabled | ((active == SC_ScrollBarSubPage) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarAddPage) && addpage.isValid())
+ drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg,
+ ((maxedOut) ? Style_Default : Style_Enabled) |
+ ((active == SC_ScrollBarAddPage) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarFirst) && first.isValid())
+ drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg,
+ Style_Enabled | ((active == SC_ScrollBarFirst) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarLast) && last.isValid())
+ drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg,
+ Style_Enabled | ((active == SC_ScrollBarLast) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+ if ((controls & SC_ScrollBarSlider) && slider.isValid()) {
+ drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
+ Style_Enabled | ((active == SC_ScrollBarSlider) ?
+ Style_Down : Style_Default) |
+ ((ceData.orientation == TQt::Horizontal) ?
+ Style_Horizontal : 0));
+
+ // ### perhaps this should not be able to accept focus if maxedOut?
+ if (elementFlags & CEF_HasFocus) {
+ TQRect fr(slider.x() + 2, slider.y() + 2,
+ slider.width() - 5, slider.height() - 5);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default);
+ }
+ }
+
+ break;
+ }
+
+ case CC_Slider:
+ {
+ const TQSlider *slider = (const TQSlider *) widget;
+ TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
+ data, widget),
+ handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
+ data, widget);
+
+ if ((controls & SC_SliderGroove) && groove.isValid()) {
+ TQColor grooveColor = cg.midlight();
+ if (!(flags & Style_Enabled))
+ grooveColor = cg.background();
+
+
+ TQBrush brush(grooveColor);
+ drawLightBevel( p, groove, cg,
+ ( ( flags | Style_Raised ) ^ Style_Raised ) |
+ ( ( flags & Style_Enabled ) ? Style_Sunken :
+ Style_Default ), 2, true, true,
+ &brush );
+ groove.addCoords( 2, 2, -2, -2 );
+ drawLightEtch( p, groove, grooveColor, false );
+
+ if (flags & Style_HasFocus) {
+ groove.addCoords( -2, -2, 2, 2 );
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg, flags );
+ }
+ }
+
+ if ((controls & SC_SliderHandle) && handle.isValid()) {
+ TQColor sliderColor = cg.highlight();
+ if (!(flags & Style_Enabled))
+ sliderColor = cg.button();
+
+ p->setPen( sliderColor.light() );
+
+ p->drawLine( handle.topLeft(), handle.topRight() );
+ p->drawLine( handle.left(), handle.top() + 1,
+ handle.left(), handle.bottom() - 1 );
+ p->setPen( sliderColor.dark() );
+ p->drawLine( handle.left(), handle.bottom(),
+ handle.right() - 1, handle.bottom() );
+ p->drawLine( handle.topRight(), handle.bottomRight() );
+ handle.addCoords( 1, 1, -1, -1 );
+ p->fillRect( handle, sliderColor );
+ p->setPen( cg.midlight() );
+
+ if ( ceData.orientation == TQt::Horizontal )
+ p->drawLine( handle.left() + handle.width() / 2,
+ handle.top() + 1,
+ handle.left() + handle.width() / 2,
+ handle.bottom() - 1 );
+ else
+ p->drawLine( handle.left() + 1,
+ handle.top() + handle.height() / 2,
+ handle.right() - 1,
+ handle.top() + handle.height() / 2 );
+ }
+
+ if (controls & SC_SliderTickmarks)
+ TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
+ SC_SliderTickmarks, active, data, widget );
+ break;
+ }
+
+ case CC_ListView:
+ // use the base style for CC_ListView
+ basestyle->drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
+ controls, active, data, widget);
+ break;
+
+ default:
+ TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
+ controls, active, data, widget);
+ break;
+ }
+}
+
+TQRect LightStyleV3::querySubControlMetrics( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl sc,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ TQRect ret;
+
+ switch (control) {
+ case CC_ComboBox:
+ {
+ int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
+ int sb = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags ); // width of the arrow
+
+ switch ( sc ) {
+ case SC_ComboBoxFrame:
+ ret = ceData.rect;
+ break;
+ case SC_ComboBoxArrow:
+ ret.setRect( ceData.rect.width() - fw - sb, fw,
+ sb, ceData.rect.height() - fw*2 );
+ break;
+ case SC_ComboBoxEditField:
+ ret.setRect( fw, fw, ceData.rect.width() - fw*2 - sb - 1,
+ ceData.rect.height() - fw*2 );
+ break;
+ default:
+ break;
+ }
+
+ break;
+ }
+
+ case CC_ScrollBar:
+ {
+ int sliderstart = ceData.startStep;
+ int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget);
+ int maxlen = ((ceData.orientation == TQt::Horizontal) ?
+ ceData.rect.width() : ceData.rect.height()) - (sbextent * 3);
+ int sliderlen;
+
+ // calculate slider length
+ if (ceData.maxSteps != ceData.minSteps) {
+ uint range = ceData.maxSteps - ceData.minSteps;
+ sliderlen = (ceData.pageStep * maxlen) /
+ (range + ceData.pageStep);
+
+ int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
+ if ( sliderlen < slidermin || range > INT_MAX / 2 )
+ sliderlen = slidermin;
+ if ( sliderlen > maxlen )
+ sliderlen = maxlen;
+ } else
+ sliderlen = maxlen;
+
+ switch (sc) {
+ case SC_ScrollBarSubLine:
+ // top/left button
+ ret.setRect(0, 0, sbextent, sbextent);
+ break;
+
+ case SC_ScrollBarAddLine:
+ // bottom/right button
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(ceData.rect.width() - sbextent, 0, sbextent, sbextent);
+ else
+ ret.setRect(0, ceData.rect.height() - sbextent, sbextent, sbextent);
+ break;
+
+ case SC_ScrollBarSubPage:
+ // between top/left button and slider
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(sbextent, 0, sliderstart - sbextent, sbextent);
+ else
+ ret.setRect(0, sbextent, sbextent, sliderstart - sbextent);
+ break;
+
+ case SC_ScrollBarAddPage:
+ // between bottom/right button and slider
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(sliderstart + sliderlen, 0, maxlen - sliderstart -
+ sliderlen + sbextent, sbextent);
+ else
+ ret.setRect(0, sliderstart + sliderlen, sbextent, maxlen -
+ sliderstart - sliderlen + sbextent);
+ break;
+
+ case SC_ScrollBarGroove:
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(sbextent, 0, maxlen, sbextent );
+ else
+ ret.setRect(0, sbextent, sbextent, maxlen );
+ break;
+
+ case SC_ScrollBarSlider:
+ if (ceData.orientation == TQt::Horizontal)
+ ret.setRect(sliderstart, 0, sliderlen, sbextent);
+ else
+ ret.setRect(0, sliderstart, sbextent, sliderlen);
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+ }
+
+ case CC_Slider:
+ {
+ const TQSlider *slider = (const TQSlider *) widget;
+ int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget );
+ int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
+
+ switch ( sc ) {
+ case SC_SliderGroove:
+ if ( ceData.orientation == TQt::Horizontal )
+ ret.setRect( 0, tickOffset, ceData.rect.width(), thickness );
+ else
+ ret.setRect( tickOffset, 0, thickness, ceData.rect.height() );
+ break;
+
+ case SC_SliderHandle:
+ {
+ int pos = ceData.startStep;
+ int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
+
+ if ( ceData.orientation == TQt::Horizontal )
+ ret.setRect( pos + 2, tickOffset + 2, len - 4, thickness - 4 );
+ else
+ ret.setRect( tickOffset + 2, pos + 2, thickness - 4, len - 4 );
+ break;
+ }
+
+ default:
+ ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget);
+ break;
+ }
+
+ break;
+ }
+
+ default:
+ ret = TQCommonStyle::querySubControlMetrics(control, ceData, elementFlags, sc, data, widget);
+ break;
+ }
+
+ return ret;
+}
+
+TQStyle::SubControl LightStyleV3::querySubControl( TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQPoint &pos,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ TQStyle::SubControl ret =
+ TQCommonStyle::querySubControl(control, ceData, elementFlags, pos, data, widget);
+
+ // this is an ugly hack, but i really don't care, it's the quickest way to
+ // enabled the third button
+ if (control == CC_ScrollBar &&
+ ret == SC_None)
+ ret = SC_ScrollBarSubLine;
+
+ return ret;
+}
+
+int LightStyleV3::pixelMetric( PixelMetric metric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags,
+ const TQWidget *widget ) const
+{
+ int ret;
+
+ switch (metric) {
+ case PM_ButtonMargin:
+ ret = 6;
+ break;
+
+ case PM_ButtonShiftHorizontal:
+ case PM_ButtonShiftVertical:
+ ret = 0;
+ break;
+
+ case PM_ButtonDefaultIndicator:
+ ret = 0;
+ break;
+
+ case PM_DefaultFrameWidth:
+ ret = 2;
+ break;
+
+ case PM_IndicatorWidth:
+ case PM_IndicatorHeight:
+ case PM_ExclusiveIndicatorWidth:
+ case PM_ExclusiveIndicatorHeight:
+ ret = 13;
+ break;
+
+ case PM_TabBarTabOverlap:
+ case PM_TabBarBaseOverlap:
+ ret = 0;
+ break;
+
+ case PM_ScrollBarExtent:
+ case PM_ScrollBarSliderMin:
+ ret = 15;
+ break;
+
+ case PM_MenuBarFrameWidth:
+ ret = 1;
+ break;
+
+ case PM_ProgressBarChunkWidth:
+ ret = 1;
+ break;
+
+ case PM_DockWindowHandleExtent:
+ ret = 8;
+ break;
+
+ case PM_DockWindowSeparatorExtent:
+ ret = 8;
+ break;
+
+ case PM_SplitterWidth:
+ ret = 8;
+ break;
+
+ case PM_SliderLength:
+ ret = 25;
+ break;
+
+ case PM_SliderThickness:
+ ret = 11;
+ break;
+
+ case PM_SliderControlThickness:
+ {
+ int space = (ceData.orientation == TQt::Horizontal) ? ceData.rect.height()
+ : ceData.rect.width();
+ int ticks = ceData.tickMarkSetting;
+ int n = 0;
+ if ( ticks & TQSlider::Above ) n++;
+ if ( ticks & TQSlider::Below ) n++;
+ if ( !n ) {
+ ret = space;
+ break;
+ }
+
+ int thick = 6; // Magic constant to get 5 + 16 + 5
+
+ space -= thick;
+ //### the two sides may be unequal in size
+ if ( space > 0 )
+ thick += (space * 2) / (n + 2);
+ ret = thick;
+ break;
+ }
+
+ case PM_MaximumDragDistance:
+ ret = -1;
+ break;
+
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ ret = 0;
+ break;
+
+ default:
+ ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
+ break;
+ }
+
+ return ret;
+}
+
+TQSize LightStyleV3::sizeFromContents( ContentsType contents,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentsSize,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ TQSize ret;
+
+ switch (contents) {
+ case CT_ComboBox:
+ {
+ int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget ) * 2;
+ int sb = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags ); // width of the arrow
+ int w = contentsSize.width();
+ int h = contentsSize.height();
+
+ w += fw + sb + 1;
+ h += fw;
+
+ // try to keep a similar height to buttons
+ if ( h < 21 )
+ h = 21;
+
+ ret = TQSize( w, h );
+ break;
+ }
+
+ case CT_PushButton:
+ {
+ const TQPushButton *button = (const TQPushButton *) widget;
+ ret = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, data, widget );
+ int w = ret.width(), h = ret.height();
+ int dbi = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget ) * 2;
+ int mw = 80 - dbi, mh = 25 - dbi;
+
+ // only expand the button if we are displaying text...
+ if ( ! button->text().isEmpty() ) {
+ // button minimum size
+ if ( w < mw )
+ w = mw;
+ if ( h < mh )
+ h = mh;
+ }
+
+ ret = TQSize( w, h );
+ break;
+ }
+
+ case CT_PopupMenuItem:
+ {
+ if (data.isDefault())
+ break;
+
+ TQMenuItem *mi = data.menuItem();
+ int maxpmw = data.maxIconWidth();
+ int w = contentsSize.width(), h = contentsSize.height();
+
+ if (mi->custom()) {
+ w = mi->custom()->sizeHint().width();
+ h = mi->custom()->sizeHint().height();
+ if (! mi->custom()->fullSpan() && h < 22)
+ h = 22;
+ } else if(mi->widget()) {
+ } else if (mi->isSeparator()) {
+ w = 10;
+ h = 4;
+ } else {
+ // check is at least 16x16
+ if (h < 16)
+ h = 16;
+ if (mi->pixmap())
+ h = QMAX(h, mi->pixmap()->height());
+ else if (! mi->text().isNull())
+ h = QMAX(h, TQFontMetrics(ceData.font).height() + 2);
+ if (mi->iconSet() != 0)
+ h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small,
+ TQIconSet::Normal).height());
+ h += 2;
+ }
+
+ // check | 4 pixels | item | 8 pixels | accel | 4 pixels | check
+
+ // check is at least 16x16
+ maxpmw = QMAX(maxpmw, 16);
+ w += (maxpmw * 2) + 8;
+
+ if (! mi->text().isNull() && mi->text().find('\t') >= 0)
+ w += 8;
+
+ ret = TQSize(w, h);
+ break;
+ }
+
+ case CT_ProgressBar:
+ {
+ //If we have to display the indicator, and we do it on RHS, give some more room
+ //for it. This tries to match the logic and the spacing in SR_ProgressBarGroove/Contents
+ //sizing in TQCommonStyle.
+ if (ceData.percentageVisible &&
+ ((elementFlags & CEF_IndicatorFollowsStyle) || ! (elementFlags & CEF_CenterIndicator)))
+ {
+ int addw = TQFontMetrics(ceData.font).width("100%") + 6;
+ return TQSize(contentsSize.width() + addw, contentsSize.height());
+ }
+ else
+ return contentsSize; //Otherwise leave unchanged
+
+ break;
+ }
+
+ default:
+ ret = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, data, widget);
+ break;
+ }
+
+ return ret;
+}
+
+int LightStyleV3::styleHint( TQ_StyleHint stylehint,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption &option,
+ TQStyleHintReturn* returnData,
+ const TQWidget *widget ) const
+{
+ int ret;
+
+ switch (stylehint) {
+ case SH_EtchDisabledText:
+ case SH_Slider_SnapToValue:
+ case SH_PrintDialog_RightAlignButtons:
+ case SH_FontDialog_SelectAssociatedText:
+ case SH_MenuBar_AltKeyNavigation:
+ case SH_MenuBar_MouseTracking:
+ case SH_PopupMenu_MouseTracking:
+ case SH_ComboBox_ListMouseTracking:
+ case SH_ScrollBar_MiddleClickAbsolutePosition:
+ ret = 1;
+ break;
+
+ case SH_MainWindow_SpaceBelowMenuBar:
+ ret = 0;
+ break;
+
+ case SH_ScrollBar_BackgroundMode:
+ ret = NoBackground;
+ break;
+
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int maxpmw = option.maxIconWidth();
+ maxpmw = QMAX(maxpmw, 16);
+
+ ret = maxpmw;
+ }
+ break;
+
+ default:
+ ret = TQCommonStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
+ break;
+ }
+
+ return ret;
+}
+
+TQPixmap LightStyleV3::stylePixmap( StylePixmap stylepixmap,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption &data,
+ const TQWidget *widget ) const
+{
+ return basestyle->stylePixmap( stylepixmap, ceData, elementFlags, data, widget );
+}
+#include "lightstyle-v3.moc"
diff --git a/tdestyles/light/lightstyle-v3.h b/tdestyles/light/lightstyle-v3.h
new file mode 100644
index 000000000..0330c8f87
--- /dev/null
+++ b/tdestyles/light/lightstyle-v3.h
@@ -0,0 +1,92 @@
+/*
+ Copyright (c) 2000-2001 Trolltech AS (info@trolltech.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef LIGHTSTYLE_V3_H
+#define LIGHTSTYLE_V3_H
+
+
+#ifndef QT_H
+#include <tqcommonstyle.h>
+#endif // QT_H
+
+#include "tdestyle.h"
+
+#ifdef QT_PLUGIN
+# define Q_EXPORT_STYLE_LIGHT_V3
+#else
+# define Q_EXPORT_STYLE_LIGHT_V3 Q_EXPORT
+#endif // QT_PLUGIN
+
+
+class Q_EXPORT_STYLE_LIGHT_V3 LightStyleV3 : public TDEStyle
+{
+ Q_OBJECT
+ TQStyle *basestyle;
+
+public:
+ LightStyleV3();
+ virtual ~LightStyleV3();
+
+ void polishPopupMenu( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr );
+
+ void drawPrimitive(TQ_PrimitiveElement, TQPainter *, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &, const TQColorGroup &,
+ SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default ) const;
+
+ void drawControl(TQ_ControlElement, TQPainter *, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &,
+ const TQColorGroup &, SFlags = Style_Default,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
+ void drawControlMask(TQ_ControlElement, TQPainter *, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0) const;
+
+ TQRect subRect(SubRect, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *) const;
+
+ void drawComplexControl(TQ_ComplexControl, TQPainter *, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQRect &,
+ const TQColorGroup &, SFlags = Style_Default,
+ SCFlags = SC_All, SCFlags = SC_None,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
+
+ TQRect querySubControlMetrics(TQ_ComplexControl, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, SubControl,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 0 ) const;
+
+ SubControl querySubControl(TQ_ComplexControl, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQPoint &,
+ const TQStyleOption &data = TQStyleOption::Default, const TQWidget * = 0 ) const;
+
+ int pixelMetric(PixelMetric, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget * = 0 ) const;
+
+ TQSize sizeFromContents(ContentsType, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQSize &,
+ const TQStyleOption & = TQStyleOption::Default, const TQWidget * = 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& = TQStyleOption::Default,
+ const TQWidget* widget = 0 ) const;
+};
+
+
+#endif // LIGHTSTYLE_V3_H
diff --git a/tdestyles/plastik/CMakeLists.txt b/tdestyles/plastik/CMakeLists.txt
new file mode 100644
index 000000000..ab93e42c4
--- /dev/null
+++ b/tdestyles/plastik/CMakeLists.txt
@@ -0,0 +1,48 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_subdirectory( config )
+
+add_definitions(
+ -DQT_PLUGIN
+)
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdefx
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES plastik.themerc DESTINATION ${DATA_INSTALL_DIR}/tdestyle/themes )
+
+
+##### plastik ###################################
+
+set( target plastik )
+
+set( ${target}_SRCS
+ plastik.cpp misc.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdefx-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles
+)
diff --git a/tdestyles/plastik/Makefile.am b/tdestyles/plastik/Makefile.am
new file mode 100644
index 000000000..2d228dd07
--- /dev/null
+++ b/tdestyles/plastik/Makefile.am
@@ -0,0 +1,22 @@
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = config
+
+KDE_CXXFLAGS = -DQT_PLUGIN
+
+INCLUDES = $(all_includes)
+
+stylercdir = $(kde_datadir)/tdestyle/themes
+stylerc_DATA = plastik.themerc
+
+EXTRA_DIST = $(stylerc_DATA)
+
+noinst_HEADERS = plastik.h misc.h
+
+kde_style_LTLIBRARIES = plastik.la
+plastik_la_SOURCES = plastik.cpp misc.cpp
+plastik_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+plastik_la_LIBADD = ../../tdefx/libtdefx.la $(LIB_QT)
+plastik_la_METASOURCES = AUTO
+
+DISTCLEANFILES = $(plastik_la_METASOURCES)
diff --git a/tdestyles/plastik/config/CMakeLists.txt b/tdestyles/plastik/config/CMakeLists.txt
new file mode 100644
index 000000000..531a65375
--- /dev/null
+++ b/tdestyles/plastik/config/CMakeLists.txt
@@ -0,0 +1,37 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdeui
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### tdestyle_plastik_config ######################
+
+set( target tdestyle_plastik_config )
+
+set( ${target}_SRCS
+ plastikconf.cpp
+)
+
+tde_add_kpart( ${target} AUTOMOC
+ SOURCES ${${target}_SRCS}
+ LINK tdeui-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
diff --git a/tdestyles/plastik/config/Makefile.am b/tdestyles/plastik/config/Makefile.am
new file mode 100644
index 000000000..428baf69f
--- /dev/null
+++ b/tdestyles/plastik/config/Makefile.am
@@ -0,0 +1,12 @@
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = plastikconf.h
+kde_module_LTLIBRARIES = tdestyle_plastik_config.la
+tdestyle_plastik_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module
+tdestyle_plastik_config_la_LIBADD = $(LIB_TDEUI) $(LIB_QT) $(LIB_TDECORE)
+tdestyle_plastik_config_la_SOURCES = plastikconf.cpp
+tdestyle_plastik_config_la_METASOURCES = AUTO
+
+
+messages:
+ $(XGETTEXT) *.cpp *.h -o $(podir)/tdestyle_plastik_config.pot
diff --git a/tdestyles/plastik/config/plastikconf.cpp b/tdestyles/plastik/config/plastikconf.cpp
new file mode 100644
index 000000000..4900f708e
--- /dev/null
+++ b/tdestyles/plastik/config/plastikconf.cpp
@@ -0,0 +1,223 @@
+/*
+Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
+
+based on the Keramik configuration dialog:
+Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include <tqcheckbox.h>
+#include <tqlayout.h>
+#include <tqhbox.h>
+#include <tqsettings.h>
+#include <tqcolor.h>
+#include <tqgroupbox.h>
+#include <tdeglobal.h>
+#include <tdelocale.h>
+#include <kcolorbutton.h>
+#include <kdemacros.h>
+
+#include "plastikconf.h"
+
+extern "C"
+{
+ KDE_EXPORT TQWidget* allocate_tdestyle_config(TQWidget* parent)
+ {
+ TDEGlobal::locale()->insertCatalogue("tdestyle_plastik_config");
+ return new PlastikStyleConfig(parent);
+ }
+}
+
+PlastikStyleConfig::PlastikStyleConfig(TQWidget* parent): TQWidget(parent)
+{
+ //Should have no margins here, the dialog provides them
+ TQVBoxLayout* layout = new TQVBoxLayout(this, 0, 0);
+ TDEGlobal::locale()->insertCatalogue("tdestyle_plastik_config");
+
+// scrollBarLines = new TQCheckBox(i18n("Scrollbar handle lines"), this);
+ animateProgressBar = new TQCheckBox(i18n("Animate progress bars"), this);
+ drawToolBarSeparator = new TQCheckBox(i18n("Draw toolbar separator"), this);
+ drawToolBarItemSeparator = new TQCheckBox(i18n("Draw toolbar item separators"), this);
+// drawFocusRect = new TQCheckBox(i18n("Draw focus rectangles"), this);
+ drawTriangularExpander = new TQCheckBox(i18n("Triangular tree expander"), this);
+ inputFocusHighlight = new TQCheckBox(i18n("Highlight focused text input fields"), this);
+
+ customFocusHighlightColor = new TQCheckBox(i18n("Custom text input highlight color:"), this);
+ TQHBox *hbox1 = new TQHBox(this);
+ hbox1->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
+ focusHighlightColor = new KColorButton(hbox1);
+
+ customOverHighlightColor = new TQCheckBox(i18n("Custom mouseover highlight color:"), this);
+ TQHBox *hbox2 = new TQHBox(this);
+ hbox2->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
+ overHighlightColor = new KColorButton(hbox2);
+
+ customCheckMarkColor = new TQCheckBox(i18n("Custom checkmark color:"), this);
+ TQHBox *hbox3 = new TQHBox(this);
+ hbox3->layout()->addItem(new TQSpacerItem(20, 0, TQSizePolicy::Fixed, TQSizePolicy::Minimum) );
+ checkMarkColor = new KColorButton(hbox3);
+
+// layout->add(scrollBarLines);
+ layout->add(animateProgressBar);
+ layout->add(drawToolBarSeparator);
+ layout->add(drawToolBarItemSeparator);
+// layout->add(drawFocusRect);
+ layout->add(drawTriangularExpander);
+ layout->add(inputFocusHighlight);
+ layout->add(customFocusHighlightColor);
+ layout->add(hbox1);
+ layout->add(customOverHighlightColor);
+ layout->add(hbox2);
+ layout->add(customCheckMarkColor);
+ layout->add(hbox3);
+ layout->addStretch(1);
+
+ TQSettings s;
+// origScrollBarLines = s.readBoolEntry("/plastikstyle/Settings/scrollBarLines", false);
+// scrollBarLines->setChecked(origScrollBarLines);
+ origAnimProgressBar = s.readBoolEntry("/plastikstyle/Settings/animateProgressBar", false);
+ animateProgressBar->setChecked(origAnimProgressBar);
+ origDrawToolBarSeparator = s.readBoolEntry("/plastikstyle/Settings/drawToolBarSeparator", false);
+ drawToolBarSeparator->setChecked(origDrawToolBarSeparator);
+ origDrawToolBarItemSeparator = s.readBoolEntry("/plastikstyle/Settings/drawToolBarItemSeparator", true);
+ drawToolBarItemSeparator->setChecked(origDrawToolBarItemSeparator);
+// origDrawFocusRect = s.readBoolEntry("/plastikstyle/Settings/drawFocusRect", true);
+// drawFocusRect->setChecked(origDrawFocusRect);
+ origDrawTriangularExpander = s.readBoolEntry("/plastikstyle/Settings/drawTriangularExpander", false);
+ drawTriangularExpander->setChecked(origDrawTriangularExpander);
+ origInputFocusHighlight = s.readBoolEntry("/plastikstyle/Settings/inputFocusHighlight", true);
+ inputFocusHighlight->setChecked(origInputFocusHighlight);
+ origCustomOverHighlightColor = s.readBoolEntry("/plastikstyle/Settings/customOverHighlightColor", false);
+ customOverHighlightColor->setChecked(origCustomOverHighlightColor);
+ origOverHighlightColor = s.readEntry("/plastikstyle/Settings/overHighlightColor", "black");
+ overHighlightColor->setColor(origOverHighlightColor);
+ origCustomFocusHighlightColor = s.readBoolEntry("/plastikstyle/Settings/customFocusHighlightColor", false);
+ customFocusHighlightColor->setChecked(origCustomFocusHighlightColor);
+ origFocusHighlightColor = s.readEntry("/plastikstyle/Settings/focusHighlightColor", "black");
+ focusHighlightColor->setColor(origFocusHighlightColor);
+ origCustomCheckMarkColor = s.readBoolEntry("/plastikstyle/Settings/customCheckMarkColor", false);
+ customCheckMarkColor->setChecked(origCustomCheckMarkColor);
+ origCheckMarkColor = s.readEntry("/plastikstyle/Settings/checkMarkColor", "black");
+ checkMarkColor->setColor(origCheckMarkColor);
+
+// connect(scrollBarLines, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(animateProgressBar, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(drawToolBarSeparator, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(drawToolBarItemSeparator, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+// connect(drawFocusRect, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(drawTriangularExpander, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(inputFocusHighlight, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(customOverHighlightColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(overHighlightColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_SLOT( updateChanged() ) );
+ connect(customFocusHighlightColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(focusHighlightColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_SLOT( updateChanged() ) );
+ connect(customCheckMarkColor, TQT_SIGNAL( toggled(bool) ), TQT_SLOT( updateChanged() ) );
+ connect(checkMarkColor, TQT_SIGNAL( changed(const TQColor&) ), TQT_SLOT( updateChanged() ) );
+ if ( customOverHighlightColor->isChecked() )
+ overHighlightColor->setEnabled(true);
+ else
+ overHighlightColor->setEnabled(false);
+ if ( customFocusHighlightColor->isChecked() )
+ focusHighlightColor->setEnabled(true);
+ else
+ focusHighlightColor->setEnabled(false);
+ if ( customCheckMarkColor->isChecked() )
+ checkMarkColor->setEnabled(true);
+ else
+ checkMarkColor->setEnabled(false);
+}
+
+PlastikStyleConfig::~PlastikStyleConfig()
+{
+}
+
+
+void PlastikStyleConfig::save()
+{
+ TQSettings s;
+// s.writeEntry("/plastikstyle/Settings/scrollBarLines", scrollBarLines->isChecked());
+ s.writeEntry("/plastikstyle/Settings/animateProgressBar", animateProgressBar->isChecked());
+ s.writeEntry("/plastikstyle/Settings/drawToolBarSeparator", drawToolBarSeparator->isChecked());
+ s.writeEntry("/plastikstyle/Settings/drawToolBarItemSeparator", drawToolBarItemSeparator->isChecked());
+// s.writeEntry("/plastikstyle/Settings/drawFocusRect", drawFocusRect->isChecked());
+ s.writeEntry("/plastikstyle/Settings/drawTriangularExpander", drawTriangularExpander->isChecked());
+ s.writeEntry("/plastikstyle/Settings/inputFocusHighlight", inputFocusHighlight->isChecked());
+ s.writeEntry("/plastikstyle/Settings/customOverHighlightColor", customOverHighlightColor->isChecked());
+ s.writeEntry("/plastikstyle/Settings/overHighlightColor", TQColor(overHighlightColor->color()).name());
+ s.writeEntry("/plastikstyle/Settings/customFocusHighlightColor", customFocusHighlightColor->isChecked());
+ s.writeEntry("/plastikstyle/Settings/focusHighlightColor", TQColor(focusHighlightColor->color()).name());
+ s.writeEntry("/plastikstyle/Settings/customCheckMarkColor", customCheckMarkColor->isChecked());
+ s.writeEntry("/plastikstyle/Settings/checkMarkColor", TQColor(checkMarkColor->color()).name());
+}
+
+void PlastikStyleConfig::defaults()
+{
+// scrollBarLines->setChecked(false);
+ animateProgressBar->setChecked(false);
+ drawToolBarSeparator->setChecked(false);
+ drawToolBarItemSeparator->setChecked(true);
+// drawFocusRect->setChecked(true);
+ drawTriangularExpander->setChecked(false);
+ inputFocusHighlight->setChecked(true);
+ customOverHighlightColor->setChecked(false);
+ overHighlightColor->setColor("black");
+ customFocusHighlightColor->setChecked(false);
+ focusHighlightColor->setColor("black");
+ customCheckMarkColor->setChecked(false);
+ checkMarkColor->setColor("black");
+ //updateChanged would be done by setChecked already
+}
+
+void PlastikStyleConfig::updateChanged()
+{
+ if ( customOverHighlightColor->isChecked() )
+ overHighlightColor->setEnabled(true);
+ else
+ overHighlightColor->setEnabled(false);
+ if ( customFocusHighlightColor->isChecked() )
+ focusHighlightColor->setEnabled(true);
+ else
+ focusHighlightColor->setEnabled(false);
+ if ( customCheckMarkColor->isChecked() )
+ checkMarkColor->setEnabled(true);
+ else
+ checkMarkColor->setEnabled(false);
+
+ if (/*(scrollBarLines->isChecked() == origScrollBarLines) &&*/
+ (animateProgressBar->isChecked() == origAnimProgressBar) &&
+ (drawToolBarSeparator->isChecked() == origDrawToolBarSeparator) &&
+ (drawToolBarItemSeparator->isChecked() == origDrawToolBarItemSeparator) &&
+// (drawFocusRect->isChecked() == origDrawFocusRect) &&
+ (drawTriangularExpander->isChecked() == origDrawTriangularExpander) &&
+ (inputFocusHighlight->isChecked() == origInputFocusHighlight) &&
+ (customOverHighlightColor->isChecked() == origCustomOverHighlightColor) &&
+ (overHighlightColor->color() == origOverHighlightColor) &&
+ (customFocusHighlightColor->isChecked() == origCustomFocusHighlightColor) &&
+ (focusHighlightColor->color() == origFocusHighlightColor) &&
+ (customCheckMarkColor->isChecked() == origCustomCheckMarkColor) &&
+ (checkMarkColor->color() == origCheckMarkColor)
+ )
+ emit changed(false);
+ else
+ emit changed(true);
+}
+
+#include "plastikconf.moc"
diff --git a/tdestyles/plastik/config/plastikconf.h b/tdestyles/plastik/config/plastikconf.h
new file mode 100644
index 000000000..512ad6f2e
--- /dev/null
+++ b/tdestyles/plastik/config/plastikconf.h
@@ -0,0 +1,85 @@
+/*
+Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
+
+based on the Keramik configuration dialog:
+Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+*/
+
+#ifndef PLASTIK_CONF_H
+#define PLASTIK_CONF_H
+
+class TQCheckBox;
+
+class PlastikStyleConfig: public TQWidget
+{
+ Q_OBJECT
+public:
+ PlastikStyleConfig(TQWidget* parent);
+ ~PlastikStyleConfig();
+
+ //This signal and the next two slots are the plugin
+ //page interface
+signals:
+ void changed(bool);
+
+public slots:
+ void save();
+ void defaults();
+
+ //Everything below this is internal.
+protected slots:
+ void updateChanged();
+
+protected:
+ //We store settings directly in widgets to
+ //avoid the hassle of sync'ing things
+// TQCheckBox* scrollBarLines;
+ TQCheckBox* animateProgressBar;
+ TQCheckBox* drawToolBarSeparator;
+ TQCheckBox* drawToolBarItemSeparator;
+// TQCheckBox* drawFocusRect;
+ TQCheckBox* drawTriangularExpander;
+ TQCheckBox* inputFocusHighlight;
+ TQCheckBox* customOverHighlightColor;
+ KColorButton* overHighlightColor;
+ TQCheckBox* customFocusHighlightColor;
+ KColorButton* focusHighlightColor;
+ TQCheckBox* customCheckMarkColor;
+ KColorButton* checkMarkColor;
+
+ //Original settings, for accurate dirtiness tracking
+// bool origScrollBarLines;
+ bool origAnimProgressBar;
+ bool origDrawToolBarSeparator;
+ bool origDrawToolBarItemSeparator;
+// bool origDrawFocusRect;
+ bool origDrawTriangularExpander;
+ bool origInputFocusHighlight;
+ bool origCustomOverHighlightColor;
+ TQColor origOverHighlightColor;
+ bool origCustomFocusHighlightColor;
+ TQColor origFocusHighlightColor;
+ bool origCustomCheckMarkColor;
+ TQColor origCheckMarkColor;
+};
+
+#endif
diff --git a/tdestyles/plastik/misc.cpp b/tdestyles/plastik/misc.cpp
new file mode 100644
index 000000000..d1a52d61e
--- /dev/null
+++ b/tdestyles/plastik/misc.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2003, Sandro Giessl <ceebx@users.sourceforge.net>
+ *
+ * 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.
+ */
+
+#include <tqcolor.h>
+#include "misc.h"
+
+TQColor alphaBlendColors(const TQColor &bgColor, const TQColor &fgColor, const int a)
+{
+
+ // normal button...
+ QRgb rgb = bgColor.rgb();
+ QRgb rgb_b = fgColor.rgb();
+ int alpha = a;
+ if(alpha>255) alpha = 255;
+ if(alpha<0) alpha = 0;
+ int inv_alpha = 255 - alpha;
+
+ TQColor result = TQColor( tqRgb(tqRed(rgb_b)*inv_alpha/255 + tqRed(rgb)*alpha/255,
+ tqGreen(rgb_b)*inv_alpha/255 + tqGreen(rgb)*alpha/255,
+ tqBlue(rgb_b)*inv_alpha/255 + tqBlue(rgb)*alpha/255) );
+
+ return result;
+}
diff --git a/tdestyles/plastik/misc.h b/tdestyles/plastik/misc.h
new file mode 100644
index 000000000..c09ee87c8
--- /dev/null
+++ b/tdestyles/plastik/misc.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2003, Sandro Giessl <ceebx@users.sourceforge.net>
+ *
+ * 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 __MISC_H
+#define __MISC_H
+
+TQColor alphaBlendColors(const TQColor &backgroundColor, const TQColor &foregroundColor, const int alpha);
+
+#endif // __MISC_H
diff --git a/tdestyles/plastik/plastik.cpp b/tdestyles/plastik/plastik.cpp
new file mode 100644
index 000000000..e7b6acd7f
--- /dev/null
+++ b/tdestyles/plastik/plastik.cpp
@@ -0,0 +1,3593 @@
+/* Plastik widget style for KDE 3
+ Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
+
+ based on the KDE style "dotNET":
+
+ Copyright (C) 2001-2002, Chris Lee <clee@kde.org>
+ Carsten Pfeiffer <pfeiffer@kde.org>
+ Karol Szwed <gallium@kde.org>
+ 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 <malte@kde.org>
+ (c) 2002,2003 Maksim Orlovich <mo002j@mail.rochester.edu>
+ based on the KDE3 HighColor Style
+ Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ (C) 2001-2002 Fredrik H�glund <fredrik@kde.org>
+ Drawing routines adapted from the KDE2 HCStyle,
+ Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ (C) 2000 Dirk Mueller <mueller@kde.org>
+ (C) 2001 Martijn Klingens <klingens@kde.org>
+ Progressbar code based on TDEStyle,
+ Copyright (C) 2001-2002 Karol Szwed <gallium@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.
+ */
+
+#include <tqimage.h>
+#include <tqstylefactory.h>
+#include <tqpointarray.h>
+#include <tqpainter.h>
+#include <tqtabbar.h>
+#include <tqprogressbar.h>
+#include <tqcheckbox.h>
+#include <tqcombobox.h>
+#include <tqcleanuphandler.h>
+#include <tqheader.h>
+#include <tqlineedit.h>
+#include <tqlistbox.h>
+#include <tqscrollbar.h>
+#include <tqstyleplugin.h>
+#include <tqpushbutton.h>
+#include <tqtabwidget.h>
+#include <tqtimer.h>
+#include <tqtoolbutton.h>
+#include <tqtoolbar.h>
+#include <tqmenubar.h>
+#include <tqpopupmenu.h>
+#include <tqdrawutil.h>
+#include <tqapplication.h>
+#include <tqvariant.h>
+#include <tqradiobutton.h>
+#include <tqregion.h>
+#include <tqslider.h>
+#include <tqsettings.h>
+#include <kpixmap.h>
+
+#include "plastik.h"
+#include "plastik.moc"
+#include "misc.h"
+
+// some bitmaps for the radio button so it's easier to handle the circle stuff...
+// 13x13
+static const unsigned char radiobutton_mask_bits[] = {
+ 0xf8, 0x03, 0xfc, 0x07, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f,
+ 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f, 0xfe, 0x0f, 0xfc, 0x07,
+ 0xf8, 0x03};
+static const unsigned char radiobutton_contour_bits[] = {
+ 0xf0, 0x01, 0x0c, 0x06, 0x02, 0x08, 0x02, 0x08, 0x01, 0x10, 0x01, 0x10,
+ 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x02, 0x08, 0x02, 0x08, 0x0c, 0x06,
+ 0xf0, 0x01};
+static const unsigned char radiobutton_aa_inside_bits[] = {
+ 0x00, 0x00, 0x10, 0x01, 0x04, 0x04, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x04, 0x04, 0x10, 0x01,
+ 0x00, 0x00};
+static const unsigned char radiobutton_aa_outside_bits[] = {
+ 0x08, 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x02};
+static const unsigned char radiobutton_highlight1_bits[] = {
+ 0x00, 0x00, 0xf0, 0x01, 0x1c, 0x07, 0x04, 0x04, 0x06, 0x0c, 0x02, 0x08,
+ 0x02, 0x08, 0x02, 0x08, 0x06, 0x0c, 0x04, 0x04, 0x1c, 0x07, 0xf0, 0x01,
+ 0x00, 0x00};
+static const unsigned char radiobutton_highlight2_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x18, 0x03, 0x08, 0x02, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x08, 0x02, 0x18, 0x03, 0xe0, 0x00, 0x00, 0x00,
+ 0x00, 0x00};
+// check mark
+const uint CHECKMARKSIZE = 9; // 9x9
+static const unsigned char checkmark_aa_bits[] = {
+ 0x45, 0x01, 0x28, 0x00, 0x11, 0x01, 0x82, 0x00, 0x44, 0x00, 0x82, 0x00,
+ 0x11, 0x01, 0x28, 0x00, 0x45, 0x01};
+static const unsigned char checkmark_dark_bits[] = {
+ 0x82, 0x00, 0x45, 0x01, 0xaa, 0x00, 0x54, 0x00, 0x28, 0x00, 0x74, 0x00,
+ 0xea, 0x00, 0xc5, 0x01, 0x82, 0x00};
+static const unsigned char checkmark_light_bits[] = {
+ 0x00, 0xfe, 0x82, 0xfe, 0x44, 0xfe, 0x28, 0xfe, 0x10, 0xfe, 0x08, 0xfe,
+ 0x04, 0xfe, 0x02, 0xfe, 0x00, 0xfe};
+static const unsigned char checkmark_tristate_bits[] = {
+ 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0xff, 0x01,
+ 0x00, 0x00, 0xff, 0x01, 0x00, 0x00};
+// radio mark
+const uint RADIOMARKSIZE = 9; // 9x9
+static const unsigned char radiomark_aa_bits[] = {
+ 0x00, 0x00, 0x44, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x82, 0x00, 0x44, 0x00, 0x00, 0x00};
+static const unsigned char radiomark_dark_bits[] = {
+ 0x00, 0x00, 0x38, 0x00, 0x44, 0x00, 0xf2, 0x00, 0xfa, 0x00, 0xfa, 0x00,
+ 0x7c, 0x00, 0x38, 0x00, 0x00, 0x00};
+static const unsigned char radiomark_light_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+// popupmenu item constants...
+static const int itemHMargin = 6;
+static const int itemFrame = 2;
+static const int arrowHMargin = 6;
+static const int rightBorder = 12;
+
+// -- Style Plugin Interface -------------------------
+class PlastikStylePlugin : public TQStylePlugin
+{
+ public:
+ PlastikStylePlugin() {}
+ ~PlastikStylePlugin() {}
+
+ TQStringList keys() const {
+ return TQStringList() << "Plastik";
+ }
+
+ TQStyle* create( const TQString& key ) {
+ if (key.lower() == "plastik")
+ return new PlastikStyle;
+ return 0;
+ }
+};
+
+KDE_Q_EXPORT_PLUGIN( PlastikStylePlugin )
+// -- end --
+
+PlastikStyle::PlastikStyle() : TDEStyle( AllowMenuTransparency, ThreeButtonScrollBar),
+ kickerMode(false),
+ kornMode(false),
+ flatMode(false)
+{
+ horizontalLine = 0;
+ verticalLine = 0;
+
+ TQSettings settings;
+ _contrast = settings.readNumEntry("/Qt/KDE/contrast", 6);
+ settings.beginGroup("/plastikstyle/Settings");
+ _scrollBarLines = settings.readBoolEntry("/scrollBarLines", false);
+ _animateProgressBar = settings.readBoolEntry("/animateProgressBar", false);
+ _drawToolBarSeparator = settings.readBoolEntry("/drawToolBarSeparator", false);
+ _drawToolBarItemSeparator = settings.readBoolEntry("/drawToolBarItemSeparator", true);
+ _drawFocusRect = settings.readBoolEntry("/drawFocusRect", true);
+ _drawTriangularExpander = settings.readBoolEntry("/drawTriangularExpander", false);
+ _inputFocusHighlight = settings.readBoolEntry("/inputFocusHighlight", true);
+ _customOverHighlightColor = settings.readBoolEntry("/customOverHighlightColor", false);
+ _overHighlightColor.setNamedColor( settings.readEntry("/overHighlightColor", "black") );
+ _customFocusHighlightColor = settings.readBoolEntry("/customFocusHighlightColor", false);
+ _focusHighlightColor.setNamedColor( settings.readEntry("/focusHighlightColor", "black") );
+ _customCheckMarkColor = settings.readBoolEntry("/customCheckMarkColor", false);
+ _checkMarkColor.setNamedColor( settings.readEntry("/checkMarkColor", "black") );
+ settings.endGroup();
+
+ // setup pixmap cache...
+ pixmapCache = new TQIntCache<CacheEntry>(150000, 499);
+ pixmapCache->setAutoDelete(true);
+
+ if ( _animateProgressBar )
+ {
+ animationTimer = new TQTimer( this );
+ connect( animationTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateProgressPos()) );
+ }
+}
+
+
+void PlastikStyle::updateProgressPos()
+{
+ TQProgressBar* pb;
+ //Update the registered progressbars.
+ TQMap<TQWidget*, int>::iterator iter;
+ bool visible = false;
+ for (iter = progAnimWidgets.begin(); iter != progAnimWidgets.end(); ++iter)
+ {
+ if ( !::tqqt_cast<TQProgressBar*>(iter.key()) )
+ continue;
+
+ pb = dynamic_cast<TQProgressBar*>(iter.key());
+ if ( iter.key() -> isEnabled() &&
+ pb -> progress() != pb->totalSteps() )
+ {
+ // update animation Offset of the current Widget
+ iter.data() = (iter.data() + 1) % 20;
+ iter.key()->update();
+ }
+ if (iter.key()->isVisible())
+ visible = true;
+ }
+ if (!visible)
+ animationTimer->stop();
+}
+
+
+PlastikStyle::~PlastikStyle()
+{
+ delete pixmapCache;
+ delete horizontalLine;
+ delete verticalLine;
+}
+
+void PlastikStyle::applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQAPPLICATION_OBJECT_NAME_STRING)) {
+ TQApplication *app = reinterpret_cast<TQApplication*>(ptr);
+
+ if (!qstrcmp(app->argv()[0], "kicker"))
+ kickerMode = true;
+ else if (!qstrcmp(app->argv()[0], "korn"))
+ kornMode = true;
+ }
+}
+
+void PlastikStyle::polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ if( !strcmp(widget->name(), "__tdehtml") ) { // is it a tdehtml widget...?
+ tdehtmlWidgets[widget] = true;
+ connect(widget, TQT_SIGNAL(destroyed(TQObject*)), this, TQT_SLOT(tdehtmlWidgetDestroyed(TQObject*)));
+ }
+
+ // use tqqt_cast where possible to check if the widget inheits one of the classes. might improve
+ // performance compared to TQObject::inherits()
+ if ( ::tqqt_cast<TQPushButton*>(widget) || ::tqqt_cast<TQComboBox*>(widget) ||
+ ::tqqt_cast<TQSpinWidget*>(widget) || ::tqqt_cast<TQSlider*>(widget) ||
+ ::tqqt_cast<TQCheckBox*>(widget) || ::tqqt_cast<TQRadioButton*>(widget) ||
+ ::tqqt_cast<TQToolButton*>(widget) || widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) )
+ {
+ // widget->setBackgroundMode(PaletteBackground);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (::tqqt_cast<TQLineEdit*>(widget)) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (::tqqt_cast<TQTabBar*>(widget)) {
+ widget->setMouseTracking(true);
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (::tqqt_cast<TQPopupMenu*>(widget)) {
+ widget->setBackgroundMode( NoBackground );
+ } else if ( !qstrcmp(widget->name(), "kde toolbar widget") ) {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+
+ if( _animateProgressBar && ::tqqt_cast<TQProgressBar*>(widget) )
+ {
+ installObjectEventHandler(ceData, elementFlags, ptr, this);
+ progAnimWidgets[widget] = 0;
+ connect(widget, TQT_SIGNAL(destroyed(TQObject*)), this, TQT_SLOT(progressBarDestroyed(TQObject*)));
+ if (!animationTimer->isActive())
+ animationTimer->start( 50, false );
+ }
+ }
+
+ TDEStyle::polish(ceData, elementFlags, ptr);
+}
+
+void PlastikStyle::unPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *ptr)
+{
+ if (ceData.widgetObjectTypes.contains(TQWIDGET_OBJECT_NAME_STRING)) {
+ TQWidget *widget = reinterpret_cast<TQWidget*>(ptr);
+
+ if( !strcmp(widget->name(), "__tdehtml") ) { // is it a tdehtml widget...?
+ tdehtmlWidgets.remove(widget);
+ }
+
+ // use tqqt_cast to check if the widget inheits one of the classes.
+ if ( ::tqqt_cast<TQPushButton*>(widget) || ::tqqt_cast<TQComboBox*>(widget) ||
+ ::tqqt_cast<TQSpinWidget*>(widget) || ::tqqt_cast<TQSlider*>(widget) ||
+ ::tqqt_cast<TQCheckBox*>(widget) || ::tqqt_cast<TQRadioButton*>(widget) ||
+ ::tqqt_cast<TQToolButton*>(widget) || ::tqqt_cast<TQLineEdit*>(widget) ||
+ widget->inherits(TQSPLITTERHANDLE_OBJECT_NAME_STRING) )
+ {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+ else if (::tqqt_cast<TQTabBar*>(widget)) {
+ widget->setMouseTracking(false);
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ } else if (::tqqt_cast<TQPopupMenu*>(widget)) {
+ widget->setBackgroundMode( PaletteBackground );
+ } else if ( !qstrcmp(widget->name(), "kde toolbar widget") ) {
+ removeObjectEventHandler(ceData, elementFlags, ptr, this);
+ }
+
+ if ( ::tqqt_cast<TQProgressBar*>(widget) )
+ {
+ progAnimWidgets.remove(widget);
+ }
+ }
+
+ TDEStyle::unPolish(ceData, elementFlags, ptr);
+}
+
+void PlastikStyle::tdehtmlWidgetDestroyed(TQObject* obj)
+{
+ tdehtmlWidgets.remove(TQT_TQWIDGET(obj));
+}
+
+void PlastikStyle::progressBarDestroyed(TQObject* obj)
+{
+ progAnimWidgets.remove(TQT_TQWIDGET(obj));
+}
+
+void PlastikStyle::renderContour(TQPainter *p,
+ const TQRect &r,
+ const TQColor &backgroundColor,
+ const TQColor &contour,
+ const uint flags) const
+{
+ if((r.width() <= 0)||(r.height() <= 0))
+ return;
+
+ const bool drawLeft = flags&Draw_Left;
+ const bool drawRight = flags&Draw_Right;
+ const bool drawTop = flags&Draw_Top;
+ const bool drawBottom = flags&Draw_Bottom;
+ const bool disabled = flags&Is_Disabled;
+ const bool alphaBlend = flags&Draw_AlphaBlend;
+
+ TQColor contourColor;
+ if (disabled) {
+ contourColor = backgroundColor.dark(150);
+ } else {
+ contourColor = contour;
+ }
+
+// sides
+ p->setPen( alphaBlendColors(backgroundColor, contourColor, 50) );
+ if(drawLeft)
+ p->drawLine(r.left(), drawTop?r.top()+2:r.top(), r.left(), drawBottom?r.bottom()-2:r.bottom());
+ if(drawRight)
+ p->drawLine(r.right(), drawTop?r.top()+2:r.top(), r.right(), drawBottom?r.bottom()-2:r.bottom());
+ if(drawTop)
+ p->drawLine(drawLeft?r.left()+2:r.left(), r.top(), drawRight?r.right()-2:r.right(), r.top());
+ if(drawBottom)
+ p->drawLine(drawLeft?r.left()+2:r.left(), r.bottom(), drawRight?r.right()-2:r.right(), r.bottom());
+
+// edges
+ const int alphaAA = 110; // the alpha value for anti-aliasing...
+
+ // first part...
+ p->setPen(alphaBlendColors(backgroundColor, contourColor, 50) );
+ if(drawLeft && drawTop) {
+ switch(flags&Round_UpperLeft) {
+ case false:
+ p->drawPoint(r.left()+1, r.top());
+ p->drawPoint(r.left(), r.top()+1);
+ break;
+ default:
+ p->drawPoint(r.left()+1, r.top()+1);
+ }
+ }
+ if(drawLeft && drawBottom) {
+ switch(flags&Round_BottomLeft) {
+ case false:
+ p->drawPoint(r.left()+1, r.bottom());
+ p->drawPoint(r.left(), r.bottom()-1);
+ break;
+ default:
+ p->drawPoint(r.left()+1, r.bottom()-1);
+ }
+ }
+ if(drawRight && drawTop) {
+ switch(flags&Round_UpperRight) {
+ case false:
+ p->drawPoint(r.right()-1, r.top());
+ p->drawPoint(r.right(), r.top()+1);
+ break;
+ default:
+ p->drawPoint(r.right()-1, r.top()+1);
+ }
+ }
+ if(drawRight && drawBottom) {
+ switch(flags&Round_BottomRight) {
+ case false:
+ p->drawPoint(r.right()-1, r.bottom());
+ p->drawPoint(r.right(), r.bottom()-1);
+ break;
+ default:
+ p->drawPoint(r.right()-1, r.bottom()-1);
+ }
+ }
+
+ // second part... fill edges in case we don't paint alpha-blended
+ p->setPen( backgroundColor );
+ if (!alphaBlend) {
+ if(flags&Round_UpperLeft && drawLeft && drawTop) {
+ p->drawPoint( r.x(), r.y() );
+ }
+ if(flags&Round_BottomLeft && drawLeft && drawBottom) {
+ p->drawPoint( r.x(), r.bottom() );
+ }
+ if(flags&Round_UpperRight && drawRight && drawTop) {
+ p->drawPoint( r.right(), r.y() );
+ }
+ if(flags&Round_BottomRight && drawRight && drawBottom) {
+ p->drawPoint( r.right(), r.bottom() );
+ }
+ }
+
+ // third part... anti-aliasing...
+ if(drawLeft && drawTop) {
+ switch(flags&Round_UpperLeft) {
+ case false:
+ renderPixel(p,TQPoint(r.left(),r.top()),alphaAA,contourColor,backgroundColor,alphaBlend);
+ break;
+ default:
+ renderPixel(p,TQPoint(r.left()+1,r.top()),alphaAA,contourColor,backgroundColor,alphaBlend);
+ renderPixel(p,TQPoint(r.left(),r.top()+1),alphaAA,contourColor,backgroundColor,alphaBlend);
+ }
+ }
+ if(drawLeft && drawBottom) {
+ switch(flags&Round_BottomLeft) {
+ case false:
+ renderPixel(p,TQPoint(r.left(),r.bottom()),alphaAA,contourColor,backgroundColor,alphaBlend);
+ break;
+ default:
+ renderPixel(p,TQPoint(r.left()+1,r.bottom()),alphaAA,contourColor,backgroundColor,alphaBlend);
+ renderPixel(p,TQPoint(r.left(),r.bottom()-1),alphaAA,contourColor,backgroundColor,alphaBlend);
+ }
+ }
+ if(drawRight && drawTop) {
+ switch(flags&Round_UpperRight) {
+ case false:
+ renderPixel(p,TQPoint(r.right(),r.top()),alphaAA,contourColor,backgroundColor,alphaBlend);
+ break;
+ default:
+ renderPixel(p,TQPoint(r.right()-1,r.top()),alphaAA,contourColor,backgroundColor,alphaBlend);
+ renderPixel(p,TQPoint(r.right(),r.top()+1),alphaAA,contourColor,backgroundColor,alphaBlend);
+ }
+ }
+ if(drawRight && drawBottom) {
+ switch(flags&Round_BottomRight) {
+ case false:
+ renderPixel(p,TQPoint(r.right(),r.bottom()),alphaAA,contourColor,backgroundColor,alphaBlend);
+ break;
+ default:
+ renderPixel(p,TQPoint(r.right()-1,r.bottom()),alphaAA,contourColor,backgroundColor,alphaBlend);
+ renderPixel(p,TQPoint(r.right(),r.bottom()-1),alphaAA,contourColor,backgroundColor,alphaBlend);
+ }
+ }
+
+}
+
+void PlastikStyle::renderMask(TQPainter *p,
+ const TQRect &r,
+ const TQColor &color,
+ const uint flags) const
+{
+ if((r.width() <= 0)||(r.height() <= 0))
+ return;
+
+ const bool roundUpperLeft = flags&Round_UpperLeft;
+ const bool roundUpperRight = flags&Round_UpperRight;
+ const bool roundBottomLeft = flags&Round_BottomLeft;
+ const bool roundBottomRight = flags&Round_BottomRight;
+
+
+ p->fillRect (TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2) , color);
+
+ p->setPen(color);
+ // sides
+ p->drawLine(roundUpperLeft?r.x()+1:r.x(), r.y(),
+ roundUpperRight?r.right()-1:r.right(), r.y() );
+ p->drawLine(roundBottomLeft?r.x()+1:r.x(), r.bottom(),
+ roundBottomRight?r.right()-1:r.right(), r.bottom() );
+ p->drawLine(r.x(), roundUpperLeft?r.y()+1:r.y(),
+ r.x(), roundBottomLeft?r.bottom()-1:r.bottom() );
+ p->drawLine(r.right(), roundUpperLeft?r.y()+1:r.y(),
+ r.right(), roundBottomLeft?r.bottom()-1:r.bottom() );
+}
+
+void PlastikStyle::renderSurface(TQPainter *p,
+ const TQRect &r,
+ const TQColor &backgroundColor,
+ const TQColor &buttonColor,
+ const TQColor &highlightColor,
+ int intensity,
+ const uint flags) const
+{
+ if((r.width() <= 0)||(r.height() <= 0))
+ return;
+
+ const bool disabled = flags&Is_Disabled;
+
+ const bool drawLeft = flags&Draw_Left;
+ const bool drawRight = flags&Draw_Right;
+ const bool drawTop = flags&Draw_Top;
+ const bool drawBottom = flags&Draw_Bottom;
+ const bool roundUpperLeft = flags&Round_UpperLeft;
+ const bool roundUpperRight = flags&Round_UpperRight;
+ const bool roundBottomLeft = flags&Round_BottomLeft;
+ const bool roundBottomRight = flags&Round_BottomRight;
+ const bool sunken = flags&Is_Sunken;
+ const bool horizontal = flags&Is_Horizontal;
+ bool highlight = false,
+ highlightLeft = false,
+ highlightRight = false,
+ highlightTop = false,
+ highlightBottom = false;
+ // only highlight if not sunken & not disabled...
+ if(!sunken && !disabled) {
+ highlight = (flags&Is_Highlight);
+ highlightLeft = (flags&Highlight_Left);
+ highlightRight = (flags&Highlight_Right);
+ highlightTop = (flags&Highlight_Top);
+ highlightBottom = (flags&Highlight_Bottom);
+ }
+
+ TQColor baseColor = alphaBlendColors(backgroundColor, disabled?backgroundColor:buttonColor, 10);
+ if (disabled) {
+ intensity = 2;
+ } else if (highlight) {
+ // blend this _slightly_ with the background
+ baseColor = alphaBlendColors(baseColor, highlightColor, 240);
+ } else if (sunken) {
+ // enforce a common sunken-style...
+ baseColor = baseColor.dark(110+intensity);
+ intensity = _contrast/2;
+ }
+// some often needed colors...
+ // 1 more intensive than 2 and 3.
+ const TQColor colorTop1 = alphaBlendColors(baseColor,
+ sunken?baseColor.dark(100+intensity*2):baseColor.light(100+intensity*2), 80);
+ const TQColor colorTop2 = alphaBlendColors(baseColor,
+ sunken?baseColor.dark(100+intensity):baseColor.light(100+intensity), 80);
+ const TQColor colorBottom1 = alphaBlendColors(baseColor,
+ sunken?baseColor.light(100+intensity*2):baseColor.dark(100+intensity*2), 80);
+ const TQColor colorBottom2 = alphaBlendColors(baseColor,
+ sunken?baseColor.light(100+intensity):baseColor.dark(100+intensity), 80);
+
+// sides
+ if (drawLeft) {
+ if (horizontal) {
+ int height = r.height();
+ if (roundUpperLeft || !drawTop) height--;
+ if (roundBottomLeft || !drawBottom) height--;
+ renderGradient(p, TQRect(r.left(), (roundUpperLeft&&drawTop)?r.top()+1:r.top(), 1, height),
+ colorTop1, baseColor);
+ } else {
+ p->setPen(colorTop1 );
+ p->drawLine(r.left(), (roundUpperLeft&&drawTop)?r.top()+1:r.top(),
+ r.left(), (roundBottomLeft&&drawBottom)?r.bottom()-1:r.bottom() );
+ }
+ }
+ if (drawRight) {
+ if (horizontal) {
+ int height = r.height();
+ // TODO: there's still a bogus in it: when edge4 is Thick
+ // and we don't whant to draw the Top, we have a unpainted area
+ if (roundUpperRight || !drawTop) height--;
+ if (roundBottomRight || !drawBottom) height--;
+ renderGradient(p, TQRect(r.right(), (roundUpperRight&&drawTop)?r.top()+1:r.top(), 1, height),
+ baseColor, colorBottom1);
+ } else {
+ p->setPen(colorBottom1 );
+ p->drawLine(r.right(), (roundUpperRight&&drawTop)?r.top()+1:r.top(),
+ r.right(), (roundBottomRight&&drawBottom)?r.bottom()-1:r.bottom() );
+ }
+ }
+ if (drawTop) {
+ if (horizontal) {
+ p->setPen(colorTop1 );
+ p->drawLine((roundUpperLeft&&drawLeft)?r.left()+1:r.left(), r.top(),
+ (roundUpperRight&&drawRight)?r.right()-1:r.right(), r.top() );
+ } else {
+ int width = r.width();
+ if (roundUpperLeft || !drawLeft) width--;
+ if (roundUpperRight || !drawRight) width--;
+ renderGradient(p, TQRect((roundUpperLeft&&drawLeft)?r.left()+1:r.left(), r.top(), width, 1),
+ colorTop1, colorTop2);
+ }
+ }
+ if (drawBottom) {
+ if (horizontal) {
+ p->setPen(colorBottom1 );
+ p->drawLine((roundBottomLeft&&drawLeft)?r.left()+1:r.left(), r.bottom(),
+ (roundBottomRight&&drawRight)?r.right()-1:r.right(), r.bottom() );
+ } else {
+ int width = r.width();
+ if (roundBottomLeft || !drawLeft) width--;
+ if (roundBottomRight || !drawRight) width--;
+ renderGradient(p, TQRect((roundBottomLeft&&drawLeft)?r.left()+1:r.left(), r.bottom(), width, 1),
+ colorBottom2, colorBottom1);
+ }
+ }
+
+// button area...
+ int width = r.width();
+ int height = r.height();
+ if (drawLeft) width--;
+ if (drawRight) width--;
+ if (drawTop) height--;
+ if (drawBottom) height--;
+ renderGradient(p, TQRect(drawLeft?r.left()+1:r.left(), drawTop?r.top()+1:r.top(), width, height),
+ colorTop2, colorBottom2, horizontal);
+
+
+// highlighting...
+ if(highlightTop) {
+ p->setPen(alphaBlendColors(colorTop1 , highlightColor, 80) );
+ p->drawLine((roundUpperLeft&&drawLeft)?r.left()+1:r.left(), r.top(),
+ (roundUpperRight&&drawRight)?r.right()-1:r.right(), r.top() );
+ p->setPen(alphaBlendColors(colorTop2 , highlightColor, 150) );
+ p->drawLine(highlightLeft?r.left()+1:r.left(), r.top()+1,
+ highlightRight?r.right()-1:r.right(), r.top()+1 );
+ }
+ if(highlightBottom) {
+ p->setPen(alphaBlendColors(colorBottom1 , highlightColor, 80) );
+ p->drawLine((roundBottomLeft&&drawLeft)?r.left()+1:r.left(), r.bottom(),
+ (roundBottomRight&&drawRight)?r.right()-1:r.right(), r.bottom() );
+ p->setPen(alphaBlendColors(colorBottom2 , highlightColor, 150) );
+ p->drawLine(highlightLeft?r.left()+1:r.left(), r.bottom()-1,
+ highlightRight?r.right()-1:r.right(), r.bottom()-1 );
+ }
+ if(highlightLeft) {
+ p->setPen(alphaBlendColors(colorTop1 , highlightColor, 80) );
+ p->drawLine(r.left(), (roundUpperLeft&&drawTop)?r.top()+1:r.top(),
+ r.left(), (roundBottomLeft&&drawBottom)?r.bottom()-1:r.bottom() );
+ p->setPen(alphaBlendColors(colorTop2 , highlightColor, 150) );
+ p->drawLine(r.left()+1, highlightTop?r.top()+1:r.top(),
+ r.left()+1, highlightBottom?r.bottom()-1:r.bottom() );
+ }
+ if(highlightRight) {
+ p->setPen(alphaBlendColors(colorBottom1 , highlightColor, 80) );
+ p->drawLine(r.right(), (roundUpperRight&&drawTop)?r.top()+1:r.top(),
+ r.right(), (roundBottomRight&&drawBottom)?r.bottom()-1:r.bottom() );
+ p->setPen(alphaBlendColors(colorBottom2 , highlightColor, 150) );
+ p->drawLine(r.right()-1, highlightTop?r.top()+1:r.top(),
+ r.right()-1, highlightBottom?r.bottom()-1:r.bottom() );
+ }
+}
+
+void PlastikStyle::renderPixel(TQPainter *p,
+ const TQPoint &pos,
+ const int alpha,
+ const TQColor &color,
+ const TQColor &background,
+ bool fullAlphaBlend) const
+{
+ if(fullAlphaBlend)
+ // full alpha blend: paint into an image with alpha buffer and convert to a pixmap ...
+ {
+ QRgb rgb = color.rgb();
+ // generate a quite unique key -- use the unused width field to store the alpha value.
+ CacheEntry search(cAlphaDot, alpha, 0, rgb);
+ int key = search.key();
+
+ CacheEntry *cacheEntry;
+ if( (cacheEntry = pixmapCache->find(key)) ) {
+ if( search == *cacheEntry ) { // match! we can draw now...
+ if(cacheEntry->pixmap)
+ p->drawPixmap(pos, *(cacheEntry->pixmap) );
+ return;
+ } else { //Remove old entry in case of a conflict!
+ pixmapCache->remove( key );
+ }
+ }
+
+
+ TQImage aImg(1,1,32); // 1x1
+ aImg.setAlphaBuffer(true);
+ aImg.setPixel(0,0,tqRgba(tqRed(rgb),tqGreen(rgb),tqBlue(rgb),alpha));
+ TQPixmap *result = new TQPixmap(aImg);
+
+ p->drawPixmap(pos, *result);
+
+ // add to the cache...
+ CacheEntry *toAdd = new CacheEntry(search);
+ toAdd->pixmap = result;
+ bool insertOk = pixmapCache->insert( key, toAdd, result->depth()/8);
+ if(!insertOk)
+ delete result;
+ } else
+ // don't use an alpha buffer: calculate the resulting color from the alpha value, the fg- and the bg-color.
+ {
+ QRgb rgb_a = color.rgb();
+ QRgb rgb_b = background.rgb();
+ int a = alpha;
+ if(a>255) a = 255;
+ if(a<0) a = 0;
+ int a_inv = 255 - a;
+
+ TQColor res = TQColor( tqRgb(tqRed(rgb_b)*a_inv/255 + tqRed(rgb_a)*a/255,
+ tqGreen(rgb_b)*a_inv/255 + tqGreen(rgb_a)*a/255,
+ tqBlue(rgb_b)*a_inv/255 + tqBlue(rgb_a)*a/255) );
+ p->setPen(res);
+ p->drawPoint(pos);
+ }
+}
+
+void PlastikStyle::renderButton(TQPainter *p,
+ const TQRect &r,
+ const TQColorGroup &g,
+ bool sunken,
+ bool mouseOver,
+ bool horizontal,
+ bool enabled,
+ bool tdehtmlMode) const
+{
+ // small fix for the kicker buttons...
+ if(kickerMode) enabled = true;
+
+ const TQPen oldPen( p->pen() );
+
+ uint contourFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ if(!enabled) contourFlags|=Is_Disabled;
+ if(tdehtmlMode) contourFlags|=Draw_AlphaBlend;
+
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ if(horizontal) surfaceFlags|=Is_Horizontal;
+ if(!enabled) surfaceFlags|=Is_Disabled;
+ else {
+ if(sunken) surfaceFlags|=Is_Sunken;
+ else {
+ if(mouseOver) {
+ surfaceFlags|=Is_Highlight;
+ if(horizontal) {
+ surfaceFlags|=Highlight_Top;
+ surfaceFlags|=Highlight_Bottom;
+ } else {
+ surfaceFlags|=Highlight_Left;
+ surfaceFlags|=Highlight_Right;
+ }
+ }
+ }
+ }
+
+ if (!flatMode) {
+ contourFlags |= Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight;
+ surfaceFlags |= Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight;
+
+ renderContour(p, r, g.background(), getColor(g,ButtonContour),
+ contourFlags);
+ renderSurface(p, TQRect(r.left()+1, r.top()+1, r.width()-2, r.height()-2),
+ g.background(), g.button(), getColor(g,MouseOverHighlight), _contrast, surfaceFlags);
+ } else {
+ renderContour(p, r, g.background(), g.button().dark(105+_contrast*3),
+ contourFlags);
+ renderSurface(p, TQRect(r.left()+1, r.top()+1, r.width()-2, r.height()-2),
+ g.background(), g.button(), getColor(g,MouseOverHighlight), _contrast/2, surfaceFlags);
+
+ flatMode = false;
+ }
+
+ p->setPen(oldPen);
+}
+
+void PlastikStyle::renderDot(TQPainter *p,
+ const TQPoint &point,
+ const TQColor &baseColor,
+ const bool thick,
+ const bool sunken) const
+{
+ const TQColor topColor = alphaBlendColors(baseColor, sunken?baseColor.dark(130):baseColor.light(150), 70);
+ const TQColor bottomColor = alphaBlendColors(baseColor, sunken?baseColor.light(150):baseColor.dark(130), 70);
+ p->setPen(topColor );
+ p->drawLine(point.x(), point.y(), point.x()+1, point.y());
+ p->drawPoint(point.x(), point.y()+1);
+ p->setPen(bottomColor );
+ if(thick) {
+ p->drawLine(point.x()+1, point.y()+2, point.x()+2, point.y()+2);
+ p->drawPoint(point.x()+2, point.y()+1);
+ } else {
+ p->drawPoint(point.x()+1, point.y()+1);
+ }
+}
+
+void PlastikStyle::renderGradient(TQPainter *painter,
+ const TQRect &rect,
+ const TQColor &c1,
+ const TQColor &c2,
+ bool horizontal) const
+{
+ if((rect.width() <= 0)||(rect.height() <= 0))
+ return;
+
+ // generate a quite unique key for this surface.
+ CacheEntry search(cGradientTile,
+ horizontal ? 0 : rect.width(),
+ horizontal ? rect.height() : 0,
+ c1.rgb(), c2.rgb(), horizontal );
+ int key = search.key();
+
+ CacheEntry *cacheEntry;
+ if( (cacheEntry = pixmapCache->find(key)) ) {
+ if( search == *cacheEntry ) { // match! we can draw now...
+ if(cacheEntry->pixmap) {
+ painter->drawTiledPixmap(rect, *(cacheEntry->pixmap) );
+ }
+ return;
+ } else {
+ // Remove old entry in case of a conflict!
+ // This shouldn't happen very often, see comment in CacheEntry.
+ pixmapCache->remove(key);
+ }
+ }
+
+ // there wasn't anything matching in the cache, create the pixmap now...
+ TQPixmap *result = new TQPixmap(horizontal ? 10 : rect.width(),
+ horizontal ? rect.height() : 10);
+ TQPainter p(result);
+
+ int r_w = result->rect().width();
+ int r_h = result->rect().height();
+ int r_x, r_y, r_x2, r_y2;
+ TQT_TQRECT_OBJECT(result->rect()).coords(&r_x, &r_y, &r_x2, &r_y2);
+
+ int rDiff, gDiff, bDiff;
+ int rc, gc, bc;
+
+ register int x, y;
+
+ rDiff = ( c2.red()) - (rc = c1.red());
+ gDiff = ( c2.green()) - (gc = c1.green());
+ bDiff = ( c2.blue()) - (bc = c1.blue());
+
+ register int rl = rc << 16;
+ register int gl = gc << 16;
+ register int bl = bc << 16;
+
+ int rdelta = ((1<<16) / (horizontal ? r_h : r_w)) * rDiff;
+ int gdelta = ((1<<16) / (horizontal ? r_h : r_w)) * gDiff;
+ int bdelta = ((1<<16) / (horizontal ? r_h : r_w)) * bDiff;
+
+ // these for-loops could be merged, but the if's in the inner loop
+ // would make it slow
+ if(horizontal) {
+ for ( y = 0; y < r_h; y++ ) {
+ rl += rdelta;
+ gl += gdelta;
+ bl += bdelta;
+
+ p.setPen(TQColor(rl>>16, gl>>16, bl>>16));
+ p.drawLine(r_x, r_y+y, r_x2, r_y+y);
+ }
+ } else {
+ for( x = 0; x < r_w; x++) {
+ rl += rdelta;
+ gl += gdelta;
+ bl += bdelta;
+
+ p.setPen(TQColor(rl>>16, gl>>16, bl>>16));
+ p.drawLine(r_x+x, r_y, r_x+x, r_y2);
+ }
+ }
+
+ p.end();
+
+ // draw the result...
+ painter->drawTiledPixmap(rect, *result);
+
+ // insert into cache using the previously created key.
+ CacheEntry *toAdd = new CacheEntry(search);
+ toAdd->pixmap = result;
+ bool insertOk = pixmapCache->insert( key, toAdd, result->width()*result->height()*result->depth()/8 );
+
+ if(!insertOk)
+ delete result;
+}
+
+void PlastikStyle::renderPanel(TQPainter *p,
+ const TQRect &r,
+ const TQColorGroup &g,
+ const bool pseudo3d,
+ const bool sunken) const
+{
+ int x, x2, y, y2, w, h;
+ r.rect(&x,&y,&w,&h);
+ r.coords(&x, &y, &x2, &y2);
+
+ if (kickerMode &&
+ p->device() && p->device()->devType() == TQInternal::Widget &&
+ TQCString(TQT_TQWIDGET(static_cast<TQPaintDevice*>(p->device()))->className()) == "FittsLawFrame") {
+ // Stolen wholesale from Keramik. I don't like it, but oh well.
+ if (sunken) {
+ const TQCOORD corners[] = { x2, y, x2, y2, x, y2, x, y };
+ p->setPen(g.background().dark());
+ p->drawConvexPolygon(TQPointArray(4, corners));
+ p->setPen(g.background().light());
+ p->drawPolyline(TQPointArray(4, corners), 0, 3);
+ } else {
+ const TQCOORD corners[] = { x, y2, x, y, x2, y, x2, y2 };
+ p->setPen(g.background().dark());
+ p->drawPolygon(TQPointArray(4, corners));
+ p->setPen(g.background().light());
+ p->drawPolyline(TQPointArray(4, corners), 0, 3);
+ }
+ } else {
+ renderContour(p, r, g.background(), getColor(g, PanelContour) );
+
+ if(pseudo3d) {
+ if (sunken) {
+ p->setPen(getColor(g, PanelDark) );
+ } else {
+ p->setPen(getColor(g, PanelLight) );
+ }
+ p->drawLine(r.left()+2, r.top()+1, r.right()-2, r.top()+1);
+ p->drawLine(r.left()+1, r.top()+2, r.left()+1, r.bottom()-2);
+ if (sunken) {
+ p->setPen(getColor(g, PanelLight) );
+ } else {
+ p->setPen(getColor(g, PanelDark) );
+ }
+ p->drawLine(r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1);
+ p->drawLine(r.right()-1, r.top()+2, r.right()-1, r.bottom()-2);
+ }
+ }
+}
+
+void PlastikStyle::renderMenuBlendPixmap( KPixmap &pix, const TQColorGroup &cg,
+ const TQPopupMenu* /* popup */ ) const
+{
+ pix.fill( cg.background().light(105) );
+}
+
+void PlastikStyle::renderTab(TQPainter *p,
+ const TQRect &r,
+ const TQColorGroup &g,
+ bool mouseOver,
+ const bool selected,
+ const bool bottom,
+ const TabPosition pos,
+ const bool triangular,
+ const bool cornerWidget) const
+{
+ const bool reverseLayout = TQApplication::reverseLayout();
+
+ const bool isFirst = (pos == First) || (pos == Single);
+ const bool isLast = (pos == Last);
+ const bool isSingle = (pos == Single);
+
+ if (selected) {
+ // is selected
+
+ // the top part of the tab which is nearly the same for all positions
+ TQRect Rc; // contour
+ if (!bottom) {
+ if (isFirst && !cornerWidget && !reverseLayout) {
+ Rc = TQRect(r.x(), r.y(), r.width()-1, r.height()-3);
+ } else if (isFirst && !cornerWidget && reverseLayout) {
+ Rc = TQRect(r.x()+1, r.y(), r.width()-1, r.height()-3);
+ } else {
+ Rc = TQRect(r.x()+1, r.y(), r.width()-2, r.height()-3);
+ }
+ } else {
+ if (isFirst && !cornerWidget && !reverseLayout) {
+ Rc = TQRect(r.x(), r.y()+3, r.width()-1, r.height()-3);
+ } else if (isFirst && !cornerWidget && reverseLayout) {
+ Rc = TQRect(r.x()+1, r.y()+3, r.width()-1, r.height()-3);
+ } else {
+ Rc = TQRect(r.x()+1, r.y()+3, r.width()-2, r.height()-3);
+ }
+ }
+ const TQRect Rs(Rc.x()+1, bottom?Rc.y():Rc.y()+1, Rc.width()-2, Rc.height()-1); // the resulting surface
+ // the area where the fake border shoudl appear
+ const TQRect Rb(r.x(), bottom?r.top():Rc.bottom()+1, r.width(), r.height()-Rc.height() );
+
+ uint contourFlags = Draw_Left|Draw_Right;
+ if(!bottom) {
+ contourFlags |= Draw_Top|Round_UpperLeft|Round_UpperRight;
+ } else {
+ contourFlags |= Draw_Bottom|Round_BottomLeft|Round_BottomRight;
+ }
+ renderContour(p, Rc,
+ g.background(), getColor(g,PanelContour),
+ contourFlags);
+
+ // surface
+ if(!bottom) {
+ p->setPen(getColor(g,PanelLight) );
+ p->drawLine(Rs.x()+1, Rs.y(), Rs.right()-1, Rs.y() );
+ renderGradient(p, TQRect(Rs.x(), Rs.y()+1, 1, Rs.height()-1),
+ getColor(g,PanelLight), getColor(g,PanelLight2));
+ renderGradient(p, TQRect(Rs.right(), Rs.y()+1, 1, Rs.height()-1),
+ getColor(g,PanelDark), getColor(g,PanelDark2));
+ } else {
+ p->setPen(alphaBlendColors(g.background(), g.background().dark(160), 100) );
+ p->drawLine(Rs.x()+1, Rs.bottom(), Rs.right()-1, Rs.bottom() );
+ renderGradient(p, TQRect(Rs.x(), Rs.y(), 1, Rs.height()-1),
+ getColor(g,PanelLight), getColor(g,PanelLight2));
+ renderGradient(p, TQRect(Rs.right(), Rs.y(), 1, Rs.height()-1),
+ getColor(g,PanelDark), getColor(g,PanelDark2));
+ }
+
+ // some "position specific" paintings...
+ // draw parts of the inactive tabs around...
+ if(!isSingle) {
+ p->setPen(alphaBlendColors(g.background(), getColor(g, ButtonContour), 50) );
+ if( (!isFirst&&!reverseLayout) || (!isLast&&reverseLayout) ) {
+ p->drawPoint(r.left(), bottom?(triangular?r.bottom()-2:r.bottom()-3):(triangular?r.top()+2:r.top()+3) );
+ renderSurface(p, TQRect(r.left(), bottom?r.top()+3:(triangular?r.top()+3:r.top()+4), 1, (triangular?r.height()-6:r.height()-7) ),
+ g.background(), g.button(), getColor(g,MouseOverHighlight), _contrast,
+ Draw_Top|Draw_Bottom|Is_Horizontal);
+ }
+ if( (!isLast&&!reverseLayout) || (!isFirst&&reverseLayout) ) {
+ p->drawPoint(r.right(), bottom?(triangular?r.bottom()-2:r.bottom()-3):(triangular?r.top()+2:r.top()+3) );
+ renderSurface(p, TQRect(r.right(), bottom?r.top()+3:(triangular?r.top()+3:r.top()+4), 1, (triangular?r.height()-6:r.height()-7) ),
+ g.background(), g.button(), getColor(g,MouseOverHighlight), _contrast,
+ Draw_Top|Draw_Bottom|Is_Horizontal);
+ }
+ }
+ // left connection from the panel border to the tab. :)
+ if(isFirst && !reverseLayout && !cornerWidget) {
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawLine(Rb.x(), Rb.y(), Rb.x(), Rb.bottom() );
+ p->setPen(getColor(g,PanelLight) );
+ p->drawLine(Rb.x()+1, Rb.y(), Rb.x()+1, Rb.bottom() );
+ } else if(isFirst && reverseLayout && !cornerWidget) {
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawLine(Rb.right(), Rb.y(), Rb.right(), Rb.bottom() );
+ p->setPen(getColor(g,PanelDark) );
+ p->drawLine(Rb.right()-1, Rb.y(), Rb.right()-1, Rb.bottom() );
+ }
+ // rounded connections to the panel...
+ if(!bottom) {
+ // left
+ if( (!isFirst && !reverseLayout) || (reverseLayout) || (isFirst && !reverseLayout && cornerWidget) ) {
+ p->setPen( alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawPoint(Rb.x(), Rb.y());
+ p->setPen( alphaBlendColors(g.background(), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.x(), Rb.y()+1);
+ p->drawPoint(Rb.x()+1, Rb.y());
+ }
+ // right
+ if( (!reverseLayout) || (!isFirst && reverseLayout) || (isFirst && reverseLayout && cornerWidget) ) {
+ p->setPen( alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawPoint(Rb.right(), Rb.y());
+ p->setPen( alphaBlendColors(g.background(), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.right(), Rb.y()+1);
+ p->drawPoint(Rb.right()-1, Rb.y());
+ }
+ } else {
+ // left
+ if( (!isFirst && !reverseLayout) || (reverseLayout) || (isFirst && !reverseLayout && cornerWidget) ) {
+ p->setPen( alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawPoint(Rb.x(), Rb.bottom());
+ p->setPen( alphaBlendColors(g.background(), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.x(), Rb.bottom()-1);
+ p->drawPoint(Rb.x()+1, Rb.bottom());
+ }
+ // right
+ if( (!reverseLayout) || (!isFirst && reverseLayout) || (isFirst && reverseLayout && cornerWidget) ) {
+ p->setPen( alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawPoint(Rb.right(), Rb.bottom());
+ p->setPen( alphaBlendColors(g.background(), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.right(), Rb.bottom()-1);
+ p->drawPoint(Rb.right()-1, Rb.bottom());
+ }
+ }
+
+ } else {
+ // inactive tabs
+
+ // the top part of the tab which is nearly the same for all positions
+ TQRect Rc; // contour
+ if (isFirst&&reverseLayout ) {
+ Rc = TQRect(r.x()+1, (bottom?r.y()+2:(triangular?r.y()+2:r.y()+3)), r.width()-2, (triangular?r.height()-4:r.height()-5) );
+ } else {
+ Rc = TQRect(r.x()+1, (bottom?r.y()+2:(triangular?r.y()+2:r.y()+3)), r.width()-1, (triangular?r.height()-4:r.height()-5) );
+ }
+ TQRect Rs; // the resulting surface
+ if ( (isFirst&&!reverseLayout) || (isLast&&reverseLayout) ) {
+ Rs = TQRect(Rc.x()+1, bottom?Rc.y():Rc.y()+1, Rc.width()-2, Rc.height()-1);
+ } else {
+ Rs = TQRect(Rc.x(), bottom?Rc.y():Rc.y()+1, Rc.width()-1, Rc.height()-1);
+ }
+ // the area where the fake border shoudl appear
+ const TQRect Rb(r.x(), bottom?r.y():Rc.bottom()+1, r.width(), 2 );
+
+ uint contourFlags;
+ if(!bottom) {
+ if ( (isFirst&&!reverseLayout) || (isLast&&reverseLayout) ) {
+ contourFlags = Draw_Left|Draw_Right|Draw_Top|Round_UpperLeft;
+ } else if ( (isLast&&!reverseLayout) || (isFirst&&reverseLayout) ) {
+ contourFlags = Draw_Right|Draw_Top|Round_UpperRight;
+ } else {
+ contourFlags = Draw_Right|Draw_Top;
+ }
+ } else {
+ if ( (isFirst&&!reverseLayout) || (isLast&&reverseLayout) ) {
+ contourFlags = Draw_Left|Draw_Right|Draw_Bottom|Round_BottomLeft;
+ } else if ( (isLast&&!reverseLayout) || (isFirst&&reverseLayout) ) {
+ contourFlags = Draw_Right|Draw_Bottom|Round_BottomRight;
+ } else {
+ contourFlags = Draw_Right|Draw_Bottom;
+ }
+ }
+ renderContour(p, Rc,
+ g.background(), getColor(g, ButtonContour),
+ contourFlags);
+
+ uint surfaceFlags = Is_Horizontal;
+ if(mouseOver) {
+ surfaceFlags |= (bottom?Highlight_Bottom:Highlight_Top);
+ surfaceFlags |= Is_Highlight;
+ }
+ if ( (isFirst&&!reverseLayout) || (isLast&&reverseLayout) ) {
+ if(!bottom)
+ surfaceFlags |= Draw_Left|Draw_Top|Draw_Bottom|Round_UpperLeft;
+ else
+ surfaceFlags |= Draw_Left|Draw_Top|Draw_Bottom|Round_BottomLeft;
+ } else if ( (isLast&&!reverseLayout) || (isFirst&&reverseLayout) ) {
+ if(!bottom)
+ surfaceFlags |= Draw_Right|Draw_Top|Draw_Bottom|Round_UpperRight;
+ else
+ surfaceFlags |= Draw_Right|Draw_Top|Draw_Bottom|Round_BottomRight;
+ } else {
+ surfaceFlags |= Draw_Top|Draw_Bottom;
+ }
+ renderSurface(p, Rs,
+ g.background(), g.button(), getColor(g,MouseOverHighlight), _contrast,
+ surfaceFlags);
+
+ // some "position specific" paintings...
+ // fake parts of the panel border
+ if(!bottom) {
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawLine(Rb.x(), Rb.y(), ((isLast&&!reverseLayout)||(isFirst&&reverseLayout&&cornerWidget))?Rb.right():Rb.right()-1, Rb.y());
+ p->setPen(getColor(g,PanelLight) );
+ p->drawLine(Rb.x(), Rb.y()+1, ((isLast&&!reverseLayout)||(isFirst&&reverseLayout&&cornerWidget))?Rb.right():Rb.right()-1, Rb.y()+1 );
+ } else {
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawLine(Rb.x(), Rb.bottom(), ((isLast&&!reverseLayout)||(isFirst&&reverseLayout&&cornerWidget))?Rb.right():Rb.right()-1, Rb.bottom());
+ p->setPen(getColor(g,PanelDark) );
+ p->drawLine(Rb.x(), Rb.bottom()-1, ((isLast&&!reverseLayout)||(isFirst&&reverseLayout&&cornerWidget))?Rb.right():Rb.right()-1, Rb.bottom()-1 );
+ }
+ // fake the panel border edge for tabs which are aligned left-most
+ // (i.e. only if there is no widget in the corner of the tabwidget!)
+ if(isFirst&&!reverseLayout&&!cornerWidget)
+ // normal layout
+ {
+ if (!bottom) {
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawPoint(Rb.x()+1, Rb.y()+1 );
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.x(), Rb.y()+1 );
+ p->setPen(g.background() );
+ p->drawPoint(Rb.x(), Rb.y() );
+ p->setPen(alphaBlendColors( alphaBlendColors(g.background(), getColor(g, ButtonContour), 50), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.x()+1, Rb.y() );
+ } else {
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawPoint(Rb.x()+1, Rb.bottom()-1 );
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.x(), Rb.bottom()-1 );
+ p->setPen(g.background() );
+ p->drawPoint(Rb.x(), Rb.bottom() );
+ p->setPen(alphaBlendColors( alphaBlendColors(g.background(), getColor(g, ButtonContour), 50), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.x()+1, Rb.bottom() );
+ }
+ } else if(isFirst&&reverseLayout&&!cornerWidget)
+ // reverse layout
+ {
+ if (!bottom) {
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawPoint(Rb.right()-1, Rb.y()+1 );
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.right(), Rb.y()+1 );
+ p->setPen(g.background() );
+ p->drawPoint(Rb.right(), Rb.y() );
+ p->setPen(alphaBlendColors( alphaBlendColors(g.background(), getColor(g, ButtonContour), 50), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.right()-1, Rb.y() );
+ } else {
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 50) );
+ p->drawPoint(Rb.right()-1, Rb.bottom()-1 );
+ p->setPen(alphaBlendColors(g.background(), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.right(), Rb.bottom()-1 );
+ p->setPen(g.background() );
+ p->drawPoint(Rb.right(), Rb.bottom() );
+ p->setPen(alphaBlendColors( alphaBlendColors(g.background(), getColor(g, ButtonContour), 50), getColor(g,PanelContour), 150) );
+ p->drawPoint(Rb.right()-1, Rb.bottom() );
+ }
+ }
+ }
+}
+
+void PlastikStyle::drawTDEStylePrimitive(TDEStylePrimitive kpe,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt,
+ const TQWidget* widget) const
+{
+ // some "global" vars...
+ const bool enabled = (flags & Style_Enabled);
+
+// SLIDER
+// ------
+ switch( kpe ) {
+ case KPE_SliderGroove: {
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+
+ if (horizontal) {
+ int center = r.y()+r.height()/2;
+ renderContour(p, TQRect(r.left(), center-2, r.width(), 4),
+ cg.background(), cg.background().dark(enabled?150:130),
+ Draw_Left|Draw_Right|Draw_Top|Draw_Bottom);
+ } else {
+ int center = r.x()+r.width()/2;
+ renderContour(p, TQRect(center-2, r.top(), 4, r.height()),
+ cg.background(), cg.background().dark(enabled?150:130),
+ Draw_Left|Draw_Right|Draw_Top|Draw_Bottom);
+ }
+ break;
+ }
+
+ case KPE_SliderHandle: {
+ bool horizontal = ceData.orientation == TQt::Horizontal;
+
+ const bool pressed = (flags&Style_Active);
+ const WidgetState s = enabled?(pressed?IsPressed:IsEnabled):IsDisabled;
+ const TQColor contour = getColor(cg,DragButtonContour,s),
+ surface = getColor(cg,DragButtonSurface,s);
+
+ int xcenter = (r.left()+r.right()) / 2;
+ int ycenter = (r.top()+r.bottom()) / 2;
+
+ if (horizontal) {
+ renderContour(p, TQRect(xcenter-5, ycenter-6, 11, 10),
+ cg.background(), contour,
+ Draw_Left|Draw_Right|Draw_Top|Round_UpperLeft|Round_UpperRight);
+
+ // manual contour: vertex
+ p->setPen(alphaBlendColors(cg.background(), contour, 50) );
+ p->drawPoint(xcenter-5+1, ycenter+4);
+ p->drawPoint(xcenter+5-1, ycenter+4);
+ p->drawPoint(xcenter-5+2, ycenter+5);
+ p->drawPoint(xcenter+5-2, ycenter+5);
+ p->drawPoint(xcenter-5+3, ycenter+6);
+ p->drawPoint(xcenter+5-3, ycenter+6);
+ p->drawPoint(xcenter-5+4, ycenter+7);
+ p->drawPoint(xcenter+5-4, ycenter+7);
+ // anti-aliasing of the contour... sort of. :)
+ p->setPen(alphaBlendColors(cg.background(), contour, 80) );
+ p->drawPoint(xcenter, ycenter+8);
+ p->setPen(alphaBlendColors(cg.background(), contour, 150) );
+ p->drawPoint(xcenter-5, ycenter+4);
+ p->drawPoint(xcenter+5, ycenter+4);
+ p->drawPoint(xcenter-5+1, ycenter+5);
+ p->drawPoint(xcenter+5-1, ycenter+5);
+ p->drawPoint(xcenter-5+2, ycenter+6);
+ p->drawPoint(xcenter+5-2, ycenter+6);
+ p->drawPoint(xcenter-5+3, ycenter+7);
+ p->drawPoint(xcenter+5-3, ycenter+7);
+ p->setPen(alphaBlendColors(cg.background(), contour, 190) );
+ p->drawPoint(xcenter-5+4, ycenter+8);
+ p->drawPoint(xcenter+5-4, ycenter+8);
+
+
+ TQRegion mask(xcenter-4, ycenter-5, 9, 13);
+ mask -= TQRegion(xcenter-4, ycenter+4, 1, 4);
+ mask -= TQRegion(xcenter-3, ycenter+5, 1, 3);
+ mask -= TQRegion(xcenter-2, ycenter+6, 1, 2);
+ mask -= TQRegion(xcenter-1, ycenter+7, 1, 1);
+ mask -= TQRegion(xcenter+1, ycenter+7, 1, 1);
+ mask -= TQRegion(xcenter+2, ycenter+6, 1, 2);
+ mask -= TQRegion(xcenter+3, ycenter+5, 1, 3);
+ mask -= TQRegion(xcenter+4, ycenter+4, 1, 4);
+ p->setClipRegion(mask);
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Round_UpperLeft|Round_UpperRight|Is_Horizontal;
+ if(!enabled)
+ surfaceFlags |= Is_Disabled;
+ renderSurface(p, TQRect(xcenter-4, ycenter-5, 9, 13),
+ cg.background(), surface, getColor(cg,MouseOverHighlight),
+ _contrast+3, surfaceFlags);
+ renderDot(p, TQPoint(xcenter-3, ycenter-3), surface, false, true );
+ renderDot(p, TQPoint(xcenter+2, ycenter-3), surface, false, true );
+ p->setClipping(false);
+ } else {
+ renderContour(p, TQRect(xcenter-6, ycenter-5, 10, 11),
+ cg.background(), contour,
+ Draw_Left|Draw_Top|Draw_Bottom|Round_UpperLeft|Round_BottomLeft);
+
+ // manual contour: vertex
+ p->setPen(alphaBlendColors(cg.background(), contour, 50) );
+ p->drawPoint(xcenter+4, ycenter-5+1);
+ p->drawPoint(xcenter+4, ycenter+5-1);
+ p->drawPoint(xcenter+5, ycenter-5+2);
+ p->drawPoint(xcenter+5, ycenter+5-2);
+ p->drawPoint(xcenter+6, ycenter-5+3);
+ p->drawPoint(xcenter+6, ycenter+5-3);
+ p->drawPoint(xcenter+7, ycenter-5+4);
+ p->drawPoint(xcenter+7, ycenter+5-4);
+ // anti-aliasing. ...sort of :)
+ p->setPen(alphaBlendColors(cg.background(), contour, 80) );
+ p->drawPoint(xcenter+8, ycenter);
+ p->setPen(alphaBlendColors(cg.background(), contour, 150) );
+ p->drawPoint(xcenter+4, ycenter-5);
+ p->drawPoint(xcenter+4, ycenter+5);
+ p->drawPoint(xcenter+5, ycenter-5+1);
+ p->drawPoint(xcenter+5, ycenter+5-1);
+ p->drawPoint(xcenter+6, ycenter-5+2);
+ p->drawPoint(xcenter+6, ycenter+5-2);
+ p->drawPoint(xcenter+7, ycenter-5+3);
+ p->drawPoint(xcenter+7, ycenter+5-3);
+ p->setPen(alphaBlendColors(cg.background(), contour, 190) );
+ p->drawPoint(xcenter+8, ycenter-5+4);
+ p->drawPoint(xcenter+8, ycenter+5-4);
+
+ TQRegion mask(xcenter-5, ycenter-4, 13, 9);
+ mask -= TQRegion(xcenter+4, ycenter-4, 4, 1);
+ mask -= TQRegion(xcenter+5, ycenter-3, 3, 1);
+ mask -= TQRegion(xcenter+6, ycenter-2, 2, 1);
+ mask -= TQRegion(xcenter+7, ycenter-1, 1, 1);
+ mask -= TQRegion(xcenter+7, ycenter+1, 1, 1);
+ mask -= TQRegion(xcenter+6, ycenter+2, 2, 1);
+ mask -= TQRegion(xcenter+5, ycenter+3, 3, 1);
+ mask -= TQRegion(xcenter+4, ycenter+4, 4, 1);
+ p->setClipRegion(mask);
+ uint surfaceFlags = Draw_Left|Draw_Top|Draw_Bottom|Round_UpperLeft|Round_BottomLeft|
+ Round_UpperRight|Is_Horizontal;
+ if(!enabled)
+ surfaceFlags |= Is_Disabled;
+ renderSurface(p, TQRect(xcenter-5, ycenter-4, 13, 9),
+ cg.background(), surface, getColor(cg,MouseOverHighlight),
+ _contrast+3, surfaceFlags);
+ renderDot(p, TQPoint(xcenter-3, ycenter-3), surface, false, true );
+ renderDot(p, TQPoint(xcenter-3, ycenter+2), surface, false, true );
+ p->setClipping(false);
+ }
+
+ break;
+ }
+
+ case KPE_ListViewExpander: {
+ int radius = (r.width() - 4) / 2;
+ int centerx = r.x() + r.width()/2;
+ int centery = r.y() + r.height()/2;
+
+ renderContour(p, r, cg.base(), cg.dark(), Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight );
+
+ p->setPen( cg.text() );
+ if(!_drawTriangularExpander)
+ {
+ // plus or minus
+ p->drawLine( centerx - radius, centery, centerx + radius, centery );
+ if ( flags & Style_On ) // Collapsed = On
+ p->drawLine( centerx, centery - radius, centerx, centery + radius );
+ } else if(_drawTriangularExpander) {
+ if( flags & Style_On )
+ drawPrimitive(PE_ArrowRight, p, ceData, elementFlags, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags);
+ if( flags & Style_Off )
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, TQRect(r.x()+1,r.y()+1,r.width(),r.height()), cg,ButtonContour, flags);
+ }
+
+ break;
+ }
+
+ // copied and slightly modified from TDEStyle.
+ case KPE_ListViewBranch: {
+ // Typical Windows style listview branch element (dotted line).
+
+ // Create the dotline pixmaps if not already created
+ if ( !verticalLine )
+ {
+ // make 128*1 and 1*128 bitmaps that can be used for
+ // drawing the right sort of lines.
+ verticalLine = new TQBitmap( 1, 129, true );
+ horizontalLine = new TQBitmap( 128, 1, true );
+ TQPointArray a( 64 );
+ TQPainter p2;
+ p2.begin( verticalLine );
+
+ int i;
+ for( i=0; i < 64; i++ )
+ a.setPoint( i, 0, i*2+1 );
+ p2.setPen( color1 );
+ p2.drawPoints( a );
+ p2.end();
+ TQApplication::flushX();
+ verticalLine->setMask( *verticalLine );
+
+ p2.begin( horizontalLine );
+ for( i=0; i < 64; i++ )
+ a.setPoint( i, i*2+1, 0 );
+ p2.setPen( color1 );
+ p2.drawPoints( a );
+ p2.end();
+ TQApplication::flushX();
+ horizontalLine->setMask( *horizontalLine );
+ }
+
+ p->setPen( cg.mid() );
+
+ if (flags & Style_Horizontal)
+ {
+ int point = r.x();
+ int other = r.y();
+ int end = r.x()+r.width();
+ int thickness = r.height();
+
+ while( point < end )
+ {
+ int i = 128;
+ if ( i+point > end )
+ i = end-point;
+ p->drawPixmap( point, other, *horizontalLine, 0, 0, i, thickness );
+ point += i;
+ }
+
+ } else {
+ int point = r.y();
+ int other = r.x();
+ int end = r.y()+r.height();
+ int thickness = r.width();
+ int pixmapoffset = (flags & Style_NoChange) ? 0 : 1; // ### Hackish
+
+ while( point < end )
+ {
+ int i = 128;
+ if ( i+point > end )
+ i = end-point;
+ p->drawPixmap( other, point, *verticalLine, 0, pixmapoffset, thickness, i );
+ point += i;
+ }
+ }
+
+ break;
+ }
+
+ default:
+ TDEStyle::drawTDEStylePrimitive(kpe, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+}
+
+
+void PlastikStyle::drawPrimitive(TQ_PrimitiveElement pe,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption &opt ) const
+{
+ bool down = flags & Style_Down;
+ bool on = flags & Style_On;
+ bool sunken = flags & Style_Sunken;
+ bool horiz = flags & Style_Horizontal;
+ const bool enabled = flags & Style_Enabled;
+ const bool mouseOver = flags & Style_MouseOver;
+
+ bool hasFocus = flags & Style_HasFocus;
+
+ int x = r.x();
+ int y = r.y();
+ int w = r.width();
+ int h = r.height();
+
+ int x2, y2;
+ r.coords(&x, &y, &x2, &y2);
+
+ switch(pe) {
+ // BUTTONS
+ // -------
+ case PE_FocusRect: {
+ if(_drawFocusRect)
+ p->drawWinFocusRect( r );
+ break;
+ }
+
+ case PE_HeaderSectionMenu:
+ case PE_HeaderSection: {
+ // the taskbar buttons seems to be painted with PE_HeaderSection but I
+ // want them look like normal buttons (at least for now. :) )
+ if(!kickerMode) {
+ // detect if this is the left most header item
+ bool isFirst = false;
+ TQHeader *header = dynamic_cast<TQHeader*>(p->device() );
+ if (header) {
+ isFirst = header->mapToIndex(header->sectionAt(r.x() ) ) == 0;
+ }
+
+ uint contourFlags = Draw_Right|Draw_Top|Draw_Bottom;
+ if (isFirst)
+ contourFlags |= Draw_Left;
+ if(!enabled) contourFlags|=Is_Disabled;
+ renderContour(p, r, cg.background(), getColor(cg,ButtonContour),
+ contourFlags);
+
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Is_Horizontal;
+ if(!enabled) surfaceFlags|=Is_Disabled;
+ else {
+ if(on||down) surfaceFlags|=Is_Sunken;
+ else {
+ if(mouseOver) {
+ surfaceFlags|=Is_Highlight|Highlight_Top|Highlight_Bottom;
+ }
+ }
+ }
+ renderSurface(p, TQRect(isFirst?r.left()+1:r.left(), r.top()+1, isFirst?r.width()-2:r.width()-1, r.height()-2),
+ cg.background(), cg.button(), getColor(cg,MouseOverHighlight), _contrast,
+ surfaceFlags);
+
+ break;
+ }
+ }
+ case PE_ButtonBevel:
+ case PE_ButtonTool:
+ case PE_ButtonDropDown:
+ case PE_ButtonCommand: {
+ bool tdehtmlMode = opt.isDefault() ? false : tdehtmlWidgets.contains(opt.widget());
+ renderButton(p, r, cg, (on||down), mouseOver, true, enabled, tdehtmlMode );
+ break;
+ }
+
+ case PE_ButtonDefault: {
+ uint contourFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|
+ Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight;
+ if(!enabled) contourFlags|=Is_Disabled;
+ renderContour(p, r, cg.background(), cg.background().dark(120),
+ contourFlags);
+ break;
+ }
+
+ case PE_SpinWidgetPlus:
+ case PE_SpinWidgetMinus: {
+ p->setPen( cg.buttonText() );
+
+ int l = QMIN( w-2, h-2 );
+ // make the length even so that we get a nice symmetric plus...
+ if(l%2 != 0)
+ --l;
+ TQPoint c = r.center();
+
+ p->drawLine( c.x()-l/2, c.y(), c.x()+l/2, c.y() );
+ if ( pe == PE_SpinWidgetPlus ) {
+ p->drawLine( c.x(), c.y()-l/2, c.x(), c.y()+l/2 );
+ }
+ break;
+ }
+
+ case PE_ScrollBarSlider: {
+ const WidgetState s = enabled?(down?IsPressed:IsEnabled):IsDisabled;
+ const TQColor surface = getColor(cg, DragButtonSurface, s);
+
+ uint contourFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ if(!enabled) contourFlags|=Is_Disabled;
+ renderContour(p, r, cg.background(), getColor(cg, DragButtonContour, s),
+ contourFlags);
+
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ if(horiz) surfaceFlags|=Is_Horizontal;
+ if(!enabled) surfaceFlags|=Is_Disabled;
+ if(r.height() >= 4)
+ renderSurface(p, TQRect(r.left()+1, r.top()+1, r.width()-2, r.height()-2),
+ cg.background(), surface, cg.background(),
+ _contrast+3, surfaceFlags);
+
+ // set contour-like color for the case _scrollBarLines is set and we paint lines instead of dots.
+ p->setPen(alphaBlendColors(cg.background(), surface.dark(enabled?140:120), 50) );
+
+ const int d = 4;
+ int n = ((horiz?r.width():r.height())-8)/d;
+ if(n>5) n=5;
+ if(!horiz) {
+ for(int j = 0; j < n; j++) {
+ int yPos = r.center().y()-(n*d)/2+d*j+1;
+ if(_scrollBarLines)
+ p->drawLine(r.x()+1, yPos, r.right()-1, yPos);
+ else
+ {
+ for(int k = 3; k <= 13; k+=4) {
+ renderDot(p, TQPoint(k, yPos), surface, false, true );
+ }
+ }
+ }
+ } else {
+ for(int j = 0; j < n; j++) {
+ int xPos = r.center().x()-(n*d)/2+d*j+1;
+ if(_scrollBarLines)
+ p->drawLine(xPos, r.y()+1, xPos, r.bottom()-1);
+ else
+ {
+ for(int k = 3; k <= 13; k+=4) {
+ renderDot(p, TQPoint(xPos, k), surface, false, true );
+ }
+ }
+ }
+ }
+
+ break;
+ }
+
+ case PE_ScrollBarAddPage:
+ case PE_ScrollBarSubPage: {
+ // draw double buffered to avoid flicker...
+ TQPixmap buffer;
+ if(flags & Style_Horizontal) {
+ buffer.resize(2, r.height() );
+ } else {
+ buffer.resize(r.width(), 2 );
+ }
+ TQRect br(buffer.rect() );
+ TQPainter bp(&buffer);
+
+ if (on || down) {
+ bp.fillRect(br, TQBrush(cg.mid().dark()));
+ } else {
+ if(flags & Style_Horizontal) {
+ bp.setPen(cg.background().dark(106));
+ bp.drawLine(br.left(), br.top(), br.right(), br.top());
+ bp.setPen(cg.background().light(106));
+ bp.drawLine(br.left(), br.bottom(), br.right(), br.bottom());
+ bp.fillRect(br.left(), br.top()+1, br.width(), br.height()-2,cg.background());
+ } else {
+ bp.setPen(cg.background().dark(106));
+ bp.drawLine(br.left(), br.top(), br.left(), br.bottom());
+ bp.setPen(cg.background().light(106));
+ bp.drawLine(br.right(), br.top(), br.right(), br.bottom());
+ bp.fillRect(br.left()+1, br.top(), br.width()-2, br.height(),cg.background());
+ }
+ }
+
+ bp.fillRect(br, TQBrush(cg.background().light(), Dense4Pattern));
+
+ bp.end();
+
+ p->drawTiledPixmap(r, buffer, TQPoint(0, r.top()%2) );
+ break;
+ }
+
+ // SCROLLBAR BUTTONS
+ // -----------------
+ case PE_ScrollBarSubLine: {
+ uint contourFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ if(down) surfaceFlags|=Is_Sunken;
+ if(!enabled) {
+ contourFlags|=Is_Disabled;
+ surfaceFlags|=Is_Disabled;
+ }
+ if(horiz) {
+ contourFlags |= Round_UpperLeft|Round_BottomLeft|Is_Horizontal;
+ surfaceFlags |= Round_UpperLeft|Round_BottomLeft|Is_Horizontal;
+ } else {
+ contourFlags |= Round_UpperLeft|Round_UpperRight;
+ surfaceFlags |= Round_UpperLeft|Round_UpperRight;
+ }
+ renderContour(p, r, cg.background(), getColor(cg, ButtonContour),
+ contourFlags);
+ renderSurface(p, TQRect(r.left()+1, r.top()+1, r.width()-2, r.height()-2),
+ cg.background(), cg.button(), getColor(cg,MouseOverHighlight), _contrast+3,
+ surfaceFlags);
+
+ p->setPen(cg.foreground());
+ drawPrimitive((horiz ? PE_ArrowLeft : PE_ArrowUp), p, ceData, elementFlags, r, cg, flags);
+ break;
+ }
+
+ case PE_ScrollBarAddLine: {
+ uint contourFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ if(down) surfaceFlags|=Is_Sunken;
+ if(!enabled) {
+ contourFlags|=Is_Disabled;
+ surfaceFlags|=Is_Disabled;
+ }
+ if(horiz) {
+ contourFlags |= Round_UpperRight|Round_BottomRight|Is_Horizontal;
+ surfaceFlags |= Round_UpperRight|Round_BottomRight|Is_Horizontal;
+ } else {
+ contourFlags |= Round_BottomLeft|Round_BottomRight;
+ surfaceFlags |= Round_BottomLeft|Round_BottomRight;
+ }
+ renderContour(p, r, cg.background(), getColor(cg, ButtonContour),
+ contourFlags);
+ renderSurface(p, TQRect(r.left()+1, r.top()+1, r.width()-2, r.height()-2),
+ cg.background(), cg.button(), getColor(cg,MouseOverHighlight), _contrast+3,
+ surfaceFlags);
+
+ p->setPen(cg.foreground());
+ drawPrimitive((horiz ? PE_ArrowRight : PE_ArrowDown), p, ceData, elementFlags, r, cg, flags);
+ break;
+ }
+
+ // CHECKBOXES
+ // ----------
+ case PE_Indicator: {
+ TQColor contentColor = enabled?cg.base():cg.background();
+
+ uint contourFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom;
+ if(!enabled) {
+ contourFlags |= Is_Disabled;
+ }
+ renderContour(p, r, cg.background(), getColor(cg, ButtonContour),
+ contourFlags);
+
+ // surface
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Is_Horizontal;
+ if(!enabled) {
+ surfaceFlags |= Is_Disabled;
+ } else if(mouseOver) {
+ contentColor = alphaBlendColors(contentColor, getColor(cg,MouseOverHighlight), 240);
+ surfaceFlags |= Is_Highlight;
+ surfaceFlags |= Highlight_Left|Highlight_Right|
+ Highlight_Top|Highlight_Bottom;
+ }
+ renderSurface(p, TQRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2),
+ cg.background(), contentColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), surfaceFlags);
+
+ drawPrimitive(PE_CheckMark, p, ceData, elementFlags, r, cg, flags);
+
+ break;
+ }
+
+ case PE_IndicatorMask: {
+ p->fillRect (r, color1);
+ break;
+ }
+
+ // RADIOBUTTONS
+ // ------------
+ case PE_ExclusiveIndicator: {
+ const TQColor contourColor = getColor(cg, ButtonContour, enabled);
+ TQColor contentColor = enabled?cg.base():cg.background();
+
+ TQBitmap bmp;
+ bmp = TQBitmap(13, 13, radiobutton_mask_bits, true);
+ // first the surface...
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Is_Horizontal;
+ if(!enabled) {
+ surfaceFlags |= Is_Disabled;
+ } else if (mouseOver) {
+ contentColor = alphaBlendColors(contentColor, getColor(cg,MouseOverHighlight), 240);
+ }
+ p->setClipRegion(bmp);
+ renderSurface(p, r,
+ cg.background(), contentColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2), surfaceFlags);
+ p->setClipping(false);
+
+ // ...then contour, anti-alias, mouseOver...
+ // contour
+ bmp = TQBitmap(13, 13, radiobutton_contour_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(cg.background(), contourColor, 50) );
+ p->drawPixmap(x, y, bmp);
+ // anti-alias outside
+ bmp = TQBitmap(13, 13, radiobutton_aa_outside_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(cg.background(), contourColor, 150) );
+ p->drawPixmap(x, y, bmp);
+ // highlighting...
+ if(mouseOver) {
+ bmp = TQBitmap(13, 13, radiobutton_highlight1_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, getColor(cg,MouseOverHighlight), 80) );
+ p->drawPixmap(x, y, bmp);
+ bmp = TQBitmap(13, 13, radiobutton_highlight2_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, getColor(cg,MouseOverHighlight), 150) );
+ p->drawPixmap(x, y, bmp);
+ }
+ // anti-alias inside, "above" the higlighting!
+ bmp = TQBitmap(13, 13, radiobutton_aa_inside_bits, true);
+ bmp.setMask(bmp);
+ if(mouseOver) {
+ p->setPen(alphaBlendColors(getColor(cg,MouseOverHighlight), contourColor, 180) );
+ } else {
+ p->setPen(alphaBlendColors(contentColor, contourColor, 180) );
+ }
+ p->drawPixmap(x, y, bmp);
+
+
+ TQColor checkmarkColor = enabled?getColor(cg,CheckMark):cg.background();
+ if(flags & Style_Down) {
+ checkmarkColor = alphaBlendColors(contentColor, checkmarkColor, 150);
+ }
+
+ // draw the radio mark
+ if (flags & Style_On || flags & Style_Down) {
+ bmp = TQBitmap(CHECKMARKSIZE, CHECKMARKSIZE, radiomark_dark_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, checkmarkColor.dark(150), 50) );
+ p->drawPixmap(x+2, y+2, bmp);
+ bmp = TQBitmap(CHECKMARKSIZE, CHECKMARKSIZE, radiomark_light_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, checkmarkColor.dark(125), 50) );
+ p->drawPixmap(x+2, y+2, bmp);
+ bmp = TQBitmap(CHECKMARKSIZE, CHECKMARKSIZE, radiomark_aa_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, checkmarkColor.dark(150), 150) );
+ p->drawPixmap(x+2, y+2, bmp);
+ }
+
+ break;
+ }
+
+ case PE_ExclusiveIndicatorMask: {
+ p->fillRect(r, color0);
+
+ TQBitmap bmp;
+ bmp = TQBitmap(13, 13, radiobutton_mask_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(color1);
+ p->drawPixmap(x, y, bmp);
+
+ break;
+ }
+
+ // GENERAL PANELS
+ // --------------
+ case PE_Splitter: {
+ // highlight on mouse over
+ TQColor color = (mouseOver)?TQColor(cg.background().light(100+_contrast)):cg.background();
+ p->fillRect(r, color);
+ if (w > h) {
+ if (h > 4) {
+ int ycenter = r.height()/2;
+ for(int k = 2*r.width()/10; k < 8*r.width()/10; k+=5) {
+ renderDot(p, TQPoint(k, ycenter-1), color, false, true);
+ }
+ }
+ } else {
+ if (w > 4) {
+ int xcenter = r.width()/2;
+ for(int k = 2*r.height()/10; k < 8*r.height()/10; k+=5) {
+ renderDot(p, TQPoint(xcenter-1, k), color, false, true);
+ }
+ }
+ }
+
+ break;
+ }
+
+ case PE_PanelGroupBox:
+ case PE_GroupBoxFrame: {
+ if ( opt.isDefault() || opt.lineWidth() <= 0 )
+ break;
+ renderPanel(p, r, cg, false);
+
+ break;
+ }
+
+ case PE_WindowFrame:
+ case PE_Panel: {
+ if ( opt.isDefault() || opt.lineWidth() <= 0 )
+ break;
+ renderPanel(p, r, cg, true, sunken);
+ break;
+ }
+
+ case PE_PanelLineEdit: {
+ bool isReadOnly = false;
+ bool isEnabled = true;
+ // panel is highlighted by default if it has focus, but if we have access to the
+ // widget itself we can try to avoid highlighting in case it's readOnly or disabled.
+ if (p->device() && dynamic_cast<TQLineEdit*>(p->device()))
+ {
+ TQLineEdit* lineEdit = dynamic_cast<TQLineEdit*>(p->device());
+ isReadOnly = lineEdit->isReadOnly();
+ isEnabled = lineEdit->isEnabled();
+ }
+
+ uint contourFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|
+ Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight;
+
+ // HACK!!
+ //
+ // In order to draw nice edges in tdehtml, we need to paint alpha-blended.
+ // On the other hand, we can't paint alpha-blended in normal widgets.
+ //
+ // In this place there is no reliable way to detect if we are in tdehtml; the
+ // only thing we know is that tdehtml buffers its widgets into a pixmap. So
+ // when the paint device is a TQPixmap, chances are high that we are in tdehtml.
+ // It's possible that this breaks other things, so let's see how it works...
+ if (p->device() && dynamic_cast<TQPixmap*>(p->device() ) ) {
+ contourFlags += Draw_AlphaBlend;
+ }
+
+ if ( _inputFocusHighlight && hasFocus && !isReadOnly && isEnabled)
+ {
+ renderContour(p, r, cg.background(),
+ getColor(cg,FocusHighlight,enabled), contourFlags );
+ }
+ else
+ {
+ renderContour(p, r, cg.background(),
+ getColor(cg, ButtonContour, enabled), contourFlags );
+ }
+ const TQColor contentColor = enabled?cg.base():cg.background();
+ if (_inputFocusHighlight && hasFocus && !isReadOnly && isEnabled)
+ {
+ p->setPen( getColor(cg,FocusHighlight).dark(130) );
+ }
+ else
+ {
+ p->setPen(contentColor.dark(130) );
+ }
+ p->drawLine(r.left()+1, r.top()+2, r.left()+1, r.bottom()-2 );
+ p->drawLine(r.left()+2, r.top()+1, r.right()-2, r.top()+1 );
+ if (_inputFocusHighlight && hasFocus && !isReadOnly && isEnabled)
+ {
+ p->setPen( getColor(cg,FocusHighlight).light(130) );
+ }
+ else
+ {
+ p->setPen(contentColor.light(130) );
+ }
+ p->drawLine(r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1 );
+ p->drawLine(r.right()-1, r.top()+2, r.right()-1, r.bottom()-2 );
+ break;
+ }
+
+ case PE_StatusBarSection: {
+ renderContour(p, r, cg.background(), cg.background().dark(160),
+ Draw_Left|Draw_Right|Draw_Top|Draw_Bottom);
+ break;
+ }
+
+ case PE_TabBarBase: // Still not sure what this one does
+ case PE_PanelTabWidget: {
+ renderPanel(p, r, cg, true, sunken);
+ break;
+ }
+
+ case PE_PanelPopup: {
+ renderContour(p, r, cg.background(), cg.background().dark(200),
+ Draw_Left|Draw_Right|Draw_Top|Draw_Bottom);
+ break;
+ }
+
+ // MENU / TOOLBAR PANEL
+ // --------------------
+ case PE_PanelMenuBar:
+ case PE_PanelDockWindow: {
+ // fix for toolbar lag (from Mosfet Liquid)
+ TQWidget* w = dynamic_cast<TQWidget*>(p->device());
+ if(w && w->backgroundMode() == PaletteButton)
+ w->setBackgroundMode(PaletteBackground);
+ p->fillRect(r, cg.brush(TQColorGroup::Background));
+
+ if ( _drawToolBarSeparator ) {
+ if ( r.width() > r.height() ) {
+ p->setPen( getColor(cg, PanelLight) );
+ p->drawLine( r.left(), r.top(), r.right(), r.top() );
+ p->setPen( getColor(cg, PanelDark) );
+ p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() );
+ }
+ else {
+ p->setPen( getColor(cg, PanelLight) );
+ p->drawLine( r.left(), r.top(), r.left(), r.bottom() );
+ p->setPen( getColor(cg, PanelDark) );
+ p->drawLine( r.right(), r.top(), r.right(), r.bottom() );
+ }
+ }
+
+ break;
+ }
+
+ // TOOLBAR/DOCK WINDOW HANDLE
+ // --------------------------
+ case PE_DockWindowResizeHandle: {
+ renderButton(p, r, cg);
+ break;
+ }
+
+ case PE_DockWindowHandle: {
+
+ int counter = 1;
+
+ if(horiz) {
+ int center = r.left()+r.width()/2;
+ for(int j = r.top()+2; j <= r.bottom()-3; j+=3) {
+ if(counter%2 == 0) {
+ renderDot(p, TQPoint(center+1, j), cg.background(), true, true);
+ } else {
+ renderDot(p, TQPoint(center-2, j), cg.background(), true, true);
+ }
+ counter++;
+ }
+ } else {
+ int center = r.top()+r.height()/2;
+ for(int j = r.left()+2; j <= r.right()-3; j+=3) {
+ if(counter%2 == 0) {
+ renderDot(p, TQPoint(j, center+1), cg.background(), true, true);
+ } else {
+ renderDot(p, TQPoint(j, center-2), cg.background(), true, true);
+ }
+ counter++;
+ }
+ }
+
+ break;
+ }
+
+ // TOOLBAR SEPARATOR
+ // -----------------
+ case PE_DockWindowSeparator: {
+ p->fillRect(r, cg.background());
+
+ if(_drawToolBarItemSeparator) {
+ if(horiz) {
+ int center = r.left()+r.width()/2;
+ p->setPen( getColor(cg, PanelDark) );
+ p->drawLine( center-1, r.top()+3, center-1, r.bottom()-3 );
+ p->setPen( getColor(cg, PanelLight) );
+ p->drawLine( center, r.top()+3, center, r.bottom()-3 );
+ } else {
+ int center = r.top()+r.height()/2;
+ p->setPen( getColor(cg, PanelDark) );
+ p->drawLine( r.x()+3, center-1, r.right()-3, center-1 );
+ p->setPen( getColor(cg, PanelLight) );
+ p->drawLine( r.x()+3, center, r.right()-3, center );
+ }
+ }
+ break;
+ }
+
+ case PE_CheckMark: {
+ const TQColor contentColor = enabled?cg.base():cg.background();
+ TQColor checkmarkColor = enabled?getColor(cg,CheckMark):cg.background();
+ if(flags & Style_Down) {
+ checkmarkColor = alphaBlendColors(contentColor, checkmarkColor, 150);
+ }
+
+ int x = r.center().x() - 4, y = r.center().y() - 4;
+ TQBitmap bmp;
+ if( flags & Style_On ) {
+ bmp = TQBitmap(CHECKMARKSIZE, CHECKMARKSIZE, checkmark_dark_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, checkmarkColor.dark(150), 50) );
+ p->drawPixmap(x, y, bmp);
+ bmp = TQBitmap(CHECKMARKSIZE, CHECKMARKSIZE, checkmark_light_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, checkmarkColor.dark(125), 50) );
+ p->drawPixmap(x, y, bmp);
+ bmp = TQBitmap(CHECKMARKSIZE, CHECKMARKSIZE, checkmark_aa_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, checkmarkColor.dark(150), 150) );
+ p->drawPixmap(x, y, bmp);
+ } else if ( flags & Style_Off ) {
+ // empty
+ } else { // tristate
+ bmp = TQBitmap(CHECKMARKSIZE, CHECKMARKSIZE, checkmark_tristate_bits, true);
+ bmp.setMask(bmp);
+ p->setPen(alphaBlendColors(contentColor, checkmarkColor.dark(150), 50) );
+ p->drawPixmap(x, y, bmp);
+ }
+
+ break;
+ }
+
+ case PE_MenuItemIndicatorFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
+ qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
+ break;
+ }
+ case PE_MenuItemIndicatorIconFrame:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
+ qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1, &cg.brush(TQColorGroup::Midlight) );
+ break;
+ }
+ case PE_MenuItemIndicatorCheck:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+ int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL);
+ TQRect cr = visualRect( TQRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
+ // Draw the checkmark
+ SFlags cflags = Style_On;
+ if (enabled)
+ cflags |= Style_Enabled;
+ drawPrimitive( PE_CheckMark, p, ceData, elementFlags, cr, cg, cflags );
+ break;
+ }
+
+ case PE_SpinWidgetUp:
+ case PE_SpinWidgetDown:
+ case PE_HeaderArrow:
+ case PE_ArrowUp:
+ case PE_ArrowDown:
+ case PE_ArrowLeft:
+ case PE_ArrowRight: {
+ TQPointArray a;
+
+ switch (pe) {
+ case PE_SpinWidgetUp:
+ case PE_ArrowUp: {
+ a.setPoints(7, u_arrow);
+ break;
+ }
+ case PE_SpinWidgetDown:
+ case PE_ArrowDown: {
+ a.setPoints(7, d_arrow);
+ break;
+ }
+ case PE_ArrowLeft: {
+ a.setPoints(7, l_arrow);
+ break;
+ }
+ case PE_ArrowRight: {
+ a.setPoints(7, r_arrow);
+ break;
+ }
+ default: {
+ if (flags & Style_Up) {
+ a.setPoints(7, u_arrow);
+ } else {
+ a.setPoints(7, d_arrow);
+ }
+ }
+ }
+
+ const TQWMatrix oldMatrix( p->worldMatrix() );
+
+ if (flags & Style_Down) {
+ p->translate(pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags),
+ pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags));
+ }
+
+ a.translate((r.x()+r.width()/2), (r.y()+r.height()/2));
+ // extra-pixel-shift, correcting some visual tics...
+ switch(pe) {
+ case PE_ArrowLeft:
+ case PE_ArrowRight:
+ a.translate(0, -1);
+ break;
+ case PE_SpinWidgetUp:
+ case PE_SpinWidgetDown:
+ a.translate(+1, 0);
+ break;
+ default:
+ a.translate(0, 0);
+ }
+
+ if (p->pen() == Qt::NoPen) {
+ if (flags & Style_Enabled) {
+ p->setPen(cg.buttonText());
+ } else {
+ p->setPen(cg.highlightedText());
+ }
+ }
+ p->drawLineSegments(a, 0, 3);
+ p->drawPoint(a[6]);
+
+ p->setWorldMatrix( oldMatrix );
+
+ break;
+ }
+
+ default: {
+ return TDEStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
+ }
+ }
+}
+
+
+void PlastikStyle::drawControl(TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ const TQStyleOption& opt,
+ const TQWidget *widget) const
+{
+ const bool reverseLayout = TQApplication::reverseLayout();
+
+ const bool enabled = (flags & Style_Enabled);
+
+ switch (element) {
+
+ // PROGRESSBAR
+ // -----------
+ case CE_ProgressBarGroove: {
+ const TQColor content = enabled?cg.base():cg.background();
+ renderContour(p, r, cg.background(), getColor(cg, ButtonContour, enabled) );
+ p->setPen(content.dark(105) );
+ p->drawLine(r.left()+2, r.top()+1, r.right()-2, r.top()+1 );
+ p->drawLine(r.left()+1, r.top()+2, r.left()+1, r.bottom()-2);
+ p->setPen(content.light(105) );
+ p->drawLine(r.left()+2, r.bottom()-1, r.right()-2, r.bottom()-1 );
+ p->drawLine(r.right()-1, r.top()+2, r.right()-1, r.bottom()-2);
+ break;
+ }
+
+ case CE_ProgressBarContents: {
+ int steps = ceData.totalSteps;
+
+ const TQColor bg = enabled?cg.base():cg.background(); // background
+ const TQColor fg = enabled?cg.highlight():TQColor(cg.background().dark(110)); // foreground
+
+ if( steps == 0 ) { // Busy indicator
+ static const int barWidth = 10;
+ int progress = ceData.currentStep % (2*(r.width()-barWidth));
+ if( progress < 0)
+ progress = 0;
+ if( progress > r.width()-barWidth )
+ progress = (r.width()-barWidth)-(progress-(r.width()-barWidth));
+ p->fillRect( TQRect( r.x(), r.y(), r.width(), r.height() ), bg );
+ renderContour( p, TQRect( r.x()+progress, r.y(), barWidth, r.height() ),
+ bg, fg.dark(160),
+ Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Round_UpperRight|
+ Round_BottomRight|Round_UpperLeft|Round_BottomLeft );
+ renderSurface(p, TQRect( r.x()+progress+1, r.y()+1, barWidth-2, r.height()-2 ),
+ bg, fg, cg.highlight(),
+ 2*(_contrast/3),
+ Draw_Right|Draw_Left|Draw_Top|Draw_Bottom|
+ Round_UpperRight|Round_BottomRight|
+ Round_UpperLeft|Round_BottomLeft|Is_Horizontal);
+ } else {
+ double percent = static_cast<double>(ceData.currentStep) / static_cast<double>(steps);
+
+ int w = static_cast<int>(r.width() * percent);
+ // renderContour/renderSurface handle small sizes not very well, so set a minimal
+ // progressbar width...
+ if(w<4) w = 4;
+ int w2 = r.width()-(r.width()-w);
+
+ TQRect Rempty(reverseLayout?r.left():r.left()+w-1, r.top(), r.width()-w+1, r.height() );
+ TQRect Rcontour(reverseLayout?r.right()-w2+1:r.left(), r.top(), w2, r.height() );
+ TQRect Rsurface(Rcontour.left()+1, Rcontour.top()+1, w2-2, Rcontour.height()-2);
+
+ p->fillRect(Rempty, bg);
+
+ renderContour(p, Rcontour,
+ bg, fg.dark(160),
+ reverseLayout ? Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Round_UpperLeft|Round_BottomLeft
+ : Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Round_UpperRight|Round_BottomRight);
+
+ TQRegion mask(Rsurface);
+ if(reverseLayout) {
+ mask -= TQRegion(Rsurface.left(), Rsurface.top(), 1, 1);
+ mask -= TQRegion(Rsurface.left(), Rsurface.bottom(), 1, 1);
+ } else {
+ mask -= TQRegion(Rsurface.right(), Rsurface.top(), 1, 1);
+ mask -= TQRegion(Rsurface.right(), Rsurface.bottom(), 1, 1);
+ }
+ p->setClipRegion(mask);
+ int counter = 0;
+ TQPixmap surfaceTile(21, r.height()-2);
+ TQPainter surfacePainter(&surfaceTile);
+ // - 21 pixel -
+ // __________
+ // | ` `| <- 3
+ // | 1 | 2 |
+ // |____,____,| <- 3
+ // 1 = light, 11 pixel, 1 pixel overlapping with 2
+ // 2 = dark, 11 pixel, 1 pixel overlapping with 3
+ // 3 = light edges
+ const int tileHeight = surfaceTile.height();
+ // 3
+ renderSurface(&surfacePainter,
+ TQRect(20, 0, 11, tileHeight),
+ fg.light(105), fg, cg.highlight(), 2*(_contrast/3),
+ reverseLayout ? Draw_Right|Draw_Left|Draw_Top|Draw_Bottom|
+ Round_UpperLeft|Round_BottomLeft|Is_Horizontal
+ : Draw_Right|Draw_Left|Draw_Top|Draw_Bottom|
+ Round_UpperRight|Round_BottomRight|Is_Horizontal);
+ // 2
+ renderSurface(&surfacePainter,
+ TQRect(10, 0, 11, tileHeight),
+ fg, fg.light(105), cg.highlight(), 2*(_contrast/3),
+ reverseLayout ? Draw_Right|Draw_Left|Draw_Top|Draw_Bottom|
+ Round_UpperLeft|Round_BottomLeft|Is_Horizontal
+ : Draw_Right|Draw_Left|Draw_Top|Draw_Bottom|
+ Round_UpperRight|Round_BottomRight|Is_Horizontal);
+ // 1
+ renderSurface(&surfacePainter,
+ TQRect(0, 0, 11, tileHeight),
+ fg.light(105), fg, cg.highlight(), 2*(_contrast/3),
+ reverseLayout ? Draw_Right|Draw_Left|Draw_Top|Draw_Bottom|
+ Round_UpperLeft|Round_BottomLeft|Is_Horizontal
+ : Draw_Right|Draw_Left|Draw_Top|Draw_Bottom|
+ Round_UpperRight|Round_BottomRight|Is_Horizontal);
+
+ surfacePainter.end();
+ int staticShift = 0;
+ int animShift = 0;
+ if (!_animateProgressBar) {
+ staticShift = (reverseLayout ? Rsurface.left() : Rsurface.right()) % 40 - 40;
+ } else {
+ // find the animation Offset for the current Widget
+ TQWidget* nonConstWidget = const_cast<TQWidget*>(widget);
+ TQMapConstIterator<TQWidget*, int> iter = progAnimWidgets.find(nonConstWidget);
+ if (iter != progAnimWidgets.end())
+ animShift = iter.data();
+ }
+ while((counter*10) < (Rsurface.width()+20)) {
+ counter++;
+ if (reverseLayout) {
+ // from right to left, overlap 1 pixel with the previously drawn tile
+ p->drawPixmap(Rsurface.right()-counter*20-animShift+40+staticShift, r.top()+1,
+ surfaceTile);
+ } else {
+ // from left to right, overlap 1 pixel with the previously drawn tile
+ p->drawPixmap(Rsurface.left()+counter*20+animShift-40+staticShift, r.top()+1,
+ surfaceTile);
+ }
+ }
+
+ p->setClipping(false);
+ }
+
+ break;
+ }
+
+ // TABS
+ // ----
+ case CE_TabBarTab: {
+ bool cornerWidget = false;
+ if (!ceData.tabBarData.cornerWidgets[TQStyleControlElementTabBarData::CWL_TopLeft].widgetObjectTypes.isEmpty()) {
+ cornerWidget = true;
+ }
+ TQTabBar::Shape tbs = ceData.tabBarData.shape;
+ bool selected = false;
+ if (flags & Style_Selected) selected = true;
+ TabPosition pos;
+ if (ceData.tabBarData.tabCount == 1) {
+ pos = Single;
+ } else if (ceData.tabBarData.identIndexMap[opt.tab()->identifier()] == 0) {
+ pos = First;
+ } else if (ceData.tabBarData.identIndexMap[opt.tab()->identifier()] == (ceData.tabBarData.tabCount - 1)) {
+ pos = Last;
+ } else {
+ pos = Middle;
+ }
+
+ bool mouseOver = false;
+ if (opt.tab() == opt.hoverTab()) {
+ mouseOver = true;
+ flags |= Style_MouseOver;
+ }
+
+ switch (tbs) {
+ case TQTabBar::TriangularAbove:
+// renderTriangularTab(p, r, cg, (flags & Style_MouseOver), selected, false, pos);
+ renderTab(p, r, cg, mouseOver, selected, false, pos, true, cornerWidget);
+ break;
+ case TQTabBar::RoundedAbove:
+ renderTab(p, r, cg, mouseOver, selected, false, pos, false, cornerWidget);
+ break;
+ case TQTabBar::TriangularBelow:
+// renderTriangularTab(p, r, cg, (flags & Style_MouseOver), selected, true, pos);
+ renderTab(p, r, cg, mouseOver, selected, true, pos, true, cornerWidget);
+ break;
+ case TQTabBar::RoundedBelow:
+ renderTab(p, r, cg, mouseOver, selected, true, pos, false, cornerWidget);
+ break;
+ default:
+ TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+
+ break;
+ }
+
+ case CE_PushButton: {
+ TQPushButton *button = (TQPushButton *)widget;
+
+ const bool isDefault = enabled && (elementFlags & CEF_IsDefault);
+
+ if ( elementFlags & CEF_IsFlat )
+ flatMode = true;
+
+ TQColorGroup g2 = cg;
+ if (isDefault)
+ g2.setColor(TQColorGroup::Background, cg.background().dark(120) );
+ drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags,
+ isDefault?TQRect(r.x()+1,r.y()+1,r.width()-2,r.height()-2):r,
+ g2, flags, TQStyleOption(button) );
+
+ if (isDefault ) {
+ drawPrimitive(PE_ButtonDefault, p, ceData, elementFlags, r, cg, flags);
+ }
+
+ break;
+ }
+
+ case CE_PushButtonLabel:
+ {
+ int x, y, w, h;
+ r.rect( &x, &y, &w, &h );
+
+ const TQPushButton* button = static_cast<const TQPushButton *>( widget );
+ bool active = (elementFlags & CEF_IsOn) || (elementFlags & CEF_IsDown);
+ bool cornArrow = false;
+
+ // Shift button contents if pushed.
+ if ( active )
+ {
+ x += pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget);
+ y += pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget);
+ flags |= Style_Sunken;
+ }
+
+ // Does the button have a popup menu?
+ if ( elementFlags & CEF_IsMenuWidget )
+ {
+ int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
+ if ( !ceData.iconSet.isNull() &&
+ (dx + ceData.iconSet.pixmap (TQIconSet::Small, TQIconSet::Normal, TQIconSet::Off ).width()) >= w )
+ {
+ cornArrow = true; //To little room. Draw the arrow in the corner, don't adjust the widget
+ }
+ else
+ {
+ p->setPen(cg.buttonText());
+ drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - dx - 8, y + 2, dx, h - 4), r ),
+ cg, flags, opt );
+ w -= dx;
+ }
+ }
+
+ // Draw the icon if there is one
+ if ( !ceData.iconSet.isNull() )
+ {
+ TQIconSet::Mode mode = TQIconSet::Disabled;
+ TQIconSet::State state = TQIconSet::Off;
+
+ if (elementFlags & CEF_IsEnabled)
+ mode = (elementFlags & CEF_HasFocus) ? TQIconSet::Active : TQIconSet::Normal;
+ if ((elementFlags & CEF_BiState) && (elementFlags & CEF_IsOn))
+ state = TQIconSet::On;
+
+ TQPixmap pixmap = ceData.iconSet.pixmap( TQIconSet::Small, mode, state );
+
+ if (ceData.text.isEmpty() && ceData.fgPixmap.isNull())
+ p->drawPixmap( x + w/2 - pixmap.width()/2, y + h / 2 - pixmap.height() / 2,
+ pixmap );
+ else
+ p->drawPixmap( x + 4, y + h / 2 - pixmap.height() / 2, pixmap );
+
+ if (cornArrow) //Draw over the icon
+ drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, visualRect( TQRect(x + w - 6, x + h - 6, 7, 7), r ),
+ cg, flags, opt );
+
+
+ int pw = pixmap.width();
+ x += pw + 4;
+ w -= pw + 4;
+ }
+
+ // Make the label indicate if the button is a default button or not
+ drawItem( p, TQRect(x, y, w, h), AlignCenter|ShowPrefix, ceData.colorGroup,
+ (elementFlags & CEF_IsEnabled), (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1,
+ &ceData.colorGroup.buttonText() );
+
+
+ if ( flags & Style_HasFocus )
+ drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
+ visualRect( subRect( SR_PushButtonFocusRect, ceData, elementFlags, widget ), ceData, elementFlags ),
+ cg, flags );
+ break;
+ }
+
+ // MENUBAR ITEM (sunken panel on mouse over)
+ // -----------------------------------------
+ case CE_MenuBarItem: {
+ TQMenuItem *mi = opt.menuItem();
+ bool active = flags & Style_Active;
+ bool focused = flags & Style_HasFocus;
+ bool down = flags & Style_Down;
+ const int text_flags =
+ AlignVCenter | AlignHCenter | ShowPrefix | DontClip | SingleLine;
+
+ p->fillRect(r, cg.background());
+
+ if (active && focused) {
+ if (down) {
+ drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags|Style_Down, opt);
+ } else {
+ drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, r, cg, flags, opt);
+ }
+ }
+
+ p->setPen(cg.foreground() );
+ p->drawText(r, text_flags, mi->text());
+ break;
+ }
+
+ // POPUPMENU ITEM (highlighted on mouseover)
+ // ------------------------------------------
+ case CE_PopupMenuItem: {
+ TQMenuItem *mi = opt.menuItem();
+
+ if ( !mi )
+ {
+ // Don't leave blank holes if we set NoBackground for the TQPopupMenu.
+ // This only happens when the popupMenu spans more than one column.
+ if ( ceData.bgPixmap.isNull() )
+ p->fillRect( r, cg.background().light( 105 ) );
+
+ break;
+ }
+ int tab = opt.tabWidth();
+ int checkcol = opt.maxIconWidth();
+ bool enabled = mi->isEnabled();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+ bool active = flags & Style_Active;
+ bool etchtext = styleHint( SH_EtchDisabledText, ceData, elementFlags );
+ bool reverse = TQApplication::reverseLayout();
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ // Draw the menu item background
+ if (active) {
+ if (enabled) {
+ renderSurface(p, r, cg.background(), cg.highlight(), cg.highlight(),
+ _contrast+3, Draw_Top|Draw_Bottom|Is_Horizontal);
+ }
+ else {
+ if ( ceData.bgPixmap.isNull() )
+ p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
+ else p->fillRect( r, cg.background().light(105) );
+ if(_drawFocusRect)
+ p->drawWinFocusRect( r );
+ }
+ }
+ // Draw the transparency pixmap
+ else if ( !ceData.bgPixmap.isNull() )
+ p->drawPixmap( r.topLeft(), ceData.bgPixmap, r );
+ // Draw a solid background
+ else
+ p->fillRect( r, cg.background().light( 105 ) );
+ // Are we a menu item separator?
+ if ( mi->isSeparator() )
+ {
+ p->setPen( cg.mid() );
+ p->drawLine( r.x()+5, r.y() + 1, r.right()-5, r.y() + 1 );
+ p->setPen( cg.light() );
+ p->drawLine( r.x()+5, r.y() + 2, r.right()-5 , r.y() + 2 );
+ break;
+ }
+
+ TQRect cr = visualRect( TQRect( r.x() + 2, r.y() + 2, checkcol - 1, r.height() - 4 ), r );
+ // Do we have an icon?
+ if ( mi->iconSet() )
+ {
+ TQIconSet::Mode mode;
+
+ // Select the correct icon from the iconset
+ if (active)
+ mode = enabled?TQIconSet::Active:TQIconSet::Disabled;
+ else
+ mode = enabled?TQIconSet::Normal:TQIconSet::Disabled;
+
+ // Do we have an icon and are checked at the same time?
+ // Then draw a "pressed" background behind the icon
+ if ( checkable && /*!active &&*/ mi->isChecked() )
+ drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt);
+ // Draw the icon
+ TQPixmap pixmap = mi->iconSet()->pixmap(TQIconSet::Small, mode);
+ TQRect pmr( 0, 0, pixmap.width(), pixmap.height() );
+ pmr.moveCenter( cr.center() );
+ p->drawPixmap( pmr.topLeft(), pixmap );
+ }
+
+ // Are we checked? (This time without an icon)
+ else if ( checkable && mi->isChecked() )
+ {
+ // We only have to draw the background if the menu item is inactive -
+ // if it's active the "pressed" background is already drawn
+ // if ( ! active )
+ drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt);
+
+ drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt);
+ }
+
+ // Time to draw the menu item label...
+ int xm = 2 + checkcol + 2; // X position margin
+
+ int xp = reverse ? // X position
+ r.x() + tab + rightBorder + itemHMargin + itemFrame - 1 :
+ r.x() + xm;
+
+ int offset = reverse ? -1 : 1; // Shadow offset for etched text
+
+ // Label width (minus the width of the accelerator portion)
+ int tw = r.width() - xm - tab - arrowHMargin - itemHMargin * 3 - itemFrame + 1;
+
+ // Set the color for enabled and disabled text
+ // (used for both active and inactive menu items)
+ p->setPen( enabled ? cg.buttonText() : cg.mid() );
+
+ // This color will be used instead of the above if the menu item
+ // is active and disabled at the same time. (etched text)
+ TQColor discol = cg.mid();
+
+ // Does the menu item draw it's own label?
+ if ( mi->custom() ) {
+ int m = 2;
+ // Save the painter state in case the custom
+ // paint method changes it in some way
+ p->save();
+
+ // Draw etched text if we're inactive and the menu item is disabled
+ if ( etchtext && !enabled && !active ) {
+ p->setPen( cg.light() );
+ mi->custom()->paint( p, cg, active, enabled, xp+offset, r.y()+m+1, tw, r.height()-2*m );
+ p->setPen( discol );
+ }
+ mi->custom()->paint( p, cg, active, enabled, xp, r.y()+m, tw, r.height()-2*m );
+ p->restore();
+ }
+ else {
+ // The menu item doesn't draw it's own label
+ TQString s = mi->text();
+ // Does the menu item have a text label?
+ if ( !s.isNull() ) {
+ int t = s.find( '\t' );
+ int m = 2;
+ int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine;
+ text_flags |= reverse ? AlignRight : AlignLeft;
+
+ //TQColor draw = cg.text();
+ TQColor draw = (active && enabled) ? cg.highlightedText () : cg.foreground();
+ p->setPen(draw);
+
+
+ // Does the menu item have a tabstop? (for the accelerator text)
+ if ( t >= 0 ) {
+ int tabx = reverse ? r.x() + rightBorder + itemHMargin + itemFrame :
+ r.x() + r.width() - tab - rightBorder - itemHMargin - itemFrame;
+
+ // Draw the right part of the label (accelerator text)
+ if ( etchtext && !enabled ) {
+ // Draw etched text if we're inactive and the menu item is disabled
+ p->setPen( cg.light() );
+ p->drawText( tabx+offset, r.y()+m+1, tab, r.height()-2*m, text_flags, s.mid( t+1 ) );
+ p->setPen( discol );
+ }
+ p->drawText( tabx, r.y()+m, tab, r.height()-2*m, text_flags, s.mid( t+1 ) );
+ s = s.left( t );
+ }
+
+ // Draw the left part of the label (or the whole label
+ // if there's no accelerator)
+ if ( etchtext && !enabled ) {
+ // Etched text again for inactive disabled menu items...
+ p->setPen( cg.light() );
+ p->drawText( xp+offset, r.y()+m+1, tw, r.height()-2*m, text_flags, s, t );
+ p->setPen( discol );
+ }
+
+
+ p->drawText( xp, r.y()+m, tw, r.height()-2*m, text_flags, s, t );
+
+ p->setPen(cg.text());
+
+ }
+
+ // The menu item doesn't have a text label
+ // Check if it has a pixmap instead
+ else if ( mi->pixmap() ) {
+ TQPixmap *pixmap = mi->pixmap();
+
+ // Draw the pixmap
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::OpaqueMode );
+
+ int diffw = ( ( r.width() - pixmap->width() ) / 2 )
+ + ( ( r.width() - pixmap->width() ) % 2 );
+ p->drawPixmap( r.x()+diffw, r.y()+1, *pixmap );
+
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( Qt::TransparentMode );
+ }
+ }
+
+ // Does the menu item have a submenu?
+ if ( mi->popup() ) {
+ TQ_PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
+ int dim = pixelMetric(PM_MenuButtonIndicator, ceData, elementFlags) - 1;
+ TQRect vr = visualRect( TQRect( r.x() + r.width() - 5 - 1 - dim,
+ r.y() + r.height() / 2 - dim / 2, dim, dim), r );
+
+ // Draw an arrow at the far end of the menu item
+ if ( active ) {
+ if ( enabled )
+ discol = cg.buttonText();
+
+ TQColorGroup g2( discol, cg.highlight(), white, white,
+ enabled ? white : discol, discol, white );
+
+ drawPrimitive( arrow, p, ceData, elementFlags, vr, g2, Style_Enabled );
+ } else
+ drawPrimitive( arrow, p, ceData, elementFlags, vr, cg,
+ enabled ? Style_Enabled : Style_Default );
+ }
+ break;
+ }
+
+ // Menu and dockwindow empty space
+ //
+ case CE_DockWindowEmptyArea:
+ p->fillRect(r, cg.background());
+ break;
+
+ case CE_MenuBarEmptyArea:
+ p->fillRect(r, cg.background());
+
+// if ( _drawToolBarSeparator ) {
+// p->setPen( getColor(cg, PanelDark) );
+// p->drawLine( r.left(), r.bottom(), r.right(), r.bottom() );
+// }
+
+ break;
+
+ default:
+ TDEStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
+ }
+}
+
+void PlastikStyle::drawControlMask(TQ_ControlElement element,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &opt,
+ const TQWidget *w) const
+{
+ switch (element) {
+ case CE_PushButton: {
+ p->fillRect (r, color0);
+ renderMask(p, r, color1,
+ Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight);
+ break;
+ }
+
+ default: {
+ TDEStyle::drawControlMask (element, p, ceData, elementFlags, r, opt, w);
+ }
+ }
+}
+
+void PlastikStyle::drawComplexControlMask(TQ_ComplexControl c,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &o,
+ const TQWidget *w) const
+{
+ switch (c) {
+ case CC_SpinWidget:
+ case CC_ListView:
+ case CC_ComboBox: {
+ p->fillRect (r, color0);
+ renderMask(p, r, color1,
+ Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight);
+ break;
+ }
+ default: {
+ TDEStyle::drawComplexControlMask (c, p, ceData, elementFlags, r, o, w);
+ }
+ }
+}
+
+void PlastikStyle::drawComplexControl(TQ_ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags,
+ SCFlags controls,
+ SCFlags active,
+ const TQStyleOption& opt,
+ const TQWidget *widget) const
+{
+ const bool reverseLayout = TQApplication::reverseLayout();
+
+ const bool enabled = (flags & Style_Enabled);
+
+ switch(control) {
+ // COMBOBOX
+ // --------
+ case CC_ComboBox: {
+ static const unsigned int handleWidth = 15;
+
+ const TQComboBox *cb = dynamic_cast<const TQComboBox *>(widget);
+ bool editable = false;
+ bool hasFocus = false;
+ editable = (elementFlags & CEF_IsEditable);
+ hasFocus = (elementFlags & CEF_HasFocus);
+
+ const TQColor buttonColor = enabled?cg.button():cg.background();
+ const TQColor inputColor = enabled?(editable?cg.base():cg.button())
+ :cg.background();
+
+ uint contourFlags = 0;
+ if( tdehtmlWidgets.contains(cb) )
+ contourFlags |= Draw_AlphaBlend;
+
+ if (_inputFocusHighlight && hasFocus && editable && enabled)
+ {
+ TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget);
+ TQRect editFrame = r;
+ TQRect buttonFrame = r;
+
+ uint editFlags = contourFlags;
+ uint buttonFlags = contourFlags;
+
+ // Hightlight only the part of the contour next to the control button
+ if (reverseLayout)
+ {
+ // querySubControlMetrics doesn't work right for reverse Layout
+ int dx = r.right() - editField.right();
+ editFrame.setLeft(editFrame.left() + dx);
+ buttonFrame.setRight(editFrame.left() - 1);
+ editFlags |= Draw_Right|Draw_Top|Draw_Bottom|Round_UpperRight|Round_BottomRight;
+ buttonFlags |= Draw_Left|Draw_Top|Draw_Bottom|Round_UpperLeft|Round_BottomLeft;
+ }
+ else
+ {
+ editFrame.setRight(editField.right());
+ buttonFrame.setLeft(editField.right() + 1);
+
+ editFlags |= Draw_Left|Draw_Top|Draw_Bottom|Round_UpperLeft|Round_BottomLeft;
+ buttonFlags |= Draw_Right|Draw_Top|Draw_Bottom|Round_UpperRight|Round_BottomRight;
+ }
+ renderContour(p, editFrame, cg.background(), getColor(cg,FocusHighlight,enabled), editFlags);
+ renderContour(p, buttonFrame, cg.background(),
+ getColor(cg, ButtonContour, enabled), buttonFlags);
+ }
+ else
+ {
+ contourFlags |= Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|
+ Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight;
+ renderContour(p, r, cg.background(), getColor(cg, ButtonContour, enabled), contourFlags);
+ }
+ //extend the contour: between input and handler...
+ p->setPen(alphaBlendColors(cg.background(), getColor(cg, ButtonContour, enabled), 50) );
+ if(reverseLayout) {
+ p->drawLine(r.left()+1+handleWidth, r.top()+1, r.left()+1+handleWidth, r.bottom()-1);
+ } else {
+ p->drawLine(r.right()-handleWidth-1, r.top()+1, r.right()-handleWidth-1, r.bottom()-1);
+ }
+
+ const TQRect RbuttonSurface(reverseLayout?r.left()+1:r.right()-handleWidth, r.top()+1,
+ handleWidth, r.height()-2);
+ const TQRect RcontentSurface(reverseLayout?r.left()+1+handleWidth+1:r.left()+1, r.top()+1,
+ r.width()-handleWidth-3, r.height()-2);
+
+ // handler
+
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Is_Horizontal;
+ if(reverseLayout) {
+ surfaceFlags |= Round_UpperLeft|Round_BottomLeft;
+ } else {
+ surfaceFlags |= Round_UpperRight|Round_BottomRight;
+ }
+
+ if (flags & Style_MouseOver) {
+ surfaceFlags |= Is_Highlight;
+ if(editable) surfaceFlags |= Highlight_Left|Highlight_Right;
+ surfaceFlags |= Highlight_Top|Highlight_Bottom;
+ }
+ renderSurface(p, RbuttonSurface,
+ cg.background(), buttonColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2),
+ surfaceFlags);
+
+ if(!editable) {
+ surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Is_Horizontal;
+ if(reverseLayout) {
+ surfaceFlags |= Round_UpperRight|Round_BottomRight;
+ } else {
+ surfaceFlags |= Round_UpperLeft|Round_BottomLeft;
+ }
+
+ if (flags & Style_MouseOver) {
+ surfaceFlags |= Is_Highlight;
+ surfaceFlags |= Highlight_Top|Highlight_Bottom;
+ }
+ renderSurface(p, RcontentSurface,
+ cg.background(), buttonColor, getColor(cg,MouseOverHighlight), enabled?_contrast+3:(_contrast/2),
+ surfaceFlags);
+ if (hasFocus) {
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags,
+ TQRect(RcontentSurface.x() + 2,
+ RcontentSurface.y() + 2,
+ RcontentSurface.width() - 4,
+ RcontentSurface.height() - 4), cg);
+ }
+ } else {
+ // thin frame around the input area
+ if (_inputFocusHighlight && hasFocus && editable && enabled)
+ {
+ p->setPen( getColor(cg,FocusHighlight).dark(130) );
+ }
+ else
+ {
+ p->setPen(inputColor.dark(130) );
+ }
+ p->drawLine(RcontentSurface.x(), reverseLayout?RcontentSurface.y():RcontentSurface.y()+1,
+ RcontentSurface.x(), reverseLayout?RcontentSurface.bottom():RcontentSurface.bottom()-1);
+ p->drawLine(RcontentSurface.x()+1, RcontentSurface.y(),
+ reverseLayout?RcontentSurface.right()-1:RcontentSurface.right(), RcontentSurface.y() );
+ if (_inputFocusHighlight && hasFocus && editable && enabled)
+ {
+ p->setPen( getColor(cg,FocusHighlight).light(130) );
+ }
+ else
+ {
+ p->setPen(inputColor.light(130) );
+ }
+ p->drawLine(reverseLayout?RcontentSurface.x():RcontentSurface.x()+1, RcontentSurface.bottom(),
+ reverseLayout?RcontentSurface.right()-1:RcontentSurface.right(), RcontentSurface.bottom() );
+ p->drawLine(RcontentSurface.right(), RcontentSurface.top()+1,
+ RcontentSurface.right(), RcontentSurface.bottom()-1 );
+
+ // input area
+ p->fillRect(RcontentSurface.x()+1, RcontentSurface.y()+1,
+ RcontentSurface.width()-2, RcontentSurface.height()-2, inputColor );
+ }
+
+ p->setPen(cg.foreground());
+ drawPrimitive(PE_SpinWidgetDown, p, ceData, elementFlags, RbuttonSurface, cg, Style_Default|Style_Enabled|Style_Raised);
+
+ // TQComboBox draws the text using cg.text(), we can override this
+ // from here
+ p->setPen( cg.buttonText() );
+ p->setBackgroundColor( cg.button() );
+ break;
+ }
+
+ // TOOLBUTTON
+ // ----------
+ case CC_ToolButton: {
+ TQRect button, menuarea;
+ button = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButton, opt, widget);
+ menuarea = querySubControlMetrics(control, ceData, elementFlags, SC_ToolButtonMenu, opt, widget);
+
+ SFlags bflags = flags,
+ mflags = flags;
+
+ if (kornMode) {
+ drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
+ break;
+ } else {
+ // don't want to have the buttoncolor as the background...
+ p->fillRect(r, cg.background());
+ bflags &= ~Style_MouseOver;
+ }
+
+ if (active & SC_ToolButton)
+ bflags |= Style_Down;
+
+ if (active & SC_ToolButtonMenu)
+ mflags |= Style_Down;
+
+ if (controls & SC_ToolButton) {
+ // If we're pressed, on, or raised...
+ if (bflags & (Style_Down | Style_On | Style_Raised) || (flags & Style_MouseOver) ) {
+ drawPrimitive(PE_ButtonTool, p, ceData, elementFlags, button, cg, bflags, opt);
+ } else if ((elementFlags & CEF_HasParentWidget) &&
+ !ceData.parentWidgetData.bgPixmap.isNull()) {
+ TQPixmap pixmap = ceData.parentWidgetData.bgPixmap;
+ p->drawTiledPixmap( r, pixmap, ceData.pos );
+ }
+ }
+
+ // Draw a toolbutton menu indicator if required
+ if (controls & SC_ToolButtonMenu) {
+ if (mflags & (Style_Down | Style_On | Style_Raised)) {
+ drawPrimitive(PE_ButtonDropDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
+ }
+ drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, menuarea, cg, mflags, opt);
+ }
+
+ if ((elementFlags & CEF_HasFocus) && !(elementFlags & CEF_HasFocusProxy)) {
+ TQRect fr = ceData.rect;
+ fr.addCoords(2, 2, -2, -2);
+ drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg);
+ }
+
+ // Set the color for the ToolButton menu indicator
+ p->setPen(cg.buttonText() );
+
+ break;
+ }
+
+ // SPINWIDGETS
+ // -----------
+ case CC_SpinWidget: {
+ static const unsigned int handleWidth = 15;
+
+ const TQSpinWidget *sw = dynamic_cast<const TQSpinWidget *>(widget);
+ SFlags sflags = flags;
+ TQ_PrimitiveElement pe;
+
+ bool hasFocus = false;
+ if (sw)
+ hasFocus = sw->hasFocus();
+
+ const TQColor buttonColor = enabled?cg.button():cg.background();
+ const TQColor inputColor = enabled?cg.base():cg.background();
+
+ // contour
+ const bool heightDividable = ((r.height()%2) == 0);
+ if (_inputFocusHighlight && hasFocus && enabled)
+ {
+ TQRect editField = querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetEditField, TQStyleOption::Default, widget);
+ TQRect editFrame = r;
+ TQRect buttonFrame = r;
+
+ uint editFlags = 0;
+ uint buttonFlags = 0;
+
+ // Hightlight only the part of the contour next to the control buttons
+ if (reverseLayout)
+ {
+ // querySubControlMetrics doesn't work right for reverse Layout
+ int dx = r.right() - editField.right();
+ editFrame.setLeft(editFrame.left() + dx);
+ buttonFrame.setRight(editFrame.left() - 1);
+ editFlags |= Draw_Right|Draw_Top|Draw_Bottom|Round_UpperRight|Round_BottomRight;
+ buttonFlags |= Draw_Left|Draw_Top|Draw_Bottom|Round_UpperLeft|Round_BottomLeft;
+ }
+ else
+ {
+ editFrame.setRight(editField.right());
+ buttonFrame.setLeft(editField.right() + 1);
+
+ editFlags |= Draw_Left|Draw_Top|Draw_Bottom|Round_UpperLeft|Round_BottomLeft;
+ buttonFlags |= Draw_Right|Draw_Top|Draw_Bottom|Round_UpperRight|Round_BottomRight;
+ }
+ renderContour(p, editFrame, cg.background(), cg.highlight(), editFlags);
+ renderContour(p, buttonFrame, cg.background(),
+ getColor(cg, ButtonContour, enabled), buttonFlags);
+ }
+ else
+ {
+ renderContour(p, querySubControlMetrics(control, ceData, elementFlags, SC_SpinWidgetFrame, TQStyleOption::Default, widget),
+ cg.background(), getColor(cg, ButtonContour, enabled) );
+ }
+ p->setPen(alphaBlendColors(cg.background(), getColor(cg, ButtonContour, enabled), 50) );
+ p->drawLine(reverseLayout?r.left()+1+handleWidth:r.right()-handleWidth-1, r.top()+1,
+ reverseLayout?r.left()+1+handleWidth:r.right()-handleWidth-1, r.bottom()-1);
+ p->drawLine(reverseLayout?r.left()+1:r.right()-handleWidth, r.top()+1+(r.height()-2)/2,
+ reverseLayout?r.left()+handleWidth:r.right()-1, r.top()+1+(r.height()-2)/2);
+ if(heightDividable)
+ p->drawLine(reverseLayout?r.left()+1:r.right()-handleWidth, r.top()+1+(r.height()-2)/2-1,
+ reverseLayout?r.left()+handleWidth:r.right()-1, r.top()+1+(r.height()-2)/2-1);
+
+ // surface
+ TQRect upRect = TQRect(reverseLayout?r.left()+1:r.right()-handleWidth, r.top()+1,
+ handleWidth, (r.height()-2)/2);
+ TQRect downRect = TQRect(reverseLayout?r.left()+1:r.right()-handleWidth,
+ heightDividable?r.top()+1+((r.height()-2)/2):r.top()+1+((r.height()-2)/2)+1,
+ handleWidth, ((r.height()-2)/2) );
+ if(heightDividable) {
+ upRect = TQRect(upRect.left(), upRect.top(), upRect.width(), upRect.height()-1 );
+ downRect = TQRect(downRect.left(), downRect.top()+1, downRect.width(), downRect.height()-1 );
+ }
+
+ uint surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Is_Horizontal;
+ if(reverseLayout) {
+ surfaceFlags |= Round_UpperLeft;
+ } else {
+ surfaceFlags |= Round_UpperRight;
+ }
+ if (sflags & Style_MouseOver) {
+ surfaceFlags |= Is_Highlight;
+ surfaceFlags |= Highlight_Top|Highlight_Left|Highlight_Right;
+ }
+ if (active==SC_SpinWidgetUp) surfaceFlags|=Is_Sunken;
+ if(!enabled) surfaceFlags|=Is_Disabled;
+ renderSurface(p, upRect, cg.background(), buttonColor, getColor(cg,MouseOverHighlight),
+ _contrast, surfaceFlags);
+ surfaceFlags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|Is_Horizontal;
+ if(reverseLayout) {
+ surfaceFlags |= Round_BottomLeft;
+ } else {
+ surfaceFlags |= Round_BottomRight;
+ }
+ if (sflags & Style_MouseOver) {
+ surfaceFlags |= Is_Highlight;
+ surfaceFlags |= Highlight_Bottom|Highlight_Left|Highlight_Right;
+ }
+ if (active==SC_SpinWidgetDown) surfaceFlags|=Is_Sunken;
+ if(!enabled) surfaceFlags|=Is_Disabled;
+ renderSurface(p, downRect, cg.background(), buttonColor, getColor(cg,MouseOverHighlight),
+ _contrast, surfaceFlags);
+
+ // icons...
+ sflags = Style_Default | Style_Enabled;
+ if (active == SC_SpinWidgetUp) {
+ sflags |= Style_On;
+ sflags |= Style_Sunken;
+ } else
+ sflags |= Style_Raised;
+ if (sw->buttonSymbols() == TQSpinWidget::PlusMinus)
+ pe = PE_SpinWidgetPlus;
+ else
+ pe = PE_SpinWidgetUp;
+ p->setPen(cg.foreground());
+ drawPrimitive(pe, p, ceData, elementFlags, upRect, cg, sflags);
+
+ sflags = Style_Default | Style_Enabled;
+ if (active == SC_SpinWidgetDown) {
+ sflags |= Style_On;
+ sflags |= Style_Sunken;
+ } else
+ sflags |= Style_Raised;
+ if (sw->buttonSymbols() == TQSpinWidget::PlusMinus)
+ pe = PE_SpinWidgetMinus;
+ else
+ pe = PE_SpinWidgetDown;
+ p->setPen(cg.foreground());
+ drawPrimitive(pe, p, ceData, elementFlags, downRect, cg, sflags);
+
+ // thin frame around the input area
+ const TQRect Rcontent = TQRect(reverseLayout?r.left()+1+handleWidth+1:r.left()+1, r.top()+1,
+ r.width()-1-2-handleWidth, r.height()-2);
+ if (_inputFocusHighlight && hasFocus && enabled)
+ {
+ p->setPen( getColor(cg,FocusHighlight).dark(130) );
+ }
+ else
+ {
+ p->setPen(inputColor.dark(130) );
+ }
+ p->drawLine(Rcontent.left(), reverseLayout?Rcontent.top():Rcontent.top()+1,
+ Rcontent.left(), reverseLayout?Rcontent.bottom():Rcontent.bottom()-1 );
+ p->drawLine(Rcontent.left()+1, Rcontent.top(),
+ reverseLayout?Rcontent.right()-1:Rcontent.right(), Rcontent.top() );
+ if (_inputFocusHighlight && hasFocus && enabled)
+ {
+ p->setPen( getColor(cg,FocusHighlight).light(130) );
+ }
+ else
+ {
+ p->setPen(inputColor.light(130) );
+ }
+ p->drawLine(Rcontent.left()+1, Rcontent.bottom(), Rcontent.right()-1, Rcontent.bottom() );
+ p->drawLine(Rcontent.right(), Rcontent.top()+1,
+ Rcontent.right(), reverseLayout?Rcontent.bottom()-1:Rcontent.bottom() );
+
+ break;
+ }
+
+ default:
+ TDEStyle::drawComplexControl(control, p, ceData, elementFlags,
+ r, cg, flags, controls,
+ active, opt, widget);
+ break;
+ }
+}
+
+
+TQRect PlastikStyle::subRect(SubRect r, const TQStyleControlElementData &ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ switch (r) {
+ case SR_ComboBoxFocusRect: {
+ return querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxEditField, TQStyleOption::Default, widget );
+ }
+
+ // Don't use TDEStyles progressbar subrect
+ // TODO:
+ case SR_ProgressBarGroove: {
+ return TQRect(ceData.rect);
+ }
+ case SR_ProgressBarContents:
+ case SR_ProgressBarLabel: {
+ TQRect rw = ceData.rect;
+ return TQRect(rw.left()+2, rw.top()+2, rw.width()-4, rw.height()-4 );
+ }
+
+ default: {
+ return TDEStyle::subRect(r, ceData, elementFlags, widget);
+ }
+ }
+}
+
+TQRect PlastikStyle::querySubControlMetrics(TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl subcontrol,
+ const TQStyleOption &opt,
+ const TQWidget *widget) const
+{
+ TQRect r(ceData.rect);
+ switch (control) {
+ case CC_ComboBox: {
+ switch (subcontrol) {
+ case SC_ComboBoxEditField: {
+ // TODO: is the handler width in pixelmetric?
+ return TQRect(r.left()+2, r.top()+2, r.width()-4-15-1, r.height()-4);
+ }
+ default: {
+ return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
+ }
+ }
+ break;
+ }
+ case CC_SpinWidget: {
+ const int fw = 2; // Frame width...
+
+ const bool heightDividable = ((r.height()%2) == 0);
+
+ TQSize bs;
+ if(heightDividable) {
+ bs.setHeight(QMAX(8, (r.height()-2)/2));
+ } else {
+ bs.setHeight(QMAX(8, (r.height()-2-1)/2));
+ }
+ bs.setWidth(15);
+
+ const int buttonsLeft = /*reverseLayout?r.left()+1:*/r.right()-bs.width();
+
+ switch (subcontrol) {
+ case SC_SpinWidgetUp: {
+ return TQRect(buttonsLeft, r.top()+1, bs.width(), bs.height() );
+ }
+ case SC_SpinWidgetDown: {
+ if(heightDividable) {
+ return TQRect(buttonsLeft, r.top()+1+bs.height(),
+ bs.width(), r.height()-(bs.height()+2) );
+ } else {
+ return TQRect(buttonsLeft, r.top()+1+bs.height()+1,
+ bs.width(), r.height()-(bs.height()+2+1) );
+ }
+ }
+ case SC_SpinWidgetFrame: {
+ return TQRect(r.left(), r.top(), r.width(), r.height() );
+ }
+ case SC_SpinWidgetEditField: {
+ return TQRect(r.left()+fw, r.top()+fw,
+ r.width()-(bs.width()+1+2*fw), r.height()-2*fw);
+ }
+ case SC_SpinWidgetButtonField: {
+ return TQRect(buttonsLeft, r.top()+1, bs.width(), r.height()-2);
+ }
+ default: {
+ return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
+ }
+ }
+ break;
+ }
+ default: {
+ return TDEStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
+ }
+ }
+}
+
+int PlastikStyle::pixelMetric(PixelMetric m, const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
+{
+ switch(m) {
+ // TABS
+ // ----
+ case PM_TabBarTabVSpace: {
+ if (ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
+ ceData.tabBarData.shape == TQTabBar::RoundedBelow)
+ return 12;
+ else
+ return 4;
+ }
+
+ case PM_TabBarTabOverlap: {
+ return 1;
+ }
+
+ // extra space between menubar items
+ case PM_MenuBarItemSpacing: {
+ return 6;
+ }
+
+// // extra space between toolbar items
+// case PM_ToolBarItemSpacing: {
+// return 4;
+// }
+
+ // SCROLL BAR
+ case PM_ScrollBarSliderMin: {
+ return 21;
+ }
+ case PM_ScrollBarExtent: {
+ return 16;
+ }
+
+ case PM_DockWindowSeparatorExtent:
+ return 6;
+
+ // SPLITTERS
+ // ---------
+ case PM_SplitterWidth: {
+ return 6;
+ }
+
+ // PROGRESSBARS
+ // ------------
+ case PM_ProgressBarChunkWidth:
+ return 10;
+
+ // SLIDER
+ // ------
+ case PM_SliderLength:
+ return 11;
+
+ // MENU INDICATOR
+ // --------------
+ case PM_MenuButtonIndicator:
+ return 8;
+
+ // CHECKBOXES / RADIO BUTTONS
+ // --------------------------
+ case PM_ExclusiveIndicatorWidth: // Radiobutton size
+ case PM_ExclusiveIndicatorHeight: // 13x13
+ case PM_IndicatorWidth: // Checkbox size
+ case PM_IndicatorHeight: // 13x13
+ return 13;
+
+ // FRAMES
+ // ------
+ case PM_SpinBoxFrameWidth:
+ return 1;
+
+ case PM_MenuBarFrameWidth:
+ return 1;
+
+ case PM_DefaultFrameWidth: {
+ if(widget && ::tqqt_cast<TQPopupMenu*>(widget))
+ return 1;
+ else
+ return 2;
+ }
+
+ case PM_ButtonDefaultIndicator: {
+ return 0;
+ }
+
+ case PM_ButtonMargin: {
+ return 2;
+ }
+
+ case PM_ButtonShiftVertical:
+ case PM_ButtonShiftHorizontal: {
+ return 1;
+ }
+
+ case PM_MenuIndicatorFrameHBorder:
+ case PM_MenuIndicatorFrameVBorder:
+ case PM_MenuIconIndicatorFrameHBorder:
+ case PM_MenuIconIndicatorFrameVBorder:
+ return 2;
+
+ default:
+ return TDEStyle::pixelMetric(m, ceData, elementFlags, widget);
+ }
+}
+
+
+TQSize PlastikStyle::sizeFromContents(ContentsType t,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &s,
+ const TQStyleOption &opt,
+ const TQWidget *widget) const
+{
+ switch (t) {
+ case CT_PopupMenuItem: {
+ if (!widget || opt.isDefault())
+ return s;
+
+ const TQPopupMenu *popup = dynamic_cast<const TQPopupMenu *>(widget);
+ TQMenuItem *mi = opt.menuItem();
+ int maxpmw = opt.maxIconWidth();
+ int w = s.width(), h = s.height();
+ bool checkable = popup->isCheckable();
+
+ if (mi->custom()) {
+ w = mi->custom()->sizeHint().width();
+ h = mi->custom()->sizeHint().height();
+ if (!mi->custom()->fullSpan() )
+ h += 4;
+ } else if (mi->widget()) {
+ // don't change the size in this case.
+ } else if (mi->isSeparator()) {
+ w = 20;
+ h = 2;
+ } else {
+ if (mi->pixmap()) {
+ h = QMAX(h, mi->pixmap()->height() + 2);
+ } else {
+ h = QMAX(h, 16 + 2 );
+ h = QMAX(h, popup->fontMetrics().height() + 4 );
+ }
+
+ if (mi->iconSet()) {
+ h = QMAX(h, mi->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).height() + 2);
+ }
+ }
+
+ if (!mi->text().isNull() && (mi->text().find('\t') >= 0)) {
+ w += itemHMargin + itemFrame*2 + 7;
+ } else if (mi->popup()) {
+ w += 2 * arrowHMargin;
+ }
+
+ if (maxpmw) {
+ w += maxpmw + 6;
+ }
+ if (checkable && maxpmw < 20) {
+ w += 20 - maxpmw;
+ }
+ if (checkable || maxpmw > 0) {
+ w += 12;
+ }
+
+ w += rightBorder;
+
+ return TQSize(w, h);
+ }
+
+ case CT_PushButton:
+ {
+ const TQPushButton* btn = static_cast<const TQPushButton*>(widget);
+
+ int w = s.width() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget);
+ int h = s.height() + 2 * pixelMetric(PM_ButtonMargin, ceData, elementFlags, widget);
+ if ( btn->text().isEmpty() && s.width() < 32 ) return TQSize(w, h);
+
+ return TQSize( w+25, h+5 );
+ }
+
+ case CT_ToolButton:
+ {
+ if(widget->parent() && ::tqqt_cast<TQToolBar*>(widget->parent()) )
+ return TQSize( s.width()+2*4, s.height()+2*4 );
+ else
+ return TDEStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
+ }
+
+ default:
+ return TDEStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
+ }
+
+ return TDEStyle::sizeFromContents (t, ceData, elementFlags, s, opt, widget);
+}
+
+int PlastikStyle::styleHint( TQ_StyleHint stylehint,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption &option,
+ TQStyleHintReturn* returnData,
+ const TQWidget *widget ) const
+{
+ switch (stylehint) {
+ case SH_PopupMenu_SubMenuPopupDelay:
+ return 96; // Motif-like delay...
+
+ case SH_MenuIndicatorColumnWidth:
+ {
+ int checkcol = option.maxIconWidth();
+ bool checkable = (elementFlags & CEF_IsCheckable);
+
+ if ( checkable )
+ checkcol = QMAX( checkcol, 20 );
+
+ return checkcol;
+ }
+
+ default:
+ return TDEStyle::styleHint(stylehint, ceData, elementFlags, option, returnData, widget);
+ }
+}
+
+bool PlastikStyle::objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *ev )
+{
+ if (TDEStyle::objectEventHandler(ceData, elementFlags, source, ev) )
+ return true;
+
+ if (ceData.widgetObjectTypes.contains(TQOBJECT_OBJECT_NAME_STRING)) {
+ TQObject* obj = reinterpret_cast<TQObject*>(source);
+
+ if (!obj->isWidgetType() ) return false;
+
+ // Track show events for progress bars
+ if ( _animateProgressBar && ::tqqt_cast<TQProgressBar*>(obj) )
+ {
+ if ((ev->type() == TQEvent::Show) && !animationTimer->isActive())
+ {
+ animationTimer->start( 50, false );
+ }
+ }
+ if ( !qstrcmp(obj->name(), "kde toolbar widget") )
+ {
+ TQWidget* lb = TQT_TQWIDGET(obj);
+ if (lb->backgroundMode() == TQt::PaletteButton)
+ lb->setBackgroundMode(TQt::PaletteBackground);
+ removeObjectEventHandler(ceData, elementFlags, source, this);
+ }
+ }
+
+ return false;
+}
+
+TQColor PlastikStyle::getColor(const TQColorGroup &cg, const ColorType t, const bool enabled)const
+{
+ return getColor(cg, t, enabled?IsEnabled:IsDisabled);
+}
+
+TQColor PlastikStyle::getColor(const TQColorGroup &cg, const ColorType t, const WidgetState s)const
+{
+ const bool enabled = (s != IsDisabled) &&
+ ((s == IsEnabled) || (s == IsPressed) || (s == IsHighlighted));
+ const bool pressed = (s == IsPressed);
+ const bool highlighted = (s == IsHighlighted);
+ switch(t) {
+ case ButtonContour:
+ return enabled ? cg.button().dark(130+_contrast*8)
+ : cg.background().dark(120+_contrast*8);
+ case DragButtonContour: {
+ if(enabled) {
+ if(pressed)
+ return cg.button().dark(130+_contrast*6); // bright
+ else if(highlighted)
+ return cg.button().dark(130+_contrast*9); // dark
+ else
+ return cg.button().dark(130+_contrast*8); // normal
+ } else {
+ return cg.background().dark(120+_contrast*8);
+ }
+ }
+ case DragButtonSurface: {
+ if(enabled) {
+ if(pressed)
+ return cg.button().dark(100-_contrast); // bright
+ else if(highlighted)
+ return cg.button().light(100+_contrast); // dark
+ else
+ return cg.button(); // normal
+ } else {
+ return cg.background();
+ }
+ }
+ case PanelContour:
+ return cg.background().dark(160+_contrast*8);
+ case PanelDark:
+ return alphaBlendColors(cg.background(), cg.background().dark(120+_contrast*5), 110);
+ case PanelDark2:
+ return alphaBlendColors(cg.background(), cg.background().dark(110+_contrast*5), 110);
+ case PanelLight:
+ return alphaBlendColors(cg.background(), cg.background().light(120+_contrast*5), 110);
+ case PanelLight2:
+ return alphaBlendColors(cg.background(), cg.background().light(110+_contrast*5), 110);
+ case MouseOverHighlight:
+ if( _customOverHighlightColor )
+ return _overHighlightColor;
+ else
+ return cg.highlight();
+ case FocusHighlight:
+ if( _customFocusHighlightColor )
+ return _focusHighlightColor;
+ else
+ return cg.highlight();
+ case CheckMark:
+ if( _customCheckMarkColor )
+ return _checkMarkColor;
+ else
+ return cg.foreground();
+ default:
+ return cg.background();
+ }
+}
diff --git a/tdestyles/plastik/plastik.h b/tdestyles/plastik/plastik.h
new file mode 100644
index 000000000..68f707d79
--- /dev/null
+++ b/tdestyles/plastik/plastik.h
@@ -0,0 +1,373 @@
+/* Plastik widget style for KDE 3
+ Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
+
+ based on the KDE style "dotNET":
+ Copyright (C) 2001-2002, Chris Lee <clee@kde.org>
+ Carsten Pfeiffer <pfeiffer@kde.org>
+ Karol Szwed <gallium@kde.org>
+ 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 <malte@kde.org>
+ (c) 2002,2003 Maksim Orlovich <mo002j@mail.rochester.edu>
+ based on the KDE3 HighColor Style
+ Copyright (C) 2001-2002 Karol Szwed <gallium@kde.org>
+ (C) 2001-2002 Fredrik H�glund <fredrik@kde.org>
+ Drawing routines adapted from the KDE2 HCStyle,
+ Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
+ (C) 2000 Dirk Mueller <mueller@kde.org>
+ (C) 2001 Martijn Klingens <klingens@kde.org>
+ Progressbar code based on TDEStyle,
+ Copyright (C) 2001-2002 Karol Szwed <gallium@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 __PLASTIK_H
+#define __PLASTIK_H
+
+#include <tdestyle.h>
+#include <tqbitmap.h>
+#include <tqintcache.h>
+
+#define u_arrow -4,1, 2,1, -3,0, 1,0, -2,-1, 0,-1, -1,-2
+#define d_arrow -4,-2, 2,-2, -3,-1, 1,-1, -2,0, 0,0, -1,1
+#define l_arrow 0,-3, 0,3,-1,-2,-1,2,-2,-1,-2,1,-3,0
+#define r_arrow -2,-3,-2,3,-1,-2, -1,2,0,-1,0,1,1,0
+
+#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
+
+class TQSettings;
+class TQTab;
+class TQTimer;
+
+class PlastikStyle : public TDEStyle
+{
+ Q_OBJECT
+
+public:
+ PlastikStyle();
+ virtual ~PlastikStyle();
+
+ void applicationPolish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+ void polish(const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void *);
+ 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(TQ_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(TQ_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 * = 0) 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, const ControlElementFlags elementFlags,
+ const TQWidget *widget ) const;
+
+ TQRect querySubControlMetrics(TQ_ComplexControl control,
+ const TQStyleControlElementData &ceData,
+ ControlElementFlags elementFlags,
+ SubControl subcontrol,
+ const TQStyleOption &opt = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const;
+
+ void drawComplexControlMask(TQStyle::TQ_ComplexControl c,
+ TQPainter *p,
+ const TQStyleControlElementData &ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption &o=TQStyleOption::Default,
+ const TQWidget *w = 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;
+
+protected:
+ enum TabPosition
+ {
+ First = 0,
+ Middle,
+ Last,
+ Single // only one tab!
+ };
+
+ enum ColorType
+ {
+ ButtonContour,
+ DragButtonContour,
+ DragButtonSurface,
+ PanelContour,
+ PanelLight,
+ PanelLight2,
+ PanelDark,
+ PanelDark2,
+ MouseOverHighlight,
+ FocusHighlight,
+ CheckMark
+ };
+
+ enum WidgetState
+ {
+ IsEnabled,
+ IsPressed, // implies IsEnabled
+ IsHighlighted, // implies IsEnabled
+ IsDisabled
+ };
+
+ // the only way i see to provide all these options
+ // to renderContour/renderSurface...
+ enum SurfaceFlags {
+ Draw_Left = 0x00000001,
+ Draw_Right = 0x00000002,
+ Draw_Top = 0x00000004,
+ Draw_Bottom = 0x00000008,
+ Highlight_Left = 0x00000010, // surface
+ Highlight_Right = 0x00000020, // surface
+ Highlight_Top = 0x00000040, // surface
+ Highlight_Bottom = 0x00000080, // surface
+ Is_Sunken = 0x00000100, // surface
+ Is_Horizontal = 0x00000200, // surface
+ Is_Highlight = 0x00000400, // surface
+ Is_Default = 0x00000800, // surface
+ Is_Disabled = 0x00001000,
+ Round_UpperLeft = 0x00002000,
+ Round_UpperRight = 0x00004000,
+ Round_BottomLeft = 0x00008000,
+ Round_BottomRight = 0x00010000,
+ Draw_AlphaBlend = 0x00020000
+ };
+
+ 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 renderMask(TQPainter *p,
+ const TQRect &r,
+ const TQColor &color,
+ const uint flags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|
+ Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight) const;
+
+ void renderSurface(TQPainter *p,
+ const TQRect &r,
+ const TQColor &backgroundColor,
+ const TQColor &buttonColor,
+ const TQColor &highlightColor,
+ int intensity = 5,
+ const uint flags = Draw_Left|Draw_Right|Draw_Top|Draw_Bottom|
+ Round_UpperLeft|Round_UpperRight|Round_BottomLeft|Round_BottomRight|
+ Is_Horizontal) const;
+
+ 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 renderPanel(TQPainter *p,
+ const TQRect &r,
+ const TQColorGroup &g,
+ const bool pseudo3d = true,
+ const bool sunken = true) const;
+
+ void renderDot(TQPainter *p,
+ const TQPoint &point,
+ const TQColor &baseColor,
+ const bool thick = false,
+ const bool sunken = false) 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;
+
+ virtual void renderMenuBlendPixmap( KPixmap& pix, const TQColorGroup& cg,
+ const TQPopupMenu* popup ) const;
+
+ virtual bool objectEventHandler( const TQStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
+
+protected slots:
+ void tdehtmlWidgetDestroyed(TQObject* w);
+
+ //Animation slots.
+ void updateProgressPos();
+ void progressBarDestroyed(TQObject* bar);
+
+ inline TQColor getColor(const TQColorGroup &cg, const ColorType t, const bool enabled = true)const;
+ inline TQColor getColor(const TQColorGroup &cg, const ColorType t, const WidgetState s)const;
+private:
+// Disable copy constructor and = operator
+ PlastikStyle( const PlastikStyle & );
+ PlastikStyle& operator=( const PlastikStyle & );
+
+ bool kickerMode, kornMode;
+ mutable bool flatMode;
+
+ int _contrast;
+ bool _scrollBarLines;
+ bool _animateProgressBar;
+ bool _drawToolBarSeparator;
+ bool _drawToolBarItemSeparator;
+ bool _drawFocusRect;
+ bool _drawTriangularExpander;
+ bool _inputFocusHighlight;
+ bool _customOverHighlightColor;
+ bool _customFocusHighlightColor;
+ bool _customCheckMarkColor;
+ TQColor _overHighlightColor;
+ TQColor _focusHighlightColor;
+ TQColor _checkMarkColor;
+
+ // 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;
+ QRgb c1Rgb;
+ QRgb c2Rgb;
+ bool horizontal;
+
+ TQPixmap* pixmap;
+
+ CacheEntry(CacheEntryType t, int w, int h, QRgb c1, QRgb 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;
+};
+
+#endif // __PLASTIK_H
diff --git a/tdestyles/plastik/plastik.themerc b/tdestyles/plastik/plastik.themerc
new file mode 100644
index 000000000..3ed2783e6
--- /dev/null
+++ b/tdestyles/plastik/plastik.themerc
@@ -0,0 +1,101 @@
+[Misc]
+Name=Plastik
+Name[af]=Plastiek
+Name[be]=ПлаÑтыка
+Name[bn]=পà§à¦²à¦¾à¦¸à§à¦Ÿà¦¿à¦•
+Name[fa]=پلاستیک
+Name[he]=פלסטיק
+Name[hi]=पà¥à¤²à¤¾à¤¸à¥à¤Ÿà¤¿à¤•
+Name[is]=Plast
+Name[ka]=პლáƒáƒ¡áƒ¢áƒ˜áƒ™áƒ˜
+Name[kk]=ПлаÑтик
+Name[lt]=Plastikinis
+Name[lv]=Plastika
+Name[mk]=ПлаÑтик
+Name[nb]=Plastikk
+Name[ne]=पà¥à¤²à¤¾à¤¸à¥à¤Ÿà¤¿à¤•
+Name[nn]=Plastikk
+Name[pa]=ਪਲਾਸਟਿਕ
+Name[ru]=ПлаÑтик
+Name[sr]=ПлаÑтика
+Name[sr@Latn]=Plastika
+Name[ta]=பà¯à®³à®¾à®¸à¯à®Ÿà®¿à®•à¯
+Name[te]=à°ªà±à°²à°¾à°¸à±à°Ÿà°¿à°•à±
+Name[tg]=ПлаÑтик
+Name[th]=พลาสติคK
+Name[uk]=ПлаÑтик
+Name[uz@cyrillic]=ПлаÑтик
+Name[zh_CN]=å¡‘æ–™
+ConfigPage=tdestyle_plastik_config
+Comment=A simple and clean style
+Comment[af]=´n eenvoudige en skoon styl
+Comment[be]=ПроÑÑ‚Ñ‹ Ñ– прыгожы Ñтыль
+Comment[bg]=Семпъл и изчиÑтен Ñтил
+Comment[bn]=à¦à¦•à¦Ÿà¦¿ সরল à¦à¦¬à¦‚ পরিচà§à¦›à¦¨à§à¦¨ সà§à¦Ÿà¦¾à¦‡à¦²
+Comment[br]=Un arloadig panell eeun
+Comment[bs]=Jednostavan i Äist stil
+Comment[ca]=Un estil simple i net
+Comment[cs]=Jednoduchý a Äistý styl
+Comment[csb]=Prosti ë czësti sztél
+Comment[cy]=Arddull syml a glan
+Comment[da]=En simpel og ren stil
+Comment[de]=Ein einfacher und schlichter Stil
+Comment[el]=Ένα απλό και καθαÏÏŒ στυλ
+Comment[eo]=Simpla kaj pura etoso
+Comment[es]=Un estilo sencillo y terso
+Comment[et]=Lihtne ja klaar stiil
+Comment[eu]=Estilo xehe eta gardena
+Comment[fa]=یک سبک ساده و تمیز
+Comment[fi]=Yksinkertainen ja siisti tyyli
+Comment[fr]=Un style simple et propre
+Comment[fy]=In ienfâldich en skjinne styl
+Comment[ga]=Stíl shímplí shoiléir
+Comment[gl]=Un estilo simples e limpo
+Comment[he]=סגנון נקי ופשוט
+Comment[hi]=à¤à¤• सादा और साफ शैली
+Comment[hr]=Jednostavan i pregledan stil
+Comment[hu]=ÃttekinthetÅ‘, egyszerű alapstílus
+Comment[id]=Gaya yang ringkas dan sederhana
+Comment[is]=Einfaldur og hreinlegur stíll
+Comment[it]=Uno stile semplice e pulito
+Comment[ja]=シンプルã§ãã‚Œã„ãªã‚¹ã‚¿ã‚¤ãƒ«
+Comment[ka]=მáƒáƒ áƒ¢áƒ˜áƒ•áƒ˜ დრსუფთრსტილი
+Comment[kk]=Қарапайым және анық Ñтилі
+Comment[km]=រចនាបáŸáž‘្ម​សាមញ្ញ ហើយស្អាáž
+Comment[lb]=En einfachen a schlichte Stil
+Comment[lt]=Paprastas ir Å¡varus stilius
+Comment[lv]=VienkÄrÅ¡s un tÄ«rs stils
+Comment[mk]=ЕдноÑтавен и чиÑÑ‚ Ñтил
+Comment[ms]=Gaya ringkas dan bersih
+Comment[nb]=En enkel og ren stil
+Comment[nds]=En eenfache un smucke Stil
+Comment[ne]=सरल र सफा शैली
+Comment[nl]=Een eenvoudige en schone stijl
+Comment[nn]=Ein enkel og rein stil
+Comment[pa]=ਇੱਕ ਸਧਾਰਨ ਤੇ ਸਾਫ਼ ਸ਼ੈਲੀ
+Comment[pl]=Prosty i czysty styl
+Comment[pt]=Um estilo simples e limpo
+Comment[pt_BR]=Um estilo simples e limpo
+Comment[ro]=Un stil simplu ÅŸi clar
+Comment[ru]=ПроÑтой и изÑщный Ñтиль
+Comment[rw]=Imisusire yoroshye kandi ikeye
+Comment[se]=Oktageardánis ja Äorges stiila
+Comment[sk]=Jednoduchý a Äistý Å¡týl
+Comment[sl]=Preprost in Äist slog
+Comment[sr]=ЈедноÑтаван и чиÑÑ‚ Ñтил
+Comment[sr@Latn]=Jednostavan i Äist stil
+Comment[sv]=En enkel och ren stil
+Comment[ta]=ஒர௠சà¯à®²à®ªà®®à®¾à®©à®¤à¯à®®à¯ தெளிவானதà¯à®®à®¾à®© பாணி
+Comment[te]=సరళమైన మరయౠశà±à°­à±à°°à°®à±ˆà°¨ à°’à°• శైలి
+Comment[tg]=УÑлуби оÑон ва тоза
+Comment[th]=รูปà¹à¸šà¸šà¸—ี่เรียบง่ายà¹à¸¥à¸°à¸ªà¸°à¸­à¸²à¸”
+Comment[tr]=Basit ve temiz stil
+Comment[tt]=Ciñel yämle tışlaw
+Comment[uk]=ПроÑтий та чиÑтий Ñтиль
+Comment[uz]=Oddiy va chiroyli uslub
+Comment[uz@cyrillic]=Оддий ва чиройли уÑлуб
+Comment[vi]=Kiểu dáng sạch và đơn giản.
+Comment[zh_CN]=简æ´æ¸…爽的样å¼
+Comment[zh_TW]=簡單而乾淨的風格
+[KDE]
+WidgetStyle=Plastik
diff --git a/tdestyles/riscos/CMakeLists.txt b/tdestyles/riscos/CMakeLists.txt
new file mode 100644
index 000000000..a6808ba47
--- /dev/null
+++ b/tdestyles/riscos/CMakeLists.txt
@@ -0,0 +1,30 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+##### other data ################################
+
+install( FILES
+ arrowdown.png arrowdown_down.png arrowleft.png
+ arrowleft_down.png arrowright.png arrowright_down.png
+ arrowup.png arrowup_down.png background.png
+ check.png check_checked.png checkmark.png
+ combo.png combo_down.png hscrollback.png
+ hscrollbar.png hscrollbar_down.png hscrollborder.png
+ htab.png menu_back.png radio.png radio_down.png
+ raised_border.png scrollborder.png slider.png
+ sunk_border.png tab_up.png vscrollback.png
+ vscrollbar.png vscrollbar_down.png vscrollborder.png
+ vtab.png
+ DESTINATION ${DATA_INSTALL_DIR}/tdestyle/pixmaps/riscos )
+
+install( FILES
+ riscos.themerc
+ DESTINATION ${DATA_INSTALL_DIR}/tdestyle/themes )
diff --git a/tdestyles/riscos/Makefile.am b/tdestyles/riscos/Makefile.am
new file mode 100644
index 000000000..27ebd4e61
--- /dev/null
+++ b/tdestyles/riscos/Makefile.am
@@ -0,0 +1,40 @@
+pixmap_DATA = \
+ arrowdown.png \
+ arrowdown_down.png \
+ arrowleft.png \
+ arrowleft_down.png \
+ arrowright.png \
+ arrowright_down.png \
+ arrowup.png \
+ arrowup_down.png \
+ background.png \
+ check.png \
+ check_checked.png \
+ checkmark.png \
+ combo.png \
+ combo_down.png \
+ hscrollback.png \
+ hscrollbar.png \
+ hscrollbar_down.png \
+ hscrollborder.png \
+ htab.png \
+ menu_back.png \
+ radio.png \
+ radio_down.png \
+ raised_border.png \
+ scrollborder.png \
+ slider.png \
+ sunk_border.png \
+ tab_up.png \
+ vscrollback.png \
+ vscrollbar.png \
+ vscrollbar_down.png \
+ vscrollborder.png \
+ vtab.png
+
+pixmapdir = $(kde_datadir)/tdestyle/pixmaps/riscos
+
+themerc_DATA = riscos.themerc
+themercdir = $(kde_datadir)/tdestyle/themes
+
+EXTRA_DIST = $(pixmap_DATA) $(themerc_DATA)
diff --git a/tdestyles/riscos/README b/tdestyles/riscos/README
new file mode 100644
index 000000000..2e4e6fba6
--- /dev/null
+++ b/tdestyles/riscos/README
@@ -0,0 +1,5 @@
+This theme was made by Rich Wareham. Bug reports to Rik Hemsley <rik@kde.org>
+who is looking after it.
+
+After a make install, it should appear in kcontrol's 'style' module.
+
diff --git a/tdestyles/riscos/arrowdown.png b/tdestyles/riscos/arrowdown.png
new file mode 100644
index 000000000..3965607bd
--- /dev/null
+++ b/tdestyles/riscos/arrowdown.png
Binary files differ
diff --git a/tdestyles/riscos/arrowdown_down.png b/tdestyles/riscos/arrowdown_down.png
new file mode 100644
index 000000000..060ce51ae
--- /dev/null
+++ b/tdestyles/riscos/arrowdown_down.png
Binary files differ
diff --git a/tdestyles/riscos/arrowleft.png b/tdestyles/riscos/arrowleft.png
new file mode 100644
index 000000000..0e774c29c
--- /dev/null
+++ b/tdestyles/riscos/arrowleft.png
Binary files differ
diff --git a/tdestyles/riscos/arrowleft_down.png b/tdestyles/riscos/arrowleft_down.png
new file mode 100644
index 000000000..da2332ef5
--- /dev/null
+++ b/tdestyles/riscos/arrowleft_down.png
Binary files differ
diff --git a/tdestyles/riscos/arrowright.png b/tdestyles/riscos/arrowright.png
new file mode 100644
index 000000000..89a619932
--- /dev/null
+++ b/tdestyles/riscos/arrowright.png
Binary files differ
diff --git a/tdestyles/riscos/arrowright_down.png b/tdestyles/riscos/arrowright_down.png
new file mode 100644
index 000000000..dd6282ee6
--- /dev/null
+++ b/tdestyles/riscos/arrowright_down.png
Binary files differ
diff --git a/tdestyles/riscos/arrowup.png b/tdestyles/riscos/arrowup.png
new file mode 100644
index 000000000..fce21a75d
--- /dev/null
+++ b/tdestyles/riscos/arrowup.png
Binary files differ
diff --git a/tdestyles/riscos/arrowup_down.png b/tdestyles/riscos/arrowup_down.png
new file mode 100644
index 000000000..c453a3af2
--- /dev/null
+++ b/tdestyles/riscos/arrowup_down.png
Binary files differ
diff --git a/tdestyles/riscos/background.png b/tdestyles/riscos/background.png
new file mode 100644
index 000000000..9e41b4e54
--- /dev/null
+++ b/tdestyles/riscos/background.png
Binary files differ
diff --git a/tdestyles/riscos/check.png b/tdestyles/riscos/check.png
new file mode 100644
index 000000000..6b259b27c
--- /dev/null
+++ b/tdestyles/riscos/check.png
Binary files differ
diff --git a/tdestyles/riscos/check_checked.png b/tdestyles/riscos/check_checked.png
new file mode 100644
index 000000000..2513565dc
--- /dev/null
+++ b/tdestyles/riscos/check_checked.png
Binary files differ
diff --git a/tdestyles/riscos/checkmark.png b/tdestyles/riscos/checkmark.png
new file mode 100644
index 000000000..331a6c827
--- /dev/null
+++ b/tdestyles/riscos/checkmark.png
Binary files differ
diff --git a/tdestyles/riscos/combo.png b/tdestyles/riscos/combo.png
new file mode 100644
index 000000000..ead94e7a4
--- /dev/null
+++ b/tdestyles/riscos/combo.png
Binary files differ
diff --git a/tdestyles/riscos/combo_down.png b/tdestyles/riscos/combo_down.png
new file mode 100644
index 000000000..e3e2dfab7
--- /dev/null
+++ b/tdestyles/riscos/combo_down.png
Binary files differ
diff --git a/tdestyles/riscos/hscrollback.png b/tdestyles/riscos/hscrollback.png
new file mode 100644
index 000000000..b6ebe838a
--- /dev/null
+++ b/tdestyles/riscos/hscrollback.png
Binary files differ
diff --git a/tdestyles/riscos/hscrollbar.png b/tdestyles/riscos/hscrollbar.png
new file mode 100644
index 000000000..9f29c3e0b
--- /dev/null
+++ b/tdestyles/riscos/hscrollbar.png
Binary files differ
diff --git a/tdestyles/riscos/hscrollbar_down.png b/tdestyles/riscos/hscrollbar_down.png
new file mode 100644
index 000000000..ef0153cad
--- /dev/null
+++ b/tdestyles/riscos/hscrollbar_down.png
Binary files differ
diff --git a/tdestyles/riscos/hscrollborder.png b/tdestyles/riscos/hscrollborder.png
new file mode 100644
index 000000000..113d92200
--- /dev/null
+++ b/tdestyles/riscos/hscrollborder.png
Binary files differ
diff --git a/tdestyles/riscos/htab.png b/tdestyles/riscos/htab.png
new file mode 100644
index 000000000..0527b4d7e
--- /dev/null
+++ b/tdestyles/riscos/htab.png
Binary files differ
diff --git a/tdestyles/riscos/menu_back.png b/tdestyles/riscos/menu_back.png
new file mode 100644
index 000000000..bbb1a0c74
--- /dev/null
+++ b/tdestyles/riscos/menu_back.png
Binary files differ
diff --git a/tdestyles/riscos/radio.png b/tdestyles/riscos/radio.png
new file mode 100644
index 000000000..4e24602d0
--- /dev/null
+++ b/tdestyles/riscos/radio.png
Binary files differ
diff --git a/tdestyles/riscos/radio_down.png b/tdestyles/riscos/radio_down.png
new file mode 100644
index 000000000..d416452f8
--- /dev/null
+++ b/tdestyles/riscos/radio_down.png
Binary files differ
diff --git a/tdestyles/riscos/raised_border.png b/tdestyles/riscos/raised_border.png
new file mode 100644
index 000000000..f37c18eff
--- /dev/null
+++ b/tdestyles/riscos/raised_border.png
Binary files differ
diff --git a/tdestyles/riscos/riscos.themerc b/tdestyles/riscos/riscos.themerc
new file mode 100644
index 000000000..f88b8625b
--- /dev/null
+++ b/tdestyles/riscos/riscos.themerc
@@ -0,0 +1,344 @@
+# Risc OS theme by R. Wareham <richwareham@users.sourceforge.net>
+
+[PushButton]
+Background=227,227,227
+Foreground=0,0,0
+#PixmapBorder=riscos/raised_border.png
+#PixmapBWidth=2
+Border=0
+Highlight=2
+
+[PushButtonDown]
+Background=187,187,187
+Foreground=0,0,0
+#PixmapBorder=riscos/sunk_border.png
+#PixmapBWidth=2
+Border=0
+Highlight=2
+
+[ToolButton]
+Background=227,227,227
+Foreground=0,0,0
+#PixmapBorder=riscos/raised_border.png
+#PixmapBWidth=2
+Highlight=2
+Border=0
+
+[ToolButtonDown]
+Background=187,187,187
+Foreground=0,0,0
+#PixmapBorder=riscos/sunk_border.png
+#PixmapBWidth=2
+Border=0
+Highlight=2
+
+[ToolBar]
+Border=0
+Highlight=1
+Background=227,227,227
+Pixmap=riscos/background.png
+
+[CheckMark]
+Border=0
+Highlight=0
+Pixmap=riscos/checkmark.png
+
+[MenuBar]
+Background=227,227,227
+Border=0
+Highlight=1
+Pixmap=riscos/background.png
+
+[MenuBarItem]
+Foreground=255,255,255
+Background=0,0,0
+Border=0
+Highlight=0
+#PixmapBorder=riscos/raised_border.png
+#PixmapBWidth=2
+
+[Menu]
+Background=227,227,227
+Border=0
+Highlight=0
+Pixmap=riscos/background.png
+
+[MenuItem]
+Background=227,227,227
+Border=0
+Highlight=0
+Pixmap=riscos/background.png
+
+[MenuItemDown]
+Background=227,227,227
+Foreground=255,255,255
+Pixmap=riscos/menu_back.png
+Border=0
+#Highlight=0
+
+[Splitter]
+Background=227,227,227
+Border=0
+Highlight=1
+#PixmapBorder=riscos/raised_border.png
+#PixmapBWidth=2
+
+[ProgressBar]
+Border=0
+Highlight=2
+Foreground=255,255,255
+Background=187,187,187
+
+[ProgressBackground]
+Background=255,255,255
+
+# Toolbar-Handles:
+[VBarHandle]
+#Pixmap=riscos/htab.png
+Background=187,187,187
+Border=0
+Highlight=1
+#Scale=Vertical
+
+[HBarHandle]
+#Pixmap=riscos/vtab.png
+Background=187,187,187
+Border=0
+Highlight=1
+#Scale=Horizontal
+
+[VSBarSlider]
+Pixmap=riscos/vscrollbar.png
+PixmapBorder=riscos/vscrollborder.png
+PixmapBWidth=3
+
+[VSBarSliderDown]
+Pixmap=riscos/vscrollbar_down.png
+PixmapBorder=riscos/vscrollborder.png
+PixmapBWidth=3
+
+[VScrollGroove]
+Pixmap=riscos/vscrollback.png
+PixmapBorder=riscos/scrollborder.png
+PixmapBWidth=1
+
+[HSBarSlider]
+Pixmap=riscos/hscrollbar.png
+PixmapBorder=riscos/hscrollborder.png
+PixmapBWidth=3
+
+[HSBarSliderDown]
+Pixmap=riscos/hscrollbar_down.png
+PixmapBorder=riscos/hscrollborder.png
+PixmapBWidth=3
+
+[HScrollGroove]
+Pixmap=riscos/hscrollback.png
+PixmapBorder=riscos/scrollborder.png
+PixmapBWidth=1
+
+[ArrowUp]
+Pixmap=riscos/arrowup.png
+
+[ArrowDown]
+Pixmap=riscos/arrowdown.png
+
+[ArrowLeft]
+Pixmap=riscos/arrowleft.png
+
+[ArrowRight]
+Pixmap=riscos/arrowright.png
+
+[SunkenArrowUp]
+Pixmap=riscos/arrowup_down.png
+
+[SunkenArrowDown]
+Pixmap=riscos/arrowdown_down.png
+
+[SunkenArrowLeft]
+Pixmap=riscos/arrowleft_down.png
+
+[SunkenArrowRight]
+Pixmap=riscos/arrowright_down.png
+
+[Bevel]
+Background=255,255,255
+Foreground=0,0,0
+Border=0
+Highlight=1
+Pixmap=riscos/background.png
+#PixmapBorder=riscos/raised_border.png
+#PixmapBWidth=2
+
+[BevelDown]
+Background=255,255,255
+Foreground=0,0,0
+Border=0
+Highlight=1
+Pixmap=riscos/background.png
+#PixmapBorder=riscos/sunk_border.png
+#PixmapBWidth=2
+
+[ComboBox]
+Background=227,227,227
+Foreground=0,0,0
+Border=0
+Highlight=1
+
+[Radio]
+Pixmap=riscos/radio.png
+[RadioDown]
+Pixmap=riscos/radio_down.png
+
+[CheckBox]
+Pixmap=riscos/check.png
+[CheckBoxDown]
+Pixmap=riscos/check_checked.png
+
+[ComboDeco]
+Pixmap=riscos/combo.png
+
+[Slider]
+Pixmap=riscos/slider.png
+
+[SliderGroove]
+SmallGroove=true
+
+[Tab]
+Border=0
+Highlight=1
+Background=187,187,187
+Foreground=0,0,0
+BottomLine=true
+#Pixmap=riscos/background.png
+
+[TabDown]
+Border=0
+Highlight=1
+Background=227,227,227
+Foreground=0,0,0
+BottomLine=false
+Pixmap=riscos/background.png
+
+[KDE]
+widgetStyle=basicstyle.la
+WidgetStyle=riscos
+
+[Misc]
+ShadeStyle=Motif
+ScrollBarExtent=20
+Name=RISC OS
+Name[af]=Risc Os
+Name[bn]=রিসà§à¦• ও-à¦à¦¸
+Name[cs]=Risc OS
+Name[de]=RISC-OS
+Name[eo]=Risc-OS
+Name[eu]=RISC SE
+Name[fa]=سیستم عامل RISC
+Name[hi]=रिसà¥à¤• ओà¤à¤¸(RISC OS)
+Name[ko]=ë¦¬ìŠ¤í¬ OS
+Name[mn]=RISC-OS
+Name[sl]=OS RISC
+Name[sq]=Sistemi Operativ RISC
+Name[te]=à°°à°¿à°¸à±à°•à± à°“à°Žà°¸à±
+Name[tg]=СиÑтемаи омили RISC
+Name[th]=ระบบปà¸à¸´à¸šà¸±à¸•à¸´à¸à¸²à¸£ RISC
+Name[uk]=RISC ОС
+Name[uz@cyrillic]=RISC ОС
+Name[zu]=IRISC OS
+Comment=RISC OS-like theme
+Comment[af]=Risc OS-like tema
+Comment[ar]=سمة مشابهة لRISC OS
+Comment[az]=RISC OS-oxşarı tərz
+Comment[be]=Стыль RISC OS
+Comment[bg]=Тема, подобна на RISC OS
+Comment[bn]=রিসà§à¦• ও.à¦à¦¸.-à¦à¦° মতন থিম
+Comment[br]=Giz doare ISC OS
+Comment[bs]=Tema nalik na RISC OS
+Comment[ca]=Tema tipus RISC OS
+Comment[cs]=Motiv jako RISC OS
+Comment[csb]=Téma szlachùjącô za RISC-OS
+Comment[cy]=Thema sy'n debyg i RISC OS
+Comment[da]=RISC OS-lignende tema
+Comment[de]=Stil ähnlich RISC OS
+Comment[el]=Θέμα παÏόμοιο με το RISC OS
+Comment[eo]=Risc OS - simila stilo
+Comment[es]=Tema tipo RISC OS
+Comment[et]=RISC OS-laadne teema
+Comment[eu]=RISC SEen antzeko gaia
+Comment[fa]=چهرۀ شبیه RISC سیستم عامل
+Comment[fi]=RISC OS:n kaltainen tyyli
+Comment[fr]=Thème similaire à RISC OS
+Comment[fy]=RISC OS-eftich tema
+Comment[ga]=Téama cosúil le RISC OS
+Comment[gl]=Tema do estilo de RISC OS
+Comment[he]=ערכת × ×•×©× ×“×ž×•×™×™×ª RISC OS
+Comment[hi]=रिसà¥à¤• ओà¤à¤¸(RISC OS)-जैसा थीम
+Comment[hr]=Tema nalik na RISC-OS
+Comment[hu]=RISC OS-szerű téma
+Comment[id]=Gaya RISC OS
+Comment[is]=Stíll í anda RiscOS (Archimedes tölvur)
+Comment[it]=Tema simile a RISC OS
+Comment[ja]=RISC OS 風ã®ãƒ†ãƒ¼ãƒž
+Comment[ka]=RISC OS-ის მსგáƒáƒ•áƒ¡áƒ˜ სტილი
+Comment[kk]=RISC OS-Ñекілді нақышы
+Comment[km]=ស្បែក RISC OS-like
+Comment[ko]=ë¦¬ìŠ¤í¬ OS ê°™ì€ í…Œë§ˆ
+Comment[lb]=RISC OS-ähnlecht Thema
+Comment[lt]=Panašus į RISC OS stilius
+Comment[lv]=RISC OS līdzīga tēma
+Comment[mk]=Тема што личи на RISC OS
+Comment[mn]=RISC OS-той Ñ‚Ó©ÑÓ©Ó©Ñ‚Ñй Ñ…ÑлбÑÑ€
+Comment[ms]=Tema ala RISC OS
+Comment[mt]=Tema bħar-RISC OS
+Comment[nb]=RISCO OS-lignende tema
+Comment[nds]=Muster as in't RISC OS
+Comment[ne]=RISC OS-जसà¥à¤¤à¥ˆ विषयवसà¥à¤¤à¥
+Comment[nl]=RISC OS-achtig thema
+Comment[nn]=RISC OS-aktig tema
+Comment[nso]=Molaetsa wago swana le RISC OS
+Comment[pa]=RISC OS-ਵਾਂਗ ਸਰੂਪ
+Comment[pl]=Motyw podobny do RISC-OS
+Comment[pt]=Estilo tipo RISC OS
+Comment[pt_BR]=Tema parecido ao SO RISC
+Comment[ro]=Tematică RISC OS
+Comment[ru]=Тема, Ð¿Ð¾Ñ…Ð¾Ð¶Ð°Ñ Ð½Ð° RISC OS
+Comment[rw]=Insanganyamatsiko RISC OS-nka
+Comment[se]=RISC OS-lágan fáddá
+Comment[sk]=Téma ako RISC OS
+Comment[sl]=Slog, podoben OS RISC
+Comment[sq]=Temë sikurse ajo e sistemit operativ RISC
+Comment[sr]=Тема налик на RISC OS
+Comment[sr@Latn]=Tema nalik na RISC OS
+Comment[sv]=RISC OS-liknande tema
+Comment[ta]=RISC OS-போனà¯à®± தலைபà¯à®ªà¯
+Comment[te]=à°°à°¿à°¸à±à°•à± ఓఎసౠలాంటి à°’à°• వైవిదà±à°¯à°¾à°‚శం
+Comment[tg]=Тарҳи шабиÑи ÑиÑтемаи омили RISC
+Comment[th]=ธีมคล้ายระบบปà¸à¸´à¸šà¸±à¸•à¸´à¸à¸²à¸£à¸šà¸™à¸Šà¸´à¸ž RISC
+Comment[tr]=RISC OS-benzeri stil
+Comment[tt]=RISC OS-kebek tışlaw
+Comment[uk]=Тема "а Ð»Ñ RISC OS"
+Comment[uz]=RISC OSga oʻxshash mavzu
+Comment[uz@cyrillic]=RISC ОСга ўхшаш мавзу
+Comment[ven]=RISC OS-sa thero
+Comment[vi]=Sắc thái kiểu RISC OS.
+Comment[wa]=Tinme rishonnant al rivnance do sistinme RISC OS
+Comment[xh]=RISC OS-Njengo mxholo
+Comment[zh_CN]=类似 RISC OS 的主题
+Comment[zh_HK]=類似 RISC 風格的佈景
+Comment[zh_TW]=類似 RISC 的風格
+Comment[zu]=I-RISC OS-enjenge thimu
+SButtonPosition=Opposite
+FrameWidth=1
+
+[Background]
+Background=227,227,227
+Pixmap=riscos/background.png
+
+[General]
+Background=227,227,227
+Foreground=0,0,0
+windowForeground=0,0,0
+windowBackground=255,255,255
+selectForeground=255,255,255
+selectBackground=0,0,0
diff --git a/tdestyles/riscos/scrollborder.png b/tdestyles/riscos/scrollborder.png
new file mode 100644
index 000000000..21ca9e0e5
--- /dev/null
+++ b/tdestyles/riscos/scrollborder.png
Binary files differ
diff --git a/tdestyles/riscos/slider.png b/tdestyles/riscos/slider.png
new file mode 100644
index 000000000..6eaf2641f
--- /dev/null
+++ b/tdestyles/riscos/slider.png
Binary files differ
diff --git a/tdestyles/riscos/sunk_border.png b/tdestyles/riscos/sunk_border.png
new file mode 100644
index 000000000..1710a9696
--- /dev/null
+++ b/tdestyles/riscos/sunk_border.png
Binary files differ
diff --git a/tdestyles/riscos/tab_up.png b/tdestyles/riscos/tab_up.png
new file mode 100644
index 000000000..415896544
--- /dev/null
+++ b/tdestyles/riscos/tab_up.png
Binary files differ
diff --git a/tdestyles/riscos/vscrollback.png b/tdestyles/riscos/vscrollback.png
new file mode 100644
index 000000000..effe211c3
--- /dev/null
+++ b/tdestyles/riscos/vscrollback.png
Binary files differ
diff --git a/tdestyles/riscos/vscrollbar.png b/tdestyles/riscos/vscrollbar.png
new file mode 100644
index 000000000..8f869ef3a
--- /dev/null
+++ b/tdestyles/riscos/vscrollbar.png
Binary files differ
diff --git a/tdestyles/riscos/vscrollbar_down.png b/tdestyles/riscos/vscrollbar_down.png
new file mode 100644
index 000000000..31174b393
--- /dev/null
+++ b/tdestyles/riscos/vscrollbar_down.png
Binary files differ
diff --git a/tdestyles/riscos/vscrollborder.png b/tdestyles/riscos/vscrollborder.png
new file mode 100644
index 000000000..c40c16a26
--- /dev/null
+++ b/tdestyles/riscos/vscrollborder.png
Binary files differ
diff --git a/tdestyles/riscos/vtab.png b/tdestyles/riscos/vtab.png
new file mode 100644
index 000000000..0320818e3
--- /dev/null
+++ b/tdestyles/riscos/vtab.png
Binary files differ
diff --git a/tdestyles/themes/CMakeLists.txt b/tdestyles/themes/CMakeLists.txt
new file mode 100644
index 000000000..c28f89a44
--- /dev/null
+++ b/tdestyles/themes/CMakeLists.txt
@@ -0,0 +1,23 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+##### other data ################################
+
+install( FILES
+ qtplatinum.themerc qtcde.themerc qtmotif.themerc
+ qtwindows.themerc qtsgi.themerc qtmotifplus.themerc
+ highcolor.themerc default.themerc b3.themerc
+ light-v2.themerc light-v3.themerc keramik.themerc
+ DESTINATION ${DATA_INSTALL_DIR}/tdestyle/themes )
+
+install( FILES
+ kthemestylerc
+ DESTINATION ${CONFIG_INSTALL_DIR} )
diff --git a/tdestyles/themes/Makefile.am b/tdestyles/themes/Makefile.am
new file mode 100644
index 000000000..3ebb62c45
--- /dev/null
+++ b/tdestyles/themes/Makefile.am
@@ -0,0 +1,12 @@
+
+tdestylethemesdata_DATA = qtplatinum.themerc qtcde.themerc qtmotif.themerc qtwindows.themerc \
+ qtsgi.themerc qtmotifplus.themerc\
+ highcolor.themerc \
+ default.themerc b3.themerc light-v2.themerc \
+ light-v3.themerc keramik.themerc
+tdestylethemesdatadir = $(kde_datadir)/tdestyle/themes
+
+EXTRA_DIST = $(tdestylethemesdata_DATA)
+
+kde_conf_DATA = kthemestylerc
+
diff --git a/tdestyles/themes/b3.themerc b/tdestyles/themes/b3.themerc
new file mode 100644
index 000000000..76cc88733
--- /dev/null
+++ b/tdestyles/themes/b3.themerc
@@ -0,0 +1,90 @@
+[Misc]
+Name=B3/KDE
+Name[af]=B3/Kde
+Name[bn]=বি-৩/কে.ডি.ই.
+Name[fr]=B3 / KDE
+Name[hi]=B3/केडीई
+Name[ta]=B3/கேடிஇ
+Name[te]=à°¬à±3/కెడిఈ
+Comment=B3/Modification of B2
+Comment[af]=B3/Verandering van B2
+Comment[ar]=B3/تعديل من B2
+Comment[az]=B3/B2-nin Təkmilləşdirilmiş halı
+Comment[be]=Стыль B3/Modification
+Comment[bg]=Тема Ð¼Ð¾Ð´Ð¸Ñ„Ð¸ÐºÐ°Ñ†Ð¸Ñ Ð½Ð° B2, подобна на B3
+Comment[br]=Kemm B3 eus B2
+Comment[bs]=B3/Preinaka B2
+Comment[ca]=B3/Modificació de B2
+Comment[cs]=B3/modifikace B2
+Comment[csb]=B3/Mòdifikacëjô B2
+Comment[cy]=B3/Addasiad o B2
+Comment[da]=B3/Ændring af B2
+Comment[de]=B3: Eine Variante von B2
+Comment[el]=B3/ΤÏοποποίηση του B2
+Comment[eo]=B3/Varianto bazinÄanta sur B2
+Comment[es]=B3/Modificación de B2
+Comment[et]=B3 - muudatustega B2
+Comment[eu]=B3/ B2 eraldatua
+Comment[fa]=B3/اصلاح B2
+Comment[fi]=B3/Muokattu B2
+Comment[fr]=B3 / Modification de B2
+Comment[fy]=B3/modifikaasje fan B2
+Comment[ga]=B3/B2 mionathraithe
+Comment[gl]=B3/Modificación de B2
+Comment[hi]=B3/ B2 का संशोधन
+Comment[hr]=B3/Izmijenjeni B2
+Comment[hu]=B3/Módosított B2
+Comment[id]=B3/Modifikasi dari B2
+Comment[is]=B3, breytt útgáfa B2
+Comment[it]=B3/Modifica di B2
+Comment[ja]=B3 / B2 ã®æ”¹è‰¯ç‰ˆ
+Comment[ka]=B3 - B2-ის მáƒáƒ“იფიკáƒáƒªáƒ˜áƒ
+Comment[kk]=B3-өзгертілген B2
+Comment[km]=B3/ការ​កែប្រែរបស់ B2
+Comment[lb]=B3/Verännerung vu B2
+Comment[lt]=B3 – B2 modifikacija
+Comment[lv]=B2 B3/ModifikÄcija
+Comment[mk]=B3/Модификација на B2
+Comment[mn]=B3: B2-н нÑгÑн хувилбар
+Comment[ms]=B3/Ubahsuaian B2
+Comment[mt]=B3/modifikazzjoni ta' B2
+Comment[nb]=B3/Endring av B2
+Comment[nds]=B3 is en ännert B2
+Comment[ne]=B2 को B3/परिमारà¥à¤œà¤¨
+Comment[nl]=B3/modificatie van B2
+Comment[nn]=B3 / Endring av B2
+Comment[nso]=B3/Kaonafatso ya B2
+Comment[oc]=B3/Modificacion de B2
+Comment[pa]=B3/B2 ਦਾ ਸੋਧਿਆ
+Comment[pl]=B3/Modyfikacja B2
+Comment[pt]=B3/modificação do B2
+Comment[pt_BR]=B3/Modificação de B2
+Comment[ro]=B3, o modificare a B2
+Comment[ru]=B3 - Ð²Ð°Ñ€Ð¸Ð°Ñ†Ð¸Ñ B2
+Comment[rw]=B3/ihindura rya B2
+Comment[se]=B3/Rievdaduvvon B2
+Comment[sk]=B3/Úprava B2
+Comment[sl]=B3/Spremenjena razliÄica B2
+Comment[sq]=B3/Rregullimi i B2
+Comment[sr]=B3- модификација B2
+Comment[sr@Latn]=B3- modifikacija B2
+Comment[sv]=B3/Modifierad B2
+Comment[ta]=B3/B2ன௠மாறà¯à®±à®®à¯
+Comment[te]=B3/B2 యొకà±à°• సవరింపà±
+Comment[tg]=B3/Таъғироти B2
+Comment[th]=B3/à¹à¸à¹‰à¹„ขเพิ่มเติมจาภB2
+Comment[tr]=B3/B2'nin deÄŸiÅŸtirilmiÅŸ hali
+Comment[tt]=B3/Üzgärtelgän B2
+Comment[uk]=B3/Ð¼Ð¾Ð´Ð¸Ñ„Ñ–ÐºÐ°Ñ†Ñ–Ñ B2
+Comment[uz]=B3 - oʻzgartirilgan B2
+Comment[uz@cyrillic]=B3 - ўзгартирилган B2
+Comment[ven]=B3/U lugisela ha B2
+Comment[vi]=B2 đã sửa đổi / B3
+Comment[wa]=B3/Modifiadje do B2
+Comment[xh]=B3/Uguqulelo kancinane lwe B2
+Comment[zh_CN]=B3/修正的 B2
+Comment[zh_HK]=B3/B2 改良版
+Comment[zh_TW]=B3/B2 改良版
+Comment[zu]=B3/Ukulungisa kwe-B2
+[KDE]
+WidgetStyle=B3
diff --git a/tdestyles/themes/beos.themerc b/tdestyles/themes/beos.themerc
new file mode 100644
index 000000000..bb3e1a198
--- /dev/null
+++ b/tdestyles/themes/beos.themerc
@@ -0,0 +1,83 @@
+[Misc]
+Name=BeOS
+Name[af]=Beos
+Name[hi]=बीईओà¤à¤¸ (BeOS)
+Name[te]=బిఈఓఎసà±
+Comment=Unthemed BeOS-like style
+Comment[af]=Onbenoemde BeOS-tipe styl
+Comment[ar]=مظهر مشابه لBeOS
+Comment[az]=Örtüksüz BeOS bənzəri tərz
+Comment[be]=Стыль BeOS
+Comment[bg]=Стил без тема, подобен на BeOS
+Comment[br]=Giz evel BeOS anwisket
+Comment[bs]=Stil bez teme, sliÄan Beos-u
+Comment[ca]=Estil del tipus BeOS sense temes
+Comment[cs]=Styl podobný BeOS (bez motivu)
+Comment[csb]=Sztél szlachùjący za BeOS-a, bez témów
+Comment[cy]=Arddull di-thema sy'n debyg i BeOS
+Comment[da]=BeOS-lignende stil uden tema
+Comment[de]=BeOS-ähnlicher Stil (kein komplettes Design)
+Comment[el]=Στυλ παÏόμοιο με το BeOS
+Comment[eo]=BeOS-simila stilo neetosa
+Comment[es]=Estilo tipo BeOS sin tema
+Comment[et]=BeOS'i-laadne teemata stiil
+Comment[eu]=Gairik gabeko BeOS estiloa
+Comment[fa]=سبک شبیه BeOS بدون چهره
+Comment[fi]=Teemoittamaton BeOS:n kaltainen tyyli
+Comment[fr]=Style sans thème similaire à BeOS
+Comment[fy]=Temaleaze BeOs eftich slyl
+Comment[ga]=Stíl gan téama, cosúil le BeOS
+Comment[gl]=Estilo tipo Beos sen tema
+Comment[he]=סגנון דומה ל־BeOS ×œ×œ× ×¢×¨×›×”
+Comment[hi]=अनथीमà¥à¤¡ बीईओà¤à¤¸ जैसी शैली
+Comment[hr]=Stil bez teme, nalikuje na BeOS
+Comment[hu]=BeOS-szerű megjelenés, téma nélkül
+Comment[id]=Gaya ala BeOS tanpa tema
+Comment[is]=Stíll í anda BeOS stýrikerfisins (án þema)
+Comment[it]=Stile senza tema simile a BeOS
+Comment[ja]=BeOS 風ã®ã‚¹ã‚¿ã‚¤ãƒ« (テーマãªã—)
+Comment[ka]=BeOS-ის მსგáƒáƒ•áƒ¡áƒ˜ სტილი თემების გáƒáƒ áƒ”შე
+Comment[kk]=ÐақыштарÑыз BeOS-Ñекілді Ñтиль
+Comment[km]=រចនាបáŸáž‘្ម BeOS-like ដែល​គ្មាន​ស្បែក
+Comment[ko]=BeOS와 ê°™ì€ ê¼´ì„ ê°€ì§„ 테마
+Comment[lb]=BeOS-ähnlechen Stil ouni Thema
+Comment[lt]=Betemis BeOS tipo stilius
+Comment[lv]=Beztēmas BeOS līdzīgs stils
+Comment[mk]=Beos Ñтил (без тема)
+Comment[mn]=BeOS-Ñ…ÑлбÑрийн агшаалт
+Comment[ms]=Gaya BeOS
+Comment[nb]=Innebygget BeOS-liknende stil
+Comment[nds]=Stil as in't BeOS (ahn Muster)
+Comment[ne]=विषयवसà¥à¤¤à¥ नगरिà¤à¤•à¥‹ BeOS-जसà¥à¤¤à¥ˆ शैली
+Comment[nl]=Themaloze BeOS-achtige stijl
+Comment[nn]=BeOS-aktig stil utan tema
+Comment[pa]=BeOS-ਵਰਗੀ ਸ਼ੈਲੀ
+Comment[pl]=Styl podobny do BeOS-a, bez motywów
+Comment[pt]=Estilo sem tema - tipo BeOS
+Comment[pt_BR]=Estilo semelhante ao BeOS sem Temas
+Comment[ro]=Stil fără tematică BeOS
+Comment[ru]=Стиль без тем, похожий на BeOS
+Comment[rw]=Imisusire BeOS-nka itahawe insanganyamatsiko
+Comment[se]=Beos-lágan stiila fáttáhaga
+Comment[sk]=Beos štýl bez témy
+Comment[sl]=Netematski slog, podoben BeOS
+Comment[sq]=Stili i patemë sikurse ai i BeOS
+Comment[sr]=Стил без теме који личи на BeOS
+Comment[sr@Latn]=Stil bez teme koji liÄi na BeOS
+Comment[sv]=Otemad Beos-liknande stil
+Comment[ta]=தலைபà¯à®ªà®¿à®²à¯à®²à®¾ Beos-போனà¯à®± பாணி
+Comment[te]=వైవిదà±à°¯à°¾à°‚శం లేని బిఈఓఎసౠలాంటి à°’à°• శైలి
+Comment[tg]=БоÑд дониÑÑ‚ тарҳи BeOS ва Ñабук шуданашро
+Comment[th]=ธีมรูปà¹à¸šà¸šà¸„ล้ายระบบปà¸à¸´à¸šà¸±à¸•à¸´à¸à¸²à¸£ Beos
+Comment[tr]=BeOS benzeri temasız stil
+Comment[tt]=BeOS-kebek tışlaw
+Comment[uk]=Стиль Ñхожий на BeOS без вÑтановленої теми
+Comment[uz]=BeOS'ga oʻxshash mavzusiz uslub
+Comment[uz@cyrillic]=BeOS'га ўхшаш мавзуÑиз уÑлуб
+Comment[vi]=Kiểu dáng như BeOS không có sắc thái.
+Comment[wa]=Tinme rishonnant al rivnance do sistinme BeOS
+Comment[zh_CN]=无主题的类似 Beos 的风格
+Comment[zh_HK]=類似未修改佈景的 BeOS
+Comment[zh_TW]=沒有主題的 BeOS 的風格
+[KDE]
+widgetStyle=beosstyle.la
diff --git a/tdestyles/themes/default.themerc b/tdestyles/themes/default.themerc
new file mode 100644
index 000000000..929fd6831
--- /dev/null
+++ b/tdestyles/themes/default.themerc
@@ -0,0 +1,152 @@
+[Misc]
+Name=KDE Classic
+Name[af]=KDE Klassiek
+Name[ar]=كيدي كلاسيكي
+Name[az]=KDE Klassik
+Name[be]=КлаÑічны Ñтыль KDE
+Name[bn]=কে.ডি.ই. কà§à¦²à¦¾à¦¸à¦¿à¦•
+Name[br]=KDE da gustum
+Name[bs]=KDE klasiÄni
+Name[ca]=KDE clàssic
+Name[cs]=Klasické KDE
+Name[csb]=Klasykòwi KDE
+Name[cy]=KDE Clasurol
+Name[da]=KDE Klassisk
+Name[de]=KDE-Classic
+Name[el]=KDE κλασικό
+Name[eo]=Klasika KDE
+Name[es]=KDE clásico
+Name[et]=KDE vaikestiil
+Name[eu]=KDE Klasikoa
+Name[fa]=KDE کلاسیک
+Name[fi]=KDE:n klassikkotyyli
+Name[fr]=KDE Classique
+Name[fy]=KDE Klassyk
+Name[ga]=KDE Clasaiceach
+Name[gl]=Clásico de KDE
+Name[he]=קל×סי של KDE
+Name[hi]=केडीई कà¥à¤²à¥‰à¤¸à¤¿à¤•
+Name[hr]=KDE klasiÄno
+Name[id]=KDE Klasik
+Name[is]=Klassískt KDE
+Name[it]=KDE classico
+Name[ja]=KDE クラシック
+Name[ka]=კლáƒáƒ¡áƒ˜áƒ™áƒ£áƒ áƒ˜ KDE
+Name[kk]=КлаÑÑикалық KDE
+Name[km]=KDE បុរាណ
+Name[ko]=KDE 기본
+Name[lt]=KlasikinÄ— KDE
+Name[lv]=KDE klasisks
+Name[mk]=KDE клаÑично
+Name[mn]=KDE-Ñонгодог
+Name[ms]=KDE Klasik
+Name[nb]=KDE-klassisk
+Name[ne]=KDE शासà¥à¤¤à¥à¤°à¥€à¤¯
+Name[nl]=KDE klassiek
+Name[nn]=Klassisk KDE
+Name[pa]=KDE ਟਕਸਾਲੀ
+Name[pl]=Klasyczny KDE
+Name[pt]=Clássico do KDE
+Name[pt_BR]=KDE Clássico
+Name[ro]=KDE clasic
+Name[ru]=КлаÑÑичеÑкий KDE
+Name[rw]=KDE Isanzwe
+Name[se]=KDE standárda
+Name[sk]=KDE Štandardný
+Name[sq]=KDE Klasike
+Name[sr]=KDE клаÑично
+Name[sr@Latn]=KDE klasiÄno
+Name[sv]=KDE klassisk
+Name[ta]=கேடிஇ உயரà¯à®¤à®°à®®à®¾à®©
+Name[te]=సాంపà±à°°à°¦à°¾à°¯à°¿à°• కెడిఈ
+Name[tg]=KDE КлаÑÑик
+Name[th]=à¹à¸šà¸šà¸„ลาสสิคของ KDE
+Name[tr]=Klasik KDE
+Name[tt]=KDE Klassik
+Name[uk]=Типовий Ð´Ð»Ñ KDE
+Name[vi]=KDE kinh điển
+Name[wa]=KDE Classike
+Name[zh_CN]=KDE ç»å…¸
+Name[zh_HK]=KDE é è¨­
+Name[zh_TW]=KDE é è¨­
+Comment=Classic KDE style
+Comment[af]=Klassieke KDE styl
+Comment[ar]=مظهر كيدي الكلاسيكي
+Comment[az]=Klassik KDE tərzi
+Comment[be]=КлаÑічны Ñтыль KDE
+Comment[bg]=КлаÑичеÑки Ñтил на KDE
+Comment[bn]=কà§à¦²à¦¾à¦¸à¦¿à¦• কে.ডি.ই. সà§à¦Ÿà¦¾à¦‡à¦²
+Comment[br]=Giz KDE dre ziouer
+Comment[bs]=KlasiÄni KDE stil
+Comment[ca]=Estil clàssic del KDE
+Comment[cs]=Klasický styl prostředí KDE
+Comment[csb]=Klasykòwi sztél KDE
+Comment[cy]=Arddull clasurol KDE
+Comment[da]=Klassisk KDE-stil
+Comment[de]=Nostalgischer KDE-Stil
+Comment[el]=Κλασικό στυλ του KDE
+Comment[eo]=Origina KDE-stilo
+Comment[es]=Estilo KDE clásico
+Comment[et]=KDE vaikestiil
+Comment[eu]=KDEren estilo klasikoa
+Comment[fa]=سبک کلاسیک KDE
+Comment[fi]=KDE:n klassikkotyyli
+Comment[fr]=Style classique de KDE
+Comment[fy]=Klassyke KDE styl
+Comment[ga]=Stíl Chlasaiceach KDE
+Comment[gl]=Estilo Clásico de KDE
+Comment[he]=הסגנון הקל×סי של KDE
+Comment[hi]=कà¥à¤²à¥‰à¤¸à¤¿à¤• केडीई शैली
+Comment[hr]=KlasiÄni KDE stil
+Comment[hu]=A KDE korábbi stílusa
+Comment[id]=Gaya Klasik KDE
+Comment[is]=Klassíski KDE stíllinn
+Comment[it]=Stile KDE classico
+Comment[ja]=クラシック KDE スタイル
+Comment[ka]=KDE-ს კლáƒáƒ¡áƒ˜áƒ™áƒ£áƒ áƒ˜ სტილი
+Comment[kk]=КлаÑÑикалық KDE Ñтилі
+Comment[km]=រចនាបáŸáž‘្ម KDE បុរាណ
+Comment[ko]=KDEì—ì„œ 기본으로 쓰는 모양새
+Comment[lb]=Klassësche KDE-Stil
+Comment[lt]=Klasikinis KDE stilius
+Comment[lv]=Klasisks KDE stils
+Comment[mk]=КлаÑичен KDE Ñтил
+Comment[mn]=KDE-Ñонгодог Ñ…ÑлбÑÑ€
+Comment[ms]=Gaya KDE Klasik
+Comment[nb]=Klassisk KDE-stil
+Comment[nds]=De klass'sche KDE-Stil
+Comment[ne]=शासà¥à¤¤à¥à¤°à¥€à¤¯ KDE शैली
+Comment[nl]=Klassieke KDE-stijl
+Comment[nn]=Klassisk KDE-stil
+Comment[pa]=ਟਕਸਾਲੀ KDE ਸ਼ੈਲੀ
+Comment[pl]=Klasyczny styl KDE
+Comment[pt]=Estilo clássico do KDE
+Comment[pt_BR]=Estilo Clássico do KDE
+Comment[ro]=Stil clasic KDE
+Comment[ru]=КлаÑÑичеÑкий Ñтиль KDE
+Comment[rw]=Imisusire KDE isanzwe
+Comment[se]=KDE standárdastiila
+Comment[sk]=Štandardný štýl KDE
+Comment[sl]=KlasiÄen slog KDE
+Comment[sq]=Stili Klasik i KDE-së
+Comment[sr]=КлаÑични KDE Ñтил
+Comment[sr@Latn]=KlasiÄni KDE stil
+Comment[sv]=Klassisk KDE-stil
+Comment[ta]=உயரà¯à®¤à®° கேடிஇ பாணி
+Comment[te]=సాంపà±à°°à°¦à°¾à°¯à°¿à°• కెడిఈ శైలి
+Comment[tg]=Сабки клаÑÑикаи KDE
+Comment[th]=รูปà¹à¸šà¸šà¸”ั้งเดิมของ KDE
+Comment[tr]=Klasik KDE stili
+Comment[tt]=KDE'neñ klassik bizäleşe
+Comment[uk]=КлаÑичний Ñтиль KDE
+Comment[uz]=Klassik KDE uslubi
+Comment[uz@cyrillic]=КлаÑÑик KDE уÑлуби
+Comment[vi]=Kiểu dáng KDE kinh điển.
+Comment[wa]=Tinme avou l' rivnance «classike» di KDE
+Comment[zh_CN]=ç»å…¸çš„ KDE 风格
+Comment[zh_HK]=é è¨­çš„ KDE 佈景
+Comment[zh_TW]=é è¨­çš„ KDE 風格
+Highcolor=hcstyle.la
+InactiveShading=true
+[KDE]
+WidgetStyle=Default
diff --git a/tdestyles/themes/highcolor.themerc b/tdestyles/themes/highcolor.themerc
new file mode 100644
index 000000000..36db5a1a8
--- /dev/null
+++ b/tdestyles/themes/highcolor.themerc
@@ -0,0 +1,150 @@
+[Misc]
+Name=HighColor Classic
+Name[af]=Hoë-kontras Klassiek
+Name[ar]=كلاسيكي عالي الألوان
+Name[az]=Zəngin Rəngli Klassik
+Name[be]=КлаÑічны Ñтыль HighColor
+Name[bn]=হাই-কালার কà§à¦²à¦¾à¦¸à¦¿à¦•
+Name[br]=Livioù uhel dre ziouer
+Name[bs]=HighColor klasiÄni
+Name[ca]=HighColor clàssic
+Name[cs]=Mnohobarevný klasický
+Name[csb]=Klasykòwi z wieloma farwama
+Name[cy]=Uchel-liw Clasurol
+Name[da]=HighColor klassisk
+Name[el]=Κλασικό - Πολλά χÏώματα
+Name[en_GB]=HighColour Classic
+Name[eo]=Klasika multkolora
+Name[es]=Alta profundidad de color clásico
+Name[et]=Paljuvärviline vaikestiil
+Name[eu]=Kolore askodun klasikoa
+Name[fa]=رنگ بالای کلاسیک
+Name[fi]=Monivärinen klassikkotyyli
+Name[fr]=Style très coloré classique
+Name[fy]=Klassyke Hege Kleuren
+Name[gl]=Clásico de Alto Contraste
+Name[he]=קל×סי ברמת צבע גבוהה
+Name[hi]=हाई कलर कà¥à¤²à¤¾à¤¸à¤¿à¤•
+Name[hr]=KlasiÄni stil s puno boja
+Name[hu]=KDE Classic (színgazdag változat)
+Name[id]=HighColor Klasik
+Name[is]=Klassískur hágæða-litastíll
+Name[it]=Molti colori classico
+Name[ja]=ãƒã‚¤ã‚«ãƒ©ãƒ¼ã‚¯ãƒ©ã‚·ãƒƒã‚¯
+Name[ka]=HighColor კლáƒáƒ¡áƒ˜áƒ™áƒ£áƒ áƒ˜ სტილი
+Name[kk]=КлаÑÑикалық HighColor
+Name[km]=ពណ៌​ážáŸ’ពស់ បុរាណ
+Name[ko]=기본 ë§Žì€ ìƒ‰
+Name[lb]=VillFaarwe-Klassesch
+Name[lt]=Klasikinis aukštos spalvų gebos
+Name[lv]=DaudzkrÄsu klasisks
+Name[mk]=ВиÑокобојно клаÑично
+Name[mn]=64000 өнгөт Ñонгодог
+Name[ms]=Klasik Warna Cerah
+Name[nb]=Mangefarget klassisk
+Name[ne]=उचà¥à¤š रङ शासà¥à¤¤à¥à¤°à¥€à¤¯
+Name[nl]=Klassiek Hoge Kleuren
+Name[nn]=Klassisk med mange fargar
+Name[pa]=ਜਿਆਦਾ ਗੂੜੇ ਰੰਗ ਟਕਸਾਲੀ
+Name[pl]=Klasyczny z wieloma kolorami
+Name[pt]=Clássico com Muitas Cores
+Name[pt_BR]=Clássico de Alta Resolução
+Name[ro]=Clasic culori multe
+Name[ru]=КлаÑÑичеÑкий Ñтиль HighColor
+Name[rw]=IbaraRyiza Risanzwe
+Name[se]=Ivdnás standárda
+Name[sk]=Štandardný veľa farieb
+Name[sq]=Klasike Shumë Ngjyrëshe
+Name[sr]=КлаÑични Ñтил Ñа пуно боја
+Name[sr@Latn]=KlasiÄni stil sa puno boja
+Name[sv]=Färgrik klassisk
+Name[ta]=உயரà¯à®¨à®¿à®± பாரமà¯à®ªà®°à®¿à®¯à®®à¯ உயரà¯à®¤à®°à®®à®¾à®©à®¤à¯
+Name[te]=సాంపà±à°°à°¦à°¾à°¯à°¿à°• à°Žà°•à±à°•à±à°µ à°°à°‚à°—à±
+Name[tg]=Рангболоии клаÑÑика.
+Name[th]=รูปà¹à¸šà¸šà¸„ลาสสิค ความละเอียดสีสูง
+Name[tr]=Klasik Yüksek Renk
+Name[tt]=KüpTösle Klassik
+Name[uk]=Типовий (64K кольорів)
+Name[vi]=Màu cao kinh điển
+Name[zh_CN]=高色彩ç»å…¸
+Name[zh_HK]=é è¨­é«˜å½©ä½ˆæ™¯
+Name[zh_TW]=é è¨­çš„高彩
+Comment=Highcolor version of the classic style
+Comment[af]=Hoë-kontras weergawe van die klassieke styl
+Comment[ar]=نسخة عالية الألوان من المظهر الكلاسيكي
+Comment[az]=Klassik tərzin zəngin rəngli buraxılışı
+Comment[be]=ВерÑÑ–Ñ ÐºÐ»Ð°Ñічнага Ñтылю з вÑлікай колькаÑцю колераў
+Comment[bg]=КлаÑичеÑки Ñтил на KDE Ñ Ð²Ð¸Ñоко качеÑтво на цветовете
+Comment[bn]=কà§à¦²à¦¾à¦¸à¦¿à¦• সà§à¦Ÿà¦¾à¦‡à¦²à§‡à¦° হাই-কালার সংসà§à¦•à¦°à¦£
+Comment[br]=Stumm livioù uhel ar c'hiz da gustum
+Comment[bs]=Highcolor verzija klasiÄnog stila
+Comment[ca]=Versió Highcolor de l'estil clàssic
+Comment[cs]=Mnohobarevná verze klasického stylu
+Comment[csb]=Wersëjô klasykòwegò sztélu z wieloma farwama (HiColor)
+Comment[cy]=Fersiwn uchel-liw o'r arddull clasurol
+Comment[da]=Højfarve-version af klassisk stil
+Comment[de]=64000-Farben-Version des Classic-Stils
+Comment[el]=Έκδοση με πολλά χÏώματα του ÎºÎ»Î±ÏƒÎ¹ÎºÎ¿Ï ÏƒÏ„Ï…Î»
+Comment[en_GB]=Highcolour version of the classic style
+Comment[eo]=Multkolora varianto de la klasika stilo
+Comment[es]=Versión de alta profundidad de color del estilo clásico
+Comment[et]=Vaikestiili paljuvärviline versioon
+Comment[eu]=Estilo klasikoaren kolore askodun bertsioa
+Comment[fa]=نسخۀ رنگ بالای سبک کلاسیک
+Comment[fi]=Monivärinen versio klassikkotyylistä
+Comment[fr]=Version très colorée du style classique
+Comment[fy]=Hege kleuren ferzje fan de klassyke styl
+Comment[ga]=Leagan ildathach den stíl chlasaiceach
+Comment[gl]=Versión de alto contrasto do estilo clásico
+Comment[he]=גירסה בצבע גבוה של הסגנון הקל×סי של KDE
+Comment[hi]=कà¥à¤²à¤¾à¤¶à¤¿à¤• शैली का हाईकलर वरà¥à¤œà¤¨
+Comment[hr]=Verzija klasiÄnog stila s puno boja
+Comment[hu]=A KDE korábbi stílusának színgazdag változata
+Comment[id]=Versi Warna Tajam dari gaya klasik
+Comment[is]=Útgáfa klassíska stílsins sem notar hágæðaliti (HighColor)
+Comment[it]=Versione con molti colori dello stile classico
+Comment[ja]=クラシックスタイルã®ãƒã‚¤ã‚«ãƒ©ãƒ¼ãƒãƒ¼ã‚¸ãƒ§ãƒ³
+Comment[ka]=კლáƒáƒ¡áƒ˜áƒ™áƒ£áƒ áƒ˜ სტილი ფერების მეტი რáƒáƒáƒ“ენáƒáƒ‘ით
+Comment[kk]=КлаÑÑикалық Ñтильдің Highcolor нұÑқаÑÑ‹
+Comment[km]=កំណែ​ពណ៌​ážáŸ’ពស់​របស់​រចនាបáŸáž‘្ម​បុរាណ
+Comment[ko]=기본 모양새를 ë§Žì€ ìƒ‰ìœ¼ë¡œ 만든 것
+Comment[lb]=Versioun mat ville Faarwe vum klassesche Stil
+Comment[lt]=Klasikinio stiliaus aukštos spalvų gebos versija
+Comment[lv]=DaudzkrÄsu versija klasiskajam stilam
+Comment[mk]=ВиÑокобојна верзија на клаÑичниот Ñтил
+Comment[mn]=64000-Өнгөт-Ñонгодог Ñ…ÑлбÑрийн хувилбар
+Comment[ms]=Versi warna cerah untuk gaya klasik
+Comment[nb]=Mangefarget-versjon av klassisk stil
+Comment[nds]=Highcolor-Verschoon vun den klass'schen Stil
+Comment[ne]=शासà¥à¤¤à¥à¤°à¥€à¤¯ शैलीको उचà¥à¤š रङ संसà¥à¤•à¤°à¤£
+Comment[nl]=Hoge-kleuren-versie van de klassieke stijl
+Comment[nn]=Klassisk stil med mange fargar
+Comment[pa]=ਜਿਆਦਾ ਗੂੜੇ ਰੰਗਾਂ ਵਾਲ ਟਕਸਾਲੀ ਸ਼ੈਲੀ
+Comment[pl]=Wersja stylu klasycznego z wieloma kolorami (HiColor)
+Comment[pt]=Uma versão com muitas cores do estilo clássico
+Comment[pt_BR]=Estilo clássico na versão de alta resolução
+Comment[ro]=Versiune cu culori multe a stilului clasic
+Comment[ru]=ВерÑÐ¸Ñ ÐºÐ»Ð°ÑÑичеÑкого ÑÑ‚Ð¸Ð»Ñ Ñ Ð±Ð¾Ð»ÑŒÑˆÐ¸Ð¼ количеÑтвом цветов
+Comment[rw]=Verisiyo y'ibararyiza ry'imisusire isanzwe
+Comment[se]=Standárdastiilla ivdnás veršuvdna
+Comment[sk]=Štandardný štýl pre veľa farieb
+Comment[sl]=Raznobarvna razliÄica klasiÄnega sloga
+Comment[sq]=Verzion Shumë ngjyrësh i stilit klasik
+Comment[sr]=Верзија клаÑичног Ñтила Ñа пуно боја
+Comment[sr@Latn]=Verzija klasiÄnog stila sa puno boja
+Comment[sv]=Färgrik version av den klassiska stilen
+Comment[ta]=பாரமà¯à®ªà®°à®¿à®¯ பாணியின௠உயரà¯à®¨à®¿à®±à®ªà¯ பதிபà¯à®ªà¯
+Comment[te]=సాంపà±à°°à°¦à°¾à°¯à°¿à°• శైలి యొకà±à°• à°Žà°•à±à°•à±à°µ రంగౠవివరణం
+Comment[tg]=ÐуÑхаи рангбаландии Ñабки клаÑÑика
+Comment[th]=รูปà¹à¸šà¸šà¸›à¸£à¸´à¸¢à¸²à¸¢ รุ่นความละเอียดสีสูง
+Comment[tr]=Klasik stilin yüksek renk versiyonu
+Comment[tt]=Klassik tışlawnıñ küptösle töre
+Comment[uk]=ВерÑÑ–Ñ Ñ‚Ð¸Ð¿Ð¾Ð²Ð¾Ð³Ð¾ Ñтилю Ð´Ð»Ñ 64К кольорів та більше
+Comment[uz]=Klassik uslubining yuqori rangli nusxasi
+Comment[uz@cyrillic]=КлаÑÑик уÑлубининг юқори рангли нуÑхаÑи
+Comment[vi]=Phiên bản màu cao của kiểu dáng kinh điển.
+Comment[zh_CN]=ç»å…¸é£Žæ ¼çš„高色彩版本
+Comment[zh_HK]=é è¨­ä½ˆæ™¯çš„高彩版本
+Comment[zh_TW]=é è¨­é¢¨æ ¼çš„高彩版本
+[KDE]
+WidgetStyle=HighColor
diff --git a/tdestyles/themes/keramik.themerc b/tdestyles/themes/keramik.themerc
new file mode 100644
index 000000000..c59d2ee37
--- /dev/null
+++ b/tdestyles/themes/keramik.themerc
@@ -0,0 +1,99 @@
+[Misc]
+Name=Keramik
+Name[be]=Кераміка
+Name[bn]=কেরামিক
+Name[cs]=Keramika
+Name[csb]=Keramikòwi
+Name[eo]=Ceramiko
+Name[fa]=کرامیک
+Name[fy]=Keramyk
+Name[gl]=Keramic
+Name[he]=קרמיק
+Name[hi]=केरमिक
+Name[ka]=კერáƒáƒ›áƒ˜áƒ™áƒ
+Name[kk]=Керамик
+Name[ko]=K세ë¼ë¯¹
+Name[lv]=Keramika
+Name[mk]=Керамик
+Name[mn]=Керамик
+Name[ne]=केरामिक
+Name[nn]=Keramikk
+Name[pa]=ਕੀਰਾਮਿਕ
+Name[ru]=Керамика
+Name[se]=Keramihkka
+Name[sq]=Keramikë
+Name[sr]=Керамика
+Name[sr@Latn]=Keramika
+Name[ta]=கேராமிலà¯à®•à¯
+Name[te]=కెరామికà±
+Name[tg]=Сафолӣ
+Name[th]=Kเครามิà¸
+Name[uz]=Keramika
+Name[uz@cyrillic]=Керамика
+ConfigPage=tdestyle_keramik_config
+Comment=A style using alphablending
+Comment[af]='n standaard styl wat alfa vermenging gebruik
+Comment[bg]=Стил, използващ алфа Ñливане
+Comment[bs]=Stil koji koristi alphablending
+Comment[ca]=Un estil que usa barreja alfa
+Comment[cs]=Styl používající alfa kanál
+Comment[csb]=Sztél brëkùjący półprzezérnotã
+Comment[da]=En stil der bruger alfablanding
+Comment[de]=Ein Stil mit Alpha-Blending
+Comment[el]=Ένα στυλ που χÏησιμοποιεί alphablending
+Comment[eo]=stilo kiu uzas diafanan miksadon
+Comment[es]=Un estilo que utiliza mezcla alfa
+Comment[et]=Alfablendingut kasutav stiil
+Comment[eu]=Alfa kanala darabilen estilo lehenetsia
+Comment[fa]=یک سبک با استÙاده از alphablending
+Comment[fi]=Alphasekoitusta käyttävä tyyli
+Comment[fr]=Un style utilisant l'alpha-blending
+Comment[fy]=In styl dy brûk makket fan alfaminging
+Comment[ga]=Stíl a úsáideann alfachumasc
+Comment[gl]=Un estilo empregando misturas alfa
+Comment[he]=ערכה משתמשת במיזוג ×לפ×
+Comment[hr]=Stil s upotrebom Alfa pretapanja
+Comment[hu]=Alfakeverést használó stílus
+Comment[id]=Gaya dengan alphablending
+Comment[is]=Stíll sem notar alfa blöndun
+Comment[it]=Stile con effetti di trasparenza
+Comment[ja]=アルファブレンディングを使用ã—ãŸã‚¹ã‚¿ã‚¤ãƒ«
+Comment[ka]=სტილი áƒáƒšáƒ¤áƒ შერევით
+Comment[kk]=Ðльфа-арлаÑтыру Ñтилі
+Comment[km]=រចនាបáŸáž‘្ម​លំនាំដើម​ដោយ​ប្រើ ល្បាយ​អាល់ហ្វា
+Comment[lb]=E Stil, deen Alphablending benotzt
+Comment[lt]=Stilius, naudojantis alfa spalvų maišymą
+Comment[lv]=Stils izmantojot alfasaplūšanu
+Comment[mk]=Стил што кориÑти алфа-мешање
+Comment[ms]=Gaya piawai menggunakan pengadunan alfa
+Comment[nb]=En stil som bruker alfablending
+Comment[nds]=En Stil mit Alphablending
+Comment[ne]=अलà¥à¤«à¤¾à¤¬à¥à¤²à¥‡à¤¨à¥à¤¡à¤¿à¤™ पà¥à¤°à¤¯à¥‹à¤— गरिरहेको शैली
+Comment[nl]=Een stijl die gebruik maakt van alfavermenging
+Comment[nn]=Ein stil som brukar alfablanding
+Comment[pa]=ਇਹ à¨à¨²à¨«à¨¾à¨‡à©°à¨à¨¬à¨²à¨¿à©°à¨— ਵਰਤੋਂ ਕਰਕੇ ਇੱਕ ਸ਼ੈਲੀ
+Comment[pl]=Styl stosujący półprzeźroczystość
+Comment[pt]=Um estilo que utiliza 'alphablending'
+Comment[pt_BR]=Um estilo padrão usando Mistura Alpha
+Comment[ro]=Un stil care utilizează transparenţă
+Comment[ru]=Стиль Ñ Ð¸Ñпользованием альфа-ÑмешиваниÑ
+Comment[se]=Stiila mii geavaha alfaseaguhusa
+Comment[sk]=Štýl používajúci alfa kanál
+Comment[sl]=Slog z uporabo mešanja alfa
+Comment[sr]=Стил који кориÑти алфа-Ñтапање
+Comment[sr@Latn]=Stil koji koristi alfa-stapanje
+Comment[sv]=En stil som använder alfablandning
+Comment[te]=ఆలà±à°«à°¾ à°¬à±à°²à±†à°‚డింగౠవాడౠఒక శైలి
+Comment[tg]=УÑлуб бо иÑтифодаи тобиши алфа
+Comment[th]=รูปà¹à¸šà¸šà¸—ี่ใช้เทคนิคà¸à¸²à¸£à¹„ล่สีอัลฟา
+Comment[tr]=Alpha karışımı kullanan bir stil
+Comment[uk]=Стиль з викориÑтаннÑм альфа-змішуваннÑ
+Comment[uz]=Alfablendingli uslub
+Comment[uz@cyrillic]=Ðлфаблендингли уÑлуб
+Comment[vi]=Kiểu dáng hợp nhau anfa.
+Comment[zh_CN]=使用 alpha 混和的风格
+Comment[zh_HK]=一個使用漸變色的佈景
+Comment[zh_TW]=使用 alphablending çš„é è¨­é¢¨æ ¼
+
+[KDE]
+WidgetStyle=Keramik
diff --git a/tdestyles/themes/kstep.themerc b/tdestyles/themes/kstep.themerc
new file mode 100644
index 000000000..c96c6381f
--- /dev/null
+++ b/tdestyles/themes/kstep.themerc
@@ -0,0 +1,108 @@
+[Misc]
+Name=KDE Step
+Name[af]=Kde Step
+Name[bn]=কে.ডি.ই. সà§à¦Ÿà§‡à¦ª
+Name[de]=KDE-Step
+Name[eo]=KDE-Step
+Name[fa]=گام KDE
+Name[hi]=केडीई सà¥à¤Ÿà¥‡à¤ª
+Name[is]=KDE-step
+Name[ko]=KDE 스í…
+Name[lb]=KDE-Step
+Name[mi]=Hikoi KDE
+Name[mn]=KDE-Step
+Name[ne]=KDE चरण
+Name[nn]=KDE-Step
+Name[nso]=Kgato ya KDE
+Name[pa]=KDE ਪਗ
+Name[rw]=Intambwe KDE
+Name[sq]=Hapi KDE
+Name[sv]=KDE step
+Name[ta]=கேடிஇ à®®à¯à®±à¯ˆ
+Name[te]=కెడిఈ ఆడà±à°—à±
+Name[tg]=Марҳилаи KDE
+Name[th]=KDE สเต็ป
+Name[ven]=Tshitaela tsha KDE
+Name[xh]=Inyathelo le KDE
+Name[zu]=Isigaba se-KDE
+Comment=Unthemed Next-like style
+Comment[af]=Ongetemade Next-tipe styl
+Comment[ar]=مظهر مشابه لNeXT Step
+Comment[be]=Стыль Next
+Comment[bg]=Стил без тема, подобен на Next
+Comment[br]=Giz doare NeXT anwisket
+Comment[bs]=Stil bez teme, u stilu Nexta
+Comment[ca]=Estil del tipus Next sense temes
+Comment[cs]=Styl jako NeXT (bez motivu)
+Comment[csb]=Sztél szlachùjacy za Nexta, bez témów
+Comment[cy]=Arddull fel Next heb themau
+Comment[da]=Next-lignende stil uden tema
+Comment[de]=Reduzierter NeXt-Stil
+Comment[el]=Στυλ παÏόμοιο με το Next
+Comment[eo]=Next-simila stilo neetosa
+Comment[es]=Estilo tipo NeXT sin tema
+Comment[et]=NeXT'i-laadne teemata stiil
+Comment[eu]=Gairik gabeko Next estiloa
+Comment[fa]=سبک مشابه بعدی بدون چهره
+Comment[fi]=Teemoittamaton Next:n kaltainen tyyli
+Comment[fr]=Style sans thème similaire à NeXT
+Comment[fy]=Temaleaze Next-styl
+Comment[ga]=Stíl gan téama, cosúil le NeXT
+Comment[gl]=Estilo tipo Next sen tema
+Comment[hi]=अनथीमà¥à¤¡ नेकà¥à¤¸à¥à¤Ÿ शैली क़िसà¥à¤®
+Comment[hr]=Stil bez teme, nalikuje na Next
+Comment[hu]=Next-szerű stílus, téma nélkül
+Comment[id]=Gaya ala Next tanpa tema
+Comment[is]=Stíll sem minnir á Next stýrikerfið (án þema)
+Comment[it]=Stile senza tema simile a Next
+Comment[ja]=Next 風ã®ã‚¹ã‚¿ã‚¤ãƒ« (テーマãªã—)
+Comment[ka]=Next-ის მსგáƒáƒ•áƒ¡áƒ˜ სტილი თემების გáƒáƒ áƒ”შე
+Comment[kk]=ÐақыштарÑыз Next-Ñекілді Ñтиль
+Comment[km]=រចនាបáŸáž‘្ម Next-like ដែល​គ្មាន​ស្បែក
+Comment[ko]=넥스트와 ê°™ì€ ê¼´ì„ ê°€ì§„ 테마
+Comment[lb]=Next-ähnleche Stil ouni Thema
+Comment[lt]=Betemis Next tipo stilius
+Comment[lv]=Beztēmas NEXT līdzīgs stils
+Comment[mk]=NeXT Ñтил (без тема)
+Comment[mn]=NeXt-Ð¥ÑлбÑÑ€ агшаалт
+Comment[ms]=Gaya Next
+Comment[mt]=Stil bla tema simili għan-Next
+Comment[nb]=Innebygget Next-lignende stil
+Comment[nds]=Stil as Next (ahn Muster)
+Comment[ne]=विषयवसà¥à¤¤à¥ नभà¤à¤•à¥‹ पछिलà¥à¤²à¥‹-जसà¥à¤¤à¥‹ शैली
+Comment[nl]=Themaloze Next-stijl
+Comment[nn]=Next-aktig stil utan tema
+Comment[nso]=Mokgwa wo osenago molaetsa wago swana le Latelago
+Comment[oc]=Estil dèu tipus Next sense temes
+Comment[pa]=ਬੇਸਰੂਪ Next-like ਸ਼ੈਲੀ
+Comment[pl]=Styl podobny do Nexta, bez motywów
+Comment[pt]=Estilo tipo Next
+Comment[pt_BR]=Estilo semelhante ao Next
+Comment[ro]=Stil fără tematică Next
+Comment[ru]=Стиль без тем, похожий на Next
+Comment[rw]=Imisusire Ibikurikira-nka itahawe insanganyamatsiko
+Comment[se]=Next-lágan stiila fáttáhaga
+Comment[sk]=Bez témy ako Next štýl
+Comment[sl]=Netematski slog, podoben Next
+Comment[sq]=Stili i patemë sikurse ai i Next
+Comment[sr]=Стил без теме налик на NeXT
+Comment[sr@Latn]=Stil bez teme nalik na NeXT
+Comment[sv]=Otemad Next-liknande stil
+Comment[ta]=தலைபà¯à®ªà®¿à®²à¯à®²à®¾ அடà¯à®¤à¯à®¤ பாணி
+Comment[te]=వైవిదà±à°¯à°¾à°‚శంలేని నెకà±à°¸à±à°Ÿà± లాంటి శైలి
+Comment[tg]=ДониÑтани тарҳи Next Ñабк шудааÑÑ‚
+Comment[th]=ธีมคล้ายระบบปà¸à¸´à¸šà¸±à¸•à¸´à¸à¸²à¸£ Next
+Comment[tr]=Next benzeri temasız stil
+Comment[tt]=Next-kebek tışlaw
+Comment[uk]=Стиль NeXT (без теми)
+Comment[uz]=Next'ga oʻxshash mavzusiz uslub
+Comment[uz@cyrillic]=Next'га ўхшаш мавзуÑиз уÑлуб
+Comment[ven]=Hu songo newaho thero-sa tshitaela
+Comment[vi]=Kiểu dánf như NeXt không có sắc thái.
+Comment[xh]=Okulandelayo Okungenamxholo-njengo hlobo
+Comment[zh_CN]=无主题的类似 Next 的风格
+Comment[zh_HK]=類似未修改佈景的 NextStep
+Comment[zh_TW]=沒有主題的類似 Nextstep 的風格
+Comment[zu]=Okulandelayo Okungenangqikithi-okunjengesitayela
+[KDE]
+widgetStyle=kstepstyle.la
diff --git a/tdestyles/themes/kthemestylerc b/tdestyles/themes/kthemestylerc
new file mode 100644
index 000000000..96fd4114f
--- /dev/null
+++ b/tdestyles/themes/kthemestylerc
@@ -0,0 +1,2 @@
+[General]
+themes=
diff --git a/tdestyles/themes/light-v2.themerc b/tdestyles/themes/light-v2.themerc
new file mode 100644
index 000000000..d99048c6b
--- /dev/null
+++ b/tdestyles/themes/light-v2.themerc
@@ -0,0 +1,160 @@
+[Misc]
+Name=Light Style, 2nd revision
+Name[af]=Ligte Styl, 2nd hersiening
+Name[ar]=نمط Ø®ÙÙŠÙØŒ التنقيح الثاني
+Name[az]=Yüngül Tərz, 2-ci buraxılış
+Name[be]=Лёгкі Ñтыль 2
+Name[bn]=লাইট সà§à¦Ÿà¦¾à¦‡à¦², দà§à¦¬à¦¿à¦¤à§€à§Ÿ সংসà§à¦•à¦°à¦£
+Name[br]=Giz sklerijenn, eil stumm
+Name[bs]=Light stil, druga revizija
+Name[ca]=Estil Light, 2ona revisió
+Name[cs]=Light Style, druhá verze
+Name[csb]=Letczi sztél, drëgô wersëjô
+Name[cy]=Arddull Ysgafn, ail addasiad
+Name[da]=Light Style, 2. revision
+Name[de]=Leichter Stil, 2. Fassung
+Name[el]=Στυλ Light, 2η διασκευή
+Name[eo]=Lumstilo, 2a eldono
+Name[es]=Estilo ligero, 2nda revisión
+Name[et]=Light Style, 2. versioon
+Name[eu]=Argi-estiloa, 2. berrikuspena
+Name[fa]=سبک نور، دومین بازبینی
+Name[fi]=Light Style, toinen versio
+Name[fr]=Style lumière, 2ème version
+Name[fy]=Light Style, 2e revyzje
+Name[ga]=An Stíl Éadrom, 2ú leasú
+Name[gl]=Estilo Light, 2ª revisión
+Name[he]=גרסה קלילה, גרסה שנייה
+Name[hi]=लाइट शैली, 2रा संशोधन
+Name[hr]=Lagani stil, druga revizija
+Name[hu]=Light stílus, 2. verzió
+Name[id]=Light, revisi ke-2
+Name[is]=Léttur stíll, - taka 2
+Name[it]=Stile Light, seconda versione
+Name[ja]=Light スタイルã€ç¬¬2版
+Name[ka]=Light სტილი, მე-2 რედáƒáƒ¥áƒªáƒ˜áƒ
+Name[kk]=Light Ñтилі, 2-редақциÑÑÑ‹
+Name[km]=រចនាបáŸáž‘្ម​ភ្លឺ áž–áž·áž“áž·ážáŸ’យ​ឡើង​វិញ​លើក​ទី​២
+Name[ko]=가벼운 ê¼´, ë‘번째 íŒ
+Name[lb]=Liichte Stil, 2. Versioun
+Name[lt]=Lengvas stilius, 2-as variantas
+Name[lv]=Gaismas Stils, 2. revīzija
+Name[mk]=ЛеÑен Ñтил, 2-ра ревизија
+Name[mn]=Хөнгөн Ñ…ÑлбÑÑ€, 2. үзлÑг
+Name[mt]=Stil ħafif, 2ni reviżjoni
+Name[nb]=Lett stil, 2. utgave
+Name[nds]=Light-Stil, 2. Verschoon
+Name[ne]=हलà¥à¤•à¤¾ शैली, दोशà¥à¤°à¥‹ संशोधन
+Name[nl]=Light Style, 2e herziening
+Name[nn]=Lett-stil, 2. utgåve
+Name[nso]=Mokgwa wo Bofefo, ponoleswa ya bobedi
+Name[pa]=ਹਲਕਾ ਵਰਜਨ, 2ਜਾ ਵਰਜਨ
+Name[pl]=Lekki styl, wersja druga
+Name[pt]=Estilo Leve, 2a versão
+Name[pt_BR]=Estilo Light, Segunda revisão
+Name[ro]=Stil fin, versiunea 2
+Name[ru]=Light Ñтиль второй редакции
+Name[rw]=Imisusire Rumuri, Isubiramo rya 2
+Name[se]=Light stiila, 2. veršuvdna
+Name[sk]=Štýl Light, 2. revízia
+Name[sl]=Slog »Light«, 2. revizija
+Name[sq]=Stili i Lehtë, Përmirësimi i Dytë
+Name[sr]=Лак Ñтил, друга ревизија
+Name[sr@Latn]=Lak stil, druga revizija
+Name[sv]=Lätt stil, andra revisionen
+Name[ta]=சà¯à®²à®ª பாணி, இரணà¯à®Ÿà®¾à®µà®¤à¯ சோதனை
+Name[te]=వెలà±à°—ౠశైలి, ౨వ సవరణ
+Name[tg]=УÑули Ñабук, нуÑхаи дуввум
+Name[th]=รูปà¹à¸šà¸šà¹€à¸šà¸²à¸šà¸²à¸‡ รุ่นที่ 2
+Name[tr]=Açık Stil, 2.revizyon
+Name[tt]=Light Tışlaw, 2. söreme
+Name[uk]=Стиль Light, випуÑк N2
+Name[uz]=Light uslubi, ikkinchi tahriri
+Name[uz@cyrillic]=Light уÑлуби, иккинчи таҳрири
+Name[ven]=Tshitaela tshisi tshau konda, ndulamiso ya vhuvhili
+Name[vi]=Kiểu dáng sáng, bản sửa đổi 2
+Name[xh]=Uhlobo Olukhanyayo, 2nd ukhumbuzo kwakhona
+Name[zh_CN]=Light 风格,第二版
+Name[zh_HK]=輕éˆé¢¨æ ¼ï¼Œç¬¬äºŒç‰ˆ
+Name[zh_TW]=輕éˆé¢¨æ ¼ï¼Œç¬¬äºŒç‰ˆ
+Name[zu]=Ukubuyekezwa oku-2nd, Kwesitayela Esilula
+Comment=Second revision of the simple and elegant 'Light' widget style.
+Comment[af]=Tweede hersiening van die eenvoudige en elegante 'Light' gui-element styl.
+Comment[ar]=التنقيح الثاني لنمط الكائن 'الخÙÙŠÙ' الأنيق والبسيط
+Comment[az]=Sadə və eleqant 'Yüngül' tərzinin ikinci buraxılışı.
+Comment[be]=ПроÑÑ‚Ñ‹ Ñ– Ñлегантны Ñтыль 2.
+Comment[bg]=Второ издание на ÑÐµÐ¼Ð¿Ð»Ð¸Ñ Ð¸ елегантен Ñтил "Light"
+Comment[bs]=Druga revizija jednostavnog i elegantnog 'Light' stila ukrasa.
+Comment[ca]=Segona revisió de l'elegant estil d'estris 'Light'.
+Comment[cs]=Druhá revize jednoduchého a elegantního stylu prvků uživatelského prostředí 'Light'.
+Comment[csb]=Drëgô wersëjô prostegò ë szëkòwnégò letczégò sztélu (Light).
+Comment[cy]=Ail addasiad o'r arddull celfigyn syml a gwych 'Light'
+Comment[da]=Anden revision af den simple og elegante 'Light'-kontrolstil.
+Comment[de]=Zweite Version des einfachen und eleganten "Leichten Stils"
+Comment[el]=ΔεÏτεÏη διασκευή του Î±Ï€Î»Î¿Ï ÎºÎ±Î¹ ÎºÎ¿Î¼ÏˆÎ¿Ï ÏƒÏ„Ï…Î» 'Light'.
+Comment[eo]=Dua eldono de la simpla kaj eleganta fenestrostilo 'Lumo'.
+Comment[es]=Segunda revisión del elegante estilo de widgets 'Ligero'.
+Comment[et]=Lihtsa ja elegantse 'Light' stiili teine versioon
+Comment[eu]='Argi' trepetaren estilo sinple eta dotorearen 2. berrikuspena.
+Comment[fa]=دومین بازبینی سبک عنصر ساده و زیبای نور
+Comment[fi]=Toinen versio yksinkertaisesta ja elegantista Light-tyylistä
+Comment[fr]=Deuxième version du style graphique « Lumière », simple et élégant.
+Comment[fy]=Twadde revyzje fan de ienfâldige en elegante widgetstyl 'Light'
+Comment[ga]=An dara leasú de stíl shimplí fhíneálta giuirléidí 'Light'.
+Comment[gl]=Segunda revisión do simple e elegante estilo de widgets 'Light'.
+Comment[he]=גרסה שנייה של הערכה הפשוטה ×”×לגנטית וה"קלילה".
+Comment[hi]=सादा और सà¥à¤°à¥‚चिकर 'लाइट' विजेट शैली का दूसरा संशोधन.
+Comment[hr]=Druga revizija jednostavnog i elegantnog 'laganog' widget stila.
+Comment[hu]=A nemesen egyszerű 'Light' elemstílus második változata.
+Comment[id]=Revisi kedua dari gaya widget sederhana dan elegan 'Light'.
+Comment[is]=Önnur útgáfa af einföldum og snotrum stíl
+Comment[it]=Seconda versione dello stile semplice ed elegante "Light".
+Comment[ja]=シンプルã§ã‚¨ãƒ¬ã‚¬ãƒ³ãƒˆãª 'Light' ウィジェットスタイル第 2 版。
+Comment[ka]=მáƒáƒ áƒ¢áƒ˜áƒ•áƒ˜ დრელეგáƒáƒœáƒ¢áƒ£áƒ áƒ˜ Light მáƒáƒ áƒ—ვის ელემენტის სტილის მე–2 რედáƒáƒ¥áƒªáƒ˜áƒ.
+Comment[kk]='Light' деген қарапайым және Ó™Ñем Ñтилінің 2-редакциÑÑÑ‹.
+Comment[km]=ការកែប្រែលើក​ទី ២ របស់​រចនាបáŸáž‘្ម​វážáŸ’ážáž»â€‹áž˜áž¾áž›â€‹ážƒáž¾áž‰â€‹ážŸáž¶áž˜áž‰áŸ’ញ និង​ប្រណិហ"ភ្លឺ" ។
+Comment[ko]=ë½ ë‚´ì§€ ì•Šê³  멋진 '가벼운' 위젯 ê¼´, ë‘번째 íŒ.
+Comment[lb]=Zweet Versioun vum einfachen and eleganten 'liichte' Widget-Stil
+Comment[lt]=Paprasto ir elegantiško „lengvo“ valdiklio stiliaus antras variantas.
+Comment[lv]= VienkÄrÅ¡Ä un elegantÄ 'Gaismas' vidžeta stila otrÄ revÄ«zija.
+Comment[mk]=Втора ревизија на едноÑтавниот и елегантен „ЛеÑен“ Ñтил.
+Comment[mn]=Энгийн ухаалаг "Хөнгөн Ñ…ÑлбÑрүүд"-н хоёрдугаар хувилбар
+Comment[ms]=Revisi kedua untuk gaya wijet 'Light' yang ringkas dan elegan.
+Comment[mt]=It-tieni reviżjoni tal-istil sempliċi u eleganti "Light"
+Comment[nb]=Andre utgave av den enkle og elegante elementstilen «Lett».
+Comment[nds]=Tweet Verschoon vun den eenfachen un smucken "Light"-Stil.
+Comment[ne]=सरल र सà¥à¤¨à¥à¤¦à¤° 'हलà¥à¤•à¤¾' विजेट शैलीको दोशà¥à¤°à¥‹ संशोधन ।
+Comment[nl]=Tweede herziening van de eenvoudige en elegante widgetstijl 'Light'
+Comment[nn]=Andre utgåva av den enkle og elegante stilen «Lett».
+Comment[nso]=Ponoleswa ya bobedi ya mokgwa wa widget wo bonolo wo botsana ebile wo 'Bofefo'.
+Comment[pa]=ਸਧਾਰਨ 'Light' ਵਿਦਗਿਟ ਸ਼ੈਲੀ ਦਾ ਦੂਜਾ ਵਰਜਨ
+Comment[pl]=Druga wersja prostego i eleganckiego stylu Lekkiego (Light).
+Comment[pt]=Segunda versão do estilo gráfico simples e elegante 'Leve'.
+Comment[pt_BR]=Segunda revisão do simples e elegante estilo widget 'Light'.
+Comment[ro]=A doua revizie a stilului 'Fin' simplu ÅŸi elegant
+Comment[ru]=Ð’Ñ‚Ð¾Ñ€Ð°Ñ Ñ€ÐµÐ´Ð°ÐºÑ†Ð¸Ñ Ð¿Ñ€Ð¾Ñтого и краÑивого ÑÑ‚Ð¸Ð»Ñ Light.
+Comment[rw]=Isubiramo rya kabiri ry'imisusire y'uburyo 'Rumuri' ryoroshye kandi ryiza.
+Comment[se]=Oktageardánis ja fárddalaš 'Light'-stiilla nubbi veršuvdna.
+Comment[sk]=Druhá revízia jednoduchého a elegantného štýlu prvkov 'Light'.
+Comment[sl]=Druga revizija preprostega in elegantnega sloga gradnikov »Light«.
+Comment[sr]=Друга ревизија једноÑтавног и елегантног „лаког“ Ñтила.
+Comment[sr@Latn]=Druga revizija jednostavnog i elegantnog „lakog“ stila.
+Comment[sv]=Andra revisionen av den simpla och eleganta komponentstilen "Lätt".
+Comment[ta]=சà¯à®²à®ªà®®à®¾à®© 'இலேசான' சாளர பாணியின௠இரணà¯à®Ÿà®¾à®µà®¤à¯ சோதனை
+Comment[te]=సరళమైన మరయౠసొగసైన 'వెలà±à°—à±' విడà±à°œà±†à°Ÿà± శైలి యొకà±à°• రెండవ సవరణ
+Comment[tg]=Интишори дуввуми Ñабки тикаи Ñодда ва зебои 'Ðур'.
+Comment[th]=รุ่นà¹à¸à¹‰à¹„ขรุ่นที่สองของรูปà¹à¸šà¸š 'บางเบา' ที่เรียบง่ายà¹à¸¥à¸°à¸ à¸¹à¸¡à¸´à¸à¸²à¸™
+Comment[tr]=Hafif Stil'in ikinci revizyonu
+Comment[tt]=Ciñel yämle "Light" tışlawınıñ 2. söreme.
+Comment[uk]=Друга верÑÑ–Ñ Ð¿Ñ€Ð¾Ñтого та елегантного Ñтилю віджетів "Light".
+Comment[uz]=Oddiy va chiroyli Light uslubining ikkinchi tahriri
+Comment[uz@cyrillic]=Оддий ва чиройли Light уÑлубининг иккинчи таҳрири
+Comment[ven]=Ndulamiso ya vhuvhili isa kondi na tshitaela tshileluwaho
+Comment[vi]=Bản sá»­a đổi thứ hai của kiểu dáng ô Ä‘iá»u khiển Sáng Ä‘Æ¡n giản và thanh lịch.
+Comment[xh]=Ukhumbuzo kwakhona lwesibini lokulula nokubukekayo kwe hlobo lwe widget 'Ekhaphu-khaphu.
+Comment[zh_CN]=简约雅致的“Lightâ€é£Žæ ¼ï¼Œç¬¬äºŒç‰ˆã€‚
+Comment[zh_HK]=簡單高雅的「輕éˆã€ä»‹é¢å·¥å…·é¢¨æ ¼çš„第二版。
+Comment[zh_TW]=簡單高雅的“輕éˆâ€ç•Œé¢å·¥å…·é¢¨æ ¼çš„第二版。
+Comment[zu]=Ukubuyekezwa kwesibili kwesitayela se-widget 'Esilula' kanye nesiphucuzekile.
+[KDE]
+WidgetStyle=Light, 2nd revision
diff --git a/tdestyles/themes/light-v3.themerc b/tdestyles/themes/light-v3.themerc
new file mode 100644
index 000000000..cc0b5b25c
--- /dev/null
+++ b/tdestyles/themes/light-v3.themerc
@@ -0,0 +1,161 @@
+[Misc]
+Name=Light Style, 3rd revision
+Name[af]=Ligte Styl, 3de hersiening
+Name[ar]=نمط Ø®ÙÙŠÙØŒ التنقيح الثالث
+Name[az]=Yüngül Tərz, 3-cü buraxılış
+Name[be]=Лёгкі Ñтыль 3
+Name[bn]=লাইট সà§à¦Ÿà¦¾à¦‡à¦², তৃতীয় সংসà§à¦•à¦°à¦£
+Name[br]=Giz sklerijenn, trede stumm
+Name[bs]=Light stil, treća revizija
+Name[ca]=Estil Light, 3era revisió
+Name[cs]=Light Style, třetí verze
+Name[csb]=Letczi sztél, trzecô wersëjô
+Name[cy]=Arddull Ysgafn, 3ydd addasiad
+Name[da]=Light Style, 3. revision
+Name[de]=Leichter Stil, 3. Fassung
+Name[el]=Στυλ Light, 3η διασκευή
+Name[eo]=Lumo-stilo, 3a eldono
+Name[es]=Estilo Ligero, 3era revisión
+Name[et]=Light Style, 3. versioon
+Name[eu]=Argi-estiloa, 3. berrikuspena
+Name[fa]=سبک نور، سومین بازبینی
+Name[fi]=Light-tyyli, kolmas versio
+Name[fr]=Style lumière, 3ème version
+Name[fy]=Light Style, 3e revyzje
+Name[ga]=An Stíl Éadrom, 3ú leasú
+Name[gl]=Estilo Light, 3ª revisión
+Name[he]=גרסה קלילה, גרסה שלישית.
+Name[hi]=लाइट शैली, 3रा संशोधन
+Name[hr]=Lagani stil, treća revizija
+Name[hu]=Light stílus, 3. verzió
+Name[id]=Light, revisi ke-2
+Name[is]=Léttur stíll, - taka 3
+Name[it]=Stile Light, terza versione
+Name[ja]=Light スタイルã€ç¬¬3版
+Name[ka]=Light სტილი, მე–3 რედáƒáƒ¥áƒªáƒ˜áƒ
+Name[kk]=Light Ñтилі, 3-редакциÑÑÑ‹
+Name[km]=រចនាបáŸáž‘្ម​ភ្លឺ áž–áž·áž“áž·ážáŸ’យ​ឡើង​វិញ​លើក​ទី​៣
+Name[ko]=가벼운 ê¼´, 세번째 íŒ
+Name[lb]=Liichte Stil, 3. Versioun
+Name[lt]=Lengvas stilius, 3-ias variantas
+Name[lv]=Gaismas Stils, 3. revīzija
+Name[mk]=ЛеÑен Ñтил, 3-та ревизија
+Name[mn]=Хөнгөн Ñ…ÑлбÑÑ€, 3. үзлÑг
+Name[mt]=Stil ħafif, 3et reviżjoni
+Name[nb]=Lett stil, 3.utgave
+Name[nds]=Light-Stil, 3. Verschoon
+Name[ne]=हलà¥à¤•à¤¾ शैली, तेसà¥à¤°à¥‹ संशोधन
+Name[nl]=Light Style, 3e herziening
+Name[nn]=Lett-stil, 3. utgåve
+Name[nso]=Mokgwa wo Bofefo, ponoleswa ya boraro
+Name[pa]=ਹਲਕੀ ਸ਼ੈਲੀ, 3ਜਾ ਵਰਜਨ
+Name[pl]=Lekki styl, wersja trzecia
+Name[pt]=Estilo Leve, 3a versão
+Name[pt_BR]=Estilo Light, Terceira revisão
+Name[ro]=Stil fin, versiunea 3
+Name[ru]=Light Ñтиль, Ñ‚Ñ€ÐµÑ‚ÑŒÑ Ñ€ÐµÐ´Ð°ÐºÑ†Ð¸Ñ
+Name[rw]=Imisusire Rumuri, Isubiramo rya 3
+Name[se]=Light stiila, 3. veršuvdna
+Name[sk]=Štýl Light, 3. revízia
+Name[sl]=Slog »Light«, 3. revizija
+Name[sq]=Stili i Lehtë, Përmirësimi i Tretë
+Name[sr]=Лак Ñтил, трећа ревизија
+Name[sr@Latn]=Lak stil, treća revizija
+Name[sv]=Lätt stil, tredje revisionen
+Name[ta]=சà¯à®²à®ª பாணி, மூனà¯à®±à®¾à®µà®¤à¯ சோதனை
+Name[te]=వెలà±à°—ౠశైలి, ౩వ సవరణ
+Name[tg]=Сабки нур, нуÑхаи Ñаввум
+Name[th]=รูปà¹à¸šà¸šà¹€à¸šà¸²à¸šà¸²à¸‡ รุ่นที่ 3
+Name[tr]=Hafif Stil
+Name[tt]=Light Tışlaw, 3. söreme
+Name[uk]=Стиль Light, випуÑк N3
+Name[uz]=Light uslubi, uchinchi tahriri
+Name[uz@cyrillic]=Light уÑлуби, учинчи таҳрири
+Name[ven]=Tshitaela tshisa kondi, ndovhololo ya vhuraru
+Name[vi]=Kiểu dáng sáng, bản sửa đổi 3
+Name[xh]=Uhlobo Olukhanyayo, 3rd ukhumbuzo kwakhona
+Name[zh_CN]=Light 风格,第三版
+Name[zh_HK]=輕éˆé¢¨æ ¼ï¼Œç¬¬ä¸‰ç‰ˆ
+Name[zh_TW]=輕éˆé¢¨æ ¼ï¼Œç¬¬ä¸‰ç‰ˆ
+Name[zu]=Isitayela Esilula, ukubuyekezwa kwesithathu
+Comment=Third revision of the simple and elegant 'Light' widget style.
+Comment[af]=Derde hersiening van die eenvoudige en elegante 'Light' gui-element styl.
+Comment[ar]=التنقيح الثالث لنمط الكائن 'الخÙÙŠÙ' الأنيق والبسيط
+Comment[az]=Sadə və eleqant 'Yüngül' tərzinin üçüncü buraxılışı.
+Comment[be]=ПроÑÑ‚Ñ‹ Ñ– Ñлегантны Ñтыль 3.
+Comment[bg]=Трето издание на ÑÐµÐ¼Ð¿Ð»Ð¸Ñ Ð¸ елегантен Ñтил "Light"
+Comment[bs]=Treća revizija jednostavnog i elegantnog 'Light' stila ukrasa.
+Comment[ca]=Tercera revisió de l'elegant estil d'estris 'Light'.
+Comment[cs]=Třetí revize jednoduchého a elegantního stylu prvků uživatelského prostředí 'Light'.
+Comment[csb]=Trzecô wersëjô prostegò ë szëkòwnégò letczégò sztélu (Light).
+Comment[cy]=Trydydd addasiad o'r arddull celfigyn syml a gwych 'Light'
+Comment[da]=Tredje revision af den simple og elegante 'Light'-kontrolstil.
+Comment[de]=Dritte Version des einfachen und eleganten "Leichten Stils"
+Comment[el]=ΤÏίτη διασκευή του Î±Ï€Î»Î¿Ï ÎºÎ±Î¹ ÎºÎ¿Î¼ÏˆÎ¿Ï ÏƒÏ„Ï…Î» 'Light'.
+Comment[eo]=Tria eldono de la simpla kaj eleganta fenstrostilo 'Lumo'.
+Comment[es]=Tercera revisión del elegante estilo de widgets 'Ligero'.
+Comment[et]=Lihtsa ja elegantse 'Light' stiili kolmas versioon
+Comment[eu]='Argi' trepetaren estilo sinple eta dotorearen 3. berrikuspena.
+Comment[fa]=سومین بازبینی سبک عنصر ساده و زیبای نور
+Comment[fi]=Kolmas versio yksinkertaisesta ja elegantista Light-tyylistä
+Comment[fr]=Troisième version du style graphique « Lumière », simple et élégant.
+Comment[fy]=Tredde revyzje fan de ienfâldige en elegante widgetstyl 'Light'
+Comment[ga]=An tríú leasú de stíl shimplí fhíneálta giuirléidí 'Light'.
+Comment[gl]=Terceira revisión do estilo elegante e simple de widgets 'Light'.
+Comment[he]=גרסה שלישית של הערכה הפשוטה ×”×לגנטית וה"קלילה".
+Comment[hi]=सादा और सà¥à¤°à¥‚चिकर 'लाइट' विजेट शैली का तीसरा संशोधन.
+Comment[hr]=Treća revizija jednostavnog i elegantnog 'laganog' widget stila.
+Comment[hu]=A nemesen egyszerű 'Light' elemstílus harmadik változata.
+Comment[id]=Revisi ketiga dari gaya widget sederhana dan elegan 'Light'.
+Comment[is]=Þriðja útgáfa af einföldum og snotrum stíl
+Comment[it]=Terza versione dello stile semplice ed elegante "Light".
+Comment[ja]=シンプルã§ã‚¨ãƒ¬ã‚¬ãƒ³ãƒˆãª 'Light' ウィジェットスタイル第 3 版。
+Comment[ka]=მáƒáƒ áƒ¢áƒ˜áƒ•áƒ˜ დრელეგáƒáƒœáƒ¢áƒ£áƒ áƒ˜ Light მáƒáƒ áƒ—ვის ელემენტის სტილის მე–3 რედáƒáƒ¥áƒªáƒ˜áƒ.
+Comment[kk]='Light' деген қарапайым және Ó™Ñем Ñтилінің 3-редакциÑÑÑ‹.
+Comment[km]=ការកែប្រែលើក​ទី ៣ របស់​រចនាបáŸáž‘្ម​វážáŸ’ážáž»â€‹áž˜áž¾áž›â€‹ážƒáž¾áž‰â€‹ážŸáž¶áž˜áž‰áŸ’ញ និង​ប្រណិហ"ភ្លឺ" ។
+Comment[ko]=ë½ ë‚´ì§€ ì•Šê³  멋진 '가벼운' 위젯 ê¼´, 세번째 íŒ.
+Comment[lb]=Drëtt Versioun vum einfachen and eleganten 'liichte' Widget-Stil
+Comment[lt]=Paprasto ir elegantiÅ¡ko „lengvo“ valdiklio stiliaus treÄias variantas.
+Comment[lv]= VienkÄrÅ¡Ä un elegantÄ 'Gaismas' vidžeta stila treÅ¡Ä revÄ«zija.
+Comment[mk]=Трета ревизија на едноÑтавниот и елегантен „ЛеÑен“ Ñтил.
+Comment[mn]=Энгийн ухаалаг "Хөнгөн Ñ…ÑлбÑрүүд"-н гуравдугаар хувилбар
+Comment[ms]=Revisi ketiga untuk gaya wijet 'Light' yang ringkas dan elegan.
+Comment[mt]=It-tielet reviżjoni tal-istil sempliċi u eleganti "Light"
+Comment[nb]=Tredje utgave av den enkle og elegante elementstilen «Lett».
+Comment[nds]=Drütt Verschoon vun den eenfachen un smucken "Light"-Stil.
+Comment[ne]=सरल र सà¥à¤¨à¥à¤¦à¤° 'हलà¥à¤•à¤¾' विजेट शैलीको तेशà¥à¤°à¥‹ संशोधन ।
+Comment[nl]=Derde herziening van de eenvoudige en elegante widgetstijl 'Light'
+Comment[nn]=Tredje utgåva av den enkle og elegante stilen «Lett».
+Comment[nso]=Ponoleswa ya boraro ya mokgwa wa widget wo bonolo wo mmotsana ebile wo 'Bofefo'.
+Comment[pa]=ਸਧਾਰਨ 'Light' ਵਿਦਗਿਟ ਸ਼ੈਲੀ ਦਾ ਤੀਜਾ ਵਰਜਨ
+Comment[pl]=Trzecia wersja prostego i eleganckiego stylu Lekkiego (Light).
+Comment[pt]=Terceira versão do estilo gráfico simples e elegante 'Leve'.
+Comment[pt_BR]=Terceira revisão do simples e elegante estilo widget 'Light'.
+Comment[ro]=A treia revizie a stilului 'Fin' simplu ÅŸi elegant
+Comment[ru]=Ð¢Ñ€ÐµÑ‚ÑŒÑ Ñ€ÐµÐ´Ð°ÐºÑ†Ð¸Ñ Ð¿Ñ€Ð¾Ñтого и краÑивого ÑÑ‚Ð¸Ð»Ñ Light.
+Comment[rw]=Isubiramo rya gatatu ry'imisusire y'uburyo 'Rumuri' ryoroshye kandi ryiza.
+Comment[se]=Oktageardánis ja fárddalaš 'Light'-stiilla goalmmát veršuvdna.
+Comment[sk]=Tretia revízia jednoduchého a elegantného štýlu prvkov 'Light'.
+Comment[sl]=Tretja revizija preprostega in elegantnega sloga gradnikov »Light«.
+Comment[sq]=Përmirësimi i tretë i Stilit [Lehtë] i cili është i thjeshtë edhe elegant.
+Comment[sr]=Трећа ревизија једноÑтавног и елегантног „лаког“ Ñтила.
+Comment[sr@Latn]=Treća revizija jednostavnog i elegantnog „lakog“ stila.
+Comment[sv]=Tredje revisionen av den simpla och eleganta komponentstilen "Lätt".
+Comment[ta]=சà¯à®²à®ªà®®à®¾à®© 'இலேசான' சாளர பாணியின௠மூனà¯à®±à®¾à®µà®¤à¯ சோதனை
+Comment[te]=సరళమైన మరయౠసొగసైన 'వెలà±à°—à±' విడà±à°œà±†à°Ÿà± శైలి యొకà±à°• మూడొవ సవరణ
+Comment[tg]=Интишори Ñаввум Ñабки кушоди 'Light' Ñодда ва зебо аÑÑ‚.
+Comment[th]=รุ่นà¹à¸à¹‰à¹„ขรุ่นที่สามของรูปà¹à¸šà¸š 'บางเบา' ที่เรียบง่ายà¹à¸¥à¸°à¸ à¸¹à¸¡à¸´à¸à¸²à¸™
+Comment[tr]=Hafif Stil'in üçüncü revizyonu
+Comment[tt]=Ciñel yämle "Light" tışlawınıñ 3. söreme.
+Comment[uk]=Ð¢Ñ€ÐµÑ‚Ñ Ð²ÐµÑ€ÑÑ–Ñ Ð¿Ñ€Ð¾Ñтого та елегантного Ñтилю віджетів "Light".
+Comment[uz]=Oddiy va chiroyli Light uslubining uchinchi tahriri
+Comment[uz@cyrillic]=Оддий ва чиройли Light уÑлубининг учинчи таҳрири
+Comment[ven]=Ndovhololo ya vhuraru isa kondi na tshitaela tshisa kondi.
+Comment[vi]=Bản sá»­a đổi thứ ba của kiểu dáng ô Ä‘iá»u khiển Sáng Ä‘Æ¡n giản và thanh lịch.
+Comment[xh]=Ukhumbuzo kwakhona lwesithathu lokulula kunye nokubukekayo kohlobo lwe widget 'Ekhaphu-khaphu'.
+Comment[zh_CN]=简约雅致的“Lightâ€é£Žæ ¼ï¼Œç¬¬ä¸‰ç‰ˆã€‚
+Comment[zh_HK]=簡單高雅的「輕éˆã€ä»‹é¢å·¥å…·é¢¨æ ¼çš„第三版。
+Comment[zh_TW]=簡單高雅的“輕éˆâ€ç•Œé¢å·¥å…·é¢¨æ ¼çš„第三版。
+Comment[zu]=Ukubuyekezwa kwesithathu kwesitayela se-widget 'Esilula' kanye nokuphucuzekile.
+[KDE]
+WidgetStyle=Light, 3rd revision
diff --git a/tdestyles/themes/mega.themerc b/tdestyles/themes/mega.themerc
new file mode 100644
index 000000000..a0cf79e19
--- /dev/null
+++ b/tdestyles/themes/mega.themerc
@@ -0,0 +1,76 @@
+[Misc]
+Name=MegaGradient highcolor style
+Name[af]=Megagradiënt hoë-kleur styl
+Name[az]=MegaGradient yüksək rəng tərzi
+Name[be]=Градыентавы Ñтыль HighColor
+Name[ca]=Estil MegaGradient d'alta profunditat
+Name[cs]=Highcolor styl MegaGradient
+Name[csb]=Wielofarwny sztél MegaGradient
+Name[cy]=Arddull GraddliwMega uchel-liw
+Name[da]=MegaGradient højfarvestil
+Name[de]=MegaGradient (64000-Farben-Stil)
+Name[el]=MegaGradient στυλ πολλών χÏωμάτων
+Name[en_GB]=MegaGradient highcolour style
+Name[eo]=Multkolorega stilo kun kolortransiroj
+Name[es]=Estilo MegaDegradado de alta profundidad
+Name[et]=MegaGradient paljuvärviline stiil
+Name[eu]=MegaGradient kolore askodun estiloa
+Name[fa]=سبک رنگ بالای مگاگرادینت
+Name[fi]=MegaGradient-monivärityyli
+Name[fr]=Style MégaGradient très coloré
+Name[fy]=MegaGradiënt hege-kleurenstyl
+Name[gl]=Estilo de alto contraste MegaGradient
+Name[hi]=मेगागà¥à¤°à¤‚डिà¤à¤‚ट हाईकलर शैली
+Name[hr]=MegaGradient stil s puno boja
+Name[hu]=Megagradiens (színgazdag)
+Name[id]=Gaya highcolor MegaGradient
+Name[is]=MegaGradient fjöllitastíll
+Name[it]=Mega sfumature con molti colori
+Name[ja]=MegaGradient ãƒã‚¤ã‚«ãƒ©ãƒ¼ã‚¹ã‚¿ã‚¤ãƒ«
+Name[ka]=highcolor გრáƒáƒ“იენტული სტილი
+Name[kk]=МегаГрадиент Ñ‚Ò¯Ñтерге бай Ñтилі
+Name[km]=រចនាបáŸáž‘្ម​ពណ៌​ážáŸ’ពស់ MegaGradient
+Name[lb]=MegaGradient-Stil (vill Faarwen)
+Name[lt]=MegaGradient aukštos spalvų gebos stilius
+Name[lv]=MegaGradient daudzkrÄsu stils
+Name[mk]=MegaGradient виÑокобоен Ñтил
+Name[mn]=МигаГрадиент (64000-Өнгө-Ð¥ÑлбÑÑ€)
+Name[ms]=Gaya MegaGradient warna cerah
+Name[mt]=Stil MegaGradient
+Name[nb]=MegaGradient mangefargestil
+Name[nds]=MegaGradient-Stil (Highcolor)
+Name[ne]=मेगागà¥à¤°à¥‡à¤¡à¤¿à¤¯à¤¨à¥à¤Ÿ उचà¥à¤šà¤°à¤™ शैली
+Name[nl]=MegaGradiënt hogekleurenstijl
+Name[nn]=MegaGradient-stil med mange fargar
+Name[nso]=Mokgwa wa kholoro ya godimo ya MegaGradient
+Name[pa]=MegaGradient ਗੂੜਾ ਸ਼ੈਲੀ
+Name[pl]=Styl wielokolorowy MegaGradient
+Name[pt]=Estilo MegaGradient com muitas cores
+Name[pt_BR]=Estilo Mega-Gradiente
+Name[ro]=Stil cu culori multe MegaGradient
+Name[ru]=Градиентный Ñтиль highcolor
+Name[se]=MegaGradient ivdnás stiila
+Name[sk]=MegaGradient štýl veľa farieb
+Name[sl]=Raznobarvni slog MegaGradient
+Name[sq]=Stili Shumëngjyrësh i MegaShkrirjes
+Name[sr]=Мегаградијент Ñтил Ñа пуно боја
+Name[sr@Latn]=Megagradijent stil sa puno boja
+Name[sv]=Megagradient färgrik stil
+Name[ta]=மிகபà¯à®ªà¯†à®°à®¿à®¯ வணà¯à®£à®•à¯à®•à®³à®žà¯à®šà®¿à®¯ உயர௠வணà¯à®£ பாணி
+Name[te]=మెగాగà±à°°à±†à°¡à°¿à°¯à°‚à°Ÿà± à°Žà°•à±à°•à±à°µ రంగౠశైలి
+Name[tg]=Сабки рангбаландии MegaGradient
+Name[th]=รูปà¹à¸šà¸šà¹„ล่สี ความละเอียดสีสูง
+Name[tr]=Yüksek renkli stil
+Name[tt]=Küptösle MegaGradient tışlawı
+Name[uk]=Багатокольоровий Ñтиль "Мега-градієнт"
+Name[uz]=MegaGradient highcolor uslubi
+Name[uz@cyrillic]=MegaGradient highcolor уÑлуби
+Name[ven]=Tshitaela tsha muvhala wa ntha wa MegaGradient
+Name[vi]=Kiểu dáng màu cao Siêu Dốc
+Name[xh]=Uhlobo lombala ophezulu we MegaGradient
+Name[zh_CN]=MegaGradient 高色彩风格
+Name[zh_HK]=MegaGradient 高彩風格
+Name[zh_TW]=MegaGradient 高彩風格
+Name[zu]=Isitayela sombala ophezulu se-MegaGradient
+[KDE]
+widgetStyle=mega.la
diff --git a/tdestyles/themes/qtcde.themerc b/tdestyles/themes/qtcde.themerc
new file mode 100644
index 000000000..5f71e6a1e
--- /dev/null
+++ b/tdestyles/themes/qtcde.themerc
@@ -0,0 +1,88 @@
+[Misc]
+Name=CDE
+Name[bn]=সি-ডি-ই
+Name[hi]=सीडीई
+Name[te]=సిడిఈ
+Name[th]=ซีดีอี
+Comment=Built-in unthemed CDE style
+Comment[af]=Ingeboude ongetemade Cde styl
+Comment[ar]=مظهر مضمن مشابه لCDE
+Comment[az]=Yerləşmiş, örtüsüz CDE tərzi
+Comment[be]=Убудаваны Ñтыль CDE
+Comment[bg]=Вграден в библиотеката Qt Ñтил без тема CDE
+Comment[br]=Giz CDE enframmet anwisket
+Comment[bs]=Ugrađeni CDE stil bez teme
+Comment[ca]=Estil incorporat CDE sense temes
+Comment[cs]=Zabudovaný CDE styl (bez motivu)
+Comment[csb]=Wbùdowóny sztél CDE, bez témów
+Comment[cy]=Ardull mewnadeiladedig di-thema CDE
+Comment[da]=Indbygget CDE-stil uden tema
+Comment[de]=Eingebauter, reduzierter CDE-Stil
+Comment[el]=Ενσωματωμένο στυλ παÏόμοιο με το CDE
+Comment[eo]=Originala CDE-stilo neetosa
+Comment[es]=Estilo incorporado CDE sin tema
+Comment[et]=Qt CDE-laadne teemata stiil
+Comment[eu]=Gairik gabeko CDE estiloa
+Comment[fa]=سبک CDE بدون چهرۀ توکار
+Comment[fi]=Sisäänrakennettu teemoittamaton CDE-tyyli
+Comment[fr]=Style CDE d'origine sans thème
+Comment[fy]=Ynboude, temaleaze CDE-styl
+Comment[ga]=Stíl insuite gan téama, cosúil le CDE
+Comment[gl]=Estilo incorporado CDE sen tema
+Comment[he]=ערכה פנימית תו×מת CDE
+Comment[hi]=अंतरà¥à¤¨à¤¿à¤°à¥à¤®à¤¿à¤¤ अनथीमà¥à¤¡ सीडीई शैली
+Comment[hr]=Ugrađeni CDE stil, bez teme
+Comment[hu]=Beépített CDE-stílus
+Comment[id]=Gaya ala CDE built-in tanpa tema
+Comment[is]=Innbyggður stíll sem minnir á CDE notendaskilin (án þema)
+Comment[it]=Stile CDE interno senza tema
+Comment[ja]=ビルトイン CDE スタイル (テーマãªã—)
+Comment[ka]=ჩáƒáƒ“გმული CDE სტილი თემის გáƒáƒ áƒ”შე
+Comment[kk]=Qt құрамындағы нақыштарÑыз CDE-Ñекілді Ñтиль
+Comment[km]=រចនាបáŸáž‘្ម CDE ដែល​គ្មាន​ស្បែក​ជាប់
+Comment[ko]=CDE와 ê°™ì€ ê¼´ì„ ê°€ì§„ ë¶™ë°•ì´ í…Œë§ˆ
+Comment[lb]=Agebauten CDE-Stil ouni Thema
+Comment[lt]=Įtaisytas betemis CDE stilius
+Comment[lv]=Iebūvēts beztēmas CDE stils
+Comment[mk]=Вграден CDE Ñтил (без тема)
+Comment[mn]=Ðгшаалттай ÑуулгаÑан CDE-Ñ…ÑлбÑÑ€
+Comment[ms]=Gaya CDE bina dalam
+Comment[mt]=Stil bla tema CDE
+Comment[nb]=Innebygget CDE-stil uten tema
+Comment[nds]=Inbuut CDE-Stil (ahn Muster)
+Comment[ne]=विषयवसà¥à¤¤à¥ नभà¤à¤•à¥‹ CDE शैलीमा निरà¥à¤®à¤¾à¤£
+Comment[nl]=Ingebouwde, themaloze CDE-stijl
+Comment[nn]=Innebygd CDE-stil utan tema
+Comment[nso]=Mokgwa wa CDE wa kagelogare wo osenago molaetsa
+Comment[oc]=Estil incorporat CDE sense temes
+Comment[pa]=ਵਿੱਚੇ ਸ਼ਾਮਿਲ CDE ਸ਼ੈਲੀ
+Comment[pl]=Wbudowany styl CDE, bez motywów
+Comment[pt]=Estilo embutido CDE
+Comment[pt_BR]=Estilo predefinido CDE
+Comment[ro]=Stil fără tematică CDE
+Comment[ru]=Ð’Ñтроенный в Qt Ñтиль без тем, похожий на CDE
+Comment[rw]=Imisusire CDE itahawe insanganyamatsiko nkoranwa
+Comment[se]=Sisahuksejuvvon CDE-stiila fáttáhaga
+Comment[sk]=Zabudovaný netémový CDE štýl
+Comment[sl]=Vgrajeni obiÄajni slog CDE
+Comment[sr]=Уграђени, без теме, CDE Ñтил
+Comment[sr@Latn]=Ugrađeni, bez teme, CDE stil
+Comment[sv]=Inbyggd otemad CDE-stil
+Comment[ta]=உளà¯à®³à®®à¯ˆà®¨à¯à®¤ மேமà¯à®ªà®Ÿà¯à®¤à¯à®¤à®¿à®¯ CDE பாணி
+Comment[te]=అంతరà±à°—à°¤ వైవిదà±à°¯à°¾à°‚శంలేని సిడిఈ శైలి
+Comment[tg]=ДониÑтани тарҳи аз нав Ñохтани CDE Ñабк аÑÑ‚
+Comment[th]=รูปà¹à¸šà¸šà¸•à¸±à¸§à¸ˆà¸±à¸”à¸à¸²à¸£à¸«à¸™à¹‰à¸²à¸•à¹ˆà¸²à¸‡ CDE ที่มีมาให้
+Comment[tr]=Yerleşik, temasız CDE stili
+Comment[tt]=CDE kebek köylänmäslek eçke tışlaw
+Comment[uk]=Вбудований Ñтиль CDE без теми
+Comment[uz]=Ichki mavzusiz CDE uslubi
+Comment[uz@cyrillic]=Ички мавзуÑиз CDE уÑлуби
+Comment[ven]=Tshitaela tsha CDE tsho fhatelwaho ngomu
+Comment[vi]=Kiểu dáng CDE có sẵn không có sắc thái.
+Comment[xh]=Uhlobo olungenamxholo olakhelwe-ngaphakathi lwe CDE
+Comment[zh_CN]=内建的无主题 CDE 风格
+Comment[zh_HK]=內置類似沒有修改風格的 CDE 佈景
+Comment[zh_TW]=內建的無主題 CDE 風格
+Comment[zu]=Isitayela Sokwakheka-ngaphakathi okungenagqikithi
+[KDE]
+WidgetStyle=CDE
diff --git a/tdestyles/themes/qtmotif.themerc b/tdestyles/themes/qtmotif.themerc
new file mode 100644
index 000000000..dfdc9b0dc
--- /dev/null
+++ b/tdestyles/themes/qtmotif.themerc
@@ -0,0 +1,94 @@
+[Misc]
+Name=Motif
+Name[af]=Motief
+Name[bn]=মোটিফ
+Name[fa]=موتیÙ
+Name[hi]=यूटी मोटिफ़
+Name[ko]=모티프
+Name[ne]=मोटिफ
+Name[pa]=ਮੋਟੀਫ
+Name[ta]=மோடிஃபà¯
+Name[te]=మోటిఫà±
+Name[th]=โมทิฟ
+Comment=Built-in unthemed Motif style
+Comment[af]=Ingeboude ongetemade motief styl
+Comment[ar]=مظهر مضمن مشابه لMotif
+Comment[az]=Yerləşmiş, örtüsüz Motif tərzi
+Comment[be]=Убудаваны Ñтыль Motif
+Comment[bg]=Вграден в библиотеката Qt Ñтил без тема Motif
+Comment[br]=Giz Motif enframmet anwisket
+Comment[bs]=Ugrađeni Motif stil bez teme
+Comment[ca]=Estil encastat del Motif sense temes
+Comment[cs]=Zabudovaný styl Motif (bez motivu)
+Comment[csb]=Wbùdowóny sztél Motif, bez témów
+Comment[cy]=Arddull Motif mewnadeiladedig heb thema
+Comment[da]=Indbygget Motif-stil uden tema
+Comment[de]=Eingebauter, reduzierter Motif-Stil
+Comment[el]=Ενσωματωμένο στυλ παÏόμοιο με το Motif
+Comment[eo]=Originala Motif-stilo neetosa
+Comment[es]=Estilo incorporado Motif sin tema
+Comment[et]=Qt Motif'i-laadne teemata stiil
+Comment[eu]=Gairik gabeko Motif estiloa
+Comment[fa]=سبک موتی٠بدون چهرۀ توکار
+Comment[fi]=Sisäänrakennettu teemoittamaton Motif-tyyli
+Comment[fr]=Style Motif d'origine sans thème
+Comment[fy]=Ynboude, temaleaze Motif-styl
+Comment[ga]=Stíl insuite gan téama, cosúil le Motif
+Comment[gl]=Estilo incorporado Motif sen tema
+Comment[he]=ערכת × ×•×©× ×¤× ×™×ž×™×ª תו×מת Motif
+Comment[hi]=अंतरà¥à¤¨à¤¿à¤°à¥à¤®à¤¿à¤¤ अनथीमà¥à¤¡ मोटिफ शैली
+Comment[hr]=Ugrađeni Motif stil, bez teme
+Comment[hu]=Beépített Motif-stílus
+Comment[id]=Gaya ala Motif built-in tanpa tema
+Comment[is]=Innbyggður stíll sem minnir á Motif unhverfið (án þema)
+Comment[it]=Stile Motif interno senza tema
+Comment[ja]=ビルトイン Motif スタイル (テーマãªã—)
+Comment[ka]=ჩáƒáƒ“გმული Motif სტილი თემის გáƒáƒ áƒ”შე
+Comment[kk]=Qt құрамындағы нақыштарÑыз Motif-Ñекілді Ñтиль
+Comment[km]=រចនាបáŸáž‘្ម Motif ដែល​គ្មានស្បែក​ជាប់
+Comment[ko]=모티프와 ê°™ì€ ê¼´ì„ ê°€ì§„ ë¶™ë°•ì´ í…Œë§ˆ
+Comment[lb]=Agebaute Motif-Stil ouni Thema
+Comment[lt]=Įtaisytas betemis Motif stilius
+Comment[lv]=Iebūvēts beztēmas Motif stils
+Comment[mk]=Вграден Motif Ñтил (без тема)
+Comment[mn]=Motif-Ð¥ÑлбÑÑ€
+Comment[ms]=Gaya Motif bina dalam
+Comment[mt]=Stil bla tema Motif
+Comment[nb]=Innebygget Motif-stil uten tema
+Comment[nds]=Inbuut Motif-Stil (ahn Muster)
+Comment[ne]=विषयवसà¥à¤¤à¥ नभà¤à¤•à¥‹ मोटिफ शैलीमा निरà¥à¤®à¤¾à¤£
+Comment[nl]=Ingebouwde, themaloze Motifstijl
+Comment[nn]=Innebygd Motif-stil utan tema
+Comment[nso]=Mokgwa wa Motif wa kagelogare wo osenago molaetsa
+Comment[oc]=Estil incorporat Motif sense temes
+Comment[pa]=ਵਿੱਚੇ ਸ਼ਾਮਿਲ ਮੋਟੀਂਫ ਸ਼ੈਲੀ
+Comment[pl]=Wbudowany styl Motif, bez motywów
+Comment[pt]=Estilo embutido Motif
+Comment[pt_BR]=Estilo Motif predefinido
+Comment[ro]=Stil fără tematică Motif
+Comment[ru]=Ð’Ñтроенный в Qt Ñтиль без тем, похожий на Motif
+Comment[rw]=Imisusire y'Umutako itahawe insanganyamatsiko nkoranwa
+Comment[se]=Sisahuksejuvvon Motif-stiila fáttáhaga
+Comment[sk]=Zabudovaný netémový CDE štýl
+Comment[sl]=Vgrajen obiÄajni slog Motif
+Comment[sr]=Уграђени, без теме, Motif Ñтил
+Comment[sr@Latn]=Ugrađeni, bez teme, Motif stil
+Comment[sv]=Inbyggd otemad Motif-stil
+Comment[ta]=உளà¯à®³à®®à¯ˆà®¨à¯à®¤ மேமà¯à®ªà®Ÿà¯à®¤à¯à®¤à®¿à®¯ மோடிஃப௠பாணி
+Comment[te]=అంతరà±à°—à°¤ వైవిదà±à°¯à°¾à°‚శంలేని మోటిఫౠశైలి
+Comment[tg]= Сохташудани Сабки Motif бебарнома аÑÑ‚
+Comment[th]=รูปà¹à¸šà¸šà¹‚มทิฟ ที่มีมาให้
+Comment[tr]=Yerleşik, temasız Motif stili
+Comment[tt]=Motif kebek köylänmäslek eçke tışlaw
+Comment[uk]=Вбудований Ñтиль Motif без теми
+Comment[uz]=Ichki mavzusiz Motif uslubi
+Comment[uz@cyrillic]=Ички мавзуÑиз Motif уÑлуби
+Comment[ven]=Tshitaela tsha mothifi tsho fhatelwaho ngomu
+Comment[vi]=Kiểu dáng Motif có sẵn không có sắc thái.
+Comment[xh]=Uhlobo lwe Motir olungenamxholo olakhelwe-ngaphakathi
+Comment[zh_CN]=内建的无主题 Motif 风格
+Comment[zh_HK]=內置類似沒有修改風格的 Motif 佈景
+Comment[zh_TW]=內建的無主題 Motif 風格
+Comment[zu]=Ukwakekha-ngaphakathi okungenagqikithi sesitayela se-Motif
+[KDE]
+WidgetStyle=Motif
diff --git a/tdestyles/themes/qtmotifplus.themerc b/tdestyles/themes/qtmotifplus.themerc
new file mode 100644
index 000000000..d12e5dc51
--- /dev/null
+++ b/tdestyles/themes/qtmotifplus.themerc
@@ -0,0 +1,104 @@
+[Misc]
+Name=Motif Plus
+Name[af]=Motief Plus
+Name[bn]=মোটিফ পà§à¦²à¦¾à¦¸
+Name[br]=Motif Mui
+Name[cy]=Motif Plws
+Name[fa]=موتی٠ممتاز
+Name[hi]=मोटिफ़ पà¥à¤²à¤¸
+Name[is]=Motif plús
+Name[it]=Motif plus
+Name[ja]=Motif プラス
+Name[ko]=모티프 플러스
+Name[ne]=मोटिफ पà¥à¤²à¤¸
+Name[nn]=Motif pluss
+Name[pa]=ਮੋਟੀਫ ਨਵਾਂ
+Name[rw]=Impamvu Nyongera
+Name[ta]=மோடிஃப௠பà¯à®³à®¸à¯
+Name[te]=మోటిఫౠపà±à°²à°¸à±
+Name[th]=โมทีฟพลัส
+Name[vi]=Motif Cá»™ng
+Comment=Built-in enhanced Motif style
+Comment[af]=Ingeboude verbeterde Motief styl
+Comment[ar]=مظهر مضمن محسّن مشابه لMotif
+Comment[az]=Yerləşmiş, örtüsüz Motif tərzi
+Comment[be]=Убудаваны палепшаны Ñтыль Motif
+Comment[bg]=Допълнително разширен, вграден в библиотеката Qt Ñтил без тема Motif
+Comment[br]=Giz Motif enframmet gwellaet
+Comment[bs]=Ugrađeni napredni Motif stil
+Comment[ca]=Estil encastat del Motif millorat
+Comment[cs]=Zabudovaný vylepšený styl Motif
+Comment[csb]=Wbùdowóny, pòszerzony sztél Motif
+Comment[cy]=Arddull Motif mewnadeiladedig uwch
+Comment[da]=Indbygget udvidet Motif-stil
+Comment[de]=Eingebauter, erweiterter Motif-Stil
+Comment[el]=Ενσωματωμένο στυλ παÏόμοιο με το Motif με βελτιώσεις
+Comment[eo]=Enkonstruita etendita Motif-stilo
+Comment[es]=Estilo incorporado Motif mejorado
+Comment[et]=Qt täiustatud Motif'i-laadne stiil
+Comment[eu]=Gairik gabeko Motif estilo hobetua
+Comment[fa]=سبک موتی٠اÙزودۀ توکار
+Comment[fi]=Sisäänrakennettu paranneltu Motif-tyyli
+Comment[fr]=Style Motif amélioré d'origine
+Comment[fy]=Ynboude, ferbettere Motif-styl
+Comment[ga]=Stíl insuite méadaithe, cosúil le Motif
+Comment[gl]=Estilo incorporado Motif mellorado sen tema
+Comment[he]=ערכת × ×•×©× ×¤× ×™×ž×™×ª תו×מת Motif משופרת
+Comment[hi]=अंतरà¥à¤¨à¤¿à¤°à¥à¤®à¤¿à¤¤ à¤à¤¨à¤¹à¥‡à¤‚सà¥à¤¡ मोटिफ शैली
+Comment[hr]=Ugrađeni unaprijeđeni Motif stil, bez teme
+Comment[hu]=Beépített továbbfejlesztett Motif-stílus
+Comment[id]=Gaya modifikasi Motif tanpa tema
+Comment[is]=Innbyggður stíll, endurbætt Motif unhverfi
+Comment[it]=Stile Motif interno avanzato
+Comment[ja]=ビルトイン Motif スタイル 改良版
+Comment[ka]=ჩáƒáƒ“გმული გáƒáƒ£áƒ›áƒ¯áƒáƒ‘ესებული Motif სტილი
+Comment[kk]=Qt құрамындағы жетілдірген Motif-Ñекілді Ñтиль
+Comment[km]=រចនាបáŸáž‘្ម Motif ជាប់
+Comment[ko]=ë” ë‚˜ì€ ëª¨í‹°í”„ì™€ ê°™ì€ ê¼´ì„ ê°€ì§„ ë¶™ë°•ì´ í…Œë§ˆ
+Comment[lb]=Agebauten, erweiderte Motif-Stil
+Comment[lt]=Įtaisytas išplėstas Motif stilius
+Comment[lv]=Iebūvēts uzlabots Motif stils
+Comment[mk]=Вграден напреден Motif Ñтил
+Comment[mn]=Ðгшаалттай ÑуулгаÑан Motif-Ñ…ÑлбÑÑ€
+Comment[ms]=Gaya Motif bina dalam lanjut
+Comment[mt]=Stil Motif estiż
+Comment[nb]=Innebygget utvidet Motif-stil
+Comment[nds]=Inbuut verwiedert Motif-Stil
+Comment[ne]=विसà¥à¤¤à¤¾à¤°à¤¿à¤¤ मोटिफ शैलीमा निरà¥à¤®à¤¾à¤£
+Comment[nl]=Ingebouwde verbeterde Motifstijl
+Comment[nn]=Innebygd forbetra Motif-stil
+Comment[nso]=Mokgwa wa kagelogare wo o hlohloleditswego wa Motif
+Comment[oc]=Estil incorporat Motif amelhorat
+Comment[pa]=ਨਵੀਂ ਮੋਟੀਫ ਸ਼ੈਲੀ
+Comment[pl]=Wbudowany, rozszerzony styl Motif
+Comment[pt]=Estilo embutido melhorado de Motif
+Comment[pt_BR]=Estilo Motif interno melhorado
+Comment[ro]=Stil Motif îmbunătăţit
+Comment[ru]=Ð’Ñтроенный в Qt улучшенный Ñтиль Motif
+Comment[rw]=Imisusire y'Umutako ivuguruwe nkoranwa
+Comment[se]=Sisahuksejuvvon buorádallon Motif-stiila
+Comment[sk]=Zabudovaný vylepšený štýl Motif
+Comment[sl]=Vgrajen izboljšani slog Motif
+Comment[sr]=Уграђени, унапређени, Motif Ñтил
+Comment[sr@Latn]=Ugrađeni, unapređeni, Motif stil
+Comment[sv]=Inbyggd utökad Motif-stil
+Comment[ta]=உளà¯à®³à®®à¯ˆà®¨à¯à®¤ மேமà¯à®ªà®Ÿà¯à®¤à¯à®¤à®¿à®¯ மோடிஃப௠பாணி
+Comment[te]=అంతరà±à°—à°¤ à°…à°­à°¿à°µà±à°°à±à°¦à±à°¦à°¿à°ªà°°à°¿à°šà°¿à°¨ మోటిఫౠశైలి
+Comment[tg]=Сохташудани Сабки Motif тез аÑÑ‚
+Comment[th]=รูปà¹à¸šà¸šà¹‚มทีฟที่ปรับปรุงขึ้นมา
+Comment[tr]=Yerleşik, temasız Motif stili
+Comment[tt]=Motif kebek köylänmäslek yaxşırtılğan eçke tışlaw
+Comment[uk]=Вбудований покращений Ñтиль Motif
+Comment[uz]=Kengaytirilgan ichki Motif uslubi
+Comment[uz@cyrillic]=Кенгайтирилган ички Motif уÑлуби
+Comment[ven]=Tshitaela tsho fhatelwaho nga ngomu
+Comment[vi]=Name=Kiểu dáng Motif có sẵn tăng cÆ°á»ng.
+Comment[xh]=Uhlobo lwe Motif olunyusiweyo olwakhelwe-ngaphakathi
+Comment[zh_CN]=内建的增强的 Motif 风格
+Comment[zh_HK]=內置的增強的 Motif 風格
+Comment[zh_TW]=內建的增強的 Motif 風格
+Comment[zu]=Isitayela se-Mofit esenziwe ngcono
+[KDE]
+WidgetStyle=MotifPlus
+[Desktop Entry]
+Hidden=true
diff --git a/tdestyles/themes/qtplatinum.themerc b/tdestyles/themes/qtplatinum.themerc
new file mode 100644
index 000000000..08227bc4c
--- /dev/null
+++ b/tdestyles/themes/qtplatinum.themerc
@@ -0,0 +1,109 @@
+[Misc]
+Name=Platinum
+Name[be]=Платына
+Name[bn]=পà§à¦²à§à¦¯à¦¾à¦Ÿà¦¿à¦¨à¦¾à¦®
+Name[csb]=Platina
+Name[cy]=Platinwm
+Name[eo]=Plateno
+Name[fa]=پلاتین
+Name[hi]=पà¥à¤²à¥‡à¤Ÿà¤¿à¤¨à¤®
+Name[is]=Platínum
+Name[it]=Platino
+Name[ko]=플래티넘
+Name[lt]=Platina
+Name[lv]=Platīns
+Name[mn]=Платиниум
+Name[nds]=Platin
+Name[ne]=पà¥à¤²à¤¾à¤Ÿà¤¿à¤¨à¤®
+Name[pa]=ਪਲੈਟੀਨਮ
+Name[pl]=Platyna
+Name[sv]=Platina
+Name[ta]=பிளாடà¯à®Ÿà®¿à®©à®®à¯
+Name[te]=à°ªà±à°²à°¾à°Ÿà°¿à°¨à°‚
+Name[th]=à¹à¸žà¸¥à¸•à¸•à¸´à¸™à¸±à¸¡
+Name[tr]=Platin
+Name[vi]=Bạch kim
+Name[wa]=Platene
+Name[zh_CN]=白金
+Comment=Built-in unthemed Platinum style
+Comment[af]=Ingeboude ongetemade Platinum styl
+Comment[ar]=مظهر مضمن Platinum
+Comment[az]=Yerləşmiş, örtüsüz Platin tərzi
+Comment[be]=Убудаваны Ñтыль Платына
+Comment[bg]=Вграден в библиотеката Qt Ñтил без тема Platinum
+Comment[br]=Giz Platinum enframmet anwisket
+Comment[bs]=Ugrađeni Platinum stil bez teme
+Comment[ca]=Estil encastat del Platinium sense temes
+Comment[cs]=Zabudovaný styl Platinum (bez motivu)
+Comment[csb]=Wbùdowóny sztél Platina, bez témów
+Comment[cy]=Arddull Platinwm mewnadeiladedig heb thema
+Comment[da]=Indbygget platin-stil uden tema
+Comment[de]=Eingebauter, reduzierter Platin-Stil
+Comment[el]=Ενσωματωμένο στυλ Platinum
+Comment[eo]=Originala Platena stilo neetosa
+Comment[es]=Estilo incorporado Platinum sin tema
+Comment[et]=Qt Platinum teemata stiil
+Comment[eu]=Gairik gabeko Platinum estiloa
+Comment[fa]=سبک پلاتین بدون چهرۀ توکار
+Comment[fi]=Sisäänrakennettu teemoittamaton Platinium-tyyli
+Comment[fr]=Style Platinum d'origine sans thème
+Comment[fy]=Ynboude, temaleaze Platinum-styl
+Comment[ga]=Platinum - Stíl insuite gan téama
+Comment[gl]=Estilo incorporado Platinum sen tema
+Comment[he]=ערכת × ×•×©× ×¤× ×™×ž×™×ª תו×מת Platinum
+Comment[hi]=अंतरà¥à¤¨à¤¿à¤°à¥à¤®à¤¿à¤¤ अनथीमà¥à¤¡ पà¥à¤²à¥‡à¤Ÿà¤¿à¤¨à¤® शैली
+Comment[hr]=Ugrađeni Platinum stil, bez teme
+Comment[hu]=Beépített Platinum stílus
+Comment[id]=Gaya ala Platinum built-in tanpa tema
+Comment[is]=Innbyggði Platínum stíllinn (án þema)
+Comment[it]=Stile Platino interno senza tema
+Comment[ja]=ビルトイン Platinum スタイル (テーマãªã—)
+Comment[ka]=ჩáƒáƒ“გმული Platinum სტილი თემის გáƒáƒ áƒ”შე
+Comment[kk]=Qt құрамындағы нақыштарÑыз Platinum Ñтилі
+Comment[km]=រចនាបáŸáž‘្ម Platinum ដែល​គ្មានស្បែកជាប់
+Comment[ko]=플래티넘과 ê°™ì€ ê¼´ì„ ê°€ì§„ ë¶™ë°•ì´ í…Œë§ˆ
+Comment[lb]=Agebaute Platinum-Stil ouni Thema
+Comment[lt]=Įtaisytas betemis Platinos stilius
+Comment[lv]=Iebūvēts beztēmas Platīna stils
+Comment[mk]=Вграден платинум Ñтил (без тема)
+Comment[mn]=Ðгшаалттай ÑуулгаÑан Platin--Ñ…ÑлбÑÑ€
+Comment[ms]=Gaya Platinum bina dalam
+Comment[mt]=Stil Platinum bla tema
+Comment[nb]=Innebygget Platinum-stil
+Comment[nds]=Inbuut Platin-Stil (ahn Muster)
+Comment[ne]=विषय वसà¥à¤¤à¥ नभà¤à¤•à¥‹ पà¥à¤²à¤¾à¤Ÿà¤¿à¤¨à¤® शैलीमा निरà¥à¤®à¤¾à¤£
+Comment[nl]=Ingebouwde themaloze Platinum-stijl
+Comment[nn]=Innebygd Platinum-stil utan tema
+Comment[nso]=Mokgwa wa Platinum wa kagelogare wo osenago molaetsa
+Comment[oc]=Estil incorporat Plati sense temes
+Comment[pa]=ਵਿੱਚੇ ਸ਼ਾਮਿਲ ਪਲਾਟੀਨਮ ਸ਼ੈਲੀ
+Comment[pl]=Wbudowany styl Platyna, bez motywów
+Comment[pt]=Estilo embutido Platinum
+Comment[pt_BR]=Estilo Platinum predefinido
+Comment[ro]=Stil fără tematică Platinum
+Comment[ru]=Ð’Ñтроенный в Qt Ñтиль без тем Platinum
+Comment[rw]=Imiterere ya Pulatine itahawe insanganyamatsiko nkorana
+Comment[se]=Sisahuksejuvvon Platinum-stiila fáttáhaga
+Comment[sk]=Zabudovaný platinový štýl bez témy
+Comment[sl]=Netematski vgrajeni platinasti slog
+Comment[sr]=Уграђени, без теме, Platinum Ñтил
+Comment[sr@Latn]=Ugrađeni, bez teme, Platinum stil
+Comment[sv]=Inbyggd otemad platinumstil
+Comment[ta]=உளà¯à®³à®®à¯ˆà®¨à¯à®¤ தலைபà¯à®ªà®¿à®²à¯à®²à®¾ பிளாடà¯à®Ÿà®¿à®©à®®à¯ பாணி
+Comment[te]=అంతరà±à°—à°¤ వైవిదà±à°¯à°¾à°‚శంలేని à°ªà±à°²à°¾à°Ÿà°¿à°¨à°®à± శైలి
+Comment[tg]=Сохташудани Сабки Platinum Motif бебарнома аÑÑ‚
+Comment[th]=รูปà¹à¸šà¸šà¹à¸žà¸¥à¸•à¸•à¸´à¸™à¸±à¸¡
+Comment[tr]=Yerleşik, temasız Platin stili
+Comment[tt]=Platinum kebek köylänmäslek eçke tışlaw
+Comment[uk]=Вбудований Ñтиль Platinum без теми
+Comment[uz]=Ichki mavzusiz Platinum uslubi
+Comment[uz@cyrillic]=Ички мавзуÑиз Platinum уÑлуби
+Comment[ven]=Tshitale tsha pulathinamu tsho fhatelwaho nga ngomu
+Comment[vi]=Kiểu dáng Bạch Kim có sẵn không có sắc thái.
+Comment[xh]=Uhloboa lwe Platinum olungenamxholo olwakhelwe-ngaphakathi
+Comment[zh_CN]=内建的无主题白金风格
+Comment[zh_HK]=內置的無主題 Platinum 風格
+Comment[zh_TW]=內建的無主題 Platinum 風格
+Comment[zu]=Yakhelwe-kuhlobo lwesingenabizogama isitayelaPlatinum
+[KDE]
+WidgetStyle=Platinum
diff --git a/tdestyles/themes/qtsgi.themerc b/tdestyles/themes/qtsgi.themerc
new file mode 100644
index 000000000..85cf8b7b0
--- /dev/null
+++ b/tdestyles/themes/qtsgi.themerc
@@ -0,0 +1,90 @@
+[Misc]
+Name=SGI
+Name[bn]=à¦à¦¸-জি-আই
+Name[hi]=à¤à¤¸à¤œà¥€à¤†à¤ˆ
+Name[nl]=SIG
+Name[te]=à°à°¸à± జిà°
+Name[th]=เอสจีไอ
+Comment=Built-in SGI style
+Comment[af]=Ingeboude Sgi styl
+Comment[ar]=مظهر مضمن مشابه لSGI
+Comment[az]=SGI tərzi
+Comment[be]=Убудаваны Ñтыль SGI
+Comment[bg]=Вграден в библиотеката Qt Ñтил без тема SGI
+Comment[br]=Giz SGI enframmet
+Comment[bs]=Ugrađeni SGI stil
+Comment[ca]=Estil encastat del SGI
+Comment[cs]=Zabudovaný SGI styl
+Comment[csb]=Wbùdowóny sztél SGI
+Comment[cy]=Thema SGI mewnadeiladedig
+Comment[da]=Indbygget SGI-stil
+Comment[de]=Eingebauter SGI-Stil
+Comment[el]=Ενσωματωμένο στυλ παÏόμοιο με το SGI
+Comment[eo]=Enkonstruita SGI-stilo
+Comment[es]=Estilo incorporado SGI
+Comment[et]=Qt SGI stiil
+Comment[eu]=SGI estiloa
+Comment[fa]=سبک SGI توکار
+Comment[fi]=Sisäänrakennettu SGI-tyyli
+Comment[fr]=Style SGI d'origine
+Comment[fy]=Ynboude SGI-styl
+Comment[ga]=Stíl insuite SGI
+Comment[gl]=Estilo incorporado SGI
+Comment[he]=ערכת × ×•×©× ×¤× ×™×ž×™×ª תו×מת SGI
+Comment[hi]=अंतरà¥à¤¨à¤¿à¤°à¥à¤®à¤¿à¤¤ à¤à¤¸à¤œà¥€à¤†à¤ˆ शैली
+Comment[hr]=Ugrađeni SGI stil
+Comment[hu]=Beépített SGI stílus
+Comment[id]=Gaya ala SGI built-in
+Comment[is]=Innbyggður stíll sem minnir á SGI notendaskilin
+Comment[it]=Stile SGI interno
+Comment[ja]=ビルトイン SGI スタイル
+Comment[ka]=ჩáƒáƒ“გმული SGI სტილი
+Comment[kk]=Qt құрамындағы SGI Ñтилі
+Comment[km]=រចនាបáŸáž‘្ម Built-in SGI
+Comment[ko]=SGI와 ê°™ì€ ê¼´ì„ ê°€ì§„ ë¶™ë°•ì´ í…Œë§ˆ
+Comment[lb]=Agebauten SGI-Stil
+Comment[lt]=Įtaisytas SGI stilius
+Comment[lv]=Iebūvēts SGI stils
+Comment[mk]=Вграден SGI Ñтил
+Comment[mn]=СуулгаÑан SGI-Ð¥ÑлбÑÑ€
+Comment[ms]=Gaya SGI bina dalam
+Comment[mt]=Stil SGI
+Comment[nb]=Innebygget SGI-stil
+Comment[nds]=Inbuut SGI-Stil
+Comment[ne]=SGI शैलीमा निरà¥à¤®à¤¾à¤£
+Comment[nl]=Ingebouwde SGI-stijl
+Comment[nn]=Innebygd SGI-stil
+Comment[nso]=Mokgwa wa Kagelo gare wa SGI
+Comment[oc]=Estil incorporat SGI
+Comment[pa]=ਵਿੱਚੇ ਸ਼ਾਮਿਲ SGI ਸ਼ੈਲੀ
+Comment[pl]=Wbudowany styl SGI
+Comment[pt]=Estilo embutido de SGI
+Comment[pt_BR]=Estilo predefinido SGI
+Comment[ro]=Stil SGI
+Comment[ru]=Ð’Ñтроенный в Qt Ñтиль, похожий на SGI
+Comment[rw]=Imisusire SGI nkoranwa
+Comment[se]=Sisahuksejuvvon SGI-stiila
+Comment[sk]=Zabudovaný SGI štýl
+Comment[sl]=Vgrajeni slog SGI
+Comment[sq]=Stili SGI i ambalazhuar
+Comment[sr]=Уграђени SGI Ñтил
+Comment[sr@Latn]=Ugrađeni SGI stil
+Comment[sv]=Inbyggd SGI-stil
+Comment[ta]=உளà¯à®³à®®à¯ˆà®¨à¯à®¤ SGI பாணி
+Comment[te]=అంతరà±à°—à°¤ ఎసౠజిఠశైలి
+Comment[tg]=Ðз нав Ñохтани SGI Ñабк
+Comment[th]=รูปà¹à¸šà¸š SGI
+Comment[tr]=SGI stili
+Comment[tt]=SGI kebek eçke tışlaw
+Comment[uk]=Вбудований Ñтиль SGI
+Comment[uz]=Ichki SGI uslubi
+Comment[uz@cyrillic]=Ички SGI уÑлуби
+Comment[ven]=Tshitaela tsha SGI tsho fhatelwaho nga ngomu
+Comment[vi]=Kiểu dáng SGI có sẵn.
+Comment[xh]=Uhlobo lwe SGI olwakhelwe-ngaphakathi
+Comment[zh_CN]=内建的 SGI 风格
+Comment[zh_HK]=內置的 SGI 風格
+Comment[zh_TW]=內建的 SGI 風格
+Comment[zu]=Yakhelwe-kwisitayela se SGI
+[KDE]
+WidgetStyle=SGI
diff --git a/tdestyles/themes/qtwindows.themerc b/tdestyles/themes/qtwindows.themerc
new file mode 100644
index 000000000..68ee69815
--- /dev/null
+++ b/tdestyles/themes/qtwindows.themerc
@@ -0,0 +1,96 @@
+[Misc]
+Name=MS Windows 9x
+Name[bn]=à¦à¦®-à¦à¦¸ উইনà§à¦¡à§‹à¦¸ ৯x
+Name[eo]=Vindozo 9x
+Name[gl]=MS Windows 8x
+Name[hi]=à¤à¤®à¤à¤¸ विंडोज़ 9x
+Name[ko]=MS 윈ë„우즈 9x
+Name[lt]=MSWindows 9x
+Name[ne]=MS विनà¥à¤¡à¥‹à¤œ 9x
+Name[se]=Windows
+Name[te]=ఎమౠఎసౠవిండొసౠ9x
+Name[th]=เอ็มเอสวินโดว์ส 9x
+Name[vi]=MSâ„¢ Windows 9x
+Name[zh_TW]=MSWindows 9x
+Comment=Built-in unthemed Windows 9x style
+Comment[af]=Ingeboude ongetemade Vensters 9x styl
+Comment[ar]=مظهر مضمن مشابه لويندوز
+Comment[az]=Yerləşmiş, örtüsüz Windows 98 tərzi
+Comment[be]=Убудаваны Ñтыль Windows 9x
+Comment[bg]=Вграден в библиотеката Qt Ñтил без тема, приличащ на Windows 98
+Comment[br]=Giz Windows enframmet anwisket
+Comment[bs]=Ugrađeni Windows 9x stil bez teme
+Comment[ca]=Estil encastat del Windows 9x sense temes
+Comment[cs]=Zabudovaný Windows 9x styl (bez motivu)
+Comment[csb]=Wbùdowóny sztél szlachùjący za Windows 9x, bez témów
+Comment[cy]=Arddull Windows 9x mewnadeiladedig heb thema
+Comment[da]=Indbygget Windows 9x-stil uden tema
+Comment[de]=Eingebauter, reduzierter Windows-9x-Stil
+Comment[el]=Ενσωματωμένο στυλ παÏόμοιο με το Windows 9x
+Comment[eo]=Senetosa Vindozo-9x-stilo
+Comment[es]=Estilo incorporado Windows 9x sin tema
+Comment[et]=Qt Windows9x-laadne teemata stiil
+Comment[eu]=Gairik gabeko Windows 9x estiloa
+Comment[fa]=سبک ویندوز 9x بدون چهره توکار
+Comment[fi]=Sisäänrakennettu teemoittamaton Windows 9x-tyyli
+Comment[fr]=Style Windows 9x d'origine sans thème
+Comment[fy]=Ynboude, temaleaze Windows 9x-styl
+Comment[ga]=Stíl insuite gan téama, cosúil le Windows 9x
+Comment[gl]=Estilo incorporado Windows 9x sen tema
+Comment[he]=ערכת × ×•×©× ×¤× ×™×ž×™×ª תו×מת Windows 9x
+Comment[hi]=अंतरà¥à¤¨à¤¿à¤°à¥à¤®à¤¿à¤¤ विंडोज़ 9x शैली
+Comment[hr]=Ugrađeni Windows 9x stil, bez teme
+Comment[hu]=Beépített Windows 9x-stílus
+Comment[id]=Gaya ala Windows 9x built-in tanpa tema
+Comment[is]=Innbyggður stíll sem minnir á Windows 9x (án þema)
+Comment[it]=Stile Windows 9x interno senza tema
+Comment[ja]=ビルトイン Windows 9x スタイル (テーマãªã—)
+Comment[ka]=ჩáƒáƒ“გმული Windows 9x სტილი თემის გáƒáƒ áƒ”შე
+Comment[kk]=Qt құрамындағы нақыштарÑыз Windows 9x Ñтилі
+Comment[km]=រចនាបáŸáž‘្ម Windows 9x ដែល​គ្មាន​ស្បែក
+Comment[ko]=윈ë„우즈 9X와 비슷한 ê¼´ì„ ê°€ì§„ ë¶™ë°•ì´ í…Œë§ˆ
+Comment[lb]=Agebaute Windows 9x-Stil ouni Thema
+Comment[lt]=Įtaisytas betemis Windows 9x stilius
+Comment[lv]=Iebūvēts beztēmas Windows 9x stils
+Comment[mk]=Вграден Windows 9x Ñтил (без тема)
+Comment[mn]=Ðгшаалттай ÑуулгаÑан Windows-9x-Ð¥ÑлбÑÑ€
+Comment[ms]=Gaya Windows 9x bina dalam
+Comment[mt]=Stil bla tema Windows 9x
+Comment[nb]=Innebygget Windows 9x-stil
+Comment[nds]=Inbuut Windows 9x-Stil (ahn Muster)
+Comment[ne]=विषयवसà¥à¤¤à¥ नभà¤à¤•à¥‹ विनà¥à¤¡à¥‹à¤œ 9x शैलीमा निरà¥à¤®à¤¾à¤£
+Comment[nl]=Ingebouwde, themaloze MS-Windows-9x-stijl
+Comment[nn]=Innebygd Windows 9x-stil utan tema
+Comment[nso]=Mokgwa wa Windows 9x wo o agetswego kagare wo osenago molaetsa
+Comment[oc]=Estil incorporat Windows 9x sense temes
+Comment[pa]=ਵਿੰਡੋ 9x ਵਰਗੀ ਸ਼ੈਲੀ
+Comment[pl]=Wbudowany styl podobny do Windows 9x, bez motywów
+Comment[pt]=Estilo embutido Windows 9x
+Comment[pt_BR]=Estilo Windows 9x predefinido
+Comment[ro]=Stil fără tematică Windows 9x
+Comment[ru]=Ð’Ñтроенный в Qt Ñтиль без тем, похожий на Windows 9x
+Comment[rw]=Imisusire Windows 9x nkoranwa idahawe insanganyamatsiko
+Comment[se]=Sisahuksejuvvon Windows 9x-stiila fáttáhaga
+Comment[sk]=Zabudovaný štýl Windows 9x bez témy
+Comment[sl]=Vgrajeni obiÄajni slog Windows 9x
+Comment[sr]=Уграђени, без теме, Ñтил Windows-а 9x
+Comment[sr@Latn]=Ugrađeni, bez teme, stil Windows-a 9x
+Comment[sv]=Inbyggd otemad Windows 9x-stil
+Comment[ta]=உளà¯à®³à®®à¯ˆà®¨à¯à®¤ தலைபà¯à®ªà®¿à®²à¯à®²à®¾ சாளரஙà¯à®•à®³à¯ 9x பாணி
+Comment[te]=అంతరà±à°—à°¤ వైదà±à°¯à°¾à°‚శంలేని విండొసౠ9x లాంటి శైలి
+Comment[tg]= Ðамуди Windows 9x бемавзӯи Ñохта шуда
+Comment[th]=รูปà¹à¸šà¸šà¸„ล้ายวินโดว์ส 9x
+Comment[tr]=Yerleşik, temasız Windows 98 stili
+Comment[tt]=Windows9x kebek köylänmäslek eçke tışlaw
+Comment[uk]=Вбудований Ñтиль Windows 9x без теми
+Comment[uz]=Ichki mavzusiz Windows 9x uslubi
+Comment[uz@cyrillic]=Ички мавзуÑиз Windows 9x уÑлуби
+Comment[ven]=Tshitaela tsha 9x tsha windo i songo bulwaho tsho fhatelwaho nga ngomu
+Comment[vi]=Kiểu dáng Windows 9x có sẵn không có sắc thái.
+Comment[xh]=Uhlobo lwe Windows 9x olungenamxholo olwakhelwe-ngaphakathi
+Comment[zh_CN]=内建的无主题 Windows 9x 风格
+Comment[zh_HK]=內置的無主題 Windows 9x 風格
+Comment[zh_TW]=內建的無主題 Windows 9x 風格
+Comment[zu]=Yakhelwe-kuhlobo kwisitayela samawindi 9x
+[KDE]
+WidgetStyle=Windows
diff --git a/tdestyles/utils/CMakeLists.txt b/tdestyles/utils/CMakeLists.txt
new file mode 100644
index 000000000..17411c0dc
--- /dev/null
+++ b/tdestyles/utils/CMakeLists.txt
@@ -0,0 +1,12 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_subdirectory( installtheme )
diff --git a/tdestyles/utils/Makefile.am b/tdestyles/utils/Makefile.am
new file mode 100644
index 000000000..e949d7ef2
--- /dev/null
+++ b/tdestyles/utils/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS= installtheme
+
diff --git a/tdestyles/utils/installtheme/CMakeLists.txt b/tdestyles/utils/installtheme/CMakeLists.txt
new file mode 100644
index 000000000..da9b81b9a
--- /dev/null
+++ b/tdestyles/utils/installtheme/CMakeLists.txt
@@ -0,0 +1,34 @@
+#################################################
+#
+# (C) 2010 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${TQT_INCLUDE_DIRS}
+ ${CMAKE_BINARY_DIR}/tdecore
+ ${CMAKE_SOURCE_DIR}/tdecore
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+##### kinstalltheme #############################
+
+set( target kinstalltheme )
+
+set( ${target}_SRCS
+ main.cpp
+)
+
+tde_add_executable( ${target}
+ SOURCES ${${target}_SRCS}
+ LINK tdecore-shared
+ DESTINATION ${BIN_INSTALL_DIR}
+)
diff --git a/tdestyles/utils/installtheme/Makefile.am b/tdestyles/utils/installtheme/Makefile.am
new file mode 100644
index 000000000..84272a681
--- /dev/null
+++ b/tdestyles/utils/installtheme/Makefile.am
@@ -0,0 +1,18 @@
+
+# set the include path for X, qt and KDE
+INCLUDES= $(all_includes)
+
+####### This part is very settheme specific
+# you can add here more. This one gets installed
+bin_PROGRAMS = kinstalltheme
+
+# Which sources should be compiled for settheme.
+kinstalltheme_SOURCES = main.cpp
+
+# the library search path.
+kinstalltheme_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
+
+# the libraries to link against. Be aware of the order. First the libraries,
+# that depend on the following ones.
+kinstalltheme_LDADD = $(LIB_QT) $(LIB_TDECORE)
+
diff --git a/tdestyles/utils/installtheme/main.cpp b/tdestyles/utils/installtheme/main.cpp
new file mode 100644
index 000000000..d73a8c7d6
--- /dev/null
+++ b/tdestyles/utils/installtheme/main.cpp
@@ -0,0 +1,90 @@
+/*
+ Copyright (c) 2002 Maksim Orlovich <mo002j@mail.rochester.edu>
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+*/
+
+#include <tqfileinfo.h>
+#include <tqmap.h>
+#include <tqstringlist.h>
+#include <tqsettings.h>
+
+#include <tdeapplication.h>
+#include <tdecmdlineargs.h>
+#include <tdeglobal.h>
+#include <tdelocale.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+
+static const char desc[] = I18N_NOOP("TDE Tool to build a cache list of all pixmap themes installed");
+static const char ver[] = "0.9.1";
+
+int main(int argc, char **argv)
+{
+ TDECmdLineArgs::init(argc, argv, "kinstalltheme", I18N_NOOP("KInstalltheme"), desc, ver);
+ TDEApplication qapp(false, false); //We don't allow styles.. Kind of ironic, isn't it?
+
+ TDEGlobal::dirs()->addResourceType("themercs", TDEGlobal::dirs()->kde_default("data")+TQString("tdestyle/themes"));
+ TQStringList themercs = TDEGlobal::dirs()->findAllResources("themercs","*.themerc");
+
+ TQMap <TQString, TQString> themes; //Name->file mapping..
+
+ for (TQStringList::iterator i = themercs.begin(); i!=themercs.end(); ++i)
+ {
+ TQString file=*i;
+ KSimpleConfig config(file, true);
+ TQString name = TQFileInfo(file).baseName(); //This is nice and static...
+ //So we don't have to worry about our key changing when the language does.
+
+ config.setGroup( "KDE" );
+
+ if (config.readEntry( "widgetStyle" ) == "basicstyle.la")
+ {
+ //OK, emit a style entry...
+ if (!themes.contains(name)) //Only add first occurrence, i.e. user local one.
+ themes[name] = file;
+ }
+ }
+
+ KSimpleConfig cache( TDEGlobal::dirs()->saveLocation("config")+"kthemestylerc");
+
+#if 0
+//Doesn't seem to work with present Qt..
+ TQStringList existing = cache.subkeyList("/kthemestyle");
+ for (TQStringList::iterator i = existing.begin(); i != existing.end(); i++)
+ {
+ cout<<"Have:"<<(*i).latin1()<<"\n";
+ cache.removeEntry("/ktmthestyle"+(*i));
+ }
+#endif
+
+ TQStringList themeNames; //A list of names, each occurring once - the keys of the themes map..
+
+ for (TQMap<TQString, TQString>::Iterator i = themes.begin(); i!=themes.end(); ++i)
+ {
+ cache.setGroup(i.key().lower());
+ cache.writePathEntry("file",TQFileInfo(i.data()).fileName());
+ themeNames.push_back(i.key());
+ }
+
+ cache.setGroup("General");
+ cache.writeEntry("themes", themeNames.join("^e")+"^e");
+
+ return 0;
+}
diff --git a/tdestyles/web/Makefile.am b/tdestyles/web/Makefile.am
new file mode 100644
index 000000000..bfcf992bc
--- /dev/null
+++ b/tdestyles/web/Makefile.am
@@ -0,0 +1,10 @@
+INCLUDES = $(all_includes)
+lib_LTLIBRARIES = webstyle.la
+webstyle_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+webstyle_la_LIBADD = $(LIB_TDEUI)
+webstyle_la_SOURCES = webstyle.cpp plugin.cpp
+noinst_HEADERS = webstyle.h
+
+tdestylewebdata_DATA = web.themerc
+tdestylewebdatadir = $(kde_datadir)/tdestyle/themes
+EXTRA_DIST = $(tdestylewebdata_DATA)
diff --git a/tdestyles/web/README b/tdestyles/web/README
new file mode 100644
index 000000000..42e198d00
--- /dev/null
+++ b/tdestyles/web/README
@@ -0,0 +1,7 @@
+Widget style which mimicks the 'flat' appearance favored by many
+web sites. If you set the scrollbar and (exclusive) indicator sizes
+to something small (say 8 pixels) then this makes a nice style for
+embedded apps.
+
+Maintainer: Rik Hemsley (rikkus) <rik@kde.org>
+
diff --git a/tdestyles/web/plugin.cpp b/tdestyles/web/plugin.cpp
new file mode 100644
index 000000000..bd4371ce3
--- /dev/null
+++ b/tdestyles/web/plugin.cpp
@@ -0,0 +1,11 @@
+#include <tdelocale.h>
+#include "webstyle.h"
+
+extern "C"
+{
+ TDEStyle * allocate() { return new WebStyle; }
+ int minor_version() { return 0; }
+ int major_version() { return 1; }
+ const char * description() { return(i18n("Web style plugin").utf8()); }
+}
+
diff --git a/tdestyles/web/web.themerc b/tdestyles/web/web.themerc
new file mode 100644
index 000000000..041d54da0
--- /dev/null
+++ b/tdestyles/web/web.themerc
@@ -0,0 +1,163 @@
+[Misc]
+Name=Web style
+Name[af]=Web styl
+Name[ar]=مظهر الويب
+Name[az]=Veb tərzi
+Name[be]=Стыль Сеціва
+Name[bn]=ওয়েব সà§à¦Ÿà¦¾à¦‡à¦²
+Name[br]=Giz gwiad
+Name[bs]=Web stil
+Name[ca]=Estil Web
+Name[cs]=Webový styl
+Name[csb]=Sztél Internetu
+Name[cy]=Arddull Gwe
+Name[da]=Netsidestil
+Name[de]=Webstil
+Name[el]=Στυλ Web
+Name[eo]=TTT-stilo
+Name[es]=Estilo Web
+Name[et]=Veebistiil
+Name[eu]=Web estiloa
+Name[fa]=سبک وب
+Name[fi]=Web-tyyli
+Name[fr]=Style web
+Name[fy]=Webstyl
+Name[ga]=Stíl Ghréasáin
+Name[gl]=Estilo Web
+Name[he]=סגנון רשת
+Name[hi]=वेब शैली
+Name[hr]=Web stil
+Name[hu]=Webes stílus
+Name[id]=Gaya Web
+Name[is]=Vefstíll
+Name[it]=Web
+Name[ja]=ウェブスタイル
+Name[ka]=Web სტილი
+Name[kk]=Веб Ñтилі
+Name[km]=រចនាបáŸáž‘្មរបស់​គáŸáž áž‘ំពáŸážš
+Name[ko]=웹 꼴
+Name[lb]=Web-Stil
+Name[lt]=Žiniatinklio stilius
+Name[lv]=Tīmekļa stils
+Name[mk]=Web Ñтил
+Name[mn]=Ð’Ñб Ñ…ÑлбÑÑ€
+Name[ms]=Gaya Web
+Name[mt]=Stil web
+Name[nb]=Vevstil
+Name[nds]=Web-Stil
+Name[ne]=वेब शैली
+Name[nl]=Webstijl
+Name[nn]=Vevstil
+Name[nso]=Mokgwa wa web
+Name[pa]=ਵੈਬ ਸ਼ੈਲੀ
+Name[pl]=Styl Internetu
+Name[pt]=Estilo Web
+Name[pt_BR]=Estilos Web
+Name[ro]=Stil web
+Name[ru]=Стиль Web
+Name[rw]=Imisusire y'urubuga
+Name[se]=Fierpmádat-stiila
+Name[sk]=Web štýl
+Name[sl]=Spletni slog
+Name[sq]=Stili Web
+Name[sr]=Веб Ñтил
+Name[sr@Latn]=Veb stil
+Name[sv]=Webbstil
+Name[ta]=வலைப௠பாணி
+Name[te]=వెబౠశైలి
+Name[tg]=Сабки Ð’Ñб
+Name[th]=รูปà¹à¸šà¸šà¹€à¸§à¹‡à¸š
+Name[tr]=Web stili
+Name[tt]=Web-tışlaw
+Name[uk]=Стиль "Тенета"
+Name[uz]=Veb uslubi
+Name[uz@cyrillic]=Веб уÑлуби
+Name[ven]=Tshitaela tsha webu
+Name[vi]=Kiểu dáng Mạng
+Name[xh]=Uhlobo lwe Web
+Name[zh_CN]=网络风格
+Name[zh_HK]=網站風格
+Name[zh_TW]=網站風格
+Name[zu]=Uhlobo lwe-web
+Comment=Web widget style
+Comment[af]=Web gui-element styl
+Comment[ar]=مظهر ويدجات الويب
+Comment[az]=Veb pəncərəcik tərzi
+Comment[be]=Стыль Сеціва
+Comment[bg]=Стил, приличащ на уеб графични обекти
+Comment[bn]=ওয়েব উইজেট সà§à¦Ÿà¦¾à¦‡à¦²
+Comment[br]=Giz widget gwiad
+Comment[bs]=Stil ukrasa na webu
+Comment[ca]=Estil d'objectes web
+Comment[cs]=Styl prvků webu
+Comment[csb]=Internetowi sztél elementów intefejsu
+Comment[cy]=Arddull celfigyn Gwe
+Comment[da]=Netsidekontrolstil
+Comment[de]=Web-ähnlicher Stil für Bedienelemente
+Comment[el]=Στυλ Web
+Comment[eo]=TTT-speca stilo
+Comment[es]=Estilo objeto visual Web
+Comment[et]=Veebi elementide sarnane stiil
+Comment[eu]=Web trepetaren estiloa
+Comment[fa]=سبک عنصر وب
+Comment[fi]=Web-tyyli
+Comment[fr]=Style web
+Comment[fy]=Web-widgetstyl
+Comment[gl]=Estilo de widgets Web
+Comment[he]=ערכנת × ×•×©× ×”×ž×•×©×¤×¢×ª מהרשת
+Comment[hi]=वेब विज़ेट शैली
+Comment[hr]=Web widget stil
+Comment[hu]=Webes elemstílus
+Comment[id]=Gaya widget Web
+Comment[is]=Vefeiningastíll
+Comment[it]=Stile Web
+Comment[ja]=ウェブウィジェットスタイル
+Comment[ka]=Web widget სტილი
+Comment[kk]=Веб Ñлементтер Ñтилі
+Comment[km]=រចនាបáŸáž‘្មរបស់​វážáŸ’ážáž»áž˜áž¾áž›â€‹ážƒáž¾áž‰â€‹áž“ៃ​គáŸáž áž‘ំពáŸážš
+Comment[ko]=웹 위젯 꼴
+Comment[lb]=Web-Widget-Stil
+Comment[lt]=Žiniatinklio valdiklių stilius
+Comment[lv]=Tīmekļa vidžeta stils
+Comment[mk]=Стил Ñо елементи како за на веб
+Comment[mn]=Ð’ÑбтÑй Ñ‚Ó©ÑÑ‚Ñй Ñ…ÑлбÑÑ€
+Comment[ms]=Gaya wijet Web
+Comment[mt]=Stil tal-widgets tal-web
+Comment[nb]=Elementstilen «vev»
+Comment[nds]=Web-Stil för Bedeenelementen
+Comment[ne]=वेब विजेट शैली
+Comment[nl]=Web widgetstijl
+Comment[nn]=Elementstilen «vev»
+Comment[nso]=Mokgwa wa widget wa web
+Comment[pa]=ਵੈੱਬ ਸਹਾਇਕ ਸ਼ੈਲੀ
+Comment[pl]=Internetowy styl elementów intefejsu
+Comment[pt]=Estilo gráfico Web
+Comment[pt_BR]=Estilo Widget Web
+Comment[ro]=Stil de componente Web
+Comment[ru]=Стиль web widget
+Comment[rw]=Imisusire y'uburyo bw'urubuga
+Comment[se]=Fierpmádatáđa-stiila
+Comment[sk]=Štýl prvku Web
+Comment[sl]=Slog spletnega gradnika
+Comment[sq]=Stili Web i emëruar
+Comment[sr]=Веб Ñтил контрола
+Comment[sr@Latn]=Veb stil kontrola
+Comment[sv]=Webbskärmdelsstil
+Comment[ta]=வலை சாளரப௠பாணி
+Comment[te]=వెబౠవిడà±à°œà±†à°Ÿà± శైలి
+Comment[tg]=Сабки тақои Ð’Ñб
+Comment[th]=รูปà¹à¸šà¸šà¹€à¸§à¹‡à¸š
+Comment[tr]=Web aleti benzeri stil
+Comment[tt]=Web widget tışlawı
+Comment[uk]=Стиль "Віджети Тенет"
+Comment[uz]=Veb uslubi
+Comment[uz@cyrillic]=Веб уÑлуби
+Comment[ven]=Tshitaela tsha webe ya Widget
+Comment[vi]=Kiểu dáng ô Ä‘iá»u khiển Mạng
+Comment[xh]=Uhlobo lwe widget ye Web
+Comment[zh_CN]=网络部件风格
+Comment[zh_HK]=Web 元件風格
+Comment[zh_TW]=Web 元件風格
+Comment[zu]=Uhlobo lwe-widget ye-web
+[KDE]
+widgetStyle=webstyle.la
diff --git a/tdestyles/web/webstyle.cpp b/tdestyles/web/webstyle.cpp
new file mode 100644
index 000000000..b3b461954
--- /dev/null
+++ b/tdestyles/web/webstyle.cpp
@@ -0,0 +1,1690 @@
+/*
+ * Copyright (C) 2001 Rik Hemsley (rikkus) <rik@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 as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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 INCLUDE_MENUITEM_DEF
+#define INCLUDE_MENUITEM_DEF
+#endif
+
+#include <tqmenudata.h>
+#include <tqpalette.h>
+#include <tqbitmap.h>
+#include <tqtabbar.h>
+#include <tqpointarray.h>
+#include <tqscrollbar.h>
+#include <tqframe.h>
+#include <tqpushbutton.h>
+#include <tqdrawutil.h>
+#include <tqpainter.h>
+
+#include <tdeapplication.h>
+#include <kdrawutil.h>
+#include <tdelocale.h>
+#include <kiconloader.h>
+#include <kdebug.h>
+
+#include "webstyle.h"
+
+static const int _indicatorSize = 13;
+static TQButton * _highlightedButton = 0;
+static const int _scrollBarExtent = 14;
+
+static TQFrame * _currentFrame = 0;
+static int _savedFrameLineWidth;
+static int _savedFrameMidLineWidth;
+static ulong _savedFrameStyle;
+
+static TQColor contrastingForeground(const TQColor & fg, const TQColor & bg)
+{
+ int h, s, vbg, vfg;
+
+ bg.hsv(&h, &s, &vbg);
+ fg.hsv(&h, &s, &vfg);
+
+ int diff(vbg - vfg);
+
+ if ((diff > -72) && (diff < 72))
+ {
+ return (vbg < 128) ? Qt::white : Qt::black;
+ }
+ else
+ {
+ return fg;
+ }
+}
+
+// Gotta keep it separated.
+
+ static void
+scrollBarControlsMetrics
+(
+ const TQScrollBar * sb,
+ int sliderStart,
+ int /* sliderMin */,
+ int sliderMax,
+ int sliderLength,
+ int buttonDim,
+ TQRect & rSub,
+ TQRect & rAdd,
+ TQRect & rSubPage,
+ TQRect & rAddPage,
+ TQRect & rSlider
+ )
+{
+ bool horizontal = sb->orientation() == TQScrollBar::Horizontal;
+
+ int len = horizontal ? sb->width() : sb->height();
+
+ int extent = horizontal ? sb->height() : sb->width();
+
+ TQColorGroup g = sb->colorGroup();
+
+ if (sliderStart > sliderMax)
+ sliderStart = sliderMax;
+
+ int sliderEnd = sliderStart + sliderLength;
+
+ int addX, addY;
+ int subX, subY;
+ int subPageX, subPageY, subPageW, subPageH;
+ int addPageX, addPageY, addPageW, addPageH;
+ int sliderX, sliderY, sliderW, sliderH;
+
+ if (horizontal)
+ {
+ subY = 0;
+ addY = 0;
+ subX = 0;
+ addX = buttonDim;
+
+ subPageX = buttonDim * 2;
+ subPageY = 0;
+ subPageW = sliderStart - 1;
+ subPageH = extent;
+
+ addPageX = sliderEnd;
+ addPageY = 0;
+ addPageW = len - sliderEnd;
+ addPageH = extent;
+
+ sliderX = sliderStart;
+ sliderY = 0;
+ sliderW = sliderLength;
+ sliderH = extent;
+ }
+ else
+ {
+ subX = 0;
+ addX = 0;
+ subY = len - buttonDim * 2;
+ addY = len - buttonDim;
+
+ subPageX = 0;
+ subPageY = 0;
+ subPageW = extent;
+ subPageH = sliderStart;
+
+ addPageX = 0;
+ addPageY = sliderEnd;
+ addPageW = extent;
+ addPageH = subY - sliderEnd;
+
+ sliderX = 0;
+ sliderY = sliderStart;
+ sliderW = extent;
+ sliderH = sliderLength;
+ }
+
+ rSub .setRect( subX, subY, buttonDim, buttonDim);
+ rAdd .setRect( addX, addY, buttonDim, buttonDim);
+ rSubPage .setRect(subPageX, subPageY, subPageW, subPageH);
+ rAddPage .setRect(addPageX, addPageY, addPageW, addPageH);
+ rSlider .setRect( sliderX, sliderY, sliderW, sliderH);
+}
+
+// Rounded rects my way.
+
+ static void
+drawFunkyRect
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ bool small
+)
+{
+ p->translate(x, y);
+
+ if (small)
+ {
+ p->drawLine( 2, 0, w - 3, 0 );
+ p->drawLine( w - 1, 2, w - 1, h - 3 );
+ p->drawLine( w - 3, h - 1, 2, h - 1 );
+ p->drawLine( 0, h - 3, 0, 2 );
+
+ // Use an array of points so that there's only one round-trip with the
+ // X server.
+
+ QCOORD pointList[] =
+ {
+ 1, 1,
+ w - 2, 1,
+ w - 2, h - 2,
+ 1, h - 2
+ };
+
+ p->drawPoints(TQPointArray(4, pointList));
+ }
+ else
+ {
+ p->drawLine( 3, 0, w - 4, 0 );
+ p->drawLine( w - 1, 3, w - 1, h - 4 );
+ p->drawLine( w - 4, h - 1, 3, h - 1 );
+ p->drawLine( 0, h - 4, 0, 3 );
+
+ QCOORD pointList[] =
+ {
+ 1, 2,
+ 2, 1,
+ w - 3, 1,
+ w - 2, 2,
+ w - 2, h - 3,
+ w - 3, h - 2,
+ 2, h - 2,
+ 1, h - 3
+ };
+
+ p->drawPoints(TQPointArray(8, pointList));
+ }
+
+ p->translate(-x, -y);
+}
+
+WebStyle::WebStyle()
+ : TDEStyle()
+{
+ setButtonDefaultIndicatorWidth(6);
+ setScrollBarExtent(_scrollBarExtent, _scrollBarExtent);
+}
+
+WebStyle::~WebStyle()
+{
+ // Empty.
+}
+
+ void
+WebStyle::polish(TQApplication *)
+{
+ // Empty.
+}
+
+ void
+WebStyle::polish(TQPalette &)
+{
+ // Empty.
+}
+
+ void
+WebStyle::unPolish(TQApplication *)
+{
+ // Empty.
+}
+
+ void
+WebStyle::polish(TQWidget * w)
+{
+ if (w->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING))
+ w->installEventFilter(this);
+
+ else if (w->inherits(TQGROUPBOX_OBJECT_NAME_STRING) || w->inherits(TQFRAME_OBJECT_NAME_STRING))
+ {
+ TQFrame * f(static_cast<TQFrame *>(w));
+
+ if (f->frameStyle() != TQFrame::NoFrame)
+ {
+ _currentFrame = f;
+
+ _savedFrameLineWidth = f->lineWidth();
+ _savedFrameMidLineWidth = f->midLineWidth();
+ _savedFrameStyle = f->frameStyle();
+
+ if (f->frameShape() == TQFrame::HLine || f->frameShape() == TQFrame::VLine)
+ {
+ f->setMidLineWidth(1);
+ f->setFrameStyle(f->frameShape() | TQFrame::Plain);
+ }
+ else
+ {
+ f->setLineWidth(1);
+ f->setFrameStyle(TQFrame::Box | TQFrame::Plain);
+ }
+ }
+ }
+}
+
+ void
+WebStyle::unPolish(TQWidget * w)
+{
+ if (w->inherits(TQPUSHBUTTON_OBJECT_NAME_STRING))
+ w->removeEventFilter(this);
+
+ else if (w == _currentFrame)
+ {
+ TQFrame * f(static_cast<TQFrame *>(w));
+
+ f->setLineWidth(_savedFrameLineWidth);
+ f->setMidLineWidth(_savedFrameMidLineWidth);
+ f->setFrameStyle(_savedFrameStyle);
+ }
+}
+
+ bool
+WebStyle::eventFilter(TQObject * o, TQEvent * e)
+{
+ TQPushButton * pb(static_cast<TQPushButton *>(o));
+
+ if (e->type() == TQEvent::Enter)
+ {
+ _highlightedButton = pb;
+ pb->repaint(false);
+ }
+ else if (e->type() == TQEvent::Leave)
+ {
+ _highlightedButton = 0;
+ pb->repaint(false);
+ }
+
+ return false;
+}
+
+ void
+WebStyle::drawButton
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool sunken,
+ const TQBrush * fill
+)
+{
+ p->save();
+
+ if (sunken)
+ p->setPen(contrastingForeground(g.light(), g.button()));
+ else
+ p->setPen(contrastingForeground(g.mid(), g.button()));
+
+ p->setBrush(0 == fill ? NoBrush : *fill);
+
+ drawFunkyRect(p, x, y, w, h, true);
+
+ p->restore();
+}
+
+ QRect
+WebStyle::buttonRect(int x, int y, int w, int h)
+{
+ return TQRect(x + 2, y + 2, w - 4, h - 4);
+}
+
+ void
+WebStyle::drawBevelButton
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool sunken,
+ const TQBrush * fill
+)
+{
+ drawButton(p, x, y, w, h, g, sunken, fill);
+}
+
+ void
+WebStyle::drawPushButton(TQPushButton * b, TQPainter * p)
+{
+ // Note: painter is already translated for us.
+
+ bool sunken(b->isDown() || b->isOn());
+ bool hl(_highlightedButton == b);
+
+ TQColor bg(b->colorGroup().button());
+
+ p->save();
+ p->fillRect(b->rect(), b->colorGroup().brush(TQColorGroup::Background));
+
+ if (b->isDefault())
+ {
+ TQColor c(hl ? b->colorGroup().highlight() : b->colorGroup().mid());
+
+ p->setPen(contrastingForeground(c, bg));
+
+ drawFunkyRect(p, 0, 0, b->width(), b->height(), false);
+ }
+
+ p->fillRect
+ (
+ 4,
+ 4,
+ b->width() - 8,
+ b->height() - 8,
+ b->colorGroup().brush(TQColorGroup::Button)
+ );
+
+ if (b->isEnabled())
+ {
+ if (sunken)
+ {
+ p->setPen(contrastingForeground(b->colorGroup().light(), bg));
+ }
+ else
+ {
+ if (hl)
+ p->setPen(contrastingForeground(b->colorGroup().highlight(), bg));
+ else
+ p->setPen(contrastingForeground(b->colorGroup().mid(), bg));
+ }
+ }
+ else
+ {
+ p->setPen(b->colorGroup().button());
+ }
+
+ drawFunkyRect(p, 3, 3, b->width() - 6, b->height() - 6, true);
+
+ p->restore();
+}
+
+ void
+WebStyle::drawPushButtonLabel(TQPushButton * b, TQPainter * p)
+{
+ // This is complicated stuff and we don't really want to mess with it.
+
+ TDEStyle::drawPushButtonLabel(b, p);
+}
+
+ void
+WebStyle::drawScrollBarControls
+(
+ TQPainter * p,
+ const TQScrollBar * sb,
+ int sliderStart,
+ uint controls,
+ uint activeControl
+)
+{
+ p->save();
+
+ int sliderMin, sliderMax, sliderLength, buttonDim;
+
+ scrollBarMetrics(sb, sliderMin, sliderMax, sliderLength, buttonDim);
+
+ TQRect rSub, rAdd, rSubPage, rAddPage, rSlider;
+
+ scrollBarControlsMetrics
+ (
+ sb,
+ sliderStart,
+ sliderMin,
+ sliderMax,
+ sliderLength,
+ buttonDim,
+ rSub,
+ rAdd,
+ rSubPage,
+ rAddPage,
+ rSlider
+ );
+
+ TQColorGroup g(sb->colorGroup());
+
+ if (controls & AddLine && rAdd.isValid())
+ {
+ bool active(activeControl & AddLine);
+
+ TQColor c(active ? g.highlight() : g.dark());
+
+ p->setPen(c);
+ p->setBrush(g.button());
+ p->drawRect(rAdd);
+
+ Qt::ArrowType t =
+ sb->orientation() == Horizontal ? Qt::RightArrow : Qt::DownArrow;
+
+ // Is it me or is TDEStyle::drawArrow broken ?
+
+ drawArrow
+ (
+ p,
+ t,
+ true, // FIXME - down ?
+ rAdd.x(),
+ rAdd.y(),
+ rAdd.width(),
+ rAdd.height(),
+ g,
+ true // FIXME - enabled ?
+ );
+ }
+
+ if (controls & SubLine && rSub.isValid())
+ {
+ bool active(activeControl & SubLine);
+
+ TQColor c(active ? g.highlight() : g.dark());
+
+ p->setPen(c);
+ p->setBrush(g.button());
+ p->drawRect(rSub);
+
+ Qt::ArrowType t =
+ sb->orientation() == Horizontal ? Qt::LeftArrow : Qt::UpArrow;
+
+ drawArrow
+ (
+ p,
+ t,
+ true, // FIXME - down ?
+ rSub.x(),
+ rSub.y(),
+ rSub.width(),
+ rSub.height(),
+ g,
+ true // FIXME - enabled ?
+ );
+ }
+
+ if (controls & SubPage && rSubPage.isValid())
+ {
+ p->setPen(g.mid());
+ p->setBrush(g.base());
+ p->drawRect(rSubPage);
+ }
+
+ if (controls & AddPage && rAddPage.isValid())
+ {
+ p->setPen(g.mid());
+ p->setBrush(g.base());
+ p->drawRect(rAddPage);
+ }
+
+ if (controls & Slider && rSlider.isValid())
+ {
+ p->setPen(activeControl & Slider ? g.highlight() : g.dark());
+
+ p->setBrush(g.button());
+ p->drawRect(rSlider);
+
+ p->setBrush(g.light());
+ p->setPen(g.dark());
+
+ if (sliderLength > _scrollBarExtent * 2)
+ {
+ int ellipseSize =
+ Horizontal == sb->orientation()
+ ?
+ rSlider.height() - 4
+ :
+ rSlider.width() - 4
+ ;
+
+ TQPoint center(rSlider.center());
+
+ if (Horizontal == sb->orientation())
+ {
+ p->drawEllipse
+ (
+ center.x() - ellipseSize / 2, rSlider.y() + 2,
+ ellipseSize, ellipseSize
+ );
+ }
+ else
+ {
+ p->drawEllipse
+ (
+ rSlider.x() + 2, center.y() - ellipseSize / 2,
+ ellipseSize, ellipseSize
+ );
+ }
+ }
+ }
+
+ p->restore();
+}
+
+ TQStyle::ScrollControl
+WebStyle::scrollBarPointOver
+(
+ const TQScrollBar * sb,
+ int sliderStart,
+ const TQPoint & point
+)
+{
+ if (!sb->rect().contains(point))
+ return NoScroll;
+
+ int sliderMin, sliderMax, sliderLength, buttonDim;
+
+ scrollBarMetrics(sb, sliderMin, sliderMax, sliderLength, buttonDim);
+
+ if (sb->orientation() == TQScrollBar::Horizontal)
+ {
+ int x = point.x();
+
+ if (x <= buttonDim)
+ return SubLine;
+
+ else if (x <= buttonDim * 2)
+ return AddLine;
+
+ else if (x < sliderStart)
+ return SubPage;
+
+ else if (x < sliderStart+sliderLength)
+ return Slider;
+
+ return AddPage;
+ }
+ else
+ {
+ int y = point.y();
+
+ if (y < sliderStart)
+ return SubPage;
+
+ else if (y < sliderStart + sliderLength)
+ return Slider;
+
+ else if (y < sliderMax + sliderLength)
+ return AddPage;
+
+ else if (y < sliderMax + sliderLength + buttonDim)
+ return SubLine;
+
+ return AddLine;
+ }
+}
+
+ void
+WebStyle::scrollBarMetrics
+(
+ const TQScrollBar * sb,
+ int & sliderMin,
+ int & sliderMax,
+ int & sliderLength,
+ int & buttonDim
+)
+{
+ int maxlen;
+
+ bool horizontal = sb->orientation() == TQScrollBar::Horizontal;
+
+ int len = (horizontal) ? sb->width() : sb->height();
+
+ int extent = (horizontal) ? sb->height() : sb->width();
+
+ if (len > (extent - 1) * 2)
+ buttonDim = extent;
+ else
+ buttonDim = len / 2 - 1;
+
+ if (horizontal)
+ sliderMin = buttonDim * 2;
+ else
+ sliderMin = 1;
+
+ maxlen = len - buttonDim * 2 - 1;
+
+ sliderLength =
+ (sb->pageStep() * maxlen) /
+ (sb->maxValue() - sb->minValue() + sb->pageStep());
+
+ if (sliderLength < _scrollBarExtent)
+ sliderLength = _scrollBarExtent;
+
+ if (sliderLength > maxlen)
+ sliderLength = maxlen;
+
+ sliderMax = sliderMin + maxlen - sliderLength;
+}
+
+ QSize
+WebStyle::indicatorSize() const
+{
+ return TQSize(_indicatorSize, _indicatorSize);
+}
+
+ void
+WebStyle::drawIndicator
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ int state,
+ bool down,
+ bool enabled
+)
+{
+ p->save();
+
+ p->fillRect(x, y, w, h, g.background());
+
+ if (enabled)
+ {
+ p->setPen(down ? g.highlight() : contrastingForeground(g.dark(), g.background()));
+ }
+ else
+ {
+ g.mid();
+ }
+
+ p->drawRect(x, y, w, h);
+
+ if (state != TQButton::Off)
+ {
+ p->fillRect(x + 2, y + 2, w - 4, h - 4, enabled ? g.highlight() : g.mid());
+
+ if (state == TQButton::NoChange)
+ {
+ p->fillRect(x + 4, y + 4, w - 8, h - 8, g.background());
+ }
+ }
+
+ p->restore();
+}
+
+ QSize
+WebStyle::exclusiveIndicatorSize() const
+{
+ return TQSize(_indicatorSize, _indicatorSize);
+}
+
+ void
+WebStyle::drawExclusiveIndicator
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool on,
+ bool down,
+ bool enabled
+)
+{
+ p->save();
+
+ p->fillRect(x, y, w, h, g.background());
+
+ if (enabled)
+ {
+ p->setPen(down ? g.highlight() : contrastingForeground(g.dark(), g.background()));
+ }
+ else
+ {
+ p->setPen(g.mid());
+ }
+
+ p->setBrush(g.brush(TQColorGroup::Background));
+
+ // Avoid misshapen ellipses. Qt or X bug ? Who knows...
+
+ if (0 == w % 2)
+ --w;
+
+ if (0 == h % 2)
+ --h;
+
+ p->drawEllipse(x, y, w, h);
+
+ if (on)
+ {
+ p->setPen(enabled ? g.highlight() : g.mid());
+ p->setBrush(enabled ? g.highlight() : g.mid());
+ p->drawEllipse(x + 3, y + 3, w - 6, h - 6);
+ }
+
+ p->restore();
+}
+
+ void
+WebStyle::drawIndicatorMask
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ int /* state */
+)
+{
+ p->fillRect(x, y, w, h, Qt::color1);
+}
+
+ void
+WebStyle::drawExclusiveIndicatorMask
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ bool /* on */
+)
+{
+ if (0 == w % 2)
+ --w;
+
+ if (0 == h % 2)
+ --h;
+
+ p->setPen(Qt::color1);
+ p->setBrush(Qt::color1);
+ p->drawEllipse(x, y, w, h);
+}
+
+ void
+WebStyle::drawComboButton
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool sunken,
+ bool editable,
+ bool enabled,
+ const TQBrush * fill
+)
+{
+ p->save();
+
+ p->setPen(NoPen);
+ p->setBrush(0 == fill ? g.brush(TQColorGroup::Background) : *fill);
+ p->drawRect(x, y, w, h);
+
+ if (enabled)
+ {
+ if (sunken)
+ p->setPen(contrastingForeground(g.highlight(), g.background()));
+ else
+ p->setPen(contrastingForeground(g.mid(), g.background()));
+ }
+ else
+ {
+ p->setPen(contrastingForeground(g.mid(), g.background()));
+ }
+
+ drawFunkyRect(p, x, y, w, h, true);
+
+ p->drawPoint(w - 10, h - 6);
+ p->drawPoint(w - 9, h - 6);
+ p->drawPoint(w - 8, h - 6);
+ p->drawPoint(w - 7, h - 6);
+ p->drawPoint(w - 6, h - 6);
+
+ p->drawPoint(w - 9, h - 7);
+ p->drawPoint(w - 8, h - 7);
+ p->drawPoint(w - 7, h - 7);
+ p->drawPoint(w - 6, h - 7);
+
+ p->drawPoint(w - 8, h - 8);
+ p->drawPoint(w - 7, h - 8);
+ p->drawPoint(w - 6, h - 8);
+
+ p->drawPoint(w - 7, h - 9);
+ p->drawPoint(w - 6, h - 9);
+
+ p->drawPoint(w - 6, h - 10);
+
+ if (editable)
+ p->fillRect(comboButtonFocusRect(x, y, w, h), Qt::red);
+
+ p->restore();
+}
+
+ QRect
+WebStyle::comboButtonRect(int x, int y, int w, int h)
+{
+ return TQRect(x + 2, y + 2, w - 20, h - 4);
+}
+
+ QRect
+WebStyle::comboButtonFocusRect(int x, int y, int w, int h)
+{
+ return TQRect(x + 2, y + 2, w - 20, h - 4);
+}
+
+ int
+WebStyle::sliderLength() const
+{
+ return 13;
+}
+
+ void
+WebStyle::drawSliderGroove
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ QCOORD /* c */,
+ Orientation o
+)
+{
+ p->save();
+
+ p->setPen(TQPen(g.dark(), 0, Qt::DotLine));
+
+ if( o == Qt::Horizontal )
+ p->drawLine(x, y + h / 2, w, y + h / 2);
+ else
+ if( o == Qt::Vertical )
+ p->drawLine(x + w / 2, y, x + w / 2, h);
+
+ p->restore();
+}
+
+ void
+WebStyle::drawArrow
+(
+ TQPainter * p,
+ Qt::ArrowType type,
+ bool down,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool enabled,
+ const TQBrush * fill
+)
+{
+ TDEStyle::drawArrow(p, type, down, x, y, w, h, g, enabled, fill);
+}
+
+ void
+WebStyle::drawSlider
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ Orientation o,
+ bool /* tickAbove */,
+ bool /* tickBelow */
+)
+{
+ p->save();
+
+ p->fillRect(x + 1, y + 1, w - 2, h - 2, g.background());
+ p->setPen(g.dark());
+ p->setBrush(g.light());
+
+ int sl = sliderLength();
+
+ if( o == Qt::Horizontal )
+ p->drawEllipse(x, y + h / 2 - sl / 2, sl, sl);
+ else
+ if( o == Qt::Vertical )
+ p->drawEllipse(x + w / 2 - sl / 2, y, sl, sl);
+
+ p->restore();
+}
+
+ void
+WebStyle::drawTDEToolBar
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ TDEToolBarPos /* pos */,
+ TQBrush * /* fill */
+)
+{
+ p->save();
+ p->setPen(g.background());
+ p->setBrush(g.background());
+ p->drawRect(x, y, w, h);
+ p->restore();
+}
+
+ void
+WebStyle::drawKBarHandle
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ TDEToolBarPos /* pos */,
+ TQBrush * /* fill */
+)
+{
+ p->save();
+ p->setPen(g.mid());
+ p->setBrush(g.background());
+ p->drawRect(x + 1, y + 1, w - 2, h - 2);
+ p->restore();
+}
+
+ void
+WebStyle::drawKMenuBar
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool /* macMode */,
+ TQBrush * /* fill */
+)
+{
+ p->save();
+ p->setPen(g.mid());
+ p->setBrush(g.background());
+ p->drawRect(x, y, w, h);
+ p->restore();
+}
+
+ void
+WebStyle::drawTDEToolBarButton
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool sunken,
+ bool raised,
+ bool enabled,
+ bool popup,
+ TDEToolButtonType type,
+ const TQString & btext,
+ const TQPixmap * pixmap,
+ TQFont * font,
+ TQWidget * button
+)
+{
+ bool toggleAndOn = false;
+
+ if (button->inherits(TQBUTTON_OBJECT_NAME_STRING))
+ {
+ TQButton * b = static_cast<TQButton *>(button);
+ toggleAndOn = b->isToggleButton() && b->isOn();
+ }
+
+ p->save();
+
+ TQColor borderColour;
+ TQColor textColour;
+ TQColor fillColour;
+
+ if (!enabled)
+ {
+ borderColour = g.background();
+ fillColour = g.background();
+ textColour = g.text();
+ }
+ else
+ {
+ if (toggleAndOn)
+ {
+ borderColour = g.dark();
+ fillColour = g.button();
+ textColour = g.buttonText();
+ }
+ else if (sunken)
+ {
+ borderColour = g.light();
+ fillColour = g.button();
+ textColour = g.buttonText();
+ }
+ else if (raised)
+ {
+ borderColour = g.highlight();
+ fillColour = g.background();
+ textColour = g.text();
+ }
+ else
+ {
+ borderColour = g.background();
+ fillColour = g.background();
+ textColour = g.text();
+ }
+ }
+
+ p->setPen(borderColour);
+ p->setBrush(fillColour);
+
+ p->drawRect(x, y, w, h);
+
+ p->setPen(g.background());
+
+ p->drawPoint(x, y);
+ p->drawPoint(x + w, y);
+ p->drawPoint(x, y + h);
+ p->drawPoint(x + w, y + h);
+
+ switch (type)
+ {
+ case Icon:
+
+ if (0 != pixmap)
+ p->drawPixmap
+ (
+ x + (w - pixmap->width()) / 2,
+ y + (h - pixmap->height()) / 2,
+ *pixmap
+ );
+ break;
+
+ case Text:
+
+ if (!btext.isNull())
+ {
+ if (0 != font)
+ p->setFont(*font);
+
+ p->setPen(textColour);
+
+ p->drawText
+ (
+ x,
+ y,
+ w,
+ h,
+ AlignCenter,
+ btext
+ );
+ }
+
+ break;
+
+ case IconTextRight:
+
+ if (0 != pixmap)
+ p->drawPixmap
+ (
+ x + 2,
+ y + (h - pixmap->height()) / 2,
+ *pixmap
+ );
+
+ if (!btext.isNull())
+ {
+ if (0 != font)
+ p->setFont(*font);
+
+ p->setPen(textColour);
+
+ if (0 != pixmap)
+ {
+ int textLeft = pixmap->width() + 4;
+
+ p->drawText
+ (
+ x + textLeft,
+ y,
+ w - textLeft,
+ h,
+ AlignVCenter | AlignLeft,
+ btext
+ );
+ }
+ else
+ {
+ p->drawText
+ (
+ x,
+ y,
+ w,
+ h,
+ AlignVCenter | AlignLeft,
+ btext
+ );
+ }
+ }
+ break;
+
+ case IconTextBottom:
+
+ if (0 != pixmap)
+ p->drawPixmap
+ (
+ x + (w - pixmap->width()) / 2,
+ y + 2,
+ *pixmap
+ );
+
+ if (!btext.isNull())
+ {
+ if (0 != font)
+ p->setFont(*font);
+
+ p->setPen(textColour);
+
+ if (0 != pixmap)
+ {
+ int textTop = y + pixmap->height() + 4;
+
+ p->drawText
+ (
+ x + 2,
+ textTop,
+ w - 4,
+ h - x - textTop,
+ AlignCenter,
+ btext
+ );
+ }
+ else
+ {
+ p->drawText
+ (
+ x,
+ y,
+ w,
+ h,
+ AlignCenter,
+ btext
+ );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (popup)
+ {
+ p->setPen(g.dark());
+ for (int px = 0; px < 5; ++px)
+ for (int py = 0; py < 5 - px; ++py)
+ p->drawPoint(w - 6 - px, h - 6 - py);
+ }
+
+ p->restore();
+}
+
+ void
+WebStyle::drawKMenuItem
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool active,
+ TQMenuItem * mi,
+ TQBrush * /* fill */
+)
+{
+ p->save();
+
+ TQColor bg(active ? g.highlight() : g.background());
+
+ p->fillRect(x, y, w, h, bg);
+
+ TQColor textColour =
+ active ?
+ contrastingForeground(g.highlightedText(), bg) :
+ contrastingForeground(g.text(), bg);
+
+ TQApplication::style().drawItem
+ (
+ p,
+ x,
+ y,
+ w,
+ h,
+ AlignCenter | ShowPrefix | DontClip | SingleLine,
+ g,
+ mi->isEnabled(),
+ mi->pixmap(),
+ mi->text(),
+ -1,
+ &textColour
+ );
+
+ p->restore();
+}
+
+ void
+WebStyle::drawPopupMenuItem
+(
+ TQPainter * p,
+ bool checkable,
+ int maxpmw,
+ int tab,
+ TQMenuItem * mi,
+ const TQPalette & pal,
+ bool act,
+ bool enabled,
+ int x,
+ int y,
+ int w,
+ int h
+)
+{
+ // TODO
+ TDEStyle::drawPopupMenuItem(p, checkable, maxpmw, tab, mi, pal, act, enabled, x, y, w, h);
+}
+
+ void
+WebStyle::drawKProgressBlock
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ TQBrush * fill
+)
+{
+ p->save();
+
+ p->setBrush(0 == fill ? NoBrush : *fill);
+
+ p->fillRect(x, y, w, h, g.highlight());
+
+ p->restore();
+}
+
+ void
+WebStyle::drawFocusRect
+(
+ TQPainter * p,
+ const TQRect & r,
+ const TQColorGroup & g,
+ const TQColor * pen,
+ bool atBorder
+)
+{
+ p->save();
+
+ if (0 != pen)
+ p->setPen(0 == pen ? g.foreground() : *pen);
+ p->setBrush(NoBrush);
+
+ if (atBorder)
+ {
+ p->drawRect(TQRect(r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2));
+ }
+ else
+ {
+ p->drawRect(r);
+ }
+
+ p->restore();
+}
+
+ void
+WebStyle::drawPanel
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool /* sunken */,
+ int /* lineWidth */,
+ const TQBrush * fill
+)
+{
+ p->save();
+
+ p->setPen(g.dark());
+
+ p->setBrush(0 == fill ? NoBrush : *fill);
+
+ p->drawRect(x, y, w, h);
+
+ p->restore();
+}
+
+ void
+WebStyle::drawPopupPanel
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ int /* lineWidth */,
+ const TQBrush * fill
+)
+{
+ p->save();
+
+ p->setPen(g.dark());
+
+ p->setBrush(0 == fill ? NoBrush : *fill);
+
+ p->drawRect(x, y, w, h);
+
+ p->restore();
+}
+
+ void
+WebStyle::drawSeparator
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool /* sunken */,
+ int /* lineWidth */,
+ int /* midLineWidth */
+)
+{
+ p->save();
+
+ p->setPen(g.dark());
+
+ if (w > h)
+ {
+ p->drawLine(x, y + h / 2, x + w, y + h / 2);
+ }
+ else
+ {
+ p->drawLine(x + w / 2, y, x + w / 2, y + h);
+ }
+
+ p->restore();
+}
+
+ void
+WebStyle::drawTab
+(
+ TQPainter * p,
+ const TQTabBar * tabBar,
+ TQTab * tab,
+ bool selected
+)
+{
+ TQRect r(tab->rect());
+
+ TQColorGroup g(tabBar->colorGroup());
+
+ p->save();
+
+ p->setPen(selected ? g.dark() : g.mid());
+ p->fillRect(r, g.brush(TQColorGroup::Background));
+
+ switch (tabBar->shape())
+ {
+ case TQTabBar::RoundedAbove:
+ case TQTabBar::TriangularAbove:
+ p->drawLine(r.left(), r.top(), r.left(), r.bottom());
+ p->drawLine(r.left(), r.top(), r.right(), r.top());
+ p->drawLine(r.right(), r.top(), r.right(), r.bottom());
+ if (!selected)
+ {
+ p->setPen(g.dark());
+ p->drawLine(r.left(), r.bottom(), r.right(), r.bottom());
+ }
+ break;
+ case TQTabBar::RoundedBelow:
+ case TQTabBar::TriangularBelow:
+ if (!selected)
+ {
+ p->setPen(g.dark());
+ p->drawLine(r.left(), r.top(), r.right(), r.top());
+ }
+ p->drawLine(r.left(), r.top(), r.left(), r.bottom());
+ p->drawLine(r.left(), r.bottom(), r.right(), r.bottom());
+ p->drawLine(r.right(), r.top(), r.right(), r.bottom());
+ break;
+ }
+
+ p->restore();
+}
+
+ void
+WebStyle::drawTabMask
+(
+ TQPainter * p,
+ const TQTabBar *,
+ TQTab * tab,
+ bool
+)
+{
+ p->fillRect(tab->rect(), Qt::color1);
+}
+
+ void
+WebStyle::drawKickerHandle
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ TQBrush * fill
+)
+{
+ p->save();
+
+ p->setPen(g.mid());
+
+ p->setBrush(0 == fill ? NoBrush : *fill);
+
+ p->drawRect(x, y, w, h);
+
+ p->restore();
+}
+
+ void
+WebStyle::drawKickerAppletHandle
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ TQBrush * fill
+)
+{
+ p->save();
+
+ p->setPen(g.mid());
+
+ p->setBrush(0 == fill ? NoBrush : *fill);
+
+ p->drawRect(x, y, w, h);
+
+ p->restore();
+}
+
+ void
+WebStyle::drawKickerTaskButton
+(
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ const TQString & text,
+ bool active,
+ TQPixmap * icon,
+ TQBrush * /* fill */
+)
+{
+ p->save();
+
+ TQColor bg;
+
+ if (active)
+ {
+ p->setPen(g.light());
+ bg = g.highlight();
+ }
+ else
+ {
+ p->setPen(g.mid());
+ bg = g.button();
+ }
+
+ p->setBrush(bg);
+
+ p->drawRect(x, y, w, h);
+
+ if (text.isEmpty() && 0 == icon)
+ {
+ p->restore();
+ return;
+ }
+
+ const int pxWidth = 20;
+
+ int textPos = pxWidth;
+
+ TQRect br(buttonRect(x, y, w, h));
+
+ if ((0 != icon) && !icon->isNull())
+ {
+ int dx = (pxWidth - icon->width()) / 2;
+ int dy = (h - icon->height()) / 2;
+
+ p->drawPixmap(br.x() + dx, dy, *icon);
+ }
+
+ TQString s(text);
+
+ static TQString modStr =
+ TQString::fromUtf8("[") + i18n("modified") + TQString::fromUtf8("]");
+
+ int modStrPos = s.find(modStr);
+
+ if (-1 != modStrPos)
+ {
+ // +1 because we include a space after the closing brace.
+ s.remove(modStrPos, modStr.length() + 1);
+
+ TQPixmap modPixmap = SmallIcon("modified");
+
+ int dx = (pxWidth - modPixmap.width()) / 2;
+ int dy = (h - modPixmap.height()) / 2;
+
+ p->drawPixmap(br.x() + textPos + dx, dy, modPixmap);
+
+ textPos += pxWidth;
+ }
+
+ if (!s.isEmpty())
+ {
+ if (p->fontMetrics().width(s) > br.width() - textPos)
+ {
+ int maxLen = br.width() - textPos - p->fontMetrics().width("...");
+
+ while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen))
+ s.truncate(s.length() - 1);
+
+ s.append("...");
+ }
+
+ if (active)
+ {
+ p->setPen(contrastingForeground(g.buttonText(), bg));
+ }
+ else
+ {
+ p->setPen(contrastingForeground(g.text(), bg));
+ }
+
+ p->setPen(Qt::white);
+
+ p->drawText
+ (
+ br.x() + textPos,
+ -1,
+ w - textPos,
+ h,
+ AlignLeft | AlignVCenter,
+ s
+ );
+ }
+
+ p->restore();
+ p->setPen(Qt::white);
+}
+
+ int
+WebStyle::popupMenuItemHeight(bool, TQMenuItem * i, const TQFontMetrics & fm)
+{
+ if (i->isSeparator())
+ return 1;
+
+ int h = 0;
+
+ if (0 != i->pixmap())
+ {
+ h = i->pixmap()->height();
+ }
+
+ if (0 != i->iconSet())
+ {
+ h = QMAX
+ (
+ i->iconSet()->pixmap(TQIconSet::Small, TQIconSet::Normal).height(),
+ h
+ );
+ }
+
+ h = QMAX(fm.height() + 4, h);
+
+ h = QMAX(18, h);
+
+ return h;
+
+}
+
diff --git a/tdestyles/web/webstyle.h b/tdestyles/web/webstyle.h
new file mode 100644
index 000000000..0e4c59dbd
--- /dev/null
+++ b/tdestyles/web/webstyle.h
@@ -0,0 +1,414 @@
+/*
+ * Copyright (C) 2001 Rik Hemsley (rikkus) <rik@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 as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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 WEB_STYLE_H
+#define WEB_STYLE_H
+
+#include <tdestyle.h>
+#include <tqpalette.h>
+
+class TQPainter;
+class TQScrollBar;
+class TQPushButton;
+class TQWidget;
+
+class WebStyle : public TDEStyle
+{
+ public:
+
+ WebStyle();
+
+ ~WebStyle();
+
+ void polish(TQApplication *);
+
+ void unPolish(TQWidget *);
+
+ void polish(TQWidget *);
+
+ void polish(TQPalette &);
+
+ void unPolish(TQApplication *);
+
+ void drawButton
+ (
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool sunken = false,
+ const TQBrush * fill = 0
+ );
+
+ TQRect buttonRect(int x, int y, int w, int h);
+
+ void drawBevelButton
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ bool sunken = false,
+ const TQBrush * fill = 0
+ );
+
+ void drawPushButton(TQPushButton *, TQPainter *);
+
+ virtual void drawPushButtonLabel(TQPushButton *, TQPainter *);
+
+ void drawScrollBarControls
+ (
+ TQPainter *,
+ const TQScrollBar *,
+ int sliderStart,
+ uint controls,
+ uint activeControl
+ );
+
+ TQStyle::ScrollControl scrollBarPointOver
+ (
+ const TQScrollBar *,
+ int sliderStart,
+ const TQPoint &
+ );
+
+ void scrollBarMetrics
+ (
+ const TQScrollBar *,
+ int & sliderMin,
+ int & sliderMax,
+ int & sliderLength,
+ int & buttonDim
+ );
+
+ TQSize indicatorSize() const;
+
+ void drawIndicator
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ int state,
+ bool down = false,
+ bool enabled = true
+ );
+
+ TQSize exclusiveIndicatorSize() const;
+
+ void drawExclusiveIndicator
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ bool on,
+ bool down = false,
+ bool enabled = true
+ );
+
+ void drawIndicatorMask
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ int state
+ );
+
+ void drawExclusiveIndicatorMask
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ bool on
+ );
+
+ void drawComboButton
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ bool sunken = false,
+ bool editable = false,
+ bool enabled = true,
+ const TQBrush * fill = 0
+ );
+
+ TQRect comboButtonRect(int x, int y, int w, int h);
+
+ TQRect comboButtonFocusRect(int x, int y, int w, int h);
+
+ int sliderLength() const;
+
+ void drawSliderGroove
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ QCOORD,
+ Orientation
+ );
+
+ void drawArrow
+ (
+ TQPainter *,
+ Qt::ArrowType,
+ bool down,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ bool enabled = true,
+ const TQBrush * fill = 0
+ );
+
+ void drawSlider
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ Orientation,
+ bool tickAbove,
+ bool tickBelow
+ );
+
+ void drawTDEToolBar
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ TDEToolBarPos,
+ TQBrush * fill = 0
+ );
+
+ void drawKBarHandle
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ TDEToolBarPos,
+ TQBrush * fill = 0
+ );
+
+ void drawKMenuBar
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ bool macMode,
+ TQBrush * fill = 0
+ );
+
+ void drawTDEToolBarButton
+ (
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ bool sunken = false,
+ bool raised = true,
+ bool enabled = true,
+ bool popup = false,
+ TDEToolButtonType = Icon,
+ const TQString & btext = TQString::null,
+ const TQPixmap * = 0,
+ TQFont * = 0,
+ TQWidget * button = 0
+ );
+
+ void drawKMenuItem
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ bool active,
+ TQMenuItem *,
+ TQBrush * fill = 0
+ );
+
+ void drawPopupMenuItem
+ (
+ TQPainter *,
+ bool checkable,
+ int maxpmw,
+ int tab,
+ TQMenuItem *,
+ const TQPalette &,
+ bool act,
+ bool enabled,
+ int x,
+ int y,
+ int w,
+ int h
+ );
+
+ void drawKProgressBlock
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ TQBrush * fill
+ );
+
+ void drawFocusRect
+ (
+ TQPainter *,
+ const TQRect &,
+ const TQColorGroup &,
+ const TQColor * pen,
+ bool atBorder
+ );
+
+ void drawPanel
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ bool sunken,
+ int lineWidth = 1,
+ const TQBrush * = 0
+ );
+
+ void drawPopupPanel
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ int lineWidth = 2,
+ const TQBrush * = 0
+ );
+
+ void drawSeparator
+ (
+ TQPainter *,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup &,
+ bool sunken = true,
+ int lineWidth = 1,
+ int midLineWidth = 0
+ );
+
+ void drawTab
+ (
+ TQPainter * p,
+ const TQTabBar * tabBar,
+ TQTab * tab,
+ bool selected
+ );
+
+ void drawTabMask
+ (
+ TQPainter * p,
+ const TQTabBar *,
+ TQTab * tab,
+ bool
+ );
+
+ void drawKickerHandle
+ (
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ TQBrush *
+ );
+
+ void drawKickerAppletHandle
+ (
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ TQBrush *
+ );
+
+ void drawKickerTaskButton
+ (
+ TQPainter * p,
+ int x,
+ int y,
+ int w,
+ int h,
+ const TQColorGroup & g,
+ const TQString & title,
+ bool active,
+ TQPixmap * icon,
+ TQBrush *
+ );
+
+ int popupMenuItemHeight(bool, TQMenuItem *, const TQFontMetrics &);
+
+ GUIStyle guiStyle() const { return Qt::MotifStyle; }
+
+ bool eventFilter(TQObject *, TQEvent *);
+};
+
+#endif