Application Menu button support for Plastik

New icon with three lines similar to the one used in Oxygen is added
for application menu support.

REVIEW: 107937
icc-effect-5.14.5
Martin Gräßlin 2012-12-27 10:53:56 +01:00
parent 7163c9faf4
commit 54479225a3
4 changed files with 27 additions and 0 deletions

View File

@ -91,6 +91,8 @@ QPixmap PlastikButtonProvider::requestPixmap(const QString &id, QSize *size, con
} else {
button = ShadeIcon;
}
} else if (idParts[0] == "N") {
button = AppMenuIcon;
} else {
// not recognized icon
return QDeclarativeImageProvider::requestPixmap(id, size, requestedSize);
@ -360,6 +362,13 @@ QPixmap PlastikButtonProvider::icon(ButtonIcon icon, int size, bool active, bool
break;
}
case AppMenuIcon:
{
drawObject(p, HorizontalLine, r.x(), r.top()+(lwTitleBar-1), r.width(), lwTitleBar);
drawObject(p, HorizontalLine, r.x(), r.center().y(), r.width(), lwTitleBar);
drawObject(p, HorizontalLine, r.x(), r.bottom()-(lwTitleBar-1), r.width(), lwTitleBar);
break;
}
default:
break;

View File

@ -43,6 +43,7 @@ private:
NoKeepBelowIcon,
ShadeIcon,
UnShadeIcon,
AppMenuIcon,
NumButtonIcons
};
enum Object {

View File

@ -143,11 +143,19 @@ DecorationButton {
if (buttonType == "H") {
visible = decoration.providesContextHelp;
}
if (buttonType == "N") {
visible = decoration.appMenu;
}
}
onHoveredChanged: colorize()
onPressedChanged: colorize()
Connections {
target: decoration
onActiveChanged: button.colorize()
onAppMenuChanged: {
if (buttonType == "N") {
visible = decoration.appMenu;
}
}
}
}

View File

@ -267,6 +267,7 @@ Decoration {
spacing: 1
explicitSpacer: root.buttonSize
menuButton: menuButtonComponent
appMenuButton: appMenuButtonComponent
minimizeButton: minimizeButtonComponent
maximizeButton: maximizeButtonComponent
keepBelowButton: keepBelowButtonComponent
@ -305,6 +306,7 @@ Decoration {
spacing: 1
explicitSpacer: root.buttonSize
menuButton: menuButtonComponent
appMenuButton: appMenuButtonComponent
minimizeButton: minimizeButtonComponent
maximizeButton: maximizeButtonComponent
keepBelowButton: keepBelowButtonComponent
@ -402,6 +404,13 @@ Decoration {
height: root.buttonSize
}
}
Component {
id: appMenuButtonComponent
PlastikButton {
buttonType: "N"
size: root.buttonSize
}
}
Component.onCompleted: readConfig()
Connections {
target: decoration