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

Applets

pager.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Daniel Laidig <d.laidig@gmx.de>                 *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, 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 General Public License     *
00015  *   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 PAGER_H
00021 #define PAGER_H
00022 
00023 #include <QLabel>
00024 #include <QGraphicsSceneHoverEvent>
00025 #include <QList>
00026 
00027 #include <plasma/applet.h>
00028 #include <plasma/dataengine.h>
00029 #include "ui_pagerConfig.h"
00030 
00031 class KDialog;
00032 class KSelectionOwner;
00033 
00034 namespace Plasma
00035 {
00036     class PanelSvg;
00037 }
00038 
00039 class Pager : public Plasma::Applet
00040 {
00041     Q_OBJECT
00042     public:
00043         Pager(QObject *parent, const QVariantList &args);
00044 
00045         void init();
00046         void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option,
00047                             const QRect &contents);
00048         void constraintsEvent(Plasma::Constraints);
00049         virtual QList<QAction*> contextualActions();
00050         
00051     public slots:
00052         void recalculateGeometry();
00053         void recalculateWindowRects();
00054 
00055     protected slots:
00056         virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
00057         virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00058         virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00059         virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
00060         virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
00061         virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
00062         virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
00063         virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
00064         virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
00065         virtual void wheelEvent(QGraphicsSceneWheelEvent *);
00066 
00067         void configAccepted();
00068         void currentDesktopChanged(int desktop);
00069         void desktopsSizeChanged();
00070         void windowAdded(WId id);
00071         void windowRemoved(WId id);
00072         void activeWindowChanged(WId id);
00073         void numberOfDesktopsChanged(int num);
00074         void desktopNamesChanged();
00075         void stackingOrderChanged();
00076         void windowChanged(WId id, unsigned int properties);
00077         void showingDesktopChanged(bool showing);
00078         void slotConfigureDesktop();
00079         void lostDesktopLayoutOwner();
00080         void animationUpdate(qreal progress, int animId);
00081         void dragSwitch();
00082 
00083     protected:
00084         void createMenu();
00085         QRect fixViewportPosition( const QRect& r );
00086         void createConfigurationInterface(KConfigDialog *parent);
00087         bool posOnDesktopRect(const QRectF& r, const QPointF& pos);
00088         void handleHoverMove(const QPointF& pos);
00089         void handleHoverLeave();
00090 
00091     private:
00092         QTimer* m_timer;
00093         KDialog *m_dialog;
00094         Ui::pagerConfig ui;
00095         enum DisplayedText
00096         {
00097             Number,
00098             Name,
00099             None
00100         };
00101 
00102         struct AnimInfo
00103         {
00104             int animId;
00105             qreal alpha;
00106             bool fadeIn;
00107             bool operator == (AnimInfo otherAnim) const { return otherAnim.animId == animId; }
00108         };
00109 
00110         DisplayedText m_displayedText;
00111         bool m_showWindowIcons;
00112         bool m_showOwnBackground;
00113         int m_rows;
00114         int m_columns;
00115         int m_desktopCount;
00116         int m_currentDesktop;
00117         qreal m_widthScaleFactor;
00118         qreal m_heightScaleFactor;
00119         QSizeF m_size;
00120         QList<QRectF> m_rects;
00121         //list of info about animations for each desktop
00122         QList<AnimInfo> m_animations;
00123         QRectF m_hoverRect;
00124         int m_hoverIndex;
00125         QList<QList<QPair<WId, QRect> > > m_windowRects;
00126         QList<QRect> m_activeWindows;
00127         QList<QAction*> m_actions;
00128         KSelectionOwner* m_desktopLayoutOwner;
00129         Plasma::PanelSvg *m_background;
00130 
00131         // dragging of windows
00132         QRect m_dragOriginal;
00133         QPointF m_dragOriginalPos;
00134         QPointF m_dragCurrentPos;
00135         WId m_dragId;
00136         int m_dirtyDesktop;
00137         int m_dragStartDesktop;
00138         int m_dragHighlightedDesktop;
00139 
00140         // desktop switching on drop event
00141         int m_dragSwitchDesktop;
00142         QTimer* m_dragSwitchTimer;
00143 
00144         static const int s_FadeInDuration = 50;
00145         static const int s_FadeOutDuration = 100;
00146     };
00147 
00148 K_EXPORT_PLASMA_APPLET(pager, Pager)
00149 
00150 #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
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
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