* move the header bits around a bit for a more logical ordering (e.g. all static methods together, all reimp'd methods that are really imp details together at the bottom, etc)

* implement a generic shape() method. this is experimental, so will be interesting to see how it goes. it does show we need a good shape hint in the applet background svg =)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=760187
This commit is contained in:
Aaron J. Seigo 2008-01-12 06:02:29 +00:00
parent 8801af70e5
commit 16dab9574f
2 changed files with 62 additions and 46 deletions

View File

@ -829,6 +829,15 @@ QRectF Applet::boundingRect() const
return rect.adjusted(-left,-top,right,bottom);
}
QPainterPath Applet::shape() const
{
if (isContainment()) {
return Plasma::Widget::shape();
}
return Plasma::roundedRectangle(boundingRect().adjusted(-2, -2, 2, 2), 10);
}
QSizeF Applet::sizeHint() const
{
int left = 0;

View File

@ -349,11 +349,6 @@ class PLASMA_EXPORT Applet : public Widget
*/
static QStringList knownCategories(const QString &parentApp = QString(), bool visibleOnly = true);
/**
* @return true if this plasmoid provides a GUI configuration
**/
bool hasConfigurationInterface();
/**
* Attempts to load an applet
*
@ -385,6 +380,20 @@ class PLASMA_EXPORT Applet : public Widget
static Applet* loadApplet(const KPluginInfo& info, uint appletId = 0,
const QVariantList& args = QVariantList());
/**
* Get the category of the given applet
*
* @param a KPluginInfo object for the applet
*/
static QString category(const KPluginInfo& applet);
/**
* Get the category of the given applet
*
* @param the name of the applet
*/
static QString category(const QString& appletName);
/**
* This method is called when the interface should be painted.
*
@ -434,20 +443,6 @@ class PLASMA_EXPORT Applet : public Widget
*/
QColor color() const;
/**
* Get the category of the given applet
*
* @param a KPluginInfo object for the applet
*/
static QString category(const KPluginInfo& applet);
/**
* Get the category of the given applet
*
* @param the name of the applet
*/
static QString category(const QString& appletName);
/**
* @return true if this applet is immutable
**/
@ -512,17 +507,22 @@ class PLASMA_EXPORT Applet : public Widget
* or false if it doesn't
*/
void setNeedsConfiguring(bool needsConfiguring);
enum { Type = Plasma::AppletType };
/**
* Reimplemented from QGraphicsItem
* @return true if this plasmoid provides a GUI configuration
**/
int type() const;
bool hasConfigurationInterface();
/**
* Reimplemented from QGraphicsItem
* Sets whether or not this applet provides a user interface for
* configuring the applet.
*
* It defaults to false, and if true is passed in you should
* also reimplement showConfigurationInterface()
*
* @arg hasInterface whether or not there is a user interface available
**/
QRectF boundingRect () const;
void setHasConfigurationInterface(bool hasInterface);
/**
* Returns a list of context-related QAction instances.
@ -539,22 +539,12 @@ class PLASMA_EXPORT Applet : public Widget
* Sets shadow for the given applet.
*/
void setShadowShown(bool);
/**
* Returns true if the given item has a shadow shown.
*/
bool isShadowShown() const;
// reimplemented from LayoutItem
// value is the same as contentSizeHint() if drawStandardBackground() is false
// or contentSizeHint() plus the size of the border otherwise.
virtual QSizeF sizeHint() const;
/**
* Sets the geometry of this Plasma::Applet
* @param geometry the geometry to apply to this Plasma::Applet.
*/
void setGeometry(const QRectF &geometry);
/**
* Sets whether or not this Applet is acting as a Containment
*/
@ -565,6 +555,34 @@ class PLASMA_EXPORT Applet : public Widget
*/
bool isContainment() const;
/**
* Sets the geometry of this Plasma::Applet. Should not be used directly by
* applet subclasses.
* @param geometry the geometry to apply to this Plasma::Applet.
*/
void setGeometry(const QRectF &geometry);
/**
* Reimplemented from LayoutItem
*/
virtual QSizeF sizeHint() const;
/**
* Reimplemented from QGraphicsItem
**/
int type() const;
enum { Type = Plasma::AppletType };
/**
* Reimplemented from QGraphicsItem
**/
QRectF boundingRect() const;
/**
* Reimplemented from QGraphicsItem
*/
QPainterPath shape() const;
/**
* @internal
*/
@ -678,17 +696,6 @@ class PLASMA_EXPORT Applet : public Widget
*/
void needsFocus(bool focus);
/**
* Sets whether or not this applet provides a user interface for
* configuring the applet.
*
* It defaults to false, and if true is passed in you should
* also reimplement showConfigurationInterface()
*
* @arg hasInterface whether or not there is a user interface available
**/
void setHasConfigurationInterface(bool hasInterface);
/**
* @internal event filter; used for focus watching
**/