• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Plasma

appletinterface.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2008 Chani Armitage <chani@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License as
00006  *   published by the Free Software Foundation; either version 2, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #ifndef APPLETINTERFACE_H
00021 #define APPLETINTERFACE_H
00022 
00023 #include <QObject>
00024 #include <Plasma/DataEngine>
00025 
00026 class QAction;
00027 class QGraphicsLayout;
00028 class SimpleJavaScriptApplet;
00029 class QSignalMapper;
00030 class QSizeF;
00031 
00032 class KConfigGroup;
00033 
00034 namespace Plasma
00035 {
00036     class Applet;
00037     class ConfigLoader;
00038 } // namespace Plasa
00039 
00040 class AppletInterface : public QObject
00041 {
00042     Q_OBJECT
00043     Q_ENUMS(FormFactor)
00044     Q_ENUMS(Location)
00045     Q_ENUMS(AspectRatioMode)
00046     Q_ENUMS(QtOrientation)
00047     Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig)
00048 
00049 public:
00050     AppletInterface(SimpleJavaScriptApplet *parent);
00051     ~AppletInterface();
00052 
00053 //------------------------------------------------------------------
00054 //enums copy&pasted from plasma.h because qtscript is evil
00055 
00056 enum FormFactor {
00057     Planar = 0,  
00062     MediaCenter, 
00067     Horizontal,  
00069     Vertical     
00071 };
00072 enum Location {
00073     Floating = 0, 
00075     Desktop,      
00077     FullScreen,   
00078     TopEdge,      
00079     BottomEdge,   
00080     LeftEdge,     
00081     RightEdge     
00082 };
00083 enum AspectRatioMode {
00084     InvalidAspectRatioMode = -1, 
00087     IgnoreAspectRatio = 0,       
00088     KeepAspectRatio = 1,         
00089     Square = 2,                  
00090     ConstrainedSquare = 3,       
00093     FixedSize = 4                
00094 };
00095 
00096 //From Qt namespace
00097 enum QtOrientation {
00098     QtHorizontal= Qt::Horizontal,
00099     QtVertical = Qt::Vertical
00100 };
00101 
00102 //-------------------------------------------------------------------
00103 
00104     Q_INVOKABLE FormFactor formFactor();
00105 
00106     Q_INVOKABLE Location location();
00107 
00108     Q_INVOKABLE QString currentActivity();
00109 
00110     Q_INVOKABLE AspectRatioMode aspectRatioMode();
00111 
00112     Q_INVOKABLE void setAspectRatioMode(AspectRatioMode mode);
00113 
00114     Q_INVOKABLE bool shouldConserveResources();
00115 
00116     Q_INVOKABLE void setFailedToLaunch(bool failed, const QString &reason = QString());
00117 
00118     Q_INVOKABLE bool isBusy();
00119 
00120     Q_INVOKABLE void setBusy(bool busy);
00121 
00122     Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
00123 
00124     Q_INVOKABLE QSizeF size() const;
00125 
00126     Q_INVOKABLE void setAction(const QString &name, const QString &text,
00127                                const QString &icon = QString(), const QString &shortcut = QString());
00128 
00129     Q_INVOKABLE void removeAction(const QString &name);
00130 
00131     Q_INVOKABLE void resize(qreal w, qreal h);
00132 
00133     Q_INVOKABLE void setMinimumSize(qreal w, qreal h);
00134 
00135     Q_INVOKABLE void setPreferredSize(qreal w, qreal h);
00136 
00137     Q_INVOKABLE void update();
00138 
00139     Q_INVOKABLE QString activeConfig() const;
00140 
00141     Q_INVOKABLE void setActiveConfig(const QString &name);
00142 
00143     Q_INVOKABLE QVariant readConfig(const QString &entry) const;
00144 
00145     Q_INVOKABLE void writeConfig(const QString &entry, const QVariant &value);
00146 
00147     Plasma::DataEngine *dataEngine(const QString &name);
00148 
00149     const Plasma::Package *package() const;
00150     QList<QAction*> contextualActions() const;
00151     Plasma::Applet *applet() const;
00152 
00153 Q_SIGNALS:
00154     void releaseVisualFocus();
00155 
00156     void configNeedsSaving();
00157 
00158 public Q_SLOTS:
00159     void dataUpdated(QString source, Plasma::DataEngine::Data data);
00160 
00161 private:
00162     SimpleJavaScriptApplet *m_appletScriptEngine;
00163     QSet<QString> m_actions;
00164     QSignalMapper *m_actionSignals;
00165     QString m_currentConfig;
00166     QMap<QString, Plasma::ConfigLoader*> m_configs;
00167 };
00168 
00169 #endif

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal