-rw-r--r-- | noncore/styles/liquid/embeddata.h | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 20 | ||||
-rw-r--r-- | noncore/styles/liquid/opie-liquid.diff | 141 |
3 files changed, 112 insertions, 51 deletions
diff --git a/noncore/styles/liquid/embeddata.h b/noncore/styles/liquid/embeddata.h index e4ccc27..5207fb1 100644 --- a/noncore/styles/liquid/embeddata.h +++ b/noncore/styles/liquid/embeddata.h @@ -880,121 +880,121 @@ static const QRgb tab_data[] = { 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfff9f9f9,0xffececec,0xff949494,0xff949494,0xffececec,0xfff9f9f9,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfff9f9f9,0xffececec,0xff949494,0xff949494,0xffececec,0xfff9f9f9, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfff9f9f9,0xffececec,0xff949494,0xff949494,0xffececec, 0xfff9f9f9,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfff9f9f9,0xffececec,0xff949494,0xff949494, 0xffececec,0xfff9f9f9,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfff9f9f9,0xffececec,0xff949494, 0xff949494,0xffececec,0xfff9f9f9,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfff9f9f9,0xffececec, 0xff949494,0xff949494,0xffececec,0xfff9f9f9,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfff9f9f9, 0xffececec,0xff949494,0xff949494,0xffececec,0xfff9f9f9,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfff9f9f9,0xffececec,0xff949494,0xff949494,0xffececec,0xfff9f9f9,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb,0xfffbfbfb, 0xfffbfbfb,0xfff9f9f9,0xffececec,0xff949494,0x95ababab,0xbfd5d5d5,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed, 0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed, 0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed, 0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed, 0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed, 0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed,0xffededed, 0xffededed,0xffededed,0xffededed,0xc0d4d3d4,0x96aba9aa }; static struct EmbedImage { int width, height, depth; const unsigned char *data; int numColors; const QRgb *colorTable; bool alpha; const char *name; } embed_image_vec[] = { { 37, 26, 32, (const unsigned char*)buttonborder_data, 0, 0, TRUE, "buttonborder" }, { 37, 26, 32, (const unsigned char*)buttonfill_data, 0, 0, TRUE, "buttonfill" }, { 20, 22, 32, (const unsigned char*)checkbox_data, 0, 0, TRUE, "checkbox" }, { 20, 22, 32, (const unsigned char*)checkboxdown_data, 0, 0, TRUE, "checkboxdown" }, { 45, 44, 32, (const unsigned char*)clear_fill_large_data, 0, 0, TRUE, "clear_fill_large" }, { 42, 26, 32, (const unsigned char*)clear_fill_small_data, 0, 0, TRUE, "clear_fill_small" }, { 37, 26, 32, (const unsigned char*)htmlbtnborder_data, 0, 0, TRUE, "htmlbtnborder" }, { 20, 22, 32, (const unsigned char*)htmlcheckbox_data, 0, 0, TRUE, "htmlcheckbox" }, { 20, 22, 32, (const unsigned char*)htmlcheckboxdown_data, 0, 0, TRUE, "htmlcheckboxdown" }, { 16, 16, 32, (const unsigned char*)htmlradio_data, 0, 0, TRUE, "htmlradio" }, { 16, 16, 32, (const unsigned char*)htmlradiodown_data, 0, 0, TRUE, "htmlradiodown" }, { 16, 16, 32, (const unsigned char*)radio_data, 0, 0, TRUE, "radio" }, { 16, 16, 32, (const unsigned char*)radio_down_data, 0, 0, TRUE, "radio_down" }, { 13, 8, 32, (const unsigned char*)sbslider_btm_data, 0, 0, TRUE, "sbslider_btm" }, { 13, 28, 32, (const unsigned char*)sbslider_mid_data, 0, 0, TRUE, "sbslider_mid" }, { 13, 8, 32, (const unsigned char*)sbslider_top_data, 0, 0, TRUE, "sbslider_top" }, { 10, 11, 32, (const unsigned char*)sliderarrow_data, 0, 0, TRUE, "sliderarrow" }, { 85, 33, 32, (const unsigned char*)tab_data, 0, 0, TRUE, "tab" }, }; static int cmpEmbedImage(const void *a, const void *b) { const EmbedImage* ea = (const EmbedImage*)a; const EmbedImage* eb = (const EmbedImage*)b; return strcmp(ea->name,eb->name); } -inline const QImage& qembed_findImage(const char* name) +static const QImage& qembed_findImage(const char* name) { EmbedImage key; key.name = name; EmbedImage* r = (EmbedImage*)bsearch( &key, embed_image_vec, sizeof(embed_image_vec)/sizeof(EmbedImage), sizeof(EmbedImage), cmpEmbedImage ); QImage* img; if ( r ) { img = new QImage((uchar*)r->data, r->width, r->height, r->depth, (QRgb*)r->colorTable, r->numColors, QImage::BigEndian ); if ( r->alpha ) img->setAlphaBuffer(TRUE); } else { static QImage dummy; img = &dummy; } return *img; } #endif diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index ba732aa..c8f8d20 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp @@ -1912,220 +1912,230 @@ void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, } } void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, int /*state*/) { // needed for some reason by KHtml, even tho it's all filled ;P p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); } void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, const QColorGroup &/*g*/, Orientation orient, bool, bool) { QWidget *parent = (QWidget *)p->device(); p->setBrushOrigin(parent->pos()); parent->erase(x, y, w, h); p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : *getPixmap(VSlider)); } void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, Orientation orient, bool, bool) { p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : *getPixmap(VSlider)->mask()); } int LiquidStyle::sliderLength() const { return(10); } #define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, int y, int w, int h, const QColorGroup &g, bool enabled, const QBrush *) { static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5}; static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6}; static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7}; static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4}; p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); if(w > 8){ x = x + (w-8)/2; y = y + (h-8)/2; } QPointArray a; switch(type){ case Qt::UpArrow: a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); break; case Qt::DownArrow: a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); break; case Qt::LeftArrow: a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); break; default: a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); break; } a.translate(x, y); p->drawLineSegments(a); } void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) { if(active){ x -= 2; // Bug in Qt/E y -= 2; w += 2; h += 2; } QWidget *parent = (QWidget *)p->device(); p->setBrushOrigin(parent->pos()); parent->erase(x, y, w, h); if(menuHandler->useShadowText()){ QColor shadow; if(p->device() && p->device()->devType() == QInternal::Widget && ((QWidget *)p->device())->inherits("QMenuBar")){ shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : g.background().dark(130); } else shadow = g.background().dark(130); + QPixmap *dummy = 0; + + if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { + dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); + QBitmap dummy_mask ( dummy-> size ( )); + dummy_mask. fill ( color1 ); + dummy-> setMask ( dummy_mask ); + } + if(active){ drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); QApplication::style().drawItem(p, x+1, y+1, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, - g, mi->isEnabled(), NULL, mi->text(), + g, mi->isEnabled(), dummy, mi->text(), -1, &shadow); QApplication::style().drawItem(p, x, y, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, - g, mi->isEnabled(), NULL, mi->text(), + g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), -1, &g.text()); } else{ QApplication::style().drawItem(p, x+1, y+1, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, - g, mi->isEnabled(), NULL, mi->text(), + g, mi->isEnabled(), dummy, mi->text(), -1, &shadow); QApplication::style().drawItem(p, x, y, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, - g, mi->isEnabled(), NULL, mi->text(), + g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), -1, &g.text()); } + delete dummy; } else{ if(active) drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); QApplication::style().drawItem(p, x, y, w, h, AlignCenter|ShowPrefix|DontClip|SingleLine, - g, mi->isEnabled(), NULL, mi->text(), + g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), -1, &g.text()); } } void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, int /*lineWidth*/, const QBrush * /*fill*/) { QColor c; switch(menuHandler->transType()){ case None: case StippledBg: case TransStippleBg: c = g.background(); break; case StippledBtn: case TransStippleBtn: c = g.button(); break; default: c = menuHandler->bgColor(); } p->setPen(c.dark(140)); p->drawRect(x, y, w, h); p->setPen(c.light(120)); p->drawRect(x+1, y+1, w-2, h-2); } void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, const QPalette& pal, bool act, bool enabled, int x, int y, int w, int h) { static const int motifItemFrame = 2; static const int motifItemHMargin = 3; static const int motifItemVMargin = 2; static const int motifArrowHMargin = 6; static const int windowsRightBorder = 12; maxpmw = QMAX( maxpmw, 20 ); bool dis = !enabled; QColorGroup itemg = dis ? pal.disabled() : pal.active(); int checkcol = maxpmw; if(act){ // FIXME drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background()); } //else if(((QWidget*)p->device())->backgroundPixmap()){ // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(), // x, y, w, h); //} else{ if(menuHandler->transType() == None){ p->fillRect(x, y, w, h, pal.active().background()); } else if(menuHandler->transType() == StippledBg){ p->fillRect(x, y, w, h, bgBrush); } else if(menuHandler->transType() == StippledBtn){ p->fillRect(x, y, w, h, menuBrush); } else{ QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); if(pix) p->drawPixmap(x, y, *pix, x, y, w, h); } } if(!mi) return; QColor discol; if (dis) { discol = itemg.mid(); p->setPen(discol); } QColorGroup cg2(itemg); if(menuHandler->transType() == Custom){ cg2.setColor(QColorGroup::Foreground, menuHandler->textColor()); cg2.setColor(QColorGroup::Text, menuHandler->textColor()); cg2.setColor(QColorGroup::Light, menuHandler->textColor().light(120)); cg2.setColor(QColorGroup::Mid, menuHandler->textColor().dark(120)); } else{ cg2 = QColorGroup(discol, itemg.highlight(), black, black, dis ? discol : black, discol, black); } if(mi->isSeparator()){ QColor c; diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff index 29ae6f3..d90433c 100644 --- a/noncore/styles/liquid/opie-liquid.diff +++ b/noncore/styles/liquid/opie-liquid.diff @@ -1,241 +1,241 @@ This is a patch to mosfet's liquid 0.7. Features: - Qt-only - works with Qt/E on QPE/OPIE ---- - 2002-11-18 04:47:41.000000000 +0100 +--- - 2002-11-21 20:45:47.000000000 +0100 +++ liquid.h 2002-11-18 03:32:40.000000000 +0100 @@ -2,7 +2,7 @@ #define LIQUID_STYLE_H -#include <kstyle.h> +#include <qwindowsstyle.h> #include <qpainter.h> #include <qdrawutil.h> #include <qpalette.h> @@ -20,7 +20,7 @@ * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. */ -class KPixmap; +class QPixmap; #define BITMAP_ITEMS 41 #define LIQUID_MENU_CHANGE 667 @@ -50,24 +50,22 @@ ~TransMenuHandler(){;} void reloadSettings(); int transType(){return(type);} - KPixmap *pixmap(WId id){return(pixDict.find(id));} + QPixmap *pixmap(WId id){return(pixDict.find(id));} const QColor& textColor(){return(fgColor);} const QColor& bgColor(){return(color);} bool useShadowText(){return(shadowText);} -protected slots: - void slotKIPCMessage(int id, int arg); protected: bool eventFilter(QObject *obj, QEvent *ev); - void stripePixmap(KPixmap &pix, const QColor &color); + void stripePixmap(QPixmap &pix, const QColor &color); QColor color, fgColor; int opacity; int type; bool shadowText; - QIntDict<KPixmap>pixDict; + QIntDict<QPixmap>pixDict; }; -class LiquidStyle : public KStyle +class LiquidStyle : public QWindowsStyle { friend class TransMenuHandler; public: @@ -121,33 +119,14 @@ bool tickAbove, bool tickBelow); void drawSliderMask(QPainter *p, int x, int y, int w, int h, Orientation orient, bool, bool); - void drawKToolBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, KToolBarPos type, - QBrush *fill=NULL); - void drawKBarHandle(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, - KToolBarPos type, QBrush *fill=NULL); - void drawKMenuBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool macMode, - QBrush *fill=NULL); - void drawKToolBarButton(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool sunken=false, - bool raised = true, bool enabled = true, - bool popup = false, - KToolButtonType icontext = Icon, - const QString& btext=QString::null, - const QPixmap *icon=NULL, - QFont *font=NULL, QWidget *btn=NULL); - void drawKMenuItem(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool active, - QMenuItem *item, QBrush *fill=NULL); + void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, + QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); + void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, int tab, QMenuItem *mi, const QPalette &pal, bool act, bool enabled, int x, int y, int w, int h); int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); - void drawKProgressBlock(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, QBrush *fill); void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, const QColor *pen, bool atBorder); int defaultFrameWidth() const {return(2);} @@ -167,12 +146,6 @@ void drawToolButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush *fill); - void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, QBrush *); - void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, - const QString &title, bool active, - QPixmap *icon, QBrush *fill); // for repainting toolbuttons when the toolbar is resized bool eventFilter(QObject *obj, QEvent *ev); void drawSliderGroove(QPainter * p, int x, int y, int w, int h, @@ -198,25 +171,15 @@ void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, bool down=false, bool fast = true); void drawRoundRect(QPainter *p, int x, int y, int w, int h); - void loadCustomButtons(); - void applyCustomAttributes(QPushButton *btn); - void unapplyCustomAttributes(QPushButton *btn); QPixmap* getPixmap(BitmapData item); QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); private: - bool highcolor; - QColorGroup radioOnGrp; + bool oldqte; + bool flatTBButtons; QWidget *highlightWidget; - QBrush wallpaper; - QBitmap lightBmp; - QBitmap grayBmp; - QBitmap dgrayBmp; - QBitmap maskBmp; - QBitmap xBmp; QBitmap btnMaskBmp, htmlBtnMaskBmp; QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; - QBitmap paper1, paper2, paper3; - QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush; + QBrush bgBrush, menuBrush; bool menuAni, menuFade; QIntDict<QPixmap>btnDict; @@ -224,9 +187,6 @@ QIntDict<QPixmap>bevelFillDict; QIntDict<QPixmap>smallBevelFillDict; - QList<QColor>customBtnColorList; - QList<QPixmap>customBtnIconList; - QStrList customBtnLabelList; QPixmap *vsbSliderFillPix; TransMenuHandler *menuHandler; QPixmap *pixmaps[BITMAP_ITEMS]; ---- - 2002-11-18 04:47:41.000000000 +0100 -+++ liquid.cpp 2002-11-18 04:46:13.000000000 +0100 +--- - 2002-11-21 20:45:47.000000000 +0100 ++++ liquid.cpp 2002-11-21 20:27:48.000000000 +0100 @@ -2,6 +2,9 @@ * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. */ +// +// (c) 2002 Robert 'sandman' Griebl +// #ifndef INCLUDE_MENUITEM_DEF @@ -10,12 +13,10 @@ #include <qmenudata.h> #include "liquid.h" -#include <kapp.h> -#include <kglobal.h> -#include <kconfig.h> -#include <kdrawutil.h> -#include <kglobalsettings.h> -#include <kpixmapeffect.h> +//#include "liquiddeco.h" +#include <qapplication.h> +#include <qpe/config.h> +#include "effects.h" #include <qpalette.h> #include <qbitmap.h> #include <qtabbar.h> @@ -25,28 +26,30 @@ #include <qtimer.h> #include <qpixmapcache.h> #include <qradiobutton.h> -#include <kimageeffect.h> -#include <ktoolbar.h> +#include <qcombobox.h> #include <qdrawutil.h> #include <qwidgetlist.h> #include <qtoolbutton.h> #include <qheader.h> #include <unistd.h> -#include <klocale.h> -#include <kiconloader.h> -#include <kmenubar.h> -#include <kipc.h> +#include <qmenubar.h> +#include <qprogressbar.h> +#include <qlineedit.h> -#include <X11/X.h> -#include <X11/Xlib.h> +#include <stdio.h> #include "htmlmasks.h" #include "embeddata.h" -void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) +typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, + QColorGroup &, bool, bool); + +QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); + +void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) { QImage img(pix.convertToImage()); - KImageEffect::fade(img, 0.9, color); + QImageEffect::fade(img, 0.9, color); int x, y; int r, g, b; for(y=0; y < img.height(); y+=3){ @@ -71,35 +74,37 @@ : QObject(parent) { pixDict.setAutoDelete(true); - connect(kapp, SIGNAL(kipcMessage(int, int)), this, - SLOT(slotKIPCMessage(int, int))); reloadSettings(); } void TransMenuHandler::reloadSettings() { pixDict.clear(); - KConfig *config = KGlobal::config(); - config->setGroup("MosfetMenus"); - type = config->readNumEntry("Type", TransStippleBg); - color = config->readColorEntry("Color", - &QApplication::palette().active().button()); - fgColor = config->readColorEntry("TextColor", - &QApplication::palette().active().text()); - opacity = config->readNumEntry("Opacity", 10); - shadowText = config->readBoolEntry("ShadowText", true); + Config config ( "qpe" ); + config. setGroup ( "Liquid-Style" ); + + type = config. readNumEntry("Type", TransStippleBg); + color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); + fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); @@ -248,349 +248,349 @@ Features: + shadowText = config. readBoolEntry("ShadowText", true); } bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) { - QPopupMenu *p = (QPopupMenu *)obj; + QWidget *p = (QWidget *)obj; if(ev->type() == QEvent::Show){ if(type == TransStippleBg || type == TransStippleBtn || type == Custom){ QApplication::syncX(); - KPixmap *pix = new KPixmap; + QPixmap *pix = new QPixmap; if(p->testWFlags(Qt::WType_Popup)){ QRect r(p->x(), p->y(), p->width(), p->height()); QRect deskR = QApplication::desktop()->rect(); @@ -107,7 +112,7 @@ r.setBottom(deskR.bottom()); r.setRight(deskR.right()); } - *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), + *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), r.width(), r.height()); } else{ // tear off menu @@ -121,82 +126,61 @@ stripePixmap(*pix, p->colorGroup().button()); } else{ - KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); + QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); } + pixDict.insert(p->winId(), pix); + + if ( !p->inherits("QPopupMenu")) + p->setBackgroundPixmap(*pix); + + QObjectList *ol = p-> queryList("QWidget"); + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { + QWidget *wid = (QWidget *) it.current ( ); + + wid-> setBackgroundPixmap(*pix); + wid-> setBackgroundOrigin(QWidget::ParentOrigin); + } + delete ol; } } else if(ev->type() == QEvent::Hide){ if(type == TransStippleBg || type == TransStippleBtn || type == Custom){ - qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); - pixDict.remove(p->winId()); - } - } - return(false); -} - -void TransMenuHandler::slotKIPCMessage(int id, int) -{ - if(id == LIQUID_MENU_CHANGE){ - bool oldShadow = shadowText; - - KConfig *config = KGlobal::config(); - config->reparseConfiguration(); // in case KControl changed values +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); - // Make sure no popupmenus are shown. There shouldn't be any because - // the user just clicked "Apply", but there can be tear offs ;-) - // We just close them so the pixmaps are deleted and regenerated. - QWidgetList *list = QApplication::topLevelWidgets(); - QWidgetListIt it( *list ); - QWidget *w; - while ((w=it.current()) != 0 ){ - ++it; - if(w->inherits("QPopupMenu")){ - w->close(); - } - } + pixDict.remove(p->winId()); + if ( !p->inherits("QPopupMenu")) + p->setBackgroundMode(QWidget::PaletteBackground); - reloadSettings(); + QObjectList *ol = p-> queryList("QWidget"); + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { + QWidget *wid = (QWidget *) it.current ( ); - // Now repaint menubar if needed - if(shadowText != oldShadow){ - it.toFirst(); - while ((w=it.current()) != 0 ){ - ++it; - if(w->inherits("QMenuBar")){ - w->repaint(); -- } -- } + wid-> setBackgroundMode( QWidget::PaletteBackground ); } ++ delete ol; + } + } - } - else if(id == MOSFET_BUTTON_CHANGE){ - qWarning("In mosfet button change"); - // really, this should be in LiquidStyle, but what the hell? ;-) - QWidgetList *list = QApplication::allWidgets(); - QWidgetListIt it( *list ); - QWidget *w; - while ((w=it.current()) != 0 ){ - ++it; - if(w->inherits("QPushButton")){ - ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); - } - } - ((LiquidStyle*)parent())->loadCustomButtons(); - it.toFirst(); - while ((w=it.current()) != 0 ){ - ++it; - if(w->inherits("QPushButton")){ - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); -+ delete ol; - } - } +- } +- } + return(false); +} - } + +static int qt_version ( ) +{ + const char *qver = qVersion ( ); + return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); } + LiquidStyle::LiquidStyle() - :KStyle() + :QWindowsStyle() { + setName ( "LiquidStyle" ); + + oldqte = ( qt_version ( ) < 234 ); + flatTBButtons = false; + btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); btnMaskBmp.setMask(btnMaskBmp); htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); @@ -207,12 +191,8 @@ btnDict.setAutoDelete(true); bevelFillDict.setAutoDelete(true); smallBevelFillDict.setAutoDelete(true); - customBtnColorList.setAutoDelete(true); - customBtnIconList.setAutoDelete(true); - customBtnLabelList.setAutoDelete(true); rMatrix.rotate(270.0); - highcolor = QPixmap::defaultDepth() > 8; btnBorderPix = new QPixmap; btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); btnBlendPix = new QPixmap; @@ -572,131 +552,119 @@ case HTMLBtnBorderDown: pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); break; + case HTMLCB: pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); break; + case HTMLCBHover: + pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnHoverH, btnHoverS, btnHoverV); + break; case HTMLCBDown: pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); break; - case HTMLCBHover: - pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); - break; case HTMLCBDownHover: - pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", - btnHoverH, btnHoverS, - btnHoverV); + pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", btnHoverH, btnHoverS, btnHoverV); break; + case HTMLRadio: pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); + break; + case HTMLRadioHover: + pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnHoverH, btnHoverS, btnHoverV); + break; case HTMLRadioDown: pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); - case HTMLRadioHover: - pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); + break; case HTMLRadioDownHover: - pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", - btnHoverH, btnHoverS, - btnHoverV); + pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", btnHoverH, btnHoverS, btnHoverV); + break; + + case RadioOff: + pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV /*, true*/); + break; + case RadioOffHover: + pixmaps[RadioOffHover] = processEmbedded("radio", btnHoverH, btnHoverS, btnHoverV /*, true*/); + break; case RadioOn: - pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); + pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV /*, true*/); break; case RadioOnHover: - pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, - btnHoverV, true); + pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, btnHoverV /*, true*/); break; - case RadioOffHover: - pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); + + case Tab: + pixmaps[Tab] = processEmbedded("tab", bH, bS, bV /*, true*/); break; case TabDown: - pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); + pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV /*, true*/); break; case TabFocus: - pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, - btnHoverS, true); - break; - case CBDown: - pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); + pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, btnHoverV /*, true*/); break; - case CBDownHover: - pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, - btnHoverS, btnHoverV, true); + + case CB: + pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV /*, true*/); break; case CBHover: - pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); + pixmaps[CBHover] = processEmbedded("checkbox", btnHoverH, btnHoverS, btnHoverV /*, true*/); break; - case HSlider: - pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); + case CBDown: + pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV /*, true*/); - break; ++ break; + case CBDownHover: + pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, btnHoverS, btnHoverV /*, true*/); -+ break; + break; + case VSlider: - pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); + pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true ); *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); break; - case RadioOff: - pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); - break; - case Tab: - pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); - break; - case CB: - pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); - break; case VSBSliderTop: - pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); + case VSBSliderTopHover: + pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV /*, true*/); break; case VSBSliderBtm: - pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); + case VSBSliderBtmHover: + pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV /*, true*/); break; case VSBSliderMid: - pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); + case VSBSliderMidHover: + pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); break; - case VSBSliderTopHover: - pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); + case VSBSliderTopBg: + pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV /*, true*/); break; - case VSBSliderBtmHover: - pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); + case VSBSliderBtmBg: + pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV /*, true*/); break; - case VSBSliderMidHover: - pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); + case VSBSliderMidBg: + pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); break; - case HSBSliderTop: - pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); - *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); - break; - case HSBSliderBtm: - pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); - *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); - break; - case HSBSliderMid: - pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); - *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); + case HSlider: + pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV /*, true*/); break; + case HSBSliderTop: case HSBSliderTopHover: - pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); - *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); + pixmaps[item] = processEmbedded("sbslider_top", btnH, btnS, btnV, true ); + *pixmaps[item] = pixmaps[item]->xForm(rMatrix); break; + case HSBSliderBtm: case HSBSliderBtmHover: - pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); - *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); + pixmaps[item] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true ); + *pixmaps[item] = pixmaps[item]->xForm(rMatrix); break; + case HSBSliderMid: case HSBSliderMidHover: - pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); - *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); - break; - case VSBSliderTopBg: - pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); - break; - case VSBSliderBtmBg: - pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); - break; - case VSBSliderMidBg: - pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); + pixmaps[item] = processEmbedded("sbslider_mid", btnH, btnS, btnV); + *pixmaps[item] = pixmaps[item]->xForm(rMatrix); break; case HSBSliderTopBg: - pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); + pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true ); *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); break; case HSBSliderBtmBg: @@ -1479,733 +1479,784 @@ Features: && ((QWidget*)p->device())->autoMask(); if(isMasked){ if(on || down){ - p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioDownHover) : + p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioDownHover) : *getPixmap(HTMLRadioDown)); } else - p->drawPixmap(x, y, isHover ? *getPixmap(HTMLRadioHover) : + p->drawPixmap(x, y, isActive ? *getPixmap(HTMLRadioHover) : *getPixmap(HTMLRadio)); } else{ if(on || down){ - p->drawPixmap(x, y, isHover ? *getPixmap(RadioOnHover) : + p->drawPixmap(x, y, isActive ? *getPixmap(RadioOnHover) : *getPixmap(RadioOn)); } else - p->drawPixmap(x, y, isHover ? *getPixmap(RadioOffHover) : + p->drawPixmap(x, y, isActive ? *getPixmap(RadioOffHover) : *getPixmap(RadioOff)); } } @@ -1957,25 +1873,25 @@ return(QSize(20, 22)); } -void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, int state, bool down, bool) +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, + const QColorGroup &/*g*/, int state, bool /*down*/, bool) { - bool isHover = highlightWidget == p->device(); + bool isActive = ( p->device()->devType() == QInternal::Widget ) && ( qApp-> focusWidget ( ) == p-> device ( )); bool isMasked = p->device() && p->device()->devType() == QInternal::Widget && ((QWidget*)p->device())->autoMask(); if(isMasked){ if(state != QButton::Off){ - p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBDownHover) : + p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBDownHover) : *getPixmap(HTMLCBDown)); } else - p->drawPixmap(x, y, isHover ? *getPixmap(HTMLCBHover) : + p->drawPixmap(x, y, isActive ? *getPixmap(HTMLCBHover) : *getPixmap(HTMLCB)); } else{ if(state != QButton::Off){ - p->drawPixmap(x, y, isHover ? *getPixmap(CBDownHover) : + p->drawPixmap(x, y, isActive ? *getPixmap(CBDownHover) : *getPixmap(CBDown)); /* Todo - tristate if(state == QButton::On){ @@ -1992,12 +1908,12 @@ }*/ } else - p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); + p->drawPixmap(x, y, isActive ? *getPixmap(CBHover) : *getPixmap(CB)); } } -void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, - int state) +void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, + int /*state*/) { // needed for some reason by KHtml, even tho it's all filled ;P p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); @@ -2005,18 +1921,17 @@ } void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, Orientation orient, + const QColorGroup &/*g*/, Orientation orient, bool, bool) { QWidget *parent = (QWidget *)p->device(); p->setBrushOrigin(parent->pos()); - p->fillRect(x, y, w, h, - QApplication::palette().active().brush(QColorGroup::Background)); + parent->erase(x, y, w, h); p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : *getPixmap(VSlider)); } -void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, +void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, Orientation orient, bool, bool) { p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : -@@ -2065,203 +1980,26 @@ +@@ -2065,243 +1980,76 @@ p->drawLineSegments(a); } -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, KToolBarPos, - QBrush *) -{ - p->setPen(g.button().dark(120)); - int x2 = x+w-1; - int y2 = y+h-1; - p->drawLine(x+1, y, x2-1, y); - p->drawLine(x+1, y2, x2-1, y2); - p->drawLine(x, y+1, x, y2-1); - p->drawLine(x2, y+1, x2, y2-1); - - p->setPen(g.background()); - p->drawPoint(x, y); - p->drawPoint(x2, y); - p->drawPoint(x, y2); - p->drawPoint(x2, y2); - - - - // p->drawRect(x, y, w, h); - QPixmap *pix = bevelFillDict.find(g.button().rgb()); - if(!pix){ - int h, s, v; - g.button().hsv(&h, &s, &v); - pix = new QPixmap(*bevelFillPix); - adjustHSV(*pix, h, s, v); - bevelFillDict.insert(g.button().rgb(), pix); - } - - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); -} - -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool mac, QBrush *) -{ - if(p->device() && p->device()->devType() == QInternal::Widget && - ((KMenuBar *)p->device())->isTopLevelMenu()){ - p->setPen(Qt::black); - p->drawRect(x, y, w, h); - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); - // left - p->drawLine(x+1, y+1, x+1, y+5); - p->drawLine(x+2, y+1, x+2, y+3); - p->drawLine(x+3, y+1, x+3, y+2); - p->drawLine(x+4, y+1, x+6, y+1); - // right - int x2 = x+w-1; - p->drawLine(x2-1, y+1, x2-1, y+5); - p->drawLine(x2-2, y+1, x2-2, y+3); - p->drawLine(x2-3, y+1, x2-3, y+2); - p->drawLine(x2-4, y+1, x2-6, y+1); - } - else{ - qDrawShadePanel(p, x, y, w, h, g, false, 1, - &g.brush(QColorGroup::Background)); - } -- --} +-} +- -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, KToolBarPos, QBrush *) +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) { - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); -} - -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool sunken, - bool raised, bool enabled, bool popup, - KToolButtonType icontext, - const QString& btext, const QPixmap *pixmap, - QFont *font, QWidget *btn) -{ - int dx, dy; - - QFontMetrics fm(*font); - - QToolBar* toolbar = 0; - if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) - toolbar = static_cast<QToolBar*>(btn->parent()); - - --w, --h; - if(sunken) - ++x, ++y; - - QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : - g.background()); - drawClearBevel(p, x, y, w, h, btnColor, g.background()); - - p->setPen(g.text()); - - if (icontext == Icon){ // icon only - if (pixmap){ - dx = ( w - pixmap->width() ) / 2; - dy = ( h - pixmap->height() ) / 2; - if ( sunken ) - { - ++dx; - ++dy; - } - p->drawPixmap( x+dx, y+dy, *pixmap ); - } - } - else if (icontext == IconTextRight){ // icon and text (if any) - if (pixmap){ - dx = 4; - dy = ( h - pixmap->height() ) / 2; - if ( sunken ){ - ++dx; - ++dy; - } - p->drawPixmap( x+dx, y+dy, *pixmap ); - } - if (!btext.isNull()){ - int tf = AlignVCenter|AlignLeft; - if (pixmap) - dx= 4 + pixmap->width() + 2; - else - dx= 4; - dy = 0; - if ( sunken ){ - ++dx; - ++dy; - } - if (font) - p->setFont(*font); - if(raised) - p->setPen(KGlobalSettings::toolBarHighlightColor()); - p->drawText(x+dx, y+dy, w-dx, h, tf, btext); - } - } - else if (icontext == Text){ // only text, even if there is a icon - if (!btext.isNull()){ - int tf = AlignVCenter|AlignLeft; - if (!enabled) - p->setPen(g.dark()); - dx= (w - fm.width(btext)) / 2; - dy= (h - fm.lineSpacing()) / 2; - if ( sunken ){ - ++dx; - ++dy; - } - if (font) - p->setFont(*font); - if(raised) - p->setPen(KGlobalSettings::toolBarHighlightColor()); - p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); - } - } - else if (icontext == IconTextBottom){ - if (pixmap){ - dx = (w - pixmap->width()) / 2; - dy = (h - fm.lineSpacing() - pixmap->height()) / 2; - if ( sunken ){ - ++dx; - ++dy; - } - p->drawPixmap( x+dx, y+dy, *pixmap ); - } - if (!btext.isNull()){ - int tf = AlignBottom|AlignHCenter; - dy= pixmap->height(); - dx = 2; - if ( sunken ){ - ++dx; - ++dy; - } - if (font) - p->setFont(*font); - if(raised) - p->setPen(KGlobalSettings::toolBarHighlightColor()); - p->drawText(x, y, w, h-3, tf, btext); - } - } - if (popup){ - if (enabled) - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, - g, true); - else - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, - 0, 0, g, false); + if(active){ + x -= 2; // Bug in Qt/E + y -= 2; + w += 2; + h += 2; } -} - -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, bool active, QMenuItem *mi, - QBrush *) -{ - if ( p->font() == KGlobalSettings::generalFont() ) - p->setFont( KGlobalSettings::menuFont() ); + QWidget *parent = (QWidget *)p->device(); + p->setBrushOrigin(parent->pos()); + parent->erase(x, y, w, h); if(menuHandler->useShadowText()){ QColor shadow; if(p->device() && p->device()->devType() == QInternal::Widget && - ((QWidget *)p->device())->inherits("KMenuBar")){ - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : + ((QWidget *)p->device())->inherits("QMenuBar")){ + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : g.background().dark(130); } else -@@ -2300,8 +2038,8 @@ + shadow = g.background().dark(130); + ++ QPixmap *dummy = 0; ++ ++ if ( mi-> pixmap ( ) && !mi-> pixmap ( )-> isNull ( )) { ++ dummy = new QPixmap ( mi-> pixmap ( )-> size ( )); ++ QBitmap dummy_mask ( dummy-> size ( )); ++ dummy_mask. fill ( color1 ); ++ dummy-> setMask ( dummy_mask ); ++ } ++ + if(active){ + drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); + QApplication::style().drawItem(p, x+1, y+1, w, h, + AlignCenter|ShowPrefix|DontClip|SingleLine, +- g, mi->isEnabled(), NULL, mi->text(), ++ g, mi->isEnabled(), dummy, mi->text(), + -1, &shadow); + QApplication::style().drawItem(p, x, y, w, h, + AlignCenter|ShowPrefix|DontClip|SingleLine, +- g, mi->isEnabled(), NULL, mi->text(), ++ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), + -1, &g.text()); + } + else{ + QApplication::style().drawItem(p, x+1, y+1, w, h, + AlignCenter|ShowPrefix|DontClip|SingleLine, +- g, mi->isEnabled(), NULL, mi->text(), ++ g, mi->isEnabled(), dummy, mi->text(), + -1, &shadow); + QApplication::style().drawItem(p, x, y, w, h, + AlignCenter|ShowPrefix|DontClip|SingleLine, +- g, mi->isEnabled(), NULL, mi->text(), ++ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), + -1, &g.text()); + } ++ delete dummy; + } + else{ + if(active) + drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); + QApplication::style().drawItem(p, x, y, w, h, + AlignCenter|ShowPrefix|DontClip|SingleLine, +- g, mi->isEnabled(), NULL, mi->text(), ++ g, mi->isEnabled(), mi-> pixmap ( ), mi->text(), + -1, &g.text()); + } } void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, int lineWidth, - const QBrush * fill) + const QColorGroup &g, int /*lineWidth*/, + const QBrush * /*fill*/) { QColor c; switch(menuHandler->transType()){ -@@ -2336,8 +2074,6 @@ +@@ -2336,8 +2084,6 @@ maxpmw = QMAX( maxpmw, 20 ); - if ( p->font() == KGlobalSettings::generalFont() ) - p->setFont( KGlobalSettings::menuFont() ); bool dis = !enabled; QColorGroup itemg = dis ? pal.disabled() : pal.active(); -@@ -2363,7 +2099,7 @@ +@@ -2363,7 +2109,7 @@ p->fillRect(x, y, w, h, menuBrush); } else{ - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); if(pix) p->drawPixmap(x, y, *pix, x, y, w, h); } -@@ -2508,25 +2244,6 @@ +@@ -2508,25 +2254,6 @@ return h; } -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, QBrush *fill) -{ - p->setPen(g.button().dark(130)); - p->drawRect(x, y, w, h); - p->setPen(g.button().light(120)); - p->drawRect(x+1, y+1, w-2, h-2); - if(w >= 4 && h >= 4){ - QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); - if(!pix){ - int h, s, v; - g.button().dark(120).hsv(&h, &s, &v); - pix = new QPixmap(*bevelFillPix); - adjustHSV(*pix, h, s, v); - bevelFillDict.insert(g.button().dark(120).rgb(), pix); - } - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); - } -} void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, const QColor *c, -@@ -2536,29 +2253,29 @@ +@@ -2536,29 +2263,29 @@ if(p->device()->devType() == QInternal::Widget){ // if so does it use a special focus rectangle? QWidget *w = (QWidget *)p->device(); - if(w->inherits("QPushButton") || w->inherits("QSlider")){ + if(w->inherits("QPushButton") || w->inherits("QSlider") || w->inherits("QComboBox") || w->inherits("QToolButton" )){ return; } else{ - KStyle::drawFocusRect(p, r, g, c, atBorder); + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); } } else - KStyle::drawFocusRect(p, r, g, c, atBorder); + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); } void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) { mnu->installEventFilter(menuHandler); - KStyle::polishPopupMenu(mnu); + QWindowsStyle::polishPopupMenu(mnu); } void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, bool selected) { if(tabBar->shape() != QTabBar::RoundedAbove){ - KStyle::drawTab(p, tabBar, tab, selected); + QWindowsStyle::drawTab(p, tabBar, tab, selected); return; } QPixmap tilePix; -@@ -2671,7 +2388,7 @@ +@@ -2671,7 +2398,7 @@ vFrame = 8; // was 10 } else - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); } -@@ -2699,7 +2416,7 @@ +@@ -2699,7 +2426,7 @@ p->drawLine(x+1, y+1, x+1, y2-1); } else if(lineWidth != 2 || !sunken) - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); else{ QPen oldPen = p->pen(); int x2 = x+w-1; -@@ -2726,105 +2443,6 @@ +@@ -2726,105 +2453,6 @@ } } -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, QBrush *) -{ - p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); - drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? - g.button().light(120) : g.button(), g.button()); - /* - if(h > w){ - int y2 = y+h-1; - - p->setPen(g.light()); - - p->drawLine(x+1, y+2, x+1, y2-2); - p->drawLine(x+4, y+2, x+4, y2-2); - - p->setPen(g.dark()); - p->drawLine(x+2, y+2, x+2, y2-2); - p->drawLine(x+5, y+2, x+5, y2-2); - - } - else{ - int x2 = x+w-1; - - p->setPen(g.light()); - - p->drawLine(x+2, y+1, x2-2, y+1); - p->drawLine(x+2, y+4, x2-2, y+4); - - p->setPen(g.dark()); - p->drawLine(x+2, y+2, x2-2, y+2); - p->drawLine(x+2, y+5, x2-2, y+5); - }*/ - -} - -void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, - const QColorGroup &g, - const QString &text, bool sunken, - QPixmap *pixmap, QBrush *) -{ - p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); - drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); - p->setPen(g.buttonText()); // Kicker doesn't set this ;-) - - if(text.isNull() && !pixmap) - return; - - const int pxWidth = 20; - int textPos = pxWidth; - QRect br(buttonRect(x, y, w, h)); - - if (sunken) - p->translate(1,1); - - if ( pixmap && !pixmap->isNull() ) { - int dx = ( pxWidth - pixmap->width() ) / 2; - int dy = ( h - pixmap->height() ) / 2; - p->drawPixmap( br.x()+dx, dy, *pixmap ); - } - - QString s = text; - static const QString &modStr = KGlobal::staticQString( - QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); - - int modStrPos = s.find(modStr); - - if (-1 != modStrPos) { - - // +1 because we include a space after the closing brace. - s.remove(modStrPos, modStr.length()+1); - - QPixmap modPixmap = SmallIcon("modified"); - - int dx = (pxWidth - modPixmap.width()) / 2; - int dy = (h - modPixmap.height()) / 2; - - p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); - - textPos += pxWidth; - } - - if (!s.isEmpty()){ - if (p->fontMetrics().width(s) > br.width() - textPos) { - - int maxLen = br.width() - textPos - p->fontMetrics().width("..."); - - while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) - s.truncate(s.length() - 1); - - s.append("..."); - } - - p->setPen(g.buttonText()); - - p->drawText(br.x()+ textPos, -1, w-textPos, h, - AlignLeft|AlignVCenter, s); - } - -} void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) { -@@ -2988,110 +2606,5 @@ +@@ -2988,110 +2616,5 @@ } } -// I'm debating if to use QValueList or QList here. I like QValueList better, -// but QList handles pointers which is good for a lot of empty icons... - -void LiquidStyle::loadCustomButtons() -{ - return; // TODO - customBtnColorList.clear(); - customBtnIconList.clear(); - customBtnLabelList.clear(); - - KConfig *config = KGlobal::config(); - QString oldGrp = config->group(); - config->setGroup("MosfetButtons"); - - QStrList iconList, colorList; //temp, we store QPixmaps and QColors - iconList.setAutoDelete(true); - colorList.setAutoDelete(true); - config->readListEntry("Labels", customBtnLabelList); - config->readListEntry("Icons", iconList); - config->readListEntry("Colors", colorList); - - const char *labelStr = customBtnLabelList.first(); - const char *colorStr = colorList.first(); - const char *iconStr = iconList.first(); - - KIconLoader *ldr = KGlobal::iconLoader(); - while(labelStr != NULL){ - QColor *c = new QColor; - c->setNamedColor(QString(colorStr)); - customBtnColorList.append(c); - - QString tmpStr(iconStr); - if(!tmpStr.isEmpty()){ - QPixmap *pixmap = - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); - if(pixmap->isNull()){ - delete pixmap; - customBtnIconList.append(NULL); - } - else - customBtnIconList.append(pixmap); - } - else - customBtnIconList.append(NULL); - - labelStr = customBtnLabelList.next(); - colorStr = colorList.next(); - iconStr = iconList.next(); - } - config->setGroup(oldGrp); -} - -void LiquidStyle::applyCustomAttributes(QPushButton *btn) -{ - return; // TODO - QString str = btn->text(); - if(str.isEmpty()) - return; - while(str.contains('&') != 0) - str = str.remove(str.find('&'), 1); - - const char *s; - int idx = 0; - for(s = customBtnLabelList.first(); s != NULL; - ++idx, s = customBtnLabelList.next()){ - if(qstricmp(s, str.latin1()) == 0){ - QPalette pal = btn->palette(); - pal.setColor(QColorGroup::Button, - *customBtnColorList.at(idx)); - btn->setPalette(pal); - /* - if(customBtnIconList.at(idx) != NULL){ - QPixmap *pix = customBtnIconList.at(idx); - btn->setIconSet(QIconSet(*pix)); - }*/ - break; - } - } -} - -void LiquidStyle::unapplyCustomAttributes(QPushButton *btn) -{ - return; // TODO - QString str = btn->text(); - if(str.isEmpty()) - return; - while(str.contains('&') != 0) - str = str.remove(str.find('&'), 1); - - const char *s; - for(s = customBtnLabelList.first(); s != NULL; s = customBtnLabelList.next()){ - if(qstricmp(s, str.latin1()) == 0){ - btn->setPalette(QApplication::palette()); - btn->setIconSet(QIconSet()); - break; - } - } -} - -#include "liquid.moc" - - - - - /* vim: set noet sw=8 ts=8: */ ---- - 2002-11-18 04:47:41.000000000 +0100 -+++ plugin.cpp 2002-11-18 03:54:56.000000000 +0100 -@@ -1,29 +1,79 @@ +--- - 2002-11-21 20:45:47.000000000 +0100 ++++ plugin.cpp 2002-11-18 18:11:41.000000000 +0100 +@@ -1,29 +1,84 @@ +#include <qapplication.h> + #include "liquid.h" -#include <klocale.h> +#include "liquidset.h" +#include "plugin.h" + + + +LiquidInterface::LiquidInterface ( ) : ref ( 0 ) +{ + m_widget = 0; +} ++ ++LiquidInterface::~LiquidInterface ( ) ++{ ++} ++ ++QStyle *LiquidInterface::style ( ) ++{ ++ return new LiquidStyle ( ); ++} -extern "C" { - KStyle* allocate(); - int minor_version(); - int major_version(); - const char *description(); -+LiquidInterface::~LiquidInterface ( ) ++QString LiquidInterface::name ( ) const +{ ++ return qApp-> translate ( "Styles", "Liquid" ); } -KStyle* allocate() -+QStyle *LiquidInterface::style ( ) ++QString LiquidInterface::description ( ) const { - return(new LiquidStyle); -+ return new LiquidStyle ( ); ++ return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); } -int minor_version() -+QString LiquidInterface::name ( ) const ++bool LiquidInterface::hasSettings ( ) const { - return(0); -+ return qApp-> translate ( "Styles", "Liquid" ); ++ return true; } -int major_version() -+QString LiquidInterface::description ( ) const ++QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) { - return(1); -+ return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); ++ m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); ++ ++ return m_widget; } -const char *description() -+bool LiquidInterface::hasSettings ( ) const ++bool LiquidInterface::accept ( ) { - return(i18n("High performance liquid plugin").utf8()); -+ return true; -+} -+ -+QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) -+{ -+ m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); -+ -+ return m_widget; -+} -+ -+bool LiquidInterface::accept ( ) -+{ + if ( !m_widget ) + return false; + + return m_widget-> writeConfig ( ); } + +void LiquidInterface::reject ( ) +{ +} + + +QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) +{ + *iface = 0; + + if ( uuid == IID_QUnknown ) + *iface = this; + else if ( uuid == IID_Style ) + *iface = this; + else if ( uuid == IID_StyleExtended ) + *iface = this; + + if ( *iface ) + (*iface)-> addRef ( ); + + return QS_OK; +} + +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( LiquidInterface ) +} + ++ ++// For Sharp ROM ++ ++extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } ++extern "C" { void drawmenubaritem ( QStyle *sty, QPainter *p, int x, int y, int w, int h, QMenuItem *mi, QColorGroup &g, bool enabled, bool active ) { return ((LiquidStyle *) sty )-> drawMenuBarItem ( p, x, y, w, h, mi, g, enabled, active ); } } |