summaryrefslogtreecommitdiffstats
path: root/kstyles/keramik
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kstyles/keramik
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kstyles/keramik')
-rw-r--r--kstyles/keramik/Makefile.am90
-rw-r--r--kstyles/keramik/bitmaps.h83
-rw-r--r--kstyles/keramik/colorutil.cpp65
-rw-r--r--kstyles/keramik/colorutil.h37
-rw-r--r--kstyles/keramik/genembed.cpp387
-rw-r--r--kstyles/keramik/gradients.cpp179
-rw-r--r--kstyles/keramik/gradients.h41
-rw-r--r--kstyles/keramik/keramik.cpp2935
-rw-r--r--kstyles/keramik/keramik.h207
-rw-r--r--kstyles/keramik/keramikimage.h69
-rw-r--r--kstyles/keramik/pics/checkbox-off.pngbin0 -> 486 bytes
-rw-r--r--kstyles/keramik/pics/checkbox-on.pngbin0 -> 523 bytes
-rw-r--r--kstyles/keramik/pics/checkbox-tri.pngbin0 -> 552 bytes
-rw-r--r--kstyles/keramik/pics/combobox-list-bc.pngbin0 -> 174 bytes
-rw-r--r--kstyles/keramik/pics/combobox-list-bl.pngbin0 -> 225 bytes
-rw-r--r--kstyles/keramik/pics/combobox-list-br.pngbin0 -> 223 bytes
-rw-r--r--kstyles/keramik/pics/combobox-list-cl.pngbin0 -> 146 bytes
-rw-r--r--kstyles/keramik/pics/combobox-list-cr.pngbin0 -> 155 bytes
-rw-r--r--kstyles/keramik/pics/combobox-list-tc.pngbin0 -> 146 bytes
-rw-r--r--kstyles/keramik/pics/combobox-list-tl.pngbin0 -> 161 bytes
-rw-r--r--kstyles/keramik/pics/combobox-list-tr.pngbin0 -> 188 bytes
-rw-r--r--kstyles/keramik/pics/frame-shadow-cl.pngbin0 -> 159 bytes
-rw-r--r--kstyles/keramik/pics/frame-shadow-tc.pngbin0 -> 158 bytes
-rw-r--r--kstyles/keramik/pics/frame-shadow-tl.pngbin0 -> 166 bytes
-rw-r--r--kstyles/keramik/pics/listview-bc.pngbin0 -> 157 bytes
-rw-r--r--kstyles/keramik/pics/listview-bl.pngbin0 -> 147 bytes
-rw-r--r--kstyles/keramik/pics/listview-br.pngbin0 -> 147 bytes
-rw-r--r--kstyles/keramik/pics/listview-cc.pngbin0 -> 235 bytes
-rw-r--r--kstyles/keramik/pics/listview-cl.pngbin0 -> 171 bytes
-rw-r--r--kstyles/keramik/pics/listview-cr.pngbin0 -> 180 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-bc.pngbin0 -> 167 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-bl.pngbin0 -> 193 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-br.pngbin0 -> 199 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-cc.pngbin0 -> 205 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-cl.pngbin0 -> 264 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-cr.pngbin0 -> 266 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-tc.pngbin0 -> 167 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-tl.pngbin0 -> 190 bytes
-rw-r--r--kstyles/keramik/pics/listview-pressed-tr.pngbin0 -> 192 bytes
-rw-r--r--kstyles/keramik/pics/listview-tc.pngbin0 -> 157 bytes
-rw-r--r--kstyles/keramik/pics/listview-tl.pngbin0 -> 147 bytes
-rw-r--r--kstyles/keramik/pics/listview-tr.pngbin0 -> 147 bytes
-rw-r--r--kstyles/keramik/pics/menuitem-cc.pngbin0 -> 296 bytes
-rw-r--r--kstyles/keramik/pics/menuitem-cl.pngbin0 -> 195 bytes
-rw-r--r--kstyles/keramik/pics/menuitem-cr.pngbin0 -> 195 bytes
-rw-r--r--kstyles/keramik/pics/progressbar-cc.pngbin0 -> 356 bytes
-rw-r--r--kstyles/keramik/pics/progressbar-cl.pngbin0 -> 480 bytes
-rw-r--r--kstyles/keramik/pics/progressbar-cr.pngbin0 -> 428 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-bc.pngbin0 -> 186 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-bl.pngbin0 -> 302 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-br.pngbin0 -> 328 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-cc.pngbin0 -> 235 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-cl.pngbin0 -> 560 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-cr.pngbin0 -> 600 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-bc.pngbin0 -> 176 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-bl.pngbin0 -> 265 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-br.pngbin0 -> 267 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-cc.pngbin0 -> 251 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-cl.pngbin0 -> 637 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-cr.pngbin0 -> 680 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-bc.pngbin0 -> 175 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-bl.pngbin0 -> 265 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-br.pngbin0 -> 264 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-cc.pngbin0 -> 258 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-cl.pngbin0 -> 636 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-cr.pngbin0 -> 657 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-tc.pngbin0 -> 176 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-tl.pngbin0 -> 262 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-hov-tr.pngbin0 -> 290 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-bc.pngbin0 -> 175 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-bl.pngbin0 -> 270 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-br.pngbin0 -> 262 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-cc.pngbin0 -> 250 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-cl.pngbin0 -> 568 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-cr.pngbin0 -> 599 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-tc.pngbin0 -> 176 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-tl.pngbin0 -> 258 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-pressed-tr.pngbin0 -> 281 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-tc.pngbin0 -> 176 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-tl.pngbin0 -> 261 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-default-tr.pngbin0 -> 287 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-bc.pngbin0 -> 186 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-bl.pngbin0 -> 314 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-br.pngbin0 -> 325 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-cc.pngbin0 -> 239 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-cl.pngbin0 -> 589 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-cr.pngbin0 -> 584 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-tc.pngbin0 -> 183 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-tl.pngbin0 -> 270 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-hov-tr.pngbin0 -> 282 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-bc.pngbin0 -> 184 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-bl.pngbin0 -> 291 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-br.pngbin0 -> 305 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-cc.pngbin0 -> 230 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-cl.pngbin0 -> 519 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-cr.pngbin0 -> 545 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-tc.pngbin0 -> 182 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-tl.pngbin0 -> 243 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-pressed-tr.pngbin0 -> 259 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-bc.pngbin0 -> 161 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-bl.pngbin0 -> 217 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-br.pngbin0 -> 217 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-cc.pngbin0 -> 230 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-cl.pngbin0 -> 374 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-cr.pngbin0 -> 370 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-bc.pngbin0 -> 161 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-bl.pngbin0 -> 224 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-br.pngbin0 -> 217 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-cc.pngbin0 -> 206 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-cl.pngbin0 -> 370 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-cr.pngbin0 -> 368 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-tc.pngbin0 -> 161 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-tl.pngbin0 -> 212 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-pressed-tr.pngbin0 -> 205 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-tc.pngbin0 -> 161 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-tl.pngbin0 -> 203 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-small-tr.pngbin0 -> 202 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-tc.pngbin0 -> 183 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-tl.pngbin0 -> 265 bytes
-rw-r--r--kstyles/keramik/pics/pushbutton-tr.pngbin0 -> 273 bytes
-rw-r--r--kstyles/keramik/pics/radiobutton-off.pngbin0 -> 880 bytes
-rw-r--r--kstyles/keramik/pics/radiobutton-on.pngbin0 -> 884 bytes
-rw-r--r--kstyles/keramik/pics/ripple.pngbin0 -> 211 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-hbar-arrow1.pngbin0 -> 323 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-hbar-arrow2.pngbin0 -> 332 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-hbar-groove1.pngbin0 -> 138 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-hbar-groove2.pngbin0 -> 177 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-hbar-slider1.pngbin0 -> 319 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-hbar-slider2.pngbin0 -> 260 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-hbar-slider3.pngbin0 -> 337 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-hbar-slider4.pngbin0 -> 290 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-vbar-arrow1.pngbin0 -> 439 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-vbar-arrow2.pngbin0 -> 516 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-vbar-groove1.pngbin0 -> 170 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-vbar-groove2.pngbin0 -> 706 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-vbar-slider1.pngbin0 -> 280 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-vbar-slider2.pngbin0 -> 374 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-vbar-slider3.pngbin0 -> 305 bytes
-rw-r--r--kstyles/keramik/pics/scrollbar-vbar-slider4.pngbin0 -> 335 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-bc.pngbin0 -> 165 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-bl.pngbin0 -> 212 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-br.pngbin0 -> 247 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-cc.pngbin0 -> 180 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-cl.pngbin0 -> 240 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-cr.pngbin0 -> 243 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-tc.pngbin0 -> 162 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-tl.pngbin0 -> 187 bytes
-rw-r--r--kstyles/keramik/pics/slider-hgroove-tr.pngbin0 -> 198 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-bc.pngbin0 -> 241 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-bl.pngbin0 -> 217 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-br.pngbin0 -> 239 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-cc.pngbin0 -> 260 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-cl.pngbin0 -> 257 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-cr.pngbin0 -> 258 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-tc.pngbin0 -> 226 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-tl.pngbin0 -> 186 bytes
-rw-r--r--kstyles/keramik/pics/slider-vgroove-tr.pngbin0 -> 214 bytes
-rw-r--r--kstyles/keramik/pics/slider.pngbin0 -> 636 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-1.pngbin0 -> 277 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-2.pngbin0 -> 403 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-3.pngbin0 -> 271 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-arrow-down.pngbin0 -> 240 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-arrow-up.pngbin0 -> 250 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-pressed-arrow-down.pngbin0 -> 285 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-pressed-arrow-up.pngbin0 -> 289 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-pressed-down.pngbin0 -> 787 bytes
-rw-r--r--kstyles/keramik/pics/spinbox-pressed-up.pngbin0 -> 784 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-active-bc.pngbin0 -> 152 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-active-bl.pngbin0 -> 227 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-active-br.pngbin0 -> 228 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-active-cc.pngbin0 -> 271 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-active-cl.pngbin0 -> 360 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-active-cr.pngbin0 -> 370 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-inactive-bc.pngbin0 -> 143 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-inactive-bl.pngbin0 -> 175 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-inactive-br.pngbin0 -> 166 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-inactive-cc.pngbin0 -> 195 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-inactive-cl.pngbin0 -> 235 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-inactive-cr.pngbin0 -> 254 bytes
-rw-r--r--kstyles/keramik/pics/tab-bottom-inactive-separator.pngbin0 -> 154 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-active-cc.pngbin0 -> 269 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-active-cl.pngbin0 -> 365 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-active-cr.pngbin0 -> 366 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-active-tc.pngbin0 -> 147 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-active-tl.pngbin0 -> 226 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-active-tr.pngbin0 -> 226 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-inactive-cc.pngbin0 -> 190 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-inactive-cl.pngbin0 -> 239 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-inactive-cr.pngbin0 -> 254 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-inactive-separator.pngbin0 -> 154 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-inactive-tc.pngbin0 -> 145 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-inactive-tl.pngbin0 -> 169 bytes
-rw-r--r--kstyles/keramik/pics/tab-top-inactive-tr.pngbin0 -> 159 bytes
-rw-r--r--kstyles/keramik/pics/title-close-tiny.pngbin0 -> 181 bytes
-rw-r--r--kstyles/keramik/pics/title-close.pngbin0 -> 147 bytes
-rw-r--r--kstyles/keramik/pics/title-iconify.pngbin0 -> 104 bytes
-rw-r--r--kstyles/keramik/pics/title-maximize.pngbin0 -> 134 bytes
-rw-r--r--kstyles/keramik/pics/title-restore.pngbin0 -> 133 bytes
-rw-r--r--kstyles/keramik/pics/titlebutton-pressed.pngbin0 -> 469 bytes
-rw-r--r--kstyles/keramik/pics/titlebutton.pngbin0 -> 545 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-bc.pngbin0 -> 137 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-bl.pngbin0 -> 138 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-br.pngbin0 -> 136 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-cc.pngbin0 -> 228 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-cl.pngbin0 -> 223 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-cr.pngbin0 -> 218 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-tc.pngbin0 -> 136 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-tl.pngbin0 -> 136 bytes
-rw-r--r--kstyles/keramik/pics/toolbar-clk-tr.pngbin0 -> 136 bytes
-rw-r--r--kstyles/keramik/pics/vslider.pngbin0 -> 526 bytes
-rw-r--r--kstyles/keramik/pixmaploader.cpp629
-rw-r--r--kstyles/keramik/pixmaploader.h367
212 files changed, 5089 insertions, 0 deletions
diff --git a/kstyles/keramik/Makefile.am b/kstyles/keramik/Makefile.am
new file mode 100644
index 000000000..a649c4eb7
--- /dev/null
+++ b/kstyles/keramik/Makefile.am
@@ -0,0 +1,90 @@
+AM_CPPFLAGS = -DQT_PLUGIN
+
+INCLUDES = -I$(top_srcdir)/kdefx $(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 = ../../kdefx/libkdefx.la
+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 = ../../kdefx/libkdefx.la
+genembed_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+
+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/kstyles/keramik/bitmaps.h b/kstyles/keramik/bitmaps.h
new file mode 100644
index 000000000..fd5dcf327
--- /dev/null
+++ b/kstyles/keramik/bitmaps.h
@@ -0,0 +1,83 @@
+#ifndef __BITMAPS_H
+#define __BITMAPS_H
+
+/* Image bits processed by KPixmap2Bitmaps */
+// Arrow bitmaps
+static const QCOORD u_arrow[]={-1,-3, 0,-3, -2,-2, 1,-2, -3,-1, 2,-1, -4,0, 3,0, -4,1, 3,1};
+static const QCOORD d_arrow[]={-4,-2, 3,-2, -4,-1, 3,-1, -3,0, 2,0, -2,1, 1,1, -1,2, 0,2};
+static const QCOORD l_arrow[]={-3,-1, -3,0, -2,-2, -2,1, -1,-3, -1,2, 0,-4, 0,3, 1,-4, 1,3};
+static const QCOORD r_arrow[]={-2,-4, -2,3, -1,-4, -1,3, 0,-3, 0,2, 1,-2, 1,1, 2,-1, 2,0};
+
+static const QCOORD 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 QCOORD 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 QCOORD 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 QCOORD 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 QCOORD 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 QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
+
+
+
+#endif
diff --git a/kstyles/keramik/colorutil.cpp b/kstyles/keramik/colorutil.cpp
new file mode 100644
index 000000000..71bf75873
--- /dev/null
+++ b/kstyles/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 <qcolor.h>
+
+#include "colorutil.h"
+
+namespace Keramik
+{
+ QColor ColorUtil::lighten(QColor 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);
+
+ QColor 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 QColor(r,g,b);
+ }
+
+ return in;
+ }
+}
+
+// vim: ts=4 sw=4 noet
diff --git a/kstyles/keramik/colorutil.h b/kstyles/keramik/colorutil.h
new file mode 100644
index 000000000..ae01b450a
--- /dev/null
+++ b/kstyles/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 QPainter;
+
+
+namespace Keramik
+{
+ class ColorUtil
+ {
+ public:
+ static QColor lighten(QColor in, int factor);
+ };
+}
+
+#endif
diff --git a/kstyles/keramik/genembed.cpp b/kstyles/keramik/genembed.cpp
new file mode 100644
index 000000000..2f9449406
--- /dev/null
+++ b/kstyles/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 <qfileinfo.h>
+#include <qimage.h>
+#include <qmap.h>
+#include <qregexp.h>
+#include <qtextstream.h>
+#include <qvaluevector.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(QString 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;
+
+ QValueVector<KeramikEmbedImage> images;
+
+ cout<<"#include <qintdict.h>\n\n";
+ cout<<"#include \"keramikimage.h\"\n\n";
+
+ QMap<QString, int> assignID;
+ int nextID = 0;
+
+ for (int c = 1; c<argc; c++)
+ {
+
+ QImage input(argv[c]);
+
+
+ QFileInfo fi(argv[c]);
+ QString s = fi.baseName();
+
+ KeramikEmbedImage image;
+
+ int pos;
+
+ QString 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";
+
+ Q_UINT32* read = reinterpret_cast< Q_UINT32* >(input.bits() );
+ int size = input.width()*input.height();
+
+ for (int pos=0; pos<size; pos++)
+ {
+ QRgb basePix = (QRgb)*read;
+
+ if (qAlpha(basePix) != 255)
+ reallySolid = false;
+ else
+ pixSolid++;
+
+ pixCount++;
+ read++;
+ }
+
+ image.haveAlpha = !reallySolid;
+
+ images.push_back(image);
+
+ read = reinterpret_cast< Q_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";
+ QColor clr(basePix);
+ int h,s,v;
+ clr.hsv(&h,&s,&v);
+
+ v=qGray(basePix);
+
+ int targetColorAlpha = 0 , greyAdd = 0;
+ //int srcAlpha = qAlpha(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<<","<<qAlpha(basePix)<<",";
+ //cout<<qRed(basePix)<<","<<qGreen(basePix)<<","<<qBlue(basePix)<<","<<qAlpha(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<<"\tQIntDict<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";
+
+
+
+
+ QFile file("keramikrc.h");
+ file.open(IO_WriteOnly);
+ QTextStream ts( &file);
+ ts<<"#ifndef KERAMIK_RC_H\n";
+ ts<<"#define KERAMIK_RC_H\n";
+
+ ts<<"enum KeramikWidget {\n";
+ for (QMap<QString, int>::iterator i = assignID.begin(); i != assignID.end(); ++i)
+ {
+ QString 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/kstyles/keramik/gradients.cpp b/kstyles/keramik/gradients.cpp
new file mode 100644
index 000000000..cf18500bd
--- /dev/null
+++ b/kstyles/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 <qpainter.h>
+#include <qrect.h>
+#include <qcolor.h>
+
+#include "gradients.h"
+#include "colorutil.h"
+
+#include <qimage.h>
+#include <qintcache.h>
+#include <kimageeffect.h>
+
+namespace
+{
+ struct GradientCacheEntry
+ {
+ QPixmap* m_pixmap;
+ QRgb m_color;
+ bool m_menu;
+ int m_width;
+ int m_height;
+
+ GradientCacheEntry(int width, int height, const QColor& 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;
+ }
+
+ };
+
+
+ QIntCache<GradientCacheEntry> cache(65636, 17);
+
+}
+
+using namespace Keramik;
+
+void GradientPainter::releaseCache()
+{
+ cache.clear();
+}
+
+void GradientPainter::renderGradient( QPainter* p, const QRect& r, QColor 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? QPoint(0,py): QPoint(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)
+ {
+ QPixmap* pix = new QPixmap(18, height);
+
+ if (menu)
+ {
+ QImage gr = KImageEffect::gradient(QSize(4,height), c.light(93), ColorUtil::lighten(c,109), KImageEffect::VerticalGradient );
+ QPixmap grT(gr);
+ QPainter p2(pix);
+ p2.drawTiledPixmap(0,0, 18, height, grT);
+ p2.end();
+ }
+ else
+ {
+ int h1 = 3 * height/4;
+ int h2 = height - h1;
+
+ QImage top = KImageEffect::gradient(QSize(4,h1), ColorUtil::lighten(c,110), c.light(94), KImageEffect::VerticalGradient );
+ QImage bot = KImageEffect::gradient(QSize(4,h2), c.light(94), ColorUtil::lighten(c,109), KImageEffect::VerticalGradient );
+
+ QPixmap topT(top);
+ QPixmap botT(bot);
+
+ QPainter p2(pix);
+ p2.drawTiledPixmap(0, 0, 18, h1, topT);
+ p2.drawTiledPixmap(0, h1, 18, h2, botT);
+ p2.end();
+ }
+
+ entry.m_pixmap = pix;
+ }
+ else
+ {
+ QPixmap* pix = new QPixmap(width, 18);
+
+ int h1 = 3 * width/4;
+ int h2 = width - h1;
+
+ QImage top = KImageEffect::gradient(QSize(h1,4), ColorUtil::lighten(c,110), c.light(94), KImageEffect::HorizontalGradient );
+ QImage bot = KImageEffect::gradient(QSize(h2,4), c.light(94), ColorUtil::lighten(c,109), KImageEffect::HorizontalGradient );
+
+ QPixmap topT(top);
+ QPixmap botT(bot);
+
+ QPainter 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? QPoint(0,py): QPoint(px,0));
+
+ if (!cacheOK)
+ delete imgToAdd;
+
+ entry.m_pixmap = 0;//Don't free too early..
+}
+
+// vim: ts=4 sw=4 noet
diff --git a/kstyles/keramik/gradients.h b/kstyles/keramik/gradients.h
new file mode 100644
index 000000000..d4dfd2c95
--- /dev/null
+++ b/kstyles/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 QPainter;
+
+
+namespace Keramik
+{
+ class GradientPainter
+ {
+ public:
+ static void renderGradient( QPainter* p, const QRect& r, QColor 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/kstyles/keramik/keramik.cpp b/kstyles/keramik/keramik.cpp
new file mode 100644
index 000000000..5157c34ed
--- /dev/null
+++ b/kstyles/keramik/keramik.cpp
@@ -0,0 +1,2935 @@
+/* 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 KStyle, 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 <qbitmap.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qdrawutil.h>
+#include <qframe.h>
+#include <qheader.h>
+#include <qintdict.h>
+#include <qlineedit.h>
+#include <qlistbox.h>
+#include <qmenubar.h>
+#include <qpainter.h>
+#include <qpointarray.h>
+#include <qprogressbar.h>
+#include <qpushbutton.h>
+#include <qsettings.h>
+#include <qslider.h>
+#include <qstyleplugin.h>
+#include <qtabbar.h>
+#include <qtimer.h>
+#include <qtoolbar.h>
+#include <qtoolbutton.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 QStylePlugin
+{
+public:
+ KeramikStylePlugin() {}
+ ~KeramikStylePlugin() {}
+
+ QStringList keys() const
+ {
+ if (QPixmap::defaultDepth() > 8)
+ return QStringList() << "Keramik";
+ else
+ return QStringList();
+ }
+
+ QStyle* create( const QString& key )
+ {
+ if ( key == "keramik" ) return new KeramikStyle();
+ return 0;
+ }
+};
+
+KDE_Q_EXPORT_PLUGIN( KeramikStylePlugin )
+// ---------------------------------------------------
+
+
+// ### Remove globals
+/*
+QBitmap lightBmp;
+QBitmap grayBmp;
+QBitmap dgrayBmp;
+QBitmap centerBmp;
+QBitmap maskBmp;
+QBitmap 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(QPainter* p, QColorGroup cg, QRect r, QStyle::PrimitiveElement pe, bool down, bool enabled)
+ {
+ QPointArray a;
+
+ switch(pe)
+ {
+ case QStyle::PE_ArrowUp:
+ a.setPoints(QCOORDARRLEN(keramik_up_arrow), keramik_up_arrow);
+ break;
+
+ case QStyle::PE_ArrowDown:
+ a.setPoints(QCOORDARRLEN(keramik_down_arrow), keramik_down_arrow);
+ break;
+
+ case QStyle::PE_ArrowLeft:
+ a.setPoints(QCOORDARRLEN(keramik_left_arrow), keramik_left_arrow);
+ break;
+
+ default:
+ a.setPoints(QCOORDARRLEN(keramik_right_arrow), keramik_right_arrow);
+ }
+
+ p->save();
+ /*if ( down )
+ p->translate( pixelMetric( PM_ButtonShiftHorizontal ),
+ pixelMetric( PM_ButtonShiftVertical ) );
+ */
+
+ 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 QColorGroup &cg,
+ const QPopupMenu* /* popup */ ) const
+{
+ QColor col = cg.button();
+
+#ifdef Q_WS_X11 // Only draw menu gradients on TrueColor, X11 visuals
+ if ( QPaintDevice::x11AppDepth() >= 24 )
+ KPixmapEffect::gradient( pix, col.light(120), col.dark(115),
+ KPixmapEffect::HorizontalGradient );
+ else
+#endif
+ pix.fill( col );
+}
+
+// XXX
+QRect KeramikStyle::subRect(SubRect r, const QWidget *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:
+ {
+ const QPushButton* button = (const QPushButton*) widget;
+ QRect wrect(widget->rect());
+
+ if (button->isDefault() || button->autoDefault())
+ {
+ return QRect(wrect.x() + 6, wrect.y() + 5, wrect.width() - 12, wrect.height() - 10);
+ }
+ else
+ {
+ return QRect(wrect.x() + 3, wrect.y() + 5, wrect.width() - 8, wrect.height() - 10);
+ }
+
+ break;
+ }
+
+ case SR_ComboBoxFocusRect:
+ {
+ return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField );
+ }
+
+ case SR_CheckBoxFocusRect:
+ {
+ const QCheckBox* cb = static_cast<const QCheckBox*>(widget);
+
+ //Only checkbox, no label
+ if (cb->text().isEmpty() && (cb->pixmap() == 0) )
+ {
+ QRect bounding = cb->rect();
+ QSize checkDim = loader.size( keramik_checkbox_on);
+ int cw = checkDim.width();
+ int ch = checkDim.height();
+
+ QRect checkbox(bounding.x() + 1, bounding.y() + 1 + (bounding.height() - ch)/2,
+ cw - 3, ch - 4);
+
+ return checkbox;
+ }
+
+ //Fallthrough intentional
+ }
+
+ default:
+ return KStyle::subRect( r, widget );
+ }
+}
+
+
+QPixmap KeramikStyle::stylePixmap(StylePixmap stylepixmap,
+ const QWidget* widget,
+ const QStyleOption& opt) 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 KStyle::stylePixmap(stylepixmap, widget, opt);
+}
+
+
+
+
+KeramikStyle::KeramikStyle()
+ :KStyle( AllowMenuTransparency | FilledFrameWorkaround, ThreeButtonScrollBar ),
+ maskMode(false), formMode(false),
+ toolbarBlendWidget(0), titleBarMode(None), flatMode(false), customScrollMode(false), kickerMode(false)
+{
+ forceSmallMode = false;
+ hoverWidget = 0;
+
+ QSettings settings;
+
+ highlightScrollBar = settings.readBoolEntry("/keramik/Settings/highlightScrollBar", true);
+ animateProgressBar = settings.readBoolEntry("/keramik/Settings/animateProgressBar", false);
+
+ if (animateProgressBar)
+ {
+ animationTimer = new QTimer( this );
+ connect( animationTimer, SIGNAL(timeout()), this, SLOT(updateProgressPos()) );
+ }
+
+ firstComboPopupRelease = false;
+}
+
+void KeramikStyle::updateProgressPos()
+{
+ //Update the registered progressbars.
+ QMap<QProgressBar*, int>::iterator iter;
+ bool visible = false;
+ for (iter = progAnimWidgets.begin(); iter != progAnimWidgets.end(); ++iter)
+ {
+ QProgressBar* 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::polish(QApplication* app)
+{
+ if (!qstrcmp(app->argv()[0], "kicker"))
+ kickerMode = true;
+}
+
+void KeramikStyle::polish(QWidget* widget)
+{
+ // Put in order of highest occurrence to maximise hit rate
+ if ( widget->inherits( "QPushButton" ) || widget->inherits( "QComboBox" ) || widget->inherits("QToolButton") )
+ {
+ widget->installEventFilter(this);
+ if ( widget->inherits( "QComboBox" ) )
+ widget->setBackgroundMode( NoBackground );
+ }
+ else if ( widget->inherits( "QMenuBar" ) || widget->inherits( "QPopupMenu" ) )
+ widget->setBackgroundMode( NoBackground );
+
+ else if ( widget->parentWidget() &&
+ ( ( widget->inherits( "QListBox" ) && widget->parentWidget()->inherits( "QComboBox" ) ) ||
+ widget->inherits( "KCompletionBox" ) ) ) {
+ QListBox* listbox = (QListBox*) widget;
+ listbox->setLineWidth( 4 );
+ listbox->setBackgroundMode( NoBackground );
+ widget->installEventFilter( this );
+
+ } else if (widget->inherits("QToolBarExtensionWidget")) {
+ widget->installEventFilter(this);
+ //widget->setBackgroundMode( NoBackground );
+ }
+ else if ( !qstrcmp( widget->name(), kdeToolbarWidget ) ) {
+ widget->setBackgroundMode( NoBackground );
+ widget->installEventFilter(this);
+ }
+
+ if (animateProgressBar && ::qt_cast<QProgressBar*>(widget))
+ {
+ widget->installEventFilter(this);
+ progAnimWidgets[static_cast<QProgressBar*>(widget)] = 0;
+ connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(progressBarDestroyed(QObject*)));
+ if (!animationTimer->isActive())
+ animationTimer->start( 50, false );
+ }
+
+ KStyle::polish(widget);
+}
+
+void KeramikStyle::unPolish(QWidget* widget)
+{
+ //### TODO: This needs major cleanup (and so does polish() )
+ if ( widget->inherits( "QPushButton" ) || widget->inherits( "QComboBox" ) )
+ {
+ if ( widget->inherits( "QComboBox" ) )
+ widget->setBackgroundMode( PaletteButton );
+ widget->removeEventFilter(this);
+ }
+ else if ( widget->inherits( "QMenuBar" ) || widget->inherits( "QPopupMenu" ) )
+ widget->setBackgroundMode( PaletteBackground );
+
+ else if ( widget->parentWidget() &&
+ ( ( widget->inherits( "QListBox" ) && widget->parentWidget()->inherits( "QComboBox" ) ) ||
+ widget->inherits( "KCompletionBox" ) ) ) {
+ QListBox* listbox = (QListBox*) widget;
+ listbox->setLineWidth( 1 );
+ listbox->setBackgroundMode( PaletteBackground );
+ widget->removeEventFilter( this );
+ widget->clearMask();
+ } else if (widget->inherits("QToolBarExtensionWidget")) {
+ widget->removeEventFilter(this);
+ }
+ else if ( !qstrcmp( widget->name(), kdeToolbarWidget ) ) {
+ widget->setBackgroundMode( PaletteBackground );
+ widget->removeEventFilter(this);
+ }
+ else if ( ::qt_cast<QProgressBar*>(widget) )
+ {
+ progAnimWidgets.remove(static_cast<QProgressBar*>(widget));
+ }
+
+ KStyle::unPolish(widget);
+}
+
+void KeramikStyle::progressBarDestroyed(QObject* obj)
+{
+ progAnimWidgets.remove(static_cast<QProgressBar*>(obj));
+}
+
+
+void KeramikStyle::polish( QPalette& )
+{
+ loader.clear();
+}
+
+/**
+ Draws gradient background for toolbar buttons, handles and spacers
+*/
+static void renderToolbarEntryBackground(QPainter* paint,
+ const QToolBar* parent, QRect r, const QColorGroup& 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() == QDockWindow::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(QPainter* painter, const QWidget* 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.
+ QWidget *parent = static_cast<QWidget*>(widget->parentWidget());
+ int x_offset = widget->x(), y_offset = widget->y();
+ while (parent && parent->parent() && !qstrcmp( parent->name(), kdeToolbarWidget ) )
+ {
+ x_offset += parent->x();
+ y_offset += parent->y();
+ parent = static_cast<QWidget*>(parent->parent());
+ }
+
+ QRect pr = parent->rect();
+ bool horiz_grad = pr.width() > pr.height();
+
+ int toolHeight = parent->height();
+ int toolWidth = parent->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.
+ QToolBar* tb = dynamic_cast<QToolBar*>(parent);
+ if (tb)
+ {
+ horiz_grad = tb->orientation() == Qt::Horizontal;
+
+ //If floating, we need to skip the titlebar.
+ if (tb->place() == QDockWindow::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() -
+ (widget->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 - (widget->height() + needToTouchBottom) - 1;
+ }
+ }
+
+ if (painter)
+ {
+ Keramik::GradientPainter::renderGradient( painter, widget->rect(),
+ widget->colorGroup().button(), horiz_grad, false,
+ x_offset, y_offset, toolWidth, toolHeight);
+ }
+ else
+ {
+ QPainter p( widget );
+ Keramik::GradientPainter::renderGradient( &p, widget->rect(),
+ widget->colorGroup().button(), horiz_grad, false,
+ x_offset, y_offset, toolWidth, toolHeight);
+ }
+}
+
+// This function draws primitive elements as well as their masks.
+void KeramikStyle::drawPrimitive( PrimitiveElement pe,
+ QPainter *p,
+ const QRect &r,
+ const QColorGroup &cg,
+ SFlags flags,
+ const QStyleOption& opt ) const
+{
+ bool down = flags & Style_Down;
+ bool on = flags & Style_On;
+ 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)
+ {
+ QRect nr;
+ if (titleBarMode == Maximized)
+ {
+ //### What should we draw at sides?
+ nr = QRect(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 = QRect(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,
+ QRect(r.x(), 0, r.width(), r.height()),
+ Keramik::ColorUtil::lighten(cg.button(), 115), flags & Style_Horizontal, false );
+ }
+ else
+ Keramik::GradientPainter::renderGradient( p,
+ QRect(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, 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, QRect(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_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, r, cg, Style_Enabled );
+ else drawPrimitive( PE_ArrowDown, p, 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;
+
+ QColor 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, QRect(r.x(), r.y(), r.width()/2, r.height()), PE_ArrowLeft, down, !disabled);
+
+ drawKeramikArrow(p, cg, QRect(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, QRect(r.x(), r.y(), r.width(), r.height()/2), PE_ArrowUp, down, !disabled);
+
+ drawKeramikArrow(p, cg, QRect(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(QColorGroup::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( QRect( 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() == QInternal::Widget &&
+ QCString(static_cast<QWidget*>(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;
+ }
+ }
+ KStyle::drawPrimitive(pe, p, r, cg, flags, opt);
+ break;
+ }
+ case PE_WindowFrame:
+ {
+ bool sunken = flags & Style_Sunken;
+ int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth)
+ : opt.lineWidth();
+ if (lw == 2)
+ {
+ QPen 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
+ KStyle::drawPrimitive(pe, p, 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)
+ : 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)
+ : opt.lineWidth();
+
+ if (lw)
+ {
+ //Gradient border colors.
+ //(Same as in gradients.cpp)
+ QColor gradTop = Keramik::ColorUtil::lighten(cg.button(),110);
+ QColor 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, QRect(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, QRect(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:
+ {
+ QWidget* paintWidget = dynamic_cast<QWidget*>(p->device());
+ QToolBar* parent = 0;
+ if (paintWidget)
+ parent = ::qt_cast<QToolBar*>(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;
+ }
+
+ default:
+ {
+ // ARROWS
+ // -------------------------------------------------------------------
+ if (pe >= PE_ArrowUp && pe <= PE_ArrowLeft)
+ {
+ QPointArray a;
+
+ switch(pe)
+ {
+ case PE_ArrowUp:
+ a.setPoints(QCOORDARRLEN(u_arrow), u_arrow);
+ break;
+
+ case PE_ArrowDown:
+ a.setPoints(QCOORDARRLEN(d_arrow), d_arrow);
+ break;
+
+ case PE_ArrowLeft:
+ a.setPoints(QCOORDARRLEN(l_arrow), l_arrow);
+ break;
+
+ default:
+ a.setPoints(QCOORDARRLEN(r_arrow), r_arrow);
+ }
+
+ p->save();
+ if ( flags & Style_Down )
+ p->translate( pixelMetric( PM_ButtonShiftHorizontal ),
+ pixelMetric( PM_ButtonShiftVertical ) );
+
+ 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
+ KStyle::drawPrimitive( pe, p, r, cg, flags, opt );
+ }
+ }
+}
+
+void KeramikStyle::drawKStylePrimitive( KStylePrimitive kpe,
+ QPainter* p,
+ const QWidget* widget,
+ const QRect &r,
+ const QColorGroup &cg,
+ SFlags flags,
+ const QStyleOption &opt ) 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:
+ {
+ const QSlider* slider = static_cast< const QSlider* >( widget );
+ bool horizontal = slider->orientation() == Horizontal;
+
+ Keramik::TilePainter::PaintMode pmod = Keramik::TilePainter::PaintNormal;
+
+ if (slider->erasePixmap() && !slider->erasePixmap()->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:
+ {
+ const QSlider* slider = static_cast< const QSlider* >( widget );
+ bool horizontal = slider->orientation() == Horizontal;
+
+ QColor 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;
+
+ QToolBar* parent = 0;
+
+ if (widget && widget->parent() && widget->parent()->inherits("QToolBar"))
+ parent = static_cast<QToolBar*>(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:
+ KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt);
+ }
+}
+
+bool KeramikStyle::isFormWidget(const QWidget* widget) const
+{
+ //Form widgets are in the KHTMLView, but that has 2 further inner levels
+ //of widgets - QClipperWidget, and outside of that, QViewportWidget
+ QWidget* potentialClipPort = widget->parentWidget();
+ if ( !potentialClipPort || potentialClipPort->isTopLevel() )
+ return false;
+
+ QWidget* potentialViewPort = potentialClipPort->parentWidget();
+ if (!potentialViewPort || potentialViewPort->isTopLevel() ||
+ qstrcmp(potentialViewPort->name(), "qt_viewport") )
+ return false;
+
+ QWidget* potentialKHTML = potentialViewPort->parentWidget();
+ if (!potentialKHTML || potentialKHTML->isTopLevel() ||
+ qstrcmp(potentialKHTML->className(), "KHTMLView") )
+ return false;
+
+
+ return true;
+}
+
+void KeramikStyle::drawControl( ControlElement element,
+ QPainter *p,
+ const QWidget *widget,
+ const QRect &r,
+ const QColorGroup &cg,
+ SFlags flags,
+ const QStyleOption& opt ) 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 QPushButton* btn = static_cast< const QPushButton* >( widget );
+
+ if (isFormWidget(btn))
+ formMode = true;
+
+ if ( widget == hoverWidget )
+ flags |= Style_MouseOver;
+
+ if ( btn->isFlat( ) )
+ flatMode = true;
+
+ if ( btn->isDefault( ) && !flatMode )
+ {
+ drawPrimitive( PE_ButtonDefault, p, r, cg, flags );
+ }
+ else
+ {
+ if (widget->parent() && widget->parent()->inherits("QToolBar"))
+ toolbarBlendWidget = widget;
+
+ drawPrimitive( PE_ButtonCommand, p, r, cg, flags );
+ toolbarBlendWidget = 0;
+ }
+
+ formMode = false;
+ break;
+ }
+
+
+ // PUSHBUTTON LABEL
+ // -------------------------------------------------------------------
+ case CE_PushButtonLabel:
+ {
+ const QPushButton* button = static_cast<const QPushButton *>( widget );
+ bool active = button->isOn() || button->isDown();
+ bool cornArrow = false;
+
+ // Shift button contents if pushed.
+ if ( active )
+ {
+ x += pixelMetric(PM_ButtonShiftHorizontal, widget);
+ y += pixelMetric(PM_ButtonShiftVertical, widget);
+ flags |= Style_Sunken;
+ }
+
+ // Does the button have a popup menu?
+ if ( button->isMenuButton() )
+ {
+ int dx = pixelMetric( PM_MenuButtonIndicator, widget );
+ if ( button->iconSet() && !button->iconSet()->isNull() &&
+ (dx + button->iconSet()->pixmap (QIconSet::Small, QIconSet::Normal, QIconSet::Off ).width()) >= w )
+ {
+ cornArrow = true; //To little room. Draw the arrow in the corner, don't adjust the widget
+ }
+ else
+ {
+ drawPrimitive( PE_ArrowDown, p, visualRect( QRect(x + w - dx - 8, y + 2, dx, h - 4), r ),
+ cg, flags, opt );
+ w -= dx;
+ }
+ }
+
+ // Draw the icon if there is one
+ if ( button->iconSet() && !button->iconSet()->isNull() )
+ {
+ QIconSet::Mode mode = QIconSet::Disabled;
+ QIconSet::State state = QIconSet::Off;
+
+ if (button->isEnabled())
+ mode = button->hasFocus() ? QIconSet::Active : QIconSet::Normal;
+ if (button->isToggleButton() && button->isOn())
+ state = QIconSet::On;
+
+ QPixmap icon = button->iconSet()->pixmap( QIconSet::Small, mode, state );
+
+ if (!button->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, button->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 (!button->pixmap())
+ p->drawPixmap( x + w/2 - icon.width()/2, y + h / 2 - icon.height() / 2,
+ icon );
+ else //icon + pixmap. Ugh.
+ p->drawPixmap( x + button->isDefault() ? 8 : 4 , y + h / 2 - icon.height() / 2, icon );
+ }
+
+ if (cornArrow) //Draw over the icon
+ drawPrimitive( PE_ArrowDown, p, visualRect( QRect(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, QRect(x, y, w, h), AlignCenter | ShowPrefix, button->colorGroup(),
+ button->isEnabled(), button->pixmap(), button->text(), -1,
+ &button->colorGroup().buttonText() );
+
+ if ( flags & Style_HasFocus )
+ drawPrimitive( PE_FocusRect, p,
+ visualRect( subRect( SR_PushButtonFocusRect, widget ), widget ),
+ cg, flags );
+ break;
+ }
+
+ case CE_ToolButtonLabel:
+ {
+ //const QToolButton *toolbutton = static_cast<const QToolButton * >(widget);
+ bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "QToolBar" );
+ QRect nr = r;
+
+ if (!onToolbar)
+ {
+ if (widget->parentWidget() &&
+ !qstrcmp(widget->parentWidget()->name(),"qt_maxcontrols" ) )
+ {
+ //Make sure we don't cut into the endline
+ if (!qstrcmp(widget->name(), "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
+ }
+
+ KStyle::drawControl(element, p, widget, nr, cg, flags, opt);
+ break;
+ }
+
+ case CE_TabBarTab:
+ {
+ const QTabBar* tabBar = static_cast< const QTabBar* >( widget );
+
+ bool bottom = tabBar->shape() == QTabBar::RoundedBelow ||
+ tabBar->shape() == QTabBar::TriangularBelow;
+
+ if ( flags & Style_Selected )
+ {
+ QRect tabRect = r;
+ //If not the right-most tab, readjust the painting to be one pixel wider
+ //to avoid a doubled line
+ int rightMost = QApplication::reverseLayout() ? 0 : tabBar->count() - 1;
+
+ if (tabBar->indexOf( opt.tab()->identifier() ) != rightMost)
+ tabRect.setWidth( tabRect.width() + 1);
+ Keramik::ActiveTabPainter( bottom ).draw( p, tabRect, cg.button().light(110), cg.background(), !tabBar->isEnabled(), pmode());
+ }
+ else
+ {
+ Keramik::InactiveTabPainter::Mode mode;
+ int index = tabBar->indexOf( opt.tab()->identifier() );
+ if ( index == 0 ) mode = Keramik::InactiveTabPainter::First;
+ else if ( index == tabBar->count() - 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:
+ {
+ QRect pr = r;
+ if (widget && widget->inherits("QToolBar"))
+ {
+ const QToolBar* tb = static_cast<const QToolBar*>(widget);
+ if (tb->place() == QDockWindow::OutsideDock)
+ {
+ //Readjust the paint rectangle to skip the titlebar
+ pr = QRect(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
+ KStyle::drawControl( CE_DockWindowEmptyArea, p,
+ widget, r, cg, flags, opt );
+ break;
+ }
+ case CE_MenuBarEmptyArea:
+ {
+ Keramik::GradientPainter::renderGradient( p, r, cg.button(), true, true);
+ break;
+ }
+ // MENUBAR ITEM (sunken panel on mouse over)
+ // -------------------------------------------------------------------
+ case CE_MenuBarItem:
+ {
+ QMenuBar *mb = (QMenuBar*)widget;
+ QMenuItem *mi = opt.menuItem();
+ QRect 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(QColorGroup::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: {
+ const QPopupMenu *popupmenu = static_cast< const QPopupMenu * >( widget );
+ QRect main = r;
+
+ QMenuItem *mi = opt.menuItem();
+
+ if ( !mi )
+ {
+ // Don't leave blank holes if we set NoBackground for the QPopupMenu.
+ // This only happens when the popupMenu spans more than one column.
+ if (! ( widget->erasePixmap() && !widget->erasePixmap()->isNull() ) )
+ p->fillRect( r, cg.background().light( 105 ) );
+
+ break;
+ }
+ int tab = opt.tabWidth();
+ int checkcol = opt.maxIconWidth();
+ bool enabled = mi->isEnabled();
+ bool checkable = popupmenu->isCheckable();
+ bool active = flags & Style_Active;
+ bool etchtext = styleHint( SH_EtchDisabledText );
+ bool reverse = QApplication::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 ( widget->erasePixmap() && !widget->erasePixmap()->isNull() )
+ p->drawPixmap( main.topLeft(), *widget->erasePixmap(), main );
+ else p->fillRect( main, cg.background().light( 105 ) );
+ p->drawWinFocusRect( r );
+ }
+ }
+ // Draw the transparency pixmap
+ else if ( widget->erasePixmap() && !widget->erasePixmap()->isNull() )
+ p->drawPixmap( main.topLeft(), *widget->erasePixmap(), 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;
+ }
+
+ QRect cr = visualRect( QRect( x + 2, y + 2, checkcol - 1, h - 4 ), r );
+ // Do we have an icon?
+ if ( mi->iconSet() )
+ {
+ QIconSet::Mode mode;
+
+
+
+ // Select the correct icon from the iconset
+ if ( active )
+ mode = enabled ? QIconSet::Active : QIconSet::Disabled;
+ else
+ mode = enabled ? QIconSet::Normal : QIconSet::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() )
+ qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(),
+ cg, true, 1, &cg.brush(QColorGroup::Midlight) );
+ // Draw the icon
+ QPixmap pixmap = mi->iconSet()->pixmap( QIconSet::Small, mode );
+ QRect 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 )
+ qDrawShadePanel( p, cr.x(), cr.y(), cr.width(), cr.height(), cg, true, 1,
+ &cg.brush(QColorGroup::Midlight) );
+
+ // Draw the checkmark
+ SFlags cflags = Style_Default;
+ cflags |= active ? Style_Enabled : Style_On;
+
+ drawPrimitive( PE_CheckMark, p, cr, cg, cflags );
+ }
+
+ // 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)
+ QColor 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
+ QString 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;
+
+ //QColor draw = cg.text();
+ QColor 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() ) {
+ QPixmap *pixmap = mi->pixmap();
+
+ // Draw the pixmap
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( OpaqueMode );
+
+ int diffw = ( ( w - pixmap->width() ) / 2 )
+ + ( ( w - pixmap->width() ) % 2 );
+ p->drawPixmap( x+diffw, y+itemFrame, *pixmap );
+
+ if ( pixmap->depth() == 1 )
+ p->setBackgroundMode( TransparentMode );
+ }
+ }
+
+ // Does the menu item have a submenu?
+ if ( mi->popup() ) {
+ PrimitiveElement arrow = reverse ? PE_ArrowLeft : PE_ArrowRight;
+ int dim = pixelMetric(PM_MenuButtonIndicator) - itemFrame;
+ QRect vr = visualRect( QRect( 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();
+
+ QColorGroup g2( discol, cg.highlight(), white, white,
+ enabled ? white : discol, discol, white );
+
+ drawPrimitive( arrow, p, vr, g2, Style_Enabled );
+ } else
+ drawPrimitive( arrow, p, vr, cg,
+ enabled ? Style_Enabled : Style_Default );
+ }
+ break;
+ }
+ case CE_ProgressBarContents: {
+ const QProgressBar* pb = (const QProgressBar*)widget;
+ QRect cr = subRect(SR_ProgressBarContents, widget);
+ double progress = pb->progress();
+ bool reverse = QApplication::reverseLayout();
+ int steps = pb->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.
+ QRect progressRect;
+ if (reverse)
+ progressRect = QRect(cr.x() + cr.width() - width - pstep, cr.y(),
+ width, cr.height());
+ else
+ progressRect = QRect(cr.x() + pstep, cr.y(), width, cr.height());
+
+ Keramik::RowPainter(keramik_progressbar).draw(p, progressRect,
+ cg.highlight(), cg.background() );
+ return;
+ }
+
+ QRect progressRect;
+
+ if (reverse)
+ progressRect = QRect(cr.x()+(cr.width()-width), cr.y(), width, cr.height());
+ else
+ progressRect = QRect(cr.x(), cr.y(), width, cr.height());
+
+ //Apply the animation rectangle.
+ //////////////////////////////////////
+ if (animateProgressBar)
+ {
+ int progAnimShift = progAnimWidgets[const_cast<QProgressBar*>(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
+ QSize 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
+ QPixmap 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, QPainter::CoordPainter);
+
+ //Expand the paint region slightly to get the animation offset.
+ progressRect.setLeft(progressRect.x() - progAnimShift);
+
+ //Paint the stripes.
+ QPixmap 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, QPainter::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:
+ KStyle::drawControl(element, p, widget, r, cg, flags, opt);
+ }
+}
+
+void KeramikStyle::drawControlMask( ControlElement element,
+ QPainter *p,
+ const QWidget *widget,
+ const QRect &r,
+ const QStyleOption& opt ) const
+{
+ p->fillRect(r, color1);
+ maskMode = true;
+ drawControl( element, p, widget, r, QApplication::palette().active(), QStyle::Style_Default, opt);
+ maskMode = false;
+}
+
+bool KeramikStyle::isSizeConstrainedCombo(const QComboBox* combo) const
+{
+ if (combo->width() >= 80)
+ return false;
+ int suggestedWidth = combo->sizeHint().width();
+
+ if (combo->width() - suggestedWidth < -5)
+ return true;
+
+ return false;
+}
+
+void KeramikStyle::drawComplexControl( ComplexControl control,
+ QPainter *p,
+ const QWidget *widget,
+ const QRect &r,
+ const QColorGroup &cg,
+ SFlags flags,
+ SCFlags controls,
+ SCFlags active,
+ const QStyleOption& opt ) const
+{
+ bool disabled = ( flags & Style_Enabled ) == 0;
+ switch(control)
+ {
+ // COMBOBOX
+ // -------------------------------------------------------------------
+ case CC_ComboBox:
+ {
+ bool toolbarMode = false;
+ const QComboBox* cb = static_cast< const QComboBox* >( widget );
+ bool compact = isSizeConstrainedCombo(cb);
+
+ if (isFormWidget(cb))
+ formMode = true;
+
+ QPixmap * buf = 0;
+ QPainter* p2 = p;
+
+ QRect br = r;
+
+ if (controls == SC_All)
+ {
+ //Double-buffer only when we are in the slower full-blend mode
+ if (widget->parent() &&
+ ( widget->parent()->inherits("QToolBar")|| !qstrcmp(widget->parent()->name(), kdeToolbarWidget) ) )
+ {
+ buf = new QPixmap( r.width(), r.height() );
+ br.setX(0);
+ br.setY(0);
+ p2 = new QPainter(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;
+
+ if ( widget == hoverWidget )
+ flags |= Style_MouseOver;
+
+ drawPrimitive( PE_ButtonCommand, p2, 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;
+
+ QRect ar = querySubControlMetrics( CC_ComboBox, widget,
+ SC_ComboBoxArrow );
+ if (!compact)
+ {
+ ar.setWidth(ar.width()-13);
+ QRect rr = visualRect( QRect( ar.x(), ar.y() + 4,
+ loader.size(keramik_ripple ).width(), ar.height() - 8 ),
+ widget );
+
+ ar = visualRect( QRect( ar.x() + loader.size( keramik_ripple ).width() + 4, ar.y(),
+ 11, ar.height() ),
+ widget );
+
+ QPointArray a;
+
+ a.setPoints(QCOORDARRLEN(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( QRect( ar.x(), ar.y(), 11, ar.height() ), widget);
+ QPointArray a;
+
+ a.setPoints(QCOORDARRLEN(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 ( cb->editable() )
+ {
+ QRect er = visualRect( querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ), widget );
+ er.addCoords( -2, -2, 2, 2 );
+ p2->fillRect( er, cg.base() );
+ drawPrimitive( PE_PanelLineEdit, p2, er, cg );
+ Keramik::RectTilePainter( keramik_frame_shadow, false, false, 2, 2 ).draw( p2, er, cg.button(),
+ Qt::black, false, pmodeFullBlend() );
+ }
+ else if ( cb->hasFocus() )
+ {
+ QRect re = QStyle::visualRect(subRect(SR_ComboBoxFocusRect, cb), widget);
+ if ( compact )
+ re.addCoords( 3, 3, 0, -3 );
+ p2->fillRect( re, cg.brush( QColorGroup::Highlight ) );
+ drawPrimitive( PE_FocusRect, p2, re, cg,
+ Style_FocusAtBorder, QStyleOption( cg.highlight() ) );
+ }
+ // QComboBox draws the text on its own and uses the painter's current colors
+ if ( cb->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 QSpinWidget* sw = static_cast< const QSpinWidget* >( widget );
+ QRect br = visualRect( querySubControlMetrics( CC_SpinWidget, widget, SC_SpinWidgetButtonField ), widget );
+ 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, r, cg );
+
+ break;
+ }
+ case CC_ScrollBar:
+ {
+ const QScrollBar* sb = static_cast< const QScrollBar* >( widget );
+ if (highlightScrollBar && sb->parentWidget()) //Don't do the check if not highlighting anyway
+ {
+ if (sb->parentWidget()->colorGroup().button() != sb->colorGroup().button())
+ customScrollMode = true;
+ }
+ bool horizontal = sb->orientation() == Horizontal;
+ QRect slider, subpage, addpage, subline, addline;
+ if ( sb->minValue() == sb->maxValue() ) flags &= ~Style_Enabled;
+
+ slider = querySubControlMetrics( control, widget, SC_ScrollBarSlider, opt );
+ subpage = querySubControlMetrics( control, widget, SC_ScrollBarSubPage, opt );
+ addpage = querySubControlMetrics( control, widget, SC_ScrollBarAddPage, opt );
+ subline = querySubControlMetrics( control, widget, SC_ScrollBarSubLine, opt );
+ addline = querySubControlMetrics( control, widget, SC_ScrollBarAddLine, opt );
+
+ if ( controls & SC_ScrollBarSubLine )
+ drawPrimitive( PE_ScrollBarSubLine, p, subline, cg,
+ flags | ( ( active & SC_ScrollBarSubLine ) ? Style_Down : 0 ) );
+
+ QRegion clip;
+ if ( controls & SC_ScrollBarSubPage ) clip |= subpage;
+ if ( controls & SC_ScrollBarAddPage ) clip |= addpage;
+ if ( horizontal )
+ clip |= QRect( slider.x(), 0, slider.width(), sb->height() );
+ else
+ clip |= QRect( 0, slider.y(), sb->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, slider, cg,
+ flags | ( ( active == SC_ScrollBarSlider ) ? Style_Down : 0 ) );
+ }
+ p->setClipping( false );
+
+ if ( controls & ( SC_ScrollBarSubLine | SC_ScrollBarAddLine ) )
+ {
+ drawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags );
+ if ( active & SC_ScrollBarSubLine )
+ {
+ if ( horizontal )
+ p->setClipRect( QRect( addline.x(), addline.y(), addline.width() / 2, addline.height() ) );
+ else
+ p->setClipRect( QRect( addline.x(), addline.y(), addline.width(), addline.height() / 2 ) );
+ drawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags | Style_Down );
+ }
+ else if ( active & SC_ScrollBarAddLine )
+ {
+ if ( horizontal )
+ p->setClipRect( QRect( addline.x() + addline.width() / 2, addline.y(), addline.width() / 2, addline.height() ) );
+ else
+ p->setClipRect( QRect( addline.x(), addline.y() + addline.height() / 2, addline.width(), addline.height() / 2 ) );
+ drawPrimitive( PE_ScrollBarAddLine, p, addline, cg, flags | Style_Down );
+ }
+ }
+
+ customScrollMode = false;
+
+
+ break;
+ }
+
+ // TOOLBUTTON
+ // -------------------------------------------------------------------
+ case CC_ToolButton: {
+ const QToolButton *toolbutton = (const QToolButton *) widget;
+ bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "QToolBar" );
+ bool onExtender = !onToolbar &&
+ widget->parentWidget() && widget->parentWidget()->inherits( "QToolBarExtensionWidget") &&
+ widget->parentWidget()->parentWidget()->inherits( "QToolBar" );
+
+ bool onControlButtons = false;
+ if (!onToolbar && !onExtender && widget->parentWidget() &&
+ !qstrcmp(widget->parentWidget()->name(),"qt_maxcontrols" ) )
+ {
+ onControlButtons = true;
+ titleBarMode = Maximized;
+ }
+
+ QRect button, menuarea;
+ button = querySubControlMetrics(control, widget, SC_ToolButton, opt);
+ menuarea = querySubControlMetrics(control, widget, SC_ToolButtonMenu, opt);
+
+ SFlags bflags = flags,
+ mflags = flags;
+
+ if (active & SC_ToolButton)
+ bflags |= Style_Down;
+ if (active & SC_ToolButtonMenu)
+ mflags |= Style_Down;
+
+ if ( widget == hoverWidget )
+ bflags |= Style_MouseOver;
+
+
+ if (onToolbar && static_cast<QToolBar*>(widget->parent())->orientation() == Qt::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, button, cg,
+ bflags, opt);
+ }
+
+ // Check whether to draw a background pixmap
+ else if ( toolbutton->parentWidget() &&
+ toolbutton->parentWidget()->backgroundPixmap() &&
+ !toolbutton->parentWidget()->backgroundPixmap()->isNull() )
+ {
+ QPixmap pixmap = *(toolbutton->parentWidget()->backgroundPixmap());
+ p->drawTiledPixmap( r, pixmap, toolbutton->pos() );
+ }
+ else if (onToolbar)
+ {
+ renderToolbarWidgetBackground(p, widget);
+ }
+ else if (onExtender)
+ {
+ // This assumes floating toolbars can't have extenders,
+ //(so if we're on an extender, we're not floating)
+ QWidget* parent = static_cast<QWidget*> (widget->parent());
+ QToolBar* toolbar = static_cast<QToolBar*>(parent->parent());
+ QRect tr = toolbar->rect();
+ bool horiz = toolbar->orientation() == Qt::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(widget->pos()).y();
+ else
+ xoff = parent->mapToParent(widget->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, menuarea, cg, mflags, opt);
+ drawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, opt);
+ }
+
+ if (toolbutton->hasFocus() && !toolbutton->focusProxy()) {
+ QRect fr = toolbutton->rect();
+ fr.addCoords(3, 3, -3, -3);
+ drawPrimitive(PE_FocusRect, p, fr, cg);
+ }
+
+ titleBarMode = None;
+
+ break;
+ }
+
+ case CC_TitleBar:
+ titleBarMode = Regular; //Handle buttons on titlebar different from toolbuttons
+ default:
+ KStyle::drawComplexControl( control, p, widget,
+ r, cg, flags, controls, active, opt );
+
+ titleBarMode = None;
+ }
+}
+
+void KeramikStyle::drawComplexControlMask( ComplexControl control,
+ QPainter *p,
+ const QWidget *widget,
+ const QRect &r,
+ const QStyleOption& opt ) const
+{
+ if (control == CC_ComboBox)
+ {
+ maskMode = true;
+ drawComplexControl(CC_ComboBox, p, widget, r,
+ QApplication::palette().active(), Style_Default,
+ SC_ComboBoxFrame,SC_None, opt);
+ maskMode = false;
+
+ }
+ else
+ p->fillRect(r, color1);
+
+}
+
+int KeramikStyle::pixelMetric(PixelMetric m, const QWidget *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:
+ {
+ const QTabBar* tb = ::qt_cast<const QTabBar*>(widget);
+ if (tb)
+ {
+ if (tb->shape() == QTabBar::RoundedBelow ||
+ tb->shape() == QTabBar::TriangularBelow)
+ return 0;
+ }
+
+ return 2; //For top, or if not sure
+ }
+
+
+ case PM_TitleBarHeight:
+ return titleBarH;
+
+ default:
+ return KStyle::pixelMetric(m, widget);
+ }
+}
+
+
+QSize KeramikStyle::sizeFromContents( ContentsType contents,
+ const QWidget* widget,
+ const QSize &contentSize,
+ const QStyleOption& opt ) const
+{
+ switch (contents)
+ {
+ // PUSHBUTTON SIZE
+ // ------------------------------------------------------------------
+ case CT_PushButton:
+ {
+ const QPushButton* btn = static_cast< const QPushButton* >( widget );
+
+ int w = contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, widget );
+ int h = contentSize.height() + 2 * pixelMetric( PM_ButtonMargin, widget );
+ if ( btn->text().isEmpty() && contentSize.width() < 32 ) return QSize( w, h );
+
+
+ //For some reason kcontrol no longer does this...
+ //if ( btn->isDefault() || btn->autoDefault() )
+ // w = QMAX( w, 40 );
+
+ return QSize( w + 30, h + 5 ); //MX: No longer blank space -- can make a bit smaller
+ }
+
+ case CT_ToolButton:
+ {
+ bool onToolbar = widget->parentWidget() && widget->parentWidget()->inherits( "QToolBar" );
+ if (!onToolbar) //Behaves like a button, so scale appropriately to the border
+ {
+ int w = contentSize.width();
+ int h = contentSize.height();
+ return QSize( w + 12, h + 10 );
+ }
+ else
+ {
+ return KStyle::sizeFromContents( contents, widget, contentSize, opt );
+ }
+ }
+
+ case CT_ComboBox: {
+ int arrow = 11 + loader.size( keramik_ripple ).width();
+ const QComboBox *cb = static_cast<const QComboBox*>( widget );
+ return QSize( contentSize.width() + arrow + (cb->editable() ? 26 : 22),
+ contentSize.height() + 10 );
+ }
+
+ // POPUPMENU ITEM SIZE
+ // -----------------------------------------------------------------
+ case CT_PopupMenuItem: {
+ if ( ! widget || opt.isDefault() )
+ return contentSize;
+
+ const QPopupMenu *popup = (const QPopupMenu *) widget;
+ bool checkable = popup->isCheckable();
+ QMenuItem *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(
+ QIconSet::Small, QIconSet::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 QSize( w, h );
+ }
+
+ default:
+ return KStyle::sizeFromContents( contents, widget, contentSize, opt );
+ }
+}
+
+
+QStyle::SubControl KeramikStyle::querySubControl( ComplexControl control,
+ const QWidget* widget,
+ const QPoint& point,
+ const QStyleOption& opt ) const
+{
+ SubControl result = KStyle::querySubControl( control, widget, point, opt );
+ if ( control == CC_ScrollBar && result == SC_ScrollBarAddLine )
+ {
+ QRect addline = querySubControlMetrics( control, widget, result, opt );
+ if ( static_cast< const QScrollBar* >( widget )->orientation() == Horizontal )
+ {
+ if ( point.x() < addline.center().x() ) result = SC_ScrollBarSubLine;
+ }
+ else if ( point.y() < addline.center().y() ) result = SC_ScrollBarSubLine;
+ }
+ return result;
+}
+
+QRect KeramikStyle::querySubControlMetrics( ComplexControl control,
+ const QWidget* widget,
+ SubControl subcontrol,
+ const QStyleOption& opt ) const
+{
+ switch ( control )
+ {
+ case CC_ComboBox:
+ {
+ int arrow;
+ bool compact = false;
+ if ( isSizeConstrainedCombo(static_cast<const QComboBox*>(widget) ) ) //### constant
+ compact = true;
+
+ if ( compact )
+ arrow = 11;
+ else
+ arrow = 11 + loader.size( keramik_ripple ).width();
+
+ switch ( subcontrol )
+ {
+ case SC_ComboBoxArrow:
+ if ( compact )
+ return QRect( widget->width() - arrow - 7, 0, arrow + 6, widget->height() );
+ else
+ return QRect( widget->width() - arrow - 14, 0, arrow + 13, widget->height() );
+
+ case SC_ComboBoxEditField:
+ {
+ if ( compact )
+ return QRect( 2, 4, widget->width() - arrow - 2 - 7, widget->height() - 8 );
+ else if ( widget->width() < 36 || widget->height() < 22 )
+ return QRect( 4, 3, widget->width() - arrow - 20, widget->height() - 6 );
+ else if ( static_cast< const QComboBox* >( widget )->editable() )
+ return QRect( 8, 4, widget->width() - arrow - 26, widget->height() - 11 );
+ else
+ return QRect( 6, 4, widget->width() - arrow - 22, widget->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();
+ QRect 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:
+ {
+ const QScrollBar* sb = static_cast< const QScrollBar* >( widget );
+ bool horizontal = sb->orientation() == 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 = sb->width() - subline - addline + 2;
+ }
+ else
+ {
+ subline = loader.size( keramik_scrollbar_vbar_arrow1 ).height();
+ addline = loader.size( keramik_scrollbar_vbar_arrow2 ).height();
+ maxlen = sb->height() - subline - addline + 2;
+ }
+ sliderpos = sb->sliderStart();
+ if ( sb->minValue() != sb->maxValue() )
+ {
+ int range = sb->maxValue() - sb->minValue();
+ sliderlen = ( sb->pageStep() * maxlen ) / ( range + sb->pageStep() );
+ slidermin = pixelMetric( PM_ScrollBarSliderMin, sb );
+ if ( sliderlen < slidermin ) sliderlen = slidermin;
+ if ( sliderlen > maxlen ) sliderlen = maxlen;
+ }
+ else sliderlen = maxlen;
+
+ switch ( subcontrol )
+ {
+ case SC_ScrollBarGroove:
+ if ( horizontal ) return QRect( subline, 0, maxlen, sb->height() );
+ else return QRect( 0, subline, sb->width(), maxlen );
+
+ case SC_ScrollBarSlider:
+ if (horizontal) return QRect( sliderpos, 0, sliderlen, sb->height() );
+ else return QRect( 0, sliderpos, sb->width(), sliderlen );
+
+ case SC_ScrollBarSubLine:
+ if ( horizontal ) return QRect( 0, 0, subline, sb->height() );
+ else return QRect( 0, 0, sb->width(), subline );
+
+ case SC_ScrollBarAddLine:
+ if ( horizontal ) return QRect( sb->width() - addline, 0, addline, sb->height() );
+ else return QRect( 0, sb->height() - addline, sb->width(), addline );
+
+ case SC_ScrollBarSubPage:
+ if ( horizontal ) return QRect( subline, 0, sliderpos - subline, sb->height() );
+ else return QRect( 0, subline, sb->width(), sliderpos - subline );
+
+ case SC_ScrollBarAddPage:
+ if ( horizontal ) return QRect( sliderpos + sliderlen, 0, sb->width() - addline - (sliderpos + sliderlen) , sb->height() );
+ else return QRect( 0, sliderpos + sliderlen, sb->width(), sb->height() - addline - (sliderpos + sliderlen)
+ /*maxlen - sliderpos - sliderlen + subline - 5*/ );
+
+ default: break;
+ };
+ break;
+ }
+ case CC_Slider:
+ {
+ const QSlider* sl = static_cast< const QSlider* >( widget );
+ bool horizontal = sl->orientation() == Horizontal;
+ QSlider::TickSetting ticks = sl->tickmarks();
+ int pos = sl->sliderStart();
+ int size = pixelMetric( PM_SliderControlThickness, widget );
+ int handleSize = pixelMetric( PM_SliderThickness, widget );
+ int len = pixelMetric( PM_SliderLength, widget );
+
+ //Shrink the metrics if the widget is too small
+ //to fit our normal values for them.
+ if (horizontal)
+ handleSize = QMIN(handleSize, sl->height());
+ else
+ handleSize = QMIN(handleSize, sl->width());
+
+ size = QMIN(size, handleSize);
+
+ switch ( subcontrol )
+ {
+ case SC_SliderGroove:
+ if ( horizontal )
+ {
+ if ( ticks == QSlider::Both )
+ return QRect( 0, ( sl->height() - size ) / 2, sl->width(), size );
+ else if ( ticks == QSlider::Above )
+ return QRect( 0, sl->height() - size - ( handleSize - size ) / 2, sl->width(), size );
+ return QRect( 0, ( handleSize - size ) / 2, sl->width(), size );
+ }
+ else
+ {
+ if ( ticks == QSlider::Both )
+ return QRect( ( sl->width() - size ) / 2, 0, size, sl->height() );
+ else if ( ticks == QSlider::Above )
+ return QRect( sl->width() - size - ( handleSize - size ) / 2, 0, size, sl->height() );
+ return QRect( ( handleSize - size ) / 2, 0, size, sl->height() );
+ }
+ case SC_SliderHandle:
+ if ( horizontal )
+ {
+ if ( ticks == QSlider::Both )
+ return QRect( pos, ( sl->height() - handleSize ) / 2, len, handleSize );
+ else if ( ticks == QSlider::Above )
+ return QRect( pos, sl->height() - handleSize, len, handleSize );
+ return QRect( pos, 0, len, handleSize );
+ }
+ else
+ {
+ if ( ticks == QSlider::Both )
+ return QRect( ( sl->width() - handleSize ) / 2, pos, handleSize, len );
+ else if ( ticks == QSlider::Above )
+ return QRect( sl->width() - handleSize, pos, handleSize, len );
+ return QRect( 0, pos, handleSize, len );
+ }
+ default: break;
+ }
+ break;
+ }
+ default: break;
+ }
+ return KStyle::querySubControlMetrics( control, widget, subcontrol, opt );
+}
+
+
+#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::eventFilter( QObject* object, QEvent* event )
+{
+ if (KStyle::eventFilter( object, event ))
+ return true;
+
+ if ( !object->isWidgetType() ) return false;
+
+ //Clear hover highlight when needed
+ if ( (event->type() == QEvent::Leave) && (object == hoverWidget) )
+ {
+ QWidget* button = static_cast<QWidget*>(object);
+ hoverWidget = 0;
+ button->repaint( false );
+ return false;
+ }
+
+ //Hover highlight on buttons, toolbuttons and combos
+ if ( ::qt_cast<QPushButton*>(object) || ::qt_cast<QComboBox*>(object) || ::qt_cast<QToolButton*>(object) )
+ {
+ if (event->type() == QEvent::Enter && static_cast<QWidget*>(object)->isEnabled() )
+ {
+ hoverWidget = static_cast<QWidget*>(object);
+ hoverWidget->repaint( false );
+ }
+ return false;
+ }
+
+ //Combo line edits get special frames
+ if ( event->type() == QEvent::Paint && ::qt_cast<QLineEdit*>(object) )
+ {
+ static bool recursion = false;
+ if (recursion )
+ return false;
+
+ recursion = true;
+ object->event( static_cast< QPaintEvent* >( event ) );
+ QWidget* widget = static_cast< QWidget* >( object );
+ QPainter p( widget );
+ Keramik::RectTilePainter( keramik_frame_shadow, false, false, 2, 2 ).draw( &p, widget->rect(),
+ widget->palette().color( QPalette::Normal, QColorGroup::Button ),
+ Qt::black, false, Keramik::TilePainter::PaintFullBlend);
+ recursion = false;
+ return true;
+ }
+ else if ( ::qt_cast<QListBox*>(object) )
+ {
+ //Handle combobox drop downs
+ switch (event->type())
+ {
+#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
+ //Combo dropdowns are shaped
+ case QEvent::Resize:
+ {
+ QListBox* listbox = static_cast<QListBox*>(object);
+ QResizeEvent* resize = static_cast<QResizeEvent*>(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(qt_xdisplay(), listbox->handle(), ShapeBounding, 0, 0,
+ rects, 5, ShapeSet, YXSorted);
+ }
+ break;
+#endif
+ //Combo dropdowns get fancy borders
+ case QEvent::Paint:
+ {
+ static bool recursion = false;
+ if (recursion )
+ return false;
+ QListBox* listbox = (QListBox*) object;
+ QPaintEvent* paint = (QPaintEvent*) event;
+
+
+ if ( !listbox->contentsRect().contains( paint->rect() ) )
+ {
+ QPainter p( listbox );
+ Keramik::RectTilePainter( keramik_combobox_list, false, false ).draw( &p, 0, 0, listbox->width(), listbox->height(),
+ listbox->palette().color( QPalette::Normal, QColorGroup::Button ),
+ listbox->palette().color( QPalette::Normal, QColorGroup::Background ) );
+
+ QPaintEvent 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 QEvent::Show:
+ //Prioritize ourselves to see the mouse events first
+ object->removeEventFilter(this);
+ object->installEventFilter(this);
+ firstComboPopupRelease = true;
+ break;
+
+ //We need to filter some clicks out.
+ case QEvent::MouseButtonRelease:
+ if (firstComboPopupRelease)
+ {
+ firstComboPopupRelease = false;
+
+ QMouseEvent* mev = static_cast<QMouseEvent*>(event);
+ QListBox* box = static_cast<QListBox*> (object);
+
+ QWidget* parent = box->parentWidget();
+ if (!parent)
+ return false;
+
+ QPoint inParCoords = parent->mapFromGlobal(mev->globalPos());
+ if (parent->rect().contains(inParCoords))
+ return true;
+ }
+ break;
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonDblClick:
+ case QEvent::Wheel:
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ firstComboPopupRelease = false;
+ default:
+ return false;
+ }
+ }
+ //Toolbar background gradient handling
+ else if (event->type() == QEvent::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, static_cast<QWidget*>(object));
+
+ return false; // Now draw the contents
+ }
+ else if (event->type() == QEvent::Paint && object->parent() && ::qt_cast<QToolBar*>(object->parent())
+ && !::qt_cast<QPopupMenu*>(object) )
+ {
+ // We need to override the paint event to draw a
+ // gradient on a QToolBarExtensionWidget.
+ QToolBar* toolbar = static_cast<QToolBar*>(object->parent());
+ QWidget* widget = static_cast<QWidget*>(object);
+ QRect wr = widget->rect (), tr = toolbar->rect();
+ QPainter 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;
+
+ }
+ // Track show events for progress bars
+ if ( animateProgressBar && ::qt_cast<QProgressBar*>(object) )
+ {
+ if ((event->type() == QEvent::Show) && !animationTimer->isActive())
+ {
+ animationTimer->start( 50, false );
+ }
+ }
+ return false;
+}
+
+// vim: ts=4 sw=4 noet
+// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;
diff --git a/kstyles/keramik/keramik.h b/kstyles/keramik/keramik.h
new file mode 100644
index 000000000..1c1792fd3
--- /dev/null
+++ b/kstyles/keramik/keramik.h
@@ -0,0 +1,207 @@
+/* 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 <qframe.h>
+#include <kstyle.h>
+
+#include "pixmaploader.h"
+
+class QProgressBar;
+
+class KeramikStyle : public KStyle
+{
+ Q_OBJECT
+
+public:
+ KeramikStyle();
+ virtual ~KeramikStyle();
+
+ void renderMenuBlendPixmap( KPixmap& pix, const QColorGroup &cg, const QPopupMenu* ) const;
+ QPixmap stylePixmap(StylePixmap stylepixmap, const QWidget* widget, const QStyleOption& opt) const;
+
+ void polish( QWidget* widget );
+ void unPolish( QWidget* widget );
+ void polish( QPalette& );
+ void polish( QApplication *app );
+
+ void drawKStylePrimitive( KStylePrimitive kpe,
+ QPainter* p,
+ const QWidget* widget,
+ const QRect& r,
+ const QColorGroup& cg,
+ SFlags flags = Style_Default,
+ const QStyleOption& = QStyleOption::Default ) const;
+
+ void drawPrimitive( PrimitiveElement pe,
+ QPainter* p,
+ const QRect& r,
+ const QColorGroup& cg,
+ SFlags flags = Style_Default,
+ const QStyleOption& = QStyleOption::Default ) const;
+
+ void drawControl( ControlElement element,
+ QPainter* p,
+ const QWidget* widget,
+ const QRect& r,
+ const QColorGroup& cg,
+ SFlags flags = Style_Default,
+ const QStyleOption& opt = QStyleOption::Default ) const;
+
+ void drawControlMask( ControlElement element,
+ QPainter* p,
+ const QWidget* widget,
+ const QRect& r,
+ const QStyleOption& opt = QStyleOption::Default ) const;
+
+ void drawComplexControl( ComplexControl control,
+ QPainter* p,
+ const QWidget* widget,
+ const QRect& r,
+ const QColorGroup& cg,
+ SFlags flags = Style_Default,
+ SCFlags controls = SC_All,
+ SCFlags active = SC_None,
+ const QStyleOption& = QStyleOption::Default ) const;
+
+ void drawComplexControlMask( ComplexControl control,
+ QPainter* p,
+ const QWidget* widget,
+ const QRect& r,
+ const QStyleOption& = QStyleOption::Default ) const;
+
+ int pixelMetric( PixelMetric m, const QWidget* widget = 0 ) const;
+
+ QSize sizeFromContents( ContentsType contents,
+ const QWidget* widget,
+ const QSize& contentSize,
+ const QStyleOption& opt ) const;
+
+ SubControl querySubControl( ComplexControl control,
+ const QWidget* widget,
+ const QPoint& point,
+ const QStyleOption& opt = QStyleOption::Default ) const;
+
+ QRect querySubControlMetrics( ComplexControl control,
+ const QWidget* widget,
+ SubControl subcontrol,
+ const QStyleOption& opt = QStyleOption::Default ) const;
+
+private slots:
+ //Animation slots.
+ void updateProgressPos();
+ void progressBarDestroyed(QObject* bar);
+
+private:
+
+ bool isSizeConstrainedCombo(const QComboBox* combo) const;
+ bool isFormWidget (const QWidget* 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 QWidget* 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.
+ QMap<QProgressBar*, int> progAnimWidgets;
+
+ bool eventFilter( QObject* object, QEvent* event );
+
+ 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;
+ }
+
+ QWidget* hoverWidget;
+
+
+ bool kickerMode;
+
+ // For progress bar animation
+ QTimer *animationTimer;
+
+ QRect subRect(SubRect r, const QWidget *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/kstyles/keramik/keramikimage.h b/kstyles/keramik/keramikimage.h
new file mode 100644
index 000000000..c8e684a00
--- /dev/null
+++ b/kstyles/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 KStyle, 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/kstyles/keramik/pics/checkbox-off.png b/kstyles/keramik/pics/checkbox-off.png
new file mode 100644
index 000000000..0cade1079
--- /dev/null
+++ b/kstyles/keramik/pics/checkbox-off.png
Binary files differ
diff --git a/kstyles/keramik/pics/checkbox-on.png b/kstyles/keramik/pics/checkbox-on.png
new file mode 100644
index 000000000..69c1a7d83
--- /dev/null
+++ b/kstyles/keramik/pics/checkbox-on.png
Binary files differ
diff --git a/kstyles/keramik/pics/checkbox-tri.png b/kstyles/keramik/pics/checkbox-tri.png
new file mode 100644
index 000000000..c73ca8124
--- /dev/null
+++ b/kstyles/keramik/pics/checkbox-tri.png
Binary files differ
diff --git a/kstyles/keramik/pics/combobox-list-bc.png b/kstyles/keramik/pics/combobox-list-bc.png
new file mode 100644
index 000000000..609a72627
--- /dev/null
+++ b/kstyles/keramik/pics/combobox-list-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/combobox-list-bl.png b/kstyles/keramik/pics/combobox-list-bl.png
new file mode 100644
index 000000000..512bbeafe
--- /dev/null
+++ b/kstyles/keramik/pics/combobox-list-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/combobox-list-br.png b/kstyles/keramik/pics/combobox-list-br.png
new file mode 100644
index 000000000..93151ffa6
--- /dev/null
+++ b/kstyles/keramik/pics/combobox-list-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/combobox-list-cl.png b/kstyles/keramik/pics/combobox-list-cl.png
new file mode 100644
index 000000000..e0b29c26d
--- /dev/null
+++ b/kstyles/keramik/pics/combobox-list-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/combobox-list-cr.png b/kstyles/keramik/pics/combobox-list-cr.png
new file mode 100644
index 000000000..33b9b7224
--- /dev/null
+++ b/kstyles/keramik/pics/combobox-list-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/combobox-list-tc.png b/kstyles/keramik/pics/combobox-list-tc.png
new file mode 100644
index 000000000..a3f5d7225
--- /dev/null
+++ b/kstyles/keramik/pics/combobox-list-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/combobox-list-tl.png b/kstyles/keramik/pics/combobox-list-tl.png
new file mode 100644
index 000000000..89d4b48d2
--- /dev/null
+++ b/kstyles/keramik/pics/combobox-list-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/combobox-list-tr.png b/kstyles/keramik/pics/combobox-list-tr.png
new file mode 100644
index 000000000..54e5d6032
--- /dev/null
+++ b/kstyles/keramik/pics/combobox-list-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/frame-shadow-cl.png b/kstyles/keramik/pics/frame-shadow-cl.png
new file mode 100644
index 000000000..d9b5edb1f
--- /dev/null
+++ b/kstyles/keramik/pics/frame-shadow-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/frame-shadow-tc.png b/kstyles/keramik/pics/frame-shadow-tc.png
new file mode 100644
index 000000000..408e07314
--- /dev/null
+++ b/kstyles/keramik/pics/frame-shadow-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/frame-shadow-tl.png b/kstyles/keramik/pics/frame-shadow-tl.png
new file mode 100644
index 000000000..8e6e3a147
--- /dev/null
+++ b/kstyles/keramik/pics/frame-shadow-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-bc.png b/kstyles/keramik/pics/listview-bc.png
new file mode 100644
index 000000000..fc615ea8a
--- /dev/null
+++ b/kstyles/keramik/pics/listview-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-bl.png b/kstyles/keramik/pics/listview-bl.png
new file mode 100644
index 000000000..efd68101a
--- /dev/null
+++ b/kstyles/keramik/pics/listview-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-br.png b/kstyles/keramik/pics/listview-br.png
new file mode 100644
index 000000000..7e35a14c8
--- /dev/null
+++ b/kstyles/keramik/pics/listview-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-cc.png b/kstyles/keramik/pics/listview-cc.png
new file mode 100644
index 000000000..9fa204bf4
--- /dev/null
+++ b/kstyles/keramik/pics/listview-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-cl.png b/kstyles/keramik/pics/listview-cl.png
new file mode 100644
index 000000000..41850b2e6
--- /dev/null
+++ b/kstyles/keramik/pics/listview-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-cr.png b/kstyles/keramik/pics/listview-cr.png
new file mode 100644
index 000000000..69b1cf8c6
--- /dev/null
+++ b/kstyles/keramik/pics/listview-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-bc.png b/kstyles/keramik/pics/listview-pressed-bc.png
new file mode 100644
index 000000000..283fe7329
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-bl.png b/kstyles/keramik/pics/listview-pressed-bl.png
new file mode 100644
index 000000000..a457f83a6
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-br.png b/kstyles/keramik/pics/listview-pressed-br.png
new file mode 100644
index 000000000..a49203f89
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-cc.png b/kstyles/keramik/pics/listview-pressed-cc.png
new file mode 100644
index 000000000..63265116e
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-cl.png b/kstyles/keramik/pics/listview-pressed-cl.png
new file mode 100644
index 000000000..7dcc0540c
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-cr.png b/kstyles/keramik/pics/listview-pressed-cr.png
new file mode 100644
index 000000000..3a0b74f9a
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-tc.png b/kstyles/keramik/pics/listview-pressed-tc.png
new file mode 100644
index 000000000..1fa2e6905
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-tl.png b/kstyles/keramik/pics/listview-pressed-tl.png
new file mode 100644
index 000000000..e58e62306
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-pressed-tr.png b/kstyles/keramik/pics/listview-pressed-tr.png
new file mode 100644
index 000000000..bc33f3823
--- /dev/null
+++ b/kstyles/keramik/pics/listview-pressed-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-tc.png b/kstyles/keramik/pics/listview-tc.png
new file mode 100644
index 000000000..09434cebb
--- /dev/null
+++ b/kstyles/keramik/pics/listview-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-tl.png b/kstyles/keramik/pics/listview-tl.png
new file mode 100644
index 000000000..d2ca26d7a
--- /dev/null
+++ b/kstyles/keramik/pics/listview-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/listview-tr.png b/kstyles/keramik/pics/listview-tr.png
new file mode 100644
index 000000000..42c49a597
--- /dev/null
+++ b/kstyles/keramik/pics/listview-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/menuitem-cc.png b/kstyles/keramik/pics/menuitem-cc.png
new file mode 100644
index 000000000..29362ccc8
--- /dev/null
+++ b/kstyles/keramik/pics/menuitem-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/menuitem-cl.png b/kstyles/keramik/pics/menuitem-cl.png
new file mode 100644
index 000000000..c742516f4
--- /dev/null
+++ b/kstyles/keramik/pics/menuitem-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/menuitem-cr.png b/kstyles/keramik/pics/menuitem-cr.png
new file mode 100644
index 000000000..c742516f4
--- /dev/null
+++ b/kstyles/keramik/pics/menuitem-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/progressbar-cc.png b/kstyles/keramik/pics/progressbar-cc.png
new file mode 100644
index 000000000..e7881df47
--- /dev/null
+++ b/kstyles/keramik/pics/progressbar-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/progressbar-cl.png b/kstyles/keramik/pics/progressbar-cl.png
new file mode 100644
index 000000000..66824c873
--- /dev/null
+++ b/kstyles/keramik/pics/progressbar-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/progressbar-cr.png b/kstyles/keramik/pics/progressbar-cr.png
new file mode 100644
index 000000000..c6d61e75d
--- /dev/null
+++ b/kstyles/keramik/pics/progressbar-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-bc.png b/kstyles/keramik/pics/pushbutton-bc.png
new file mode 100644
index 000000000..62f169aa2
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-bl.png b/kstyles/keramik/pics/pushbutton-bl.png
new file mode 100644
index 000000000..ea17ef991
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-br.png b/kstyles/keramik/pics/pushbutton-br.png
new file mode 100644
index 000000000..91703e742
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-cc.png b/kstyles/keramik/pics/pushbutton-cc.png
new file mode 100644
index 000000000..ac5a2fdc0
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-cl.png b/kstyles/keramik/pics/pushbutton-cl.png
new file mode 100644
index 000000000..0a9c56630
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-cr.png b/kstyles/keramik/pics/pushbutton-cr.png
new file mode 100644
index 000000000..68449467f
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-bc.png b/kstyles/keramik/pics/pushbutton-default-bc.png
new file mode 100644
index 000000000..308020237
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-bl.png b/kstyles/keramik/pics/pushbutton-default-bl.png
new file mode 100644
index 000000000..97c69cd1c
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-br.png b/kstyles/keramik/pics/pushbutton-default-br.png
new file mode 100644
index 000000000..e084dca00
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-cc.png b/kstyles/keramik/pics/pushbutton-default-cc.png
new file mode 100644
index 000000000..51e655302
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-cl.png b/kstyles/keramik/pics/pushbutton-default-cl.png
new file mode 100644
index 000000000..5c4c001b1
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-cr.png b/kstyles/keramik/pics/pushbutton-default-cr.png
new file mode 100644
index 000000000..0b1ea243b
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-bc.png b/kstyles/keramik/pics/pushbutton-default-hov-bc.png
new file mode 100644
index 000000000..1c3f23766
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-bl.png b/kstyles/keramik/pics/pushbutton-default-hov-bl.png
new file mode 100644
index 000000000..5072df3a7
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-br.png b/kstyles/keramik/pics/pushbutton-default-hov-br.png
new file mode 100644
index 000000000..827df317d
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-cc.png b/kstyles/keramik/pics/pushbutton-default-hov-cc.png
new file mode 100644
index 000000000..ec57f7ed7
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-cl.png b/kstyles/keramik/pics/pushbutton-default-hov-cl.png
new file mode 100644
index 000000000..09fdf4dfa
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-cr.png b/kstyles/keramik/pics/pushbutton-default-hov-cr.png
new file mode 100644
index 000000000..131c96f55
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-tc.png b/kstyles/keramik/pics/pushbutton-default-hov-tc.png
new file mode 100644
index 000000000..45f4e86c3
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-tl.png b/kstyles/keramik/pics/pushbutton-default-hov-tl.png
new file mode 100644
index 000000000..13e2cdfa2
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-hov-tr.png b/kstyles/keramik/pics/pushbutton-default-hov-tr.png
new file mode 100644
index 000000000..0eb2d5f2d
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-hov-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-bc.png b/kstyles/keramik/pics/pushbutton-default-pressed-bc.png
new file mode 100644
index 000000000..7d1f31b4b
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-bl.png b/kstyles/keramik/pics/pushbutton-default-pressed-bl.png
new file mode 100644
index 000000000..05d432d3a
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-br.png b/kstyles/keramik/pics/pushbutton-default-pressed-br.png
new file mode 100644
index 000000000..5ac4eb761
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-cc.png b/kstyles/keramik/pics/pushbutton-default-pressed-cc.png
new file mode 100644
index 000000000..a29eb9b26
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-cl.png b/kstyles/keramik/pics/pushbutton-default-pressed-cl.png
new file mode 100644
index 000000000..1732ab586
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-cr.png b/kstyles/keramik/pics/pushbutton-default-pressed-cr.png
new file mode 100644
index 000000000..3e52fd79f
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-tc.png b/kstyles/keramik/pics/pushbutton-default-pressed-tc.png
new file mode 100644
index 000000000..a2774ed4d
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-tl.png b/kstyles/keramik/pics/pushbutton-default-pressed-tl.png
new file mode 100644
index 000000000..209673d91
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-pressed-tr.png b/kstyles/keramik/pics/pushbutton-default-pressed-tr.png
new file mode 100644
index 000000000..4b4d8bed1
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-pressed-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-tc.png b/kstyles/keramik/pics/pushbutton-default-tc.png
new file mode 100644
index 000000000..e71531f73
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-tl.png b/kstyles/keramik/pics/pushbutton-default-tl.png
new file mode 100644
index 000000000..02c8adb38
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-default-tr.png b/kstyles/keramik/pics/pushbutton-default-tr.png
new file mode 100644
index 000000000..741dd67cb
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-default-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-bc.png b/kstyles/keramik/pics/pushbutton-hov-bc.png
new file mode 100644
index 000000000..1b7731085
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-bl.png b/kstyles/keramik/pics/pushbutton-hov-bl.png
new file mode 100644
index 000000000..29f066774
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-br.png b/kstyles/keramik/pics/pushbutton-hov-br.png
new file mode 100644
index 000000000..c7b045337
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-cc.png b/kstyles/keramik/pics/pushbutton-hov-cc.png
new file mode 100644
index 000000000..f57781d87
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-cl.png b/kstyles/keramik/pics/pushbutton-hov-cl.png
new file mode 100644
index 000000000..1540ef437
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-cr.png b/kstyles/keramik/pics/pushbutton-hov-cr.png
new file mode 100644
index 000000000..e105ae6f8
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-tc.png b/kstyles/keramik/pics/pushbutton-hov-tc.png
new file mode 100644
index 000000000..fa2a00270
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-tl.png b/kstyles/keramik/pics/pushbutton-hov-tl.png
new file mode 100644
index 000000000..9eddbf5f9
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-hov-tr.png b/kstyles/keramik/pics/pushbutton-hov-tr.png
new file mode 100644
index 000000000..c4ea2e1ae
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-hov-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-bc.png b/kstyles/keramik/pics/pushbutton-pressed-bc.png
new file mode 100644
index 000000000..1e9097faa
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-bl.png b/kstyles/keramik/pics/pushbutton-pressed-bl.png
new file mode 100644
index 000000000..ae8ad9ba3
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-br.png b/kstyles/keramik/pics/pushbutton-pressed-br.png
new file mode 100644
index 000000000..8d1a62e7e
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-cc.png b/kstyles/keramik/pics/pushbutton-pressed-cc.png
new file mode 100644
index 000000000..09cb446ba
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-cl.png b/kstyles/keramik/pics/pushbutton-pressed-cl.png
new file mode 100644
index 000000000..1291cf33f
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-cr.png b/kstyles/keramik/pics/pushbutton-pressed-cr.png
new file mode 100644
index 000000000..6e35bd28b
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-tc.png b/kstyles/keramik/pics/pushbutton-pressed-tc.png
new file mode 100644
index 000000000..ab1ccf476
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-tl.png b/kstyles/keramik/pics/pushbutton-pressed-tl.png
new file mode 100644
index 000000000..41df0033f
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-pressed-tr.png b/kstyles/keramik/pics/pushbutton-pressed-tr.png
new file mode 100644
index 000000000..fc83cfdef
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-pressed-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-bc.png b/kstyles/keramik/pics/pushbutton-small-bc.png
new file mode 100644
index 000000000..b55ed441c
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-bl.png b/kstyles/keramik/pics/pushbutton-small-bl.png
new file mode 100644
index 000000000..fc14a94c1
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-br.png b/kstyles/keramik/pics/pushbutton-small-br.png
new file mode 100644
index 000000000..f24b47af1
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-cc.png b/kstyles/keramik/pics/pushbutton-small-cc.png
new file mode 100644
index 000000000..8f8d49964
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-cl.png b/kstyles/keramik/pics/pushbutton-small-cl.png
new file mode 100644
index 000000000..9ce9e492f
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-cr.png b/kstyles/keramik/pics/pushbutton-small-cr.png
new file mode 100644
index 000000000..db05257b2
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-bc.png b/kstyles/keramik/pics/pushbutton-small-pressed-bc.png
new file mode 100644
index 000000000..560f17c5d
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-bl.png b/kstyles/keramik/pics/pushbutton-small-pressed-bl.png
new file mode 100644
index 000000000..36e39f88d
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-br.png b/kstyles/keramik/pics/pushbutton-small-pressed-br.png
new file mode 100644
index 000000000..d269e61bf
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-cc.png b/kstyles/keramik/pics/pushbutton-small-pressed-cc.png
new file mode 100644
index 000000000..abab3832c
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-cl.png b/kstyles/keramik/pics/pushbutton-small-pressed-cl.png
new file mode 100644
index 000000000..8049bee04
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-cr.png b/kstyles/keramik/pics/pushbutton-small-pressed-cr.png
new file mode 100644
index 000000000..ef13139c2
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-tc.png b/kstyles/keramik/pics/pushbutton-small-pressed-tc.png
new file mode 100644
index 000000000..d10fc26a8
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-tl.png b/kstyles/keramik/pics/pushbutton-small-pressed-tl.png
new file mode 100644
index 000000000..7f189e50d
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-pressed-tr.png b/kstyles/keramik/pics/pushbutton-small-pressed-tr.png
new file mode 100644
index 000000000..5262f63a2
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-pressed-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-tc.png b/kstyles/keramik/pics/pushbutton-small-tc.png
new file mode 100644
index 000000000..216126077
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-tl.png b/kstyles/keramik/pics/pushbutton-small-tl.png
new file mode 100644
index 000000000..75d8052b1
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-small-tr.png b/kstyles/keramik/pics/pushbutton-small-tr.png
new file mode 100644
index 000000000..18ac1208d
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-small-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-tc.png b/kstyles/keramik/pics/pushbutton-tc.png
new file mode 100644
index 000000000..0d0e396d2
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-tl.png b/kstyles/keramik/pics/pushbutton-tl.png
new file mode 100644
index 000000000..6904db252
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/pushbutton-tr.png b/kstyles/keramik/pics/pushbutton-tr.png
new file mode 100644
index 000000000..b3e34dec2
--- /dev/null
+++ b/kstyles/keramik/pics/pushbutton-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/radiobutton-off.png b/kstyles/keramik/pics/radiobutton-off.png
new file mode 100644
index 000000000..6eefc781c
--- /dev/null
+++ b/kstyles/keramik/pics/radiobutton-off.png
Binary files differ
diff --git a/kstyles/keramik/pics/radiobutton-on.png b/kstyles/keramik/pics/radiobutton-on.png
new file mode 100644
index 000000000..ab4dc6798
--- /dev/null
+++ b/kstyles/keramik/pics/radiobutton-on.png
Binary files differ
diff --git a/kstyles/keramik/pics/ripple.png b/kstyles/keramik/pics/ripple.png
new file mode 100644
index 000000000..6b7d04ef3
--- /dev/null
+++ b/kstyles/keramik/pics/ripple.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-hbar-arrow1.png b/kstyles/keramik/pics/scrollbar-hbar-arrow1.png
new file mode 100644
index 000000000..af21cb269
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-hbar-arrow1.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-hbar-arrow2.png b/kstyles/keramik/pics/scrollbar-hbar-arrow2.png
new file mode 100644
index 000000000..231520d12
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-hbar-arrow2.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-hbar-groove1.png b/kstyles/keramik/pics/scrollbar-hbar-groove1.png
new file mode 100644
index 000000000..0219f2e28
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-hbar-groove1.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-hbar-groove2.png b/kstyles/keramik/pics/scrollbar-hbar-groove2.png
new file mode 100644
index 000000000..990b5b06d
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-hbar-groove2.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-hbar-slider1.png b/kstyles/keramik/pics/scrollbar-hbar-slider1.png
new file mode 100644
index 000000000..6f0896ed9
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-hbar-slider1.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-hbar-slider2.png b/kstyles/keramik/pics/scrollbar-hbar-slider2.png
new file mode 100644
index 000000000..c13ecc00c
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-hbar-slider2.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-hbar-slider3.png b/kstyles/keramik/pics/scrollbar-hbar-slider3.png
new file mode 100644
index 000000000..105718ba7
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-hbar-slider3.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-hbar-slider4.png b/kstyles/keramik/pics/scrollbar-hbar-slider4.png
new file mode 100644
index 000000000..9d56a784c
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-hbar-slider4.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-vbar-arrow1.png b/kstyles/keramik/pics/scrollbar-vbar-arrow1.png
new file mode 100644
index 000000000..cb2f70aeb
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-vbar-arrow1.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-vbar-arrow2.png b/kstyles/keramik/pics/scrollbar-vbar-arrow2.png
new file mode 100644
index 000000000..4d36f077e
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-vbar-arrow2.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-vbar-groove1.png b/kstyles/keramik/pics/scrollbar-vbar-groove1.png
new file mode 100644
index 000000000..62ed6491d
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-vbar-groove1.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-vbar-groove2.png b/kstyles/keramik/pics/scrollbar-vbar-groove2.png
new file mode 100644
index 000000000..219781e23
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-vbar-groove2.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-vbar-slider1.png b/kstyles/keramik/pics/scrollbar-vbar-slider1.png
new file mode 100644
index 000000000..29b85856c
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-vbar-slider1.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-vbar-slider2.png b/kstyles/keramik/pics/scrollbar-vbar-slider2.png
new file mode 100644
index 000000000..ebacc8e67
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-vbar-slider2.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-vbar-slider3.png b/kstyles/keramik/pics/scrollbar-vbar-slider3.png
new file mode 100644
index 000000000..197be82c5
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-vbar-slider3.png
Binary files differ
diff --git a/kstyles/keramik/pics/scrollbar-vbar-slider4.png b/kstyles/keramik/pics/scrollbar-vbar-slider4.png
new file mode 100644
index 000000000..fdb931f4f
--- /dev/null
+++ b/kstyles/keramik/pics/scrollbar-vbar-slider4.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-bc.png b/kstyles/keramik/pics/slider-hgroove-bc.png
new file mode 100644
index 000000000..d509e8357
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-bl.png b/kstyles/keramik/pics/slider-hgroove-bl.png
new file mode 100644
index 000000000..12cb99a5b
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-br.png b/kstyles/keramik/pics/slider-hgroove-br.png
new file mode 100644
index 000000000..c540bd09b
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-cc.png b/kstyles/keramik/pics/slider-hgroove-cc.png
new file mode 100644
index 000000000..cad18f802
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-cl.png b/kstyles/keramik/pics/slider-hgroove-cl.png
new file mode 100644
index 000000000..a261a086f
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-cr.png b/kstyles/keramik/pics/slider-hgroove-cr.png
new file mode 100644
index 000000000..601ff7d20
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-tc.png b/kstyles/keramik/pics/slider-hgroove-tc.png
new file mode 100644
index 000000000..f8ee8d90b
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-tl.png b/kstyles/keramik/pics/slider-hgroove-tl.png
new file mode 100644
index 000000000..525242cf5
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-hgroove-tr.png b/kstyles/keramik/pics/slider-hgroove-tr.png
new file mode 100644
index 000000000..7fcd449ad
--- /dev/null
+++ b/kstyles/keramik/pics/slider-hgroove-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-bc.png b/kstyles/keramik/pics/slider-vgroove-bc.png
new file mode 100644
index 000000000..d81815cbf
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-bl.png b/kstyles/keramik/pics/slider-vgroove-bl.png
new file mode 100644
index 000000000..5f7063525
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-br.png b/kstyles/keramik/pics/slider-vgroove-br.png
new file mode 100644
index 000000000..80fbb0c38
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-cc.png b/kstyles/keramik/pics/slider-vgroove-cc.png
new file mode 100644
index 000000000..56c3e1665
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-cl.png b/kstyles/keramik/pics/slider-vgroove-cl.png
new file mode 100644
index 000000000..cca74d7e3
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-cr.png b/kstyles/keramik/pics/slider-vgroove-cr.png
new file mode 100644
index 000000000..5e0bba54f
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-tc.png b/kstyles/keramik/pics/slider-vgroove-tc.png
new file mode 100644
index 000000000..d381a1672
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-tl.png b/kstyles/keramik/pics/slider-vgroove-tl.png
new file mode 100644
index 000000000..e2bb6ca4e
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider-vgroove-tr.png b/kstyles/keramik/pics/slider-vgroove-tr.png
new file mode 100644
index 000000000..03fe46405
--- /dev/null
+++ b/kstyles/keramik/pics/slider-vgroove-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/slider.png b/kstyles/keramik/pics/slider.png
new file mode 100644
index 000000000..6949eec33
--- /dev/null
+++ b/kstyles/keramik/pics/slider.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-1.png b/kstyles/keramik/pics/spinbox-1.png
new file mode 100644
index 000000000..728959423
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-1.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-2.png b/kstyles/keramik/pics/spinbox-2.png
new file mode 100644
index 000000000..8dcebdc47
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-2.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-3.png b/kstyles/keramik/pics/spinbox-3.png
new file mode 100644
index 000000000..43cdaf21d
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-3.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-arrow-down.png b/kstyles/keramik/pics/spinbox-arrow-down.png
new file mode 100644
index 000000000..58d326e01
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-arrow-down.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-arrow-up.png b/kstyles/keramik/pics/spinbox-arrow-up.png
new file mode 100644
index 000000000..1e1f7a72b
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-arrow-up.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-pressed-arrow-down.png b/kstyles/keramik/pics/spinbox-pressed-arrow-down.png
new file mode 100644
index 000000000..71ce2ff98
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-pressed-arrow-down.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-pressed-arrow-up.png b/kstyles/keramik/pics/spinbox-pressed-arrow-up.png
new file mode 100644
index 000000000..7fd277c26
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-pressed-arrow-up.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-pressed-down.png b/kstyles/keramik/pics/spinbox-pressed-down.png
new file mode 100644
index 000000000..47ac06d41
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-pressed-down.png
Binary files differ
diff --git a/kstyles/keramik/pics/spinbox-pressed-up.png b/kstyles/keramik/pics/spinbox-pressed-up.png
new file mode 100644
index 000000000..ed499f6ef
--- /dev/null
+++ b/kstyles/keramik/pics/spinbox-pressed-up.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-active-bc.png b/kstyles/keramik/pics/tab-bottom-active-bc.png
new file mode 100644
index 000000000..2cc3e597a
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-active-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-active-bl.png b/kstyles/keramik/pics/tab-bottom-active-bl.png
new file mode 100644
index 000000000..2f28a1cfa
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-active-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-active-br.png b/kstyles/keramik/pics/tab-bottom-active-br.png
new file mode 100644
index 000000000..8d086710a
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-active-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-active-cc.png b/kstyles/keramik/pics/tab-bottom-active-cc.png
new file mode 100644
index 000000000..29fa285ef
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-active-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-active-cl.png b/kstyles/keramik/pics/tab-bottom-active-cl.png
new file mode 100644
index 000000000..54c629b55
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-active-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-active-cr.png b/kstyles/keramik/pics/tab-bottom-active-cr.png
new file mode 100644
index 000000000..f36039005
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-active-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-inactive-bc.png b/kstyles/keramik/pics/tab-bottom-inactive-bc.png
new file mode 100644
index 000000000..538b0e20e
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-inactive-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-inactive-bl.png b/kstyles/keramik/pics/tab-bottom-inactive-bl.png
new file mode 100644
index 000000000..14e04519d
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-inactive-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-inactive-br.png b/kstyles/keramik/pics/tab-bottom-inactive-br.png
new file mode 100644
index 000000000..79298a562
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-inactive-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-inactive-cc.png b/kstyles/keramik/pics/tab-bottom-inactive-cc.png
new file mode 100644
index 000000000..e7fbaf864
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-inactive-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-inactive-cl.png b/kstyles/keramik/pics/tab-bottom-inactive-cl.png
new file mode 100644
index 000000000..9d3aaed8f
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-inactive-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-inactive-cr.png b/kstyles/keramik/pics/tab-bottom-inactive-cr.png
new file mode 100644
index 000000000..e873688c8
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-inactive-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-bottom-inactive-separator.png b/kstyles/keramik/pics/tab-bottom-inactive-separator.png
new file mode 100644
index 000000000..525341543
--- /dev/null
+++ b/kstyles/keramik/pics/tab-bottom-inactive-separator.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-active-cc.png b/kstyles/keramik/pics/tab-top-active-cc.png
new file mode 100644
index 000000000..494659c77
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-active-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-active-cl.png b/kstyles/keramik/pics/tab-top-active-cl.png
new file mode 100644
index 000000000..b369f9570
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-active-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-active-cr.png b/kstyles/keramik/pics/tab-top-active-cr.png
new file mode 100644
index 000000000..6cbf4238e
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-active-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-active-tc.png b/kstyles/keramik/pics/tab-top-active-tc.png
new file mode 100644
index 000000000..44cf7d16d
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-active-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-active-tl.png b/kstyles/keramik/pics/tab-top-active-tl.png
new file mode 100644
index 000000000..437f95bc2
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-active-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-active-tr.png b/kstyles/keramik/pics/tab-top-active-tr.png
new file mode 100644
index 000000000..74cbc48e3
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-active-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-inactive-cc.png b/kstyles/keramik/pics/tab-top-inactive-cc.png
new file mode 100644
index 000000000..1c2f0d47f
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-inactive-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-inactive-cl.png b/kstyles/keramik/pics/tab-top-inactive-cl.png
new file mode 100644
index 000000000..3f4a23136
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-inactive-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-inactive-cr.png b/kstyles/keramik/pics/tab-top-inactive-cr.png
new file mode 100644
index 000000000..477af0bc7
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-inactive-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-inactive-separator.png b/kstyles/keramik/pics/tab-top-inactive-separator.png
new file mode 100644
index 000000000..fc03d5dbb
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-inactive-separator.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-inactive-tc.png b/kstyles/keramik/pics/tab-top-inactive-tc.png
new file mode 100644
index 000000000..41eda7245
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-inactive-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-inactive-tl.png b/kstyles/keramik/pics/tab-top-inactive-tl.png
new file mode 100644
index 000000000..114d9e99a
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-inactive-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/tab-top-inactive-tr.png b/kstyles/keramik/pics/tab-top-inactive-tr.png
new file mode 100644
index 000000000..04a9019f8
--- /dev/null
+++ b/kstyles/keramik/pics/tab-top-inactive-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/title-close-tiny.png b/kstyles/keramik/pics/title-close-tiny.png
new file mode 100644
index 000000000..1e497547b
--- /dev/null
+++ b/kstyles/keramik/pics/title-close-tiny.png
Binary files differ
diff --git a/kstyles/keramik/pics/title-close.png b/kstyles/keramik/pics/title-close.png
new file mode 100644
index 000000000..b9a7a8f45
--- /dev/null
+++ b/kstyles/keramik/pics/title-close.png
Binary files differ
diff --git a/kstyles/keramik/pics/title-iconify.png b/kstyles/keramik/pics/title-iconify.png
new file mode 100644
index 000000000..6c87e05f3
--- /dev/null
+++ b/kstyles/keramik/pics/title-iconify.png
Binary files differ
diff --git a/kstyles/keramik/pics/title-maximize.png b/kstyles/keramik/pics/title-maximize.png
new file mode 100644
index 000000000..6a47ce12d
--- /dev/null
+++ b/kstyles/keramik/pics/title-maximize.png
Binary files differ
diff --git a/kstyles/keramik/pics/title-restore.png b/kstyles/keramik/pics/title-restore.png
new file mode 100644
index 000000000..12d48df42
--- /dev/null
+++ b/kstyles/keramik/pics/title-restore.png
Binary files differ
diff --git a/kstyles/keramik/pics/titlebutton-pressed.png b/kstyles/keramik/pics/titlebutton-pressed.png
new file mode 100644
index 000000000..23587dd2f
--- /dev/null
+++ b/kstyles/keramik/pics/titlebutton-pressed.png
Binary files differ
diff --git a/kstyles/keramik/pics/titlebutton.png b/kstyles/keramik/pics/titlebutton.png
new file mode 100644
index 000000000..bb99c9b30
--- /dev/null
+++ b/kstyles/keramik/pics/titlebutton.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-bc.png b/kstyles/keramik/pics/toolbar-clk-bc.png
new file mode 100644
index 000000000..4d8acdcde
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-bc.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-bl.png b/kstyles/keramik/pics/toolbar-clk-bl.png
new file mode 100644
index 000000000..891f380ed
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-bl.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-br.png b/kstyles/keramik/pics/toolbar-clk-br.png
new file mode 100644
index 000000000..d2493b18e
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-br.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-cc.png b/kstyles/keramik/pics/toolbar-clk-cc.png
new file mode 100644
index 000000000..0ae970f6b
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-cc.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-cl.png b/kstyles/keramik/pics/toolbar-clk-cl.png
new file mode 100644
index 000000000..12467b4e7
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-cl.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-cr.png b/kstyles/keramik/pics/toolbar-clk-cr.png
new file mode 100644
index 000000000..75bea2f4c
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-cr.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-tc.png b/kstyles/keramik/pics/toolbar-clk-tc.png
new file mode 100644
index 000000000..fcd0e8cd2
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-tc.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-tl.png b/kstyles/keramik/pics/toolbar-clk-tl.png
new file mode 100644
index 000000000..13625cf8e
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-tl.png
Binary files differ
diff --git a/kstyles/keramik/pics/toolbar-clk-tr.png b/kstyles/keramik/pics/toolbar-clk-tr.png
new file mode 100644
index 000000000..1b8c8f33d
--- /dev/null
+++ b/kstyles/keramik/pics/toolbar-clk-tr.png
Binary files differ
diff --git a/kstyles/keramik/pics/vslider.png b/kstyles/keramik/pics/vslider.png
new file mode 100644
index 000000000..e43857388
--- /dev/null
+++ b/kstyles/keramik/pics/vslider.png
Binary files differ
diff --git a/kstyles/keramik/pixmaploader.cpp b/kstyles/keramik/pixmaploader.cpp
new file mode 100644
index 000000000..b3c4a8c47
--- /dev/null
+++ b/kstyles/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 <qapplication.h>
+#include <qbitmap.h>
+#include <qglobal.h>
+#include <qimage.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qpixmapcache.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();
+}
+
+QImage* PixmapLoader::getDisabled(int name, const QColor& color, const QColor& back, bool blend)
+{
+ KeramikEmbedImage* edata = KeramikGetDbImage(name);
+ if (!edata)
+ return 0;
+
+ //Like getColored, but desaturate a bit, and lower gamma..
+
+ //Create a real image...
+ QImage* img = new QImage(edata->width, edata->height, 32);
+
+
+
+ //OK, now, fill it in, using the color..
+ Q_UINT32 r, g,b;
+ Q_UINT32 i = qGray(color.rgb());
+ r = (3*color.red()+i)>>2;
+ g = (3*color.green()+i)>>2;
+ b = (3*color.blue()+i)>>2;
+
+ Q_UINT32 br = back.red(), bg = back.green(), bb = back.blue();
+
+
+ if (edata->haveAlpha)
+ {
+ if (blend)
+ {
+ img->setAlphaBuffer(false);
+ Q_UINT32* write = reinterpret_cast< Q_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 3;
+
+ for (int pos = 0; pos < size; pos+=3)
+ {
+ Q_UINT32 scale = edata->data[pos];
+ Q_UINT32 add = (edata->data[pos+1]*i+127)>>8;
+ Q_UINT32 alpha = edata->data[pos+2];
+ Q_UINT32 destAlpha = 256 - alpha;
+
+ Q_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ Q_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ Q_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+ *write =qRgb(((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);
+ Q_UINT32* write = reinterpret_cast< Q_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 3;
+
+ for (int pos = 0; pos < size; pos+=3)
+ {
+ Q_UINT32 scale = edata->data[pos];
+ Q_UINT32 add = (edata->data[pos+1]*i+127)>>8;
+ Q_UINT32 alpha = edata->data[pos+2];
+
+ Q_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ Q_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ Q_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+ *write =qRgba(rr, rg, rb, alpha);
+
+ write++;
+ }
+
+ }
+ }
+ else
+ {
+ img->setAlphaBuffer(false);
+ Q_UINT32* write = reinterpret_cast< Q_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 2;
+
+ for (int pos = 0; pos < size; pos+=2)
+ {
+ Q_UINT32 scale = edata->data[pos];
+ Q_UINT32 add = (edata->data[pos+1]*i+127)>>8;
+ Q_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ Q_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ Q_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+ *write =qRgb(rr, rg, rb);
+ write++;
+ }
+ }
+
+ return img;
+}
+
+QImage* PixmapLoader::getColored(int name, const QColor& color, const QColor& back, bool blend)
+{
+ KeramikEmbedImage* edata = KeramikGetDbImage(name);
+ if (!edata)
+ return 0;
+
+ //Create a real image...
+ QImage* img = new QImage(edata->width, edata->height, 32);
+
+ //OK, now, fill it in, using the color..
+ Q_UINT32 r, g,b;
+ r = color.red() + 2;
+ g = color.green() + 2;
+ b = color.blue() + 2;
+
+// int i = qGray(color.rgb());
+
+ Q_UINT32 br = back.red(), bg = back.green(), bb = back.blue();
+
+ if (edata->haveAlpha)
+ {
+ if (blend)
+ {
+ img->setAlphaBuffer(false);
+
+ Q_UINT32* write = reinterpret_cast< Q_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 3;
+ for (int pos = 0; pos < size; pos+=3)
+ {
+ Q_UINT32 scale = edata->data[pos];
+ Q_UINT32 add = edata->data[pos+1];
+ Q_UINT32 alpha = edata->data[pos+2];
+ Q_UINT32 destAlpha = 256 - alpha;
+
+ if (scale != 0)
+ add = add*5/4;
+
+ Q_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ Q_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ Q_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+ *write =qRgb(((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);
+
+ Q_UINT32* write = reinterpret_cast< Q_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 3;
+
+ for (int pos = 0; pos < size; pos+=3)
+ {
+ Q_UINT32 scale = edata->data[pos];
+ Q_UINT32 add = edata->data[pos+1];
+ Q_UINT32 alpha = edata->data[pos+2];
+ if (scale != 0)
+ add = add*5/4;
+
+ Q_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ Q_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ Q_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+ *write =qRgba(rr, rg, rb, alpha);
+ write++;
+ }
+ }
+ }
+ else
+ {
+ img->setAlphaBuffer(false);
+
+ Q_UINT32* write = reinterpret_cast< Q_UINT32* >(img->bits() );
+ int size = img->width()*img->height() * 2;
+
+ for (int pos = 0; pos < size; pos+=2)
+ {
+ Q_UINT32 scale = edata->data[pos];
+ Q_UINT32 add = edata->data[pos+1];
+ if (scale != 0)
+ add = add*5/4;
+
+ Q_UINT32 rr = clamp[((r*scale+127)>>8) + add];
+ Q_UINT32 rg = clamp[((g*scale+127)>>8) + add];
+ Q_UINT32 rb = clamp[((b*scale+127)>>8) + add];
+
+
+ *write =qRgb(rr, rg, rb);
+ write++;
+ }
+ }
+
+ return img;
+}
+
+QPixmap PixmapLoader::pixmap( int name, const QColor& color, const QColor& bg, bool disabled, bool blend )
+{
+ return scale(name, 0, 0, color, bg, disabled, blend);
+}
+
+
+QPixmap PixmapLoader::scale( int name, int width, int height, const QColor& color, const QColor& 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);
+ }
+
+
+ QImage* img = 0;
+ QPixmap* 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 QPixmap();
+ m_pixmapCache.insert(key, toAdd, 16);
+ return QPixmap();
+ }
+
+ if (width == 0 && height == 0)
+ result = new QPixmap(*img);
+ else
+ result = new QPixmap(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)) {
+ QPixmap toRet = *result;
+ delete toAdd;
+ return toRet;
+ }
+
+ return *result;
+}
+
+QSize PixmapLoader::size( int id )
+{
+ KeramikEmbedImage* edata = KeramikGetDbImage(id);
+ if (!edata)
+ return QSize(0,0);
+ return QSize(edata->width, edata->height);
+}
+
+void TilePainter::draw( QPainter *p, int x, int y, int width, int height, const QColor& color, const QColor& 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 QBitmap* 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 QBitmap* 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 = QApplication::reverseLayout() ? First : Last;
+ m_columns = (m_mode == rightMost ? 3 : 2);
+}
+
+int InactiveTabPainter::tileName( unsigned int column, unsigned int row ) const
+{
+ Mode leftMost = QApplication::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/kstyles/keramik/pixmaploader.h b/kstyles/keramik/pixmaploader.h
new file mode 100644
index 000000000..28b2afd78
--- /dev/null
+++ b/kstyles/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 <qintcache.h>
+#include <qdict.h>
+#include <qimage.h>
+
+class QPixmap;
+class QImage;
+
+#include "keramikrc.h"
+
+namespace Keramik
+{
+ class PixmapLoader
+ {
+ public:
+ PixmapLoader();
+
+ QPixmap pixmap( int name, const QColor& color, const QColor& bg,
+ bool disabled = false, bool blend = true );
+
+ QPixmap scale( int name, int width, int height, const QColor& color, const QColor& bg,
+ bool disabled = false, bool blend = true );
+ QSize 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;
+
+ QPixmap* m_pixmap;
+
+ KeramikCacheEntry(int id, const QColor& color, const QColor& bg, bool disabled,
+ bool blended, int width, int height, QPixmap* 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;
+ }
+ };
+
+
+
+ QImage* getColored(int id, const QColor& color, const QColor& bg, bool blended);
+ QImage* getDisabled(int id, const QColor& color, const QColor& bg, bool blended);
+ QIntCache <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( QPainter *p, int x, int y, int width, int height, const QColor& color, const QColor& bg,
+ bool disabled = false, PaintMode mode = PaintNormal );
+ void draw( QPainter *p, const QRect& rect, const QColor& color, const QColor& 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;
+ }
+
+
+ QPixmap tile( unsigned int column, unsigned int row, const QColor& color, const QColor& bg, bool disabled, bool blend)
+ { return PixmapLoader::the().pixmap( absTileName( column, row ), color, bg, disabled, blend ); }
+ QPixmap scale( unsigned int column, unsigned int row, int width, int height, const QColor& color, const QColor& 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;