[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasma
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-01-12 6:02:30
Message-ID: 1200117750.087354.18405.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 760187 by aseigo:

* 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 \
=)


 M  +9 -0      applet.cpp  
 M  +51 -44    applet.h  


--- trunk/KDE/kdebase/workspace/libs/plasma/applet.cpp #760186:760187
@@ -829,6 +829,15 @@
     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;
--- trunk/KDE/kdebase/workspace/libs/plasma/applet.h #760186:760187
@@ -350,11 +350,6 @@
         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
          *
          * Returns a pointer to the applet if successful.
@@ -386,6 +381,20 @@
                                   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.
          *
          * @param painter the QPainter to use to do the paintiner
@@ -435,20 +444,6 @@
         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
          **/
         bool isImmutable() const;
@@ -512,17 +507,22 @@
          *                         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,31 +539,49 @@
          * 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 whether or not this Applet is acting as a Containment
+         */
+        void setIsContainment(bool isContainment);
 
         /**
-         * Sets the geometry of this Plasma::Applet
+         * @return true if this Applet is currently being used as a Containment, \
false otherwise +         */
+        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);
 
         /**
-         * Sets whether or not this Applet is acting as a Containment
+         * Reimplemented from LayoutItem
          */
-        void setIsContainment(bool isContainment);
+        virtual QSizeF sizeHint() const;
 
         /**
-         * @return true if this Applet is currently being used as a Containment, \
false otherwise +         * Reimplemented from QGraphicsItem
+         **/
+        int type() const;
+        enum { Type = Plasma::AppletType };
+
+        /**
+         * Reimplemented from QGraphicsItem
+         **/
+        QRectF boundingRect() const;
+
+        /**
+         * Reimplemented from QGraphicsItem
          */
-        bool isContainment() const;
+        QPainterPath shape() const;
 
         /**
          * @internal
@@ -679,17 +697,6 @@
         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
          **/
         bool eventFilter( QObject *o, QEvent *e );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic