// Copyright 2008 Simon Edwards <simon@simonzone.com>

//                 Generated by twine

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as
// published by the Free Software Foundation; either version 2, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details

// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.


%ModuleHeaderCode
#include <plasma/applet.h>
namespace Plasma
{
class AppletProtectedThunk : public Applet
{
public:
    static inline void static_public_setHasConfigurationInterface (Applet *applet, bool hasInterface) {
        ((AppletProtectedThunk *) applet ) -> public_setHasConfigurationInterface(hasInterface);
    };

    inline void public_setHasConfigurationInterface(bool hasInterface)
    {
        setHasConfigurationInterface(hasInterface);
    }
    static inline void static_public_setConfigurationRequired (Applet *applet, bool needsConfiguring, const QString& reason = QString()) {
        ((AppletProtectedThunk *) applet ) -> public_setConfigurationRequired(needsConfiguring, reason);
    };

    inline void public_setConfigurationRequired(bool needsConfiguring, const QString& reason = QString())
    {
        setConfigurationRequired(needsConfiguring, reason);
    }
};
}

%End

namespace Plasma
{

class Applet : QGraphicsWidget
{
%TypeHeaderCode
#include <plasma/applet.h>
%End

public:
    typedef QList<Plasma::Applet*> List;

    typedef QHash<QString,Plasma::Applet*> Dict;


    enum BackgroundHint
    {
        NoBackground,
        StandardBackground,
        TranslucentBackground,
        DefaultBackground
    };

    typedef QFlags<Plasma::Applet::BackgroundHint> BackgroundHints;

    static Plasma::PackageStructure::Ptr  packageStructure ();
    uint                    id () const;
    KConfigGroup            config () const;
    KConfigGroup            config (const QString& group) const;
    virtual void            save (KConfigGroup& group) const;
    virtual void            restore (KConfigGroup& group);
    KConfigGroup            globalConfig () const;
    Plasma::ConfigLoader*   configScheme () const;
    Plasma::DataEngine*     dataEngine (const QString& name) const;
    const Plasma::Package*  package () const;
    QGraphicsView*          view () const;
    QRectF                  mapFromView (const QGraphicsView* view, const QRect& rect) const;
    QRect                   mapToView (const QGraphicsView* view, const QRectF& rect) const;
    QPoint                  popupPosition (const QSize& s) const;
    void                    updateConstraints (Plasma::Constraints constraints = Plasma::AllConstraints);
    virtual Plasma::FormFactor  formFactor () const;
    virtual Plasma::Location  location () const;
    Plasma::Context*        context () const;
    Plasma::AspectRatioMode  aspectRatioMode () const;
    void                    setAspectRatioMode (Plasma::AspectRatioMode);
    static KPluginInfo::List  listAppletInfo (const QString& category = QString(), const QString& parentApp = QString());
    static KPluginInfo::List  listAppletInfoForMimetype (const QString& mimetype);
    static QStringList      listCategories (const QString& parentApp = QString(), bool visibleOnly = 1);
    static Plasma::Applet*  load (const QString& name, uint appletId = 0, const QVariantList& args = QVariantList());
    static Plasma::Applet*  load (const KPluginInfo& info, uint appletId = 0, const QVariantList& args = QVariantList());
    static QString          category (const KPluginInfo& applet);
    static QString          category (const QString& appletName);
    virtual void            paintInterface (QPainter* painter, const QStyleOptionGraphicsItem* option, const QRect& contentsRect);
    QString                 name () const;
    QFont                   font () const;
    QString                 pluginName () const;
    bool                    shouldConserveResources () const;
    QString                 icon () const;
    QString                 category () const;
    Plasma::ImmutabilityType  immutability () const;
    void                    paintWindowFrame (QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
    bool                    hasFailedToLaunch () const;
    bool                    isBusy () const;
    bool                    configurationRequired () const;
    bool                    hasConfigurationInterface () const;
    virtual QList<QAction*>  contextualActions ();
    QAction*                action (QString name) const;
    void                    addAction (QString name, QAction* action);
    void                    setBackgroundHints (const Plasma::Applet::BackgroundHints hints);
    Plasma::Applet::BackgroundHints  backgroundHints () const;
    bool                    isContainment () const;
    QRect                   screenRect () const;
    int                     type () const;

    enum 
    {
        Type
    };

    Plasma::Containment*    containment () const;
    void                    setGlobalShortcut (const KShortcut& shortcut);
    KShortcut               globalShortcut () const;
    virtual bool            isPopupShowing () const;
    virtual void            addAssociatedWidget (QWidget* widget);
    virtual void            removeAssociatedWidget (QWidget* widget);
    virtual void            initExtenderItem (Plasma::ExtenderItem* item);
    explicit                Applet (QGraphicsItem* parent = 0, const QString& serviceId = QString(), uint appletId = 0);
    bool                    destroyed () const;

signals:
    void                    releaseVisualFocus ();
    void                    geometryChanged ();
    void                    sizeHintChanged (Qt::SizeHint which);
    void                    configNeedsSaving ();
    void                    activate ();

public:
    void                    setImmutability (const Plasma::ImmutabilityType immutable);
    virtual void            destroy ();
    virtual void            showConfigurationInterface ();
    void                    raise () /PyName=raise_/;
    void                    lower ();
    void                    flushPendingConstraintsEvents ();
    virtual void            init ();
    virtual void            configChanged ();
    void                    setBusy (bool busy);

protected:
                            Applet (QObject* parent /TransferThis/, const QVariantList& args);
    void                    setFailedToLaunch (bool failed, const QString& reason = QString());
    virtual void            saveState (KConfigGroup& config) const;
    void                    setHasConfigurationInterface (bool hasInterface);
    void                    setConfigurationRequired (bool needsConfiguring, const QString& reason = QString());
    virtual void            createConfigurationInterface (KConfigDialog* parent);
    virtual void            constraintsEvent (Plasma::Constraints constraints);
    void                    registerAsDragHandle (QGraphicsItem* item);
    void                    unregisterAsDragHandle (QGraphicsItem* item);
    bool                    isRegisteredAsDragHandle (QGraphicsItem* item);
    Plasma::Extender*       extender () const;
    bool                    eventFilter (QObject* o, QEvent* e);
    bool                    sceneEventFilter (QGraphicsItem* watched, QEvent* event);
    void                    mouseMoveEvent (QGraphicsSceneMouseEvent* event);
    void                    focusInEvent (QFocusEvent* event);
    void                    resizeEvent (QGraphicsSceneResizeEvent* event);
    QVariant                itemChange (QGraphicsItem::GraphicsItemChange change, const QVariant& value);
    QPainterPath            shape () const;
    QSizeF                  sizeHint (Qt::SizeHint which, const QSizeF& constraint = QSizeF()) const;
    void                    hoverEnterEvent (QGraphicsSceneHoverEvent* event);
    void                    hoverLeaveEvent (QGraphicsSceneHoverEvent* event);
    void                    timerEvent (QTimerEvent* event);

protected:
    void                    mousePressEvent (QGraphicsSceneMouseEvent* event);
};   // Applet


class AppletProtectedThunk : Plasma::Applet
{
%TypeHeaderCode
#include <plasma/applet.h>
%End

public:
    static void             static_public_setHasConfigurationInterface (Plasma::Applet* applet, bool hasInterface);
    static void static_public_setConfigurationRequired (Plasma::Applet *applet, bool needsConfiguring, const QString& reason = QString());
};

};   // Plasma


