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
This commit is contained in:
parent
b71b06af44
commit
8d0eda13db
3 changed files with 157 additions and 1 deletions
|
@ -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 '?';
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Reference in a new issue