• Skip to content
  • Skip to link menu
KDE 4.2 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>
00028 #include <Plasma/DataEngine>
00029 #include "ui_pagerConfig.h"
00030 
00031 class KDialog;
00032 class KSelectionOwner;
00033 class KColorScheme;
00034 class KWindowInfo;
00035 
00036 namespace Plasma
00037 {
00038     class FrameSvg;
00039 }
00040 
00041 class Pager : public Plasma::Applet
00042 {
00043     Q_OBJECT
00044     public:
00045         Pager(QObject *parent, const QVariantList &args);
00046         ~Pager();
00047         void init();
00048         void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option,
00049                             const QRect &contents);
00050         void constraintsEvent(Plasma::Constraints);
00051         virtual QList<QAction*> contextualActions();
00052 
00053     public slots:
00054         void recalculateGeometry();
00055         void recalculateWindowRects();
00056         void themeRefresh();
00057 
00058     protected slots:
00059         virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
00060         virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00061         virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00062         virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
00063         virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
00064         virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
00065         virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
00066         virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
00067         virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
00068         virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
00069         virtual void wheelEvent(QGraphicsSceneWheelEvent *);
00070 
00071         void configAccepted();
00072         void currentDesktopChanged(int desktop);
00073         void desktopsSizeChanged();
00074         void windowAdded(WId id);
00075         void windowRemoved(WId id);
00076         void activeWindowChanged(WId id);
00077         void numberOfDesktopsChanged(int num);
00078         void desktopNamesChanged();
00079         void stackingOrderChanged();
00080         void windowChanged(WId id, unsigned int properties);
00081         void showingDesktopChanged(bool showing);
00082         void slotConfigureDesktop();
00083         void lostDesktopLayoutOwner();
00084         void animationUpdate(qreal progress, int animId);
00085         void dragSwitch();
00086 
00087     protected:
00088         void createMenu();
00089         KColorScheme *colorScheme();
00090         QRect fixViewportPosition( const QRect& r );
00091         void createConfigurationInterface(KConfigDialog *parent);
00092         void handleHoverMove(const QPointF& pos);
00093         void handleHoverLeave();
00094         void updateToolTip();
00095 
00096     private:
00097         QTimer* m_timer;
00098         Ui::pagerConfig ui;
00099         enum DisplayedText
00100         {
00101             Number,
00102             Name,
00103             None
00104         };
00105 
00106         struct AnimInfo
00107         {
00108             int animId;
00109             qreal alpha;
00110             bool fadeIn;
00111             bool operator == (AnimInfo otherAnim) const { return otherAnim.animId == animId; }
00112         };
00113 
00114         DisplayedText m_displayedText;
00115         bool m_showWindowIcons;
00116         bool m_showOwnBackground;
00117         int m_rows;
00118         int m_columns;
00119         int m_desktopCount;
00120         int m_currentDesktop;
00121         qreal m_widthScaleFactor;
00122         qreal m_heightScaleFactor;
00123         QSizeF m_size;
00124         QList<QRectF> m_rects;
00125         //list of info about animations for each desktop
00126         QList<AnimInfo> m_animations;
00127         QRectF m_hoverRect;
00128         int m_hoverIndex;
00129         QList<QList<QPair<WId, QRect> > > m_windowRects;
00130         QList<QRect> m_activeWindows;
00131         QList<QAction*> m_actions;
00132         QList<KWindowInfo> m_windowInfo;
00133         KSelectionOwner* m_desktopLayoutOwner;
00134         Plasma::FrameSvg *m_background;
00135         KColorScheme *m_colorScheme;
00136 
00137         // dragging of windows
00138         QRect m_dragOriginal;
00139         QPointF m_dragOriginalPos;
00140         QPointF m_dragCurrentPos;
00141         WId m_dragId;
00142         int m_dirtyDesktop;
00143         int m_dragStartDesktop;
00144         int m_dragHighlightedDesktop;
00145 
00146         // desktop switching on drop event
00147         int m_dragSwitchDesktop;
00148         QTimer* m_dragSwitchTimer;
00149 
00150         static const int s_FadeInDuration = 50;
00151         static const int s_FadeOutDuration = 100;
00152     };
00153 
00154 K_EXPORT_PLASMA_APPLET(pager, Pager)
00155 
00156 #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