From e5fe5ed0c264f994867400e80175a9b0d9856f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petri=20Damst=C3=A9n?= Date: Sat, 13 Sep 2008 17:09:34 +0000 Subject: [PATCH] add FixedSize to AspectRatioMode and don't show resize button when FixedSize. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=860649 --- plasma.h | 7 ++++--- private/applethandle.cpp | 15 +++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/plasma.h b/plasma.h index b6681535b..0dd53c948 100644 --- a/plasma.h +++ b/plasma.h @@ -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 */ }; /** diff --git a/private/applethandle.cpp b/private/applethandle.cpp index 7115aa310..3824c4608 100644 --- a/private/applethandle.cpp +++ b/private/applethandle.cpp @@ -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; }