add FixedSize to AspectRatioMode and don't show resize button when FixedSize.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=860649
This commit is contained in:
Petri Damstén 2008-09-13 17:09:34 +00:00
parent 4c0fcd80f7
commit e5fe5ed0c2
2 changed files with 13 additions and 9 deletions

View File

@ -182,7 +182,8 @@ enum AspectRatioMode { InvalidAspectRatioMode = -1 /**< Unsetted mode used for d
IgnoreAspectRatio = 0 /**< The applet can be freely resized */,
KeepAspectRatio = 1 /**< The applet keeps a fixed aspect ratio */,
Square = 2 /**< The applet is always a square */,
ConstrainedSquare = 3 /** The applet is no wider (in horizontal formfactors) or no higher (in vertical ones) than a square*/
ConstrainedSquare = 3 /** The applet is no wider (in horizontal formfactors) or no higher (in vertical ones) than a square */,
FixedSize = 4 /** The applet cannot be resized */
};
/**

View File

@ -275,9 +275,10 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
break;
}
if (m_applet && m_applet->aspectRatioMode() != FixedSize) {
painter->drawPixmap(basePoint + shiftM, SmallIcon("transform-scale")); //FIXME no transform-resize icon
basePoint += step;
}
painter->drawPixmap(basePoint + shiftR, SmallIcon("transform-rotate"));
if (m_applet && m_applet->hasConfigurationInterface()) {
@ -302,11 +303,13 @@ AppletHandle::ButtonType AppletHandle::mapToButton(const QPointF &point) const
QRectF activeArea = QRectF(basePoint, QSizeF(m_iconSize, m_iconSize));
if (m_applet && m_applet->aspectRatioMode() != FixedSize) {
if (activeArea.contains(point)) {
return ResizeButton;
}
activeArea.translate(step);
}
if (activeArea.contains(point)) {
return RotateButton;
}