2007-11-15 09:22:58 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2007 Aaron Seigo <aseigo@kde.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef VIEW_H
|
|
|
|
#define VIEW_H
|
|
|
|
|
|
|
|
#include <QtGui/QGraphicsView>
|
|
|
|
|
|
|
|
#include <plasma/plasma_export.h>
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class Containment;
|
|
|
|
class Corona;
|
|
|
|
|
|
|
|
/**
|
2008-01-19 03:45:55 +01:00
|
|
|
* @short A QGraphicsView for Plasma::Applets
|
2007-11-15 09:22:58 +01:00
|
|
|
*/
|
|
|
|
class PLASMA_EXPORT View : public QGraphicsView
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
View(int screen, Corona *corona, QWidget *parent = 0);
|
|
|
|
explicit View(Containment *containment, QWidget *parent = 0);
|
|
|
|
~View();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether or not to draw the containment wallpaper when painting
|
|
|
|
* on this item
|
|
|
|
*/
|
|
|
|
void setDrawWallpaper(bool draw);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return whether or not containments should draw wallpaper
|
|
|
|
*/
|
|
|
|
bool drawWallpaper() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets which screen this view is associated with, if any.
|
|
|
|
* This will also set the containment if a valid screen is specified
|
|
|
|
*
|
|
|
|
* @arg screen the xinerama screen number; -1 for no screen
|
|
|
|
*/
|
|
|
|
void setScreen(int screen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the screen this view is associated with
|
|
|
|
*
|
|
|
|
* @return the xinerama screen number, or -1 for none
|
|
|
|
*/
|
|
|
|
int screen() const;
|
|
|
|
|
2008-02-23 00:41:44 +01:00
|
|
|
/**
|
|
|
|
* Sets which virtual desktop this view is asociated with, if any.
|
|
|
|
*
|
|
|
|
* @arg desktop a valid desktop number, -1 for all desktops, less than -1 for none
|
|
|
|
*/
|
|
|
|
void setDesktop(int desktop);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The virtual desktop this view is associated with
|
|
|
|
*
|
|
|
|
* @return the desktop number, -1 for all desktops and less than -1 for none
|
|
|
|
*/
|
|
|
|
int desktop() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The virtual desktop this view is actually being viewed on
|
|
|
|
*
|
|
|
|
* @return the desktop number (always valid, never < 0)
|
|
|
|
*/
|
|
|
|
int effectiveDesktop() const;
|
|
|
|
|
2007-11-15 09:22:58 +01:00
|
|
|
/**
|
|
|
|
* Sets the containment for this view, which will also cause the view
|
|
|
|
* to track the geometry of the containment.
|
|
|
|
*
|
|
|
|
* @arg containment the containment to center the view on
|
|
|
|
*/
|
|
|
|
void setContainment(Containment *containment);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the containment associated with this view, or 0 if none is
|
|
|
|
*/
|
|
|
|
Containment* containment() const;
|
|
|
|
|
2008-03-05 01:02:37 +01:00
|
|
|
Q_SIGNALS:
|
|
|
|
/**
|
|
|
|
* This signal is emitted whenever the containment being viewed has
|
|
|
|
* changed its geometry, but before the View has shifted the viewd scene rect
|
|
|
|
* to the new geometry. This is useful for Views which want to keep
|
|
|
|
* their rect() in sync with the containment'sa
|
|
|
|
*
|
|
|
|
* @arg rect the new scene rect.
|
|
|
|
*/
|
|
|
|
void sceneRectAboutToChange();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This signal is emitted whenever the containment being viewed has
|
|
|
|
* changed its geometry, and after the View has shifted the viewd scene rect
|
|
|
|
* to the new geometry. This is useful for Views which want to keep
|
|
|
|
* their rect() in sync with the containment's.
|
|
|
|
*
|
|
|
|
* @arg rect the new scene rect.
|
|
|
|
*/
|
|
|
|
void sceneRectChanged();
|
|
|
|
|
2007-11-15 18:43:04 +01:00
|
|
|
protected Q_SLOTS:
|
2007-11-15 10:15:53 +01:00
|
|
|
void updateSceneRect();
|
|
|
|
|
2007-11-15 09:22:58 +01:00
|
|
|
private:
|
2007-12-30 08:32:48 +01:00
|
|
|
void initGraphicsView();
|
|
|
|
|
2007-11-15 09:22:58 +01:00
|
|
|
class Private;
|
|
|
|
Private * const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Plasma
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|