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

@ -114,7 +114,7 @@ enum Location { Floating = 0 /**< Free floating. Neither geometry or z-ordering
**/
enum Position { LeftPositioned /**< Positioned left */,
RightPositioned /**< Positioned right */,
TopPositioned /**< Positioned top */,
TopPositioned /**< Positioned top */,
BottomPositioned /**< Positioned bottom */,
CenterPositioned /**< Positioned in the center */
};
@ -177,12 +177,13 @@ enum ImmutabilityType { Mutable = 1 /**< The item can be modified in any way **/
/**
* Defines the aspect ratio used when scaling an applet
*/
enum AspectRatioMode { InvalidAspectRatioMode = -1 /**< Unsetted mode used for dev convenience when there is a need to store the
enum AspectRatioMode { InvalidAspectRatioMode = -1 /**< Unsetted mode used for dev convenience when there is a need to store the
aspectRatioMode somewhere */,
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;
}
painter->drawPixmap(basePoint + shiftM, SmallIcon("transform-scale")); //FIXME no transform-resize icon
basePoint += step;
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 (activeArea.contains(point)) {
return ResizeButton;
if (m_applet && m_applet->aspectRatioMode() != FixedSize) {
if (activeArea.contains(point)) {
return ResizeButton;
}
activeArea.translate(step);
}
activeArea.translate(step);
if (activeArea.contains(point)) {
return RotateButton;
}