// 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);
    void                    setCustomCategories (const QStringList& categories);
    QStringList             customCategories ();
    static Plasma::Applet*  loadPlasmoid (const QString& path, uint appletId = 0, const QVariantList& args = QVariantList());
    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);
    explicit                Applet (QGraphicsItem* parent, const QString& serviceId, uint appletId, const QVariantList& args);
    bool                    destroyed () const;
    virtual void            createConfigurationInterface (KConfigDialog* parent);

signals:
    void                    releaseVisualFocus ();
    void                    geometryChanged ();
    void                    appletTransformedByUser ();
    void                    appletTransformedItself ();
    void                    sizeHintChanged (Qt::SizeHint which);
    void                    configNeedsSaving ();
    void                    activate ();
    void                    messageButtonPressed (const Plasma::MessageButton button);
    void                    appletDestroyed (Plasma::Applet* applet);

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);
    QVariantList            startupArguments () const;

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());
    void                    showMessage (const QIcon& icon, const QString& message, const Plasma::MessageButtons buttons);
    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);
    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);

private:
                            Applet (const QString& packagePath, uint appletId, const QVariantList& args);

public:
    ~Applet ();
    bool                    hasAuthorization (const QString& constraint) const;
signals:
    void                    extenderItemRestored (Plasma::ExtenderItem* item);
protected:
    QVariant                itemChange (QGraphicsItem::GraphicsItemChange change, const QVariant& value);
public:
    QPoint                  popupPosition (const QSize& s, Qt::AlignmentFlag alignment) const;
    static KPluginInfo::List  listAppletInfoForUrl (const QUrl& url);
    void                    setAssociatedApplication (const QString& string);
    void                    setAssociatedApplicationUrls (const KUrl::List& urls);
    QString                 associatedApplication () const;
    KUrl::List              associatedApplicationUrls () const;
    bool                    hasValidAssociatedApplication () const;
signals:
    void                    newStatus (Plasma::ItemStatus status);
    void                    immutabilityChanged (Plasma::ImmutabilityType immutable);
public:
    Plasma::ItemStatus      status () const;
    void                    setStatus (const Plasma::ItemStatus stat);
//ig    void                    publish (Plasma::AnnouncementMethods methods, const QString& resourceName);
    void                    unpublish ();
    bool                    isPublished () const;
    void                    runAssociatedApplication ();
    void                    showConfigurationInterface (QWidget* widget);
    bool                    isUserConfiguring () const;
    explicit                Applet (const KPluginInfo& info, QGraphicsItem* parent = 0, uint appletId = 0);
};
// 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());
};
// AppletProtectedThunk

};
// Plasma


