From 8d0eda13db9b5a2b1191c9be97813a865e112057 Mon Sep 17 00:00:00 2001 From: Sandro Giessl Date: Fri, 14 May 2004 22:23:29 +0000 Subject: [PATCH] Add support for three additional titlebar buttons (#60369): Shade, Keep Above Others, Keep Below Others. CCMAIL: kwin@kde.org Slowly but surely, button indexes are going out. :) In case anyone has objections with the following ones for the API, just tell. Now. F (Above others ~ foreground) B (Below others ~ background) L (Shade ~ less/lock??) svn path=/trunk/kdebase/kwin/; revision=311518 --- kcmkwin/kwindecoration/buttons.cpp | 35 ++++++++- kcmkwin/kwindecoration/pixmaps.h | 120 +++++++++++++++++++++++++++++ lib/kdecoration.h | 3 + 3 files changed, 157 insertions(+), 1 deletion(-) diff --git a/kcmkwin/kwindecoration/buttons.cpp b/kcmkwin/kwindecoration/buttons.cpp index 5a45012eb6..a362d912c3 100644 --- a/kcmkwin/kwindecoration/buttons.cpp +++ b/kcmkwin/kwindecoration/buttons.cpp @@ -38,7 +38,7 @@ //=============================================================== enum Buttons{ BtnMenu=0, BtnOnAllDesktops, BtnSpacer, BtnHelp, - BtnMinimize, BtnMaximize, BtnClose, BtnCount }; + BtnMinimize, BtnMaximize, BtnClose, BtnAboveOthers, BtnBelowOthers, BtnShade, BtnCount }; QListBoxPixmap* buttons[ BtnCount ]; QPixmap* pixmaps[ BtnCount ]; QPixmap* miniSpacer; @@ -105,6 +105,15 @@ static int btnIndex( char btn ) case 'X': return BtnClose; break; + case 'F': + return BtnAboveOthers; + break; + case 'B': + return BtnBelowOthers; + break; + case 'L': + return BtnShade; + break; default: return -1; // Not found... } @@ -137,11 +146,17 @@ ButtonSource::ButtonSource( QWidget* parent, const char* name ) pixmaps[ BtnMinimize ] = new QPixmap( button_minimize_xpm ); pixmaps[ BtnMaximize ] = new QPixmap( button_maximize_xpm ); pixmaps[ BtnClose ] = new QPixmap( button_close_xpm ); + pixmaps[ BtnAboveOthers ] = new QPixmap( button_above_others_xpm ); + pixmaps[ BtnBelowOthers ] = new QPixmap( button_below_others_xpm ); + pixmaps[ BtnShade ] = new QPixmap( button_shade_xpm ); miniSpacer = new QPixmap( titlebarspacer_xpm ); // Add all possible button/spacer types to the list box. buttons[ BtnMenu ] = new QListBoxPixmap( this, *pixmaps[BtnMenu], i18n("Menu") ); buttons[ BtnOnAllDesktops] = new QListBoxPixmap( this, *pixmaps[BtnOnAllDesktops], i18n("On All Desktops") ); + buttons[ BtnAboveOthers ] = new QListBoxPixmap( this, *pixmaps[BtnAboveOthers], i18n("Keep Above Others") ); + buttons[ BtnBelowOthers ] = new QListBoxPixmap( this, *pixmaps[BtnBelowOthers], i18n("Keep Below Others") ); + buttons[ BtnShade ] = new QListBoxPixmap( this, *pixmaps[BtnShade], i18n("Shade") ); buttons[ BtnSpacer ] = new QListBoxPixmap( this, *pixmaps[BtnSpacer], i18n("Spacer") ); buttons[ BtnHelp ] = new QListBoxPixmap( this, *pixmaps[BtnHelp], i18n("Help") ); buttons[ BtnMinimize ] = new QListBoxPixmap( this, *pixmaps[BtnMinimize], i18n("Minimize") ); @@ -171,6 +186,12 @@ void ButtonSource::hideAllButtons() takeItem( buttons[BtnMenu] ); if (index( buttons[BtnOnAllDesktops] )!= -1) takeItem( buttons[BtnOnAllDesktops] ); + if (index( buttons[BtnAboveOthers] )!= -1) + takeItem( buttons[BtnAboveOthers] ); + if (index( buttons[BtnBelowOthers] )!= -1) + takeItem( buttons[BtnBelowOthers] ); + if (index( buttons[BtnShade] )!= -1) + takeItem( buttons[BtnShade] ); if (index( buttons[BtnHelp] ) != -1) takeItem( buttons[BtnHelp] ); if (index( buttons[BtnMinimize] ) != -1) @@ -192,6 +213,12 @@ void ButtonSource::showAllButtons() insertItem( buttons[BtnMenu] ); if (index( buttons[BtnOnAllDesktops] )== -1) insertItem( buttons[BtnOnAllDesktops] ); + if (index( buttons[BtnAboveOthers] )== -1) + insertItem( buttons[BtnAboveOthers] ); + if (index( buttons[BtnBelowOthers] )== -1) + insertItem( buttons[BtnBelowOthers] ); + if (index( buttons[BtnShade] )== -1) + insertItem( buttons[BtnShade] ); if (index( buttons[BtnHelp] ) == -1) insertItem( buttons[BtnHelp] ); if (index( buttons[BtnMinimize] ) == -1) @@ -268,6 +295,12 @@ char ButtonSource::convertToChar( QString s ) return 'A'; else if (s == i18n("Close")) return 'X'; + else if (s == i18n("Keep Above Others")) + return 'F'; + else if (s == i18n("Keep Below Others")) + return 'B'; + else if (s == i18n("Shade")) + return 'L'; else return '?'; } diff --git a/kcmkwin/kwindecoration/pixmaps.h b/kcmkwin/kwindecoration/pixmaps.h index 99bdcdb51f..5589e8ba37 100644 --- a/kcmkwin/kwindecoration/pixmaps.h +++ b/kcmkwin/kwindecoration/pixmaps.h @@ -349,4 +349,124 @@ const char * titlebarspacer_xpm[] = { ".+@#$%", ".+@#$%"}; +/* XPM */ +const char * button_above_others_xpm[] = { +"20 20 16 1", +" c None", +". c #F3F3F3", +"+ c #F2F2F2", +"@ c #F1F1F1", +"# c #FFFFFF", +"$ c #F0F0F0", +"% c #6E6E6E", +"& c #EFEFEF", +"* c #EEEEEE", +"= c #EDEDED", +"- c #ECECEC", +"; c #EBEBEB", +"> c #EAEAEA", +", c #E9E9E9", +"' c #E8E8E8", +") c #E7E7E7", +"....................", +"....................", +"++++++++++++++++++++", +"@@@@@@@@@@@@@@@@@@@@", +"@@@@###########@@@@@", +"$$$$#%%%%%%%%%%$$$$$", +"&&&&#%&&&&&&&#%&&&&&", +"&&&&#%&&#%%&&#%&&&&&", +"****#%*#%%%%*#%*****", +"====#%#%%%%%%#%=====", +"====#%==#%%==#%=====", +"----#%--#%%--#%-----", +";;;;#%;;#%%;;#%;;;;;", +";;;;#%########%;;;;;", +">>>>#%%%%%%%%%%>>>>>", +",,,,,,,,,,,,,,,,,,,,", +",,,,,,,,,,,,,,,,,,,,", +"''''''''''''''''''''", +"))))))))))))))))))))", +"))))))))))))))))))))"}; + +/* XPM */ +const char * button_below_others_xpm[] = { +"20 20 16 1", +" c None", +". c #F3F3F3", +"+ c #F2F2F2", +"@ c #F1F1F1", +"# c #FFFFFF", +"$ c #F0F0F0", +"% c #6E6E6E", +"& c #EFEFEF", +"* c #EEEEEE", +"= c #EDEDED", +"- c #ECECEC", +"; c #EBEBEB", +"> c #EAEAEA", +", c #E9E9E9", +"' c #E8E8E8", +") c #E7E7E7", +"....................", +"....................", +"++++++++++++++++++++", +"@@@@@@@@@@@@@@@@@@@@", +"@@@@###########@@@@@", +"$$$$#%%%%%%%%%%$$$$$", +"&&&&#%&&##&&&#%&&&&&", +"&&&&#%&&#%%&&#%&&&&&", +"****#%**#%%**#%*****", +"====#%###%%==#%=====", +"====#%#%%%%%%#%=====", +"----#%-#%%%%-#%-----", +";;;;#%;;#%%;;#%;;;;;", +";;;;#%########%;;;;;", +">>>>#%%%%%%%%%%>>>>>", +",,,,,,,,,,,,,,,,,,,,", +",,,,,,,,,,,,,,,,,,,,", +"''''''''''''''''''''", +"))))))))))))))))))))", +"))))))))))))))))))))"}; + +/* XPM */ +const char * button_shade_xpm[] = { +"20 20 16 1", +" c None", +". c #F3F3F3", +"+ c #F2F2F2", +"@ c #F1F1F1", +"# c #FFFFFF", +"$ c #F0F0F0", +"% c #6E6E6E", +"& c #EFEFEF", +"* c #EEEEEE", +"= c #EDEDED", +"- c #ECECEC", +"; c #EBEBEB", +"> c #EAEAEA", +", c #E9E9E9", +"' c #E8E8E8", +") c #E7E7E7", +"....................", +"....................", +"++++++++++++++++++++", +"@@@@@@@@@@@@@@@@@@@@", +"@@@@###########@@@@@", +"$$$$#%%%%%%%%%%$$$$$", +"&&&&#%########%&&&&&", +"&&&&#%%%%%%%%%%&&&&&", +"*********#**********", +"========#%%=========", +"=======#%%%%========", +"------#%%%%%%-------", +";;;;;;;;#%%;;;;;;;;;", +";;;;;#;#;#;#;#;;;;;;", +">>>>>%>%>%>%>%>>>>>>", +",,,,,,,,,,,,,,,,,,,,", +",,,,,,,,,,,,,,,,,,,,", +"''''''''''''''''''''", +"))))))))))))))))))))", +"))))))))))))))))))))"}; + // vim: ts=4 diff --git a/lib/kdecoration.h b/lib/kdecoration.h index 3c6989b8a5..cdee4642e7 100644 --- a/lib/kdecoration.h +++ b/lib/kdecoration.h @@ -204,6 +204,9 @@ public: * @li 'I' minimize ( iconify ) button * @li 'A' maximize button * @li 'X' close button + * @li 'F' keep_above_others button + * @li 'B' keep_below_others button + * @li 'L' shade button * @li '_' spacer * * The default ( which is also returned if customButtonPositions returns false )