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

Applets

applet.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright (C) 2007 Petri Damsten <damu@iki.fi>
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 version 2 as
00006  *   published by the Free Software Foundation
00007  *
00008  *   This program is distributed in the hope that it will be useful,
00009  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  *   GNU General Public License for more details
00012  *
00013  *   You should have received a copy of the GNU Library General Public
00014  *   License along with this program; if not, write to the
00015  *   Free Software Foundation, Inc.,
00016  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00017  */
00018 
00019 #ifndef SM_APPLET_HEADER
00020 #define SM_APPLET_HEADER
00021 
00022 #include <Plasma/Applet>
00023 
00024 #include "sm_export.h"
00025 
00026 #define DEFAULT_MINIMUM_WIDTH 200
00027 
00028 class Header;
00029 class QGraphicsLinearLayout;
00030 
00031 namespace Plasma {
00032     class Meter;
00033     class SignalPlotter;
00034     class Frame;
00035     class IconWidget;
00036 }
00037 
00038 namespace SM {
00039 
00040 class SM_EXPORT Applet : public Plasma::Applet
00041 {
00042     Q_OBJECT
00043     public:
00044         enum Mode { Monitor, Panel, Desktop };
00045         enum Detail { High, Low };
00046 
00047         Applet(QObject *parent, const QVariantList &args);
00048         ~Applet();
00049 
00050         virtual void constraintsEvent(Plasma::Constraints constraints);
00051         QSizeF minSize() const { return m_min; };
00052 
00053     signals:
00054         void geometryChecked();
00055 
00056     protected:
00057         void connectToEngine();
00058         void connectSource(const QString& source);
00059         void disconnectSources();
00060         void checkGeometry();
00061         QGraphicsLinearLayout* mainLayout();
00062         void setTitle(const QString& title, bool spacer = false);
00063         KConfigGroup persistentConfig() const;
00064         uint interval() { return m_interval; };
00065         void setInterval(uint interval) { m_interval = interval; };
00066         qreal preferredItemHeight() { return m_preferredItemHeight; };
00067         void setPreferredItemHeight(qreal preferredItemHeight)
00068                 { m_preferredItemHeight = preferredItemHeight; };
00069         QString title() { return m_title; };
00070         bool titleSpacer() { return m_titleSpacer; };
00071         Plasma::Frame* header() { return m_header; };
00072         QStringList items() { return m_items; };
00073         void appendItem(const QString& item) { m_items.append(item); };
00074         void setItems(const QStringList& items) { m_items = items; };
00075         void clearItems() { m_items.clear(); };
00076         QStringList connectedSources() { return m_connectedSources; };
00077         void setEngine(Plasma::DataEngine* engine) { m_engine = engine; };
00078         Plasma::DataEngine* engine() { return m_engine; };
00079         Qt::Orientation ratioOrientation() { return m_ratioOrientation; };
00080         void setRatioOrientation(Qt::Orientation ratioOrientation)
00081                 { m_ratioOrientation = ratioOrientation; };
00082         void appendKeepRatio(QGraphicsWidget* w) { m_keepRatio.append(w); };
00083         QHash<QString,Plasma::Meter*> meters() { return m_meters; };
00084         void appendMeter(const QString& source, Plasma::Meter* meter)
00085                 { m_meters[source] = meter; };
00086         QHash<QString,Plasma::SignalPlotter*> plotters() { return m_plotters; };
00087         void appendPlotter(const QString& source, Plasma::SignalPlotter* plotter)
00088                 { m_plotters[source] = plotter; };
00089         Qt::Orientation orientation() { return m_orientation; };
00090         Mode mode() { return m_mode; };
00091         Detail detail() { return m_detail; };
00092         qreal minimumWidth() { return m_minimumWidth; };
00093         void setMinimumWidth(qreal minimumWidth) { m_minimumWidth = minimumWidth; };
00094 
00095         virtual bool addMeter(const QString&) { return false; };
00096         void displayNoAvailableSources();
00097         virtual void deleteMeters(QGraphicsLinearLayout* layout = 0);
00098         virtual void setDetail(Detail detail);
00099         //QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint = QSizeF()) const;
00100 
00101     private:
00102         uint m_interval;
00103         qreal m_preferredItemHeight;
00104         QString m_title;
00105         bool m_titleSpacer;
00106         Plasma::Frame* m_header;
00107         QStringList m_items;
00108         QStringList m_connectedSources;
00109         Plasma::DataEngine *m_engine;
00110         Qt::Orientation m_ratioOrientation;
00111         QList<QGraphicsWidget*> m_keepRatio;
00112         QHash<QString, Plasma::Meter*> m_meters;
00113         QHash<QString, Plasma::SignalPlotter*> m_plotters;
00114         Qt::Orientation m_orientation;
00115         Plasma::IconWidget *m_noSourcesIcon;
00116         Mode m_mode;
00117         Detail m_detail;
00118         qreal m_minimumWidth;
00119         QSizeF m_min;
00120         QSizeF m_pref;
00121         QSizeF m_max;
00122 
00123         QGraphicsLinearLayout *m_mainLayout;
00124 
00125         static QHash< QString, QList<uint> > s_configIds;
00126         uint m_configId;
00127 };
00128 
00129 }
00130 
00131 #endif

Applets

Skip menu "Applets"
  • 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