Improved highcolor buttons, and switched to the circular sticky thingy. I'll

post to core-devel in a sec.

svn path=/trunk/kdebase/kwin/; revision=63099
This commit is contained in:
Daniel M. Duley 2000-09-08 00:38:29 +00:00
parent f6b6c62c9a
commit ee5f19c686
3 changed files with 153 additions and 42 deletions

View file

@ -0,0 +1,93 @@
/* XPM */
static const char * btnhighcolor_xpm[] = {
"14 15 75 1",
" c None",
". c #6E6E6E",
"+ c #757575",
"@ c #878787",
"# c #7D7D7D",
"$ c #9E9E9E",
"% c #B9B9B9",
"& c #C6C6C6",
"* c #BABABA",
"= c #A5A5A5",
"- c #7F7F7F",
"; c #848484",
"> c #A7A7A7",
", c #BFBFBF",
"' c #D1D1D1",
") c #D7D7D7",
"! c #DADADA",
"~ c #CBCBCB",
"{ c #ABABAB",
"] c #B3B3B3",
"^ c #C2C2C2",
"/ c #CACACA",
"( c #C9C9C9",
"_ c #B6B6B6",
": c #9A9A9A",
"< c #999999",
"[ c #B0B0B0",
"} c #C4C4C4",
"| c #C3C3C3",
"1 c #C0C0C0",
"2 c #AEAEAE",
"3 c #969696",
"4 c #C1C1C1",
"5 c #CCCCCC",
"6 c #C5C5C5",
"7 c #BEBEBE",
"8 c #AAAAAA",
"9 c #CECECE",
"0 c #D4D4D4",
"a c #DBDBDB",
"b c #DEDEDE",
"c c #D5D5D5",
"d c #D3D3D3",
"e c #BCBCBC",
"f c #CDCDCD",
"g c #E0E0E0",
"h c #E4E4E4",
"i c #E8E8E8",
"j c #EBEBEB",
"k c #E9E9E9",
"l c #E6E6E6",
"m c #DDDDDD",
"n c #E1E1E1",
"o c #EDEDED",
"p c #F1F1F1",
"q c #F5F5F5",
"r c #F8F8F8",
"s c #F6F6F6",
"t c #F3F3F3",
"u c #EEEEEE",
"v c #E5E5E5",
"w c #DCDCDC",
"x c #B7B7B7",
"y c #E2E2E2",
"z c #FDFDFD",
"A c #FFFFFF",
"B c #FCFCFC",
"C c #F7F7F7",
"D c #B5B5B5",
"E c #F2F2F2",
"F c #FAFAFA",
"G c #9B9B9B",
"H c #FBFBFB",
"I c #A9A9A9",
"J c #747474",
" .... ",
" ..+@@+.. ",
" .#$%&&*=-. ",
" .;>,')!)~{#. ",
" .$]^///(&_:. ",
".<[*^}||11*23.",
".[4&5555~(678.",
".,90!aba)cd~e.",
".faghijklhm06.",
".'nopqrstuvw/.",
".xyprzAzBCunD.",
" .'EzAAAAFpf. ",
" .GcHAAAAF0<. ",
" ..I5kk5I.. ",
" J..... "};

View file

@ -1,40 +1,40 @@
/* Image bits processed by KPixmap2Bitmaps */
#define bmap_mask_width 14
#define bmap_mask_height 15
static unsigned char bmap_mask_bits[] = {
#define lowcolor_mask_width 14
#define lowcolor_mask_height 15
static unsigned char lowcolor_mask_bits[] = {
0xf0,0x03,0xf8,0x07,0xfc,0xcf,0xfe,0x1f,0xfe,0x1f,0xff,0xff,0xff,0xff,0xff,
0x3f,0xff,0x3f,0xff,0xbf,0xfe,0xdf,0xfe,0x9f,0xfc,0x0f,0xf8,0x07,0xf0,0x03,
0x00,0x40,0x80,0x00,0x00,0x00,0x29,0x00,0x00,0x00,0x7c,0xfe,0x87,0x40,0x00,
0x00,0x64,0x00,0x20,0x00,0x64,0x00,0x86,0xfe,0x87,0x40,0x00,0x00,0x65,0x00 };
#define bmap_6a696a_width 14
#define bmap_6a696a_height 15
static unsigned char bmap_6a696a_bits[] = {
#define lowcolor_6a696a_width 14
#define lowcolor_6a696a_height 15
static unsigned char lowcolor_6a696a_bits[] = {
0xf0,0x03,0x18,0x06,0x04,0xcc,0x06,0x18,0x02,0x10,0x00,0xc0,0x00,0xc0,0x00,
0x00,0x00,0x00,0x00,0xc0,0x00,0xc0,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x40,0x80,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,
0x00,0x00,0x00,0x80,0x24,0x0e,0x08,0x61,0x00,0x00,0x00,0xf0,0xd9,0x0c,0x08 };
#define bmap_949194_width 14
#define bmap_949194_height 15
static unsigned char bmap_949194_bits[] = {
#define lowcolor_949194_width 14
#define lowcolor_949194_height 15
static unsigned char lowcolor_949194_bits[] = {
0x00,0x40,0xe0,0x01,0x08,0x02,0x00,0x04,0x04,0x08,0x07,0x78,0x03,0xf0,0x01,
0xe0,0x01,0x60,0x01,0x20,0x00,0xc0,0x02,0x90,0x04,0x08,0x08,0x04,0xf0,0x03,
0x00,0x40,0x80,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0xc8,0x51,0x0c,0x08,0x0e,
0x01,0x00,0x00,0x37,0x00,0x00,0x00,0x58,0x5f,0x49,0x6d,0x61,0x67,0x65,0x54 };
#define bmap_b4b6b4_width 14
#define bmap_b4b6b4_height 15
static unsigned char bmap_b4b6b4_bits[] = {
#define lowcolor_b4b6b4_width 14
#define lowcolor_b4b6b4_height 15
static unsigned char lowcolor_b4b6b4_bits[] = {
0x00,0x40,0x00,0x00,0x10,0x00,0x08,0x02,0x18,0x06,0xb8,0x47,0x0c,0xce,0x0e,
0xd8,0x06,0x58,0x02,0x10,0x02,0xd0,0x00,0x80,0x00,0x00,0x10,0x02,0x00,0x00,
0x00,0x40,0x80,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,
0x00,0x08,0x00,0x02,0x00,0x00,0x00,0x61,0x00,0x00,0x00,0x38,0x5b,0x0c,0x08 };
#define bmap_e6e6e6_width 14
#define bmap_e6e6e6_height 15
static unsigned char bmap_e6e6e6_bits[] = {
#define lowcolor_e6e6e6_width 14
#define lowcolor_e6e6e6_height 15
static unsigned char lowcolor_e6e6e6_bits[] = {
0x00,0x40,0x00,0x00,0x00,0x00,0xe0,0x01,0x00,0x00,0x00,0x40,0x00,0xc0,0x00,
0xc0,0x00,0x40,0xe0,0xc0,0xe0,0xc1,0xe0,0x81,0xf0,0x03,0xc0,0x00,0x00,0x00,
0x00,0x40,0x80,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x08,0x19,0x0d,0x08,0x00,

View file

@ -14,6 +14,7 @@
#include "../../options.h"
#include "buttondata.h"
#include "btnhighcolor.h"
extern "C"
{
@ -38,14 +39,20 @@ static unsigned char minmax_bits[] = {
0x0c, 0x18, 0x33, 0x67, 0xcf, 0x9f, 0x3f, 0x3f};
static unsigned char unsticky_bits[] = {
0x00, 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18, 0x00};
0x3c, 0x42, 0x99, 0xbd, 0xbd, 0x99, 0x42, 0x3c};
static unsigned char sticky_bits[] = {
0x00, 0x00, 0x00, 0x7e, 0x7e, 0x00, 0x00, 0x00};
0x3c, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3c};
static unsigned char question_bits[] = {
0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18};
static unsigned char btnhighcolor_mask_bits[] = {
0xe0,0x41,0xf8,0x07,0xfc,0x0f,0xfe,0xdf,0xfe,0x1f,0xff,0x3f,0xff,0xff,0xff,
0x3f,0xff,0x3f,0xff,0xff,0xff,0xff,0xfe,0x9f,0xfe,0x1f,0xfc,0x0f,0xf0,0x03,
0x00,0x40,0x80,0x00,0x00,0x00,0x39,0x00,0x00,0x00,0x20,0x99,0x0f,0x08,0xc4,
0x00,0x00,0x00,0x67,0x00,0x00,0x00,0x58,0x5f,0x43,0x68,0x61,0x6e,0x67,0x65 };
static KPixmap *aUpperGradient=0;
static KPixmap *iUpperGradient=0;
static QPixmap *buttonPix=0;
@ -58,43 +65,53 @@ static bool pixmaps_created = false;
static void make_button_fx(const QColorGroup &g, QPixmap *pix, bool light=false)
{
static QBitmap bDark1(14, 15, bmap_6a696a_bits, true);
static QBitmap bDark2(14, 15, bmap_949194_bits, true);
static QBitmap bDark3(14, 15, bmap_b4b6b4_bits, true);
static QBitmap bLight1(14, 15, bmap_e6e6e6_bits, true);
if(!bDark1.mask()){
bDark1.setMask(bDark1);
bDark2.setMask(bDark2);
bDark3.setMask(bDark3);
bLight1.setMask(bLight1);
}
static QBitmap lcDark1(14, 15, lowcolor_6a696a_bits, true);
static QBitmap lcDark2(14, 15, lowcolor_949194_bits, true);
static QBitmap lcDark3(14, 15, lowcolor_b4b6b4_bits, true);
static QBitmap lcLight1(14, 15, lowcolor_e6e6e6_bits, true);
static QImage btnSource(btnhighcolor_xpm);
pix->fill(g.background());
QPainter p(pix);
if(QPixmap::defaultDepth() > 8){
int i, destH, destS, destV, srcH, srcS, srcV;
QColor btnColor = g.background();
if(btnSource.depth() < 32)
btnSource = btnSource.convertDepth(32);
if(light)
btnColor = btnColor.light(120);
p.setPen(btnColor.dark(120));
p.drawPixmap(0, 0, bDark3);
p.setPen(btnColor.dark(140));
p.drawPixmap(0, 0, bDark2);
p.setPen(btnColor.dark(150));
p.drawPixmap(0, 0, bDark1);
p.setPen(btnColor.light(130));
p.drawPixmap(0, 0, bLight1);
btnColor.hsv(&destH, &destS, &destV);
QImage btnDest(14, 15, 32);
unsigned int *srcData = (unsigned int *)btnSource.bits();
unsigned int *destData = (unsigned int *)btnDest.bits();
QColor srcColor;
for(i=0; i < btnSource.width()*btnSource.height(); ++i){
srcColor.setRgb(srcData[i]);
srcColor.hsv(&srcH, &srcS, &srcV);
srcColor.setHsv(destH, destS, srcV);
destData[i] = srcColor.rgb();
}
pix->convertFromImage(btnDest);
}
else{
if(!lcDark1.mask()){
lcDark1.setMask(lcDark1);
lcDark2.setMask(lcDark2);
lcDark3.setMask(lcDark3);
lcLight1.setMask(lcLight1);
}
p.setPen(g.dark());
p.drawPixmap(0, 0, bDark2);
p.drawPixmap(0, 0, bDark1);
p.drawPixmap(0, 0, lcDark2);
p.drawPixmap(0, 0, lcDark1);
p.setPen(g.mid());
p.drawPixmap(0, 0, bDark3);
p.drawPixmap(0, 0, lcDark3);
p.setPen(g.light());
p.drawPixmap(0, 0, bLight1);
p.drawPixmap(0, 0, lcLight1);
}
p.end();
}
@ -142,7 +159,8 @@ ModernButton::ModernButton(Client *parent, const char *name,
const unsigned char *bitmap)
: QButton(parent, name)
{
static QBitmap mask(14, 15, bmap_mask_bits, true);
QBitmap mask(14, 15, QPixmap::defaultDepth() > 8 ?
btnhighcolor_mask_bits : lowcolor_mask_bits, true);
resize(14, 15);
if(bitmap)