~ubuntu-branches/ubuntu/vivid/psi/vivid

« back to all changes in this revision

Viewing changes to src/whiteboarding/wbscene.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * wbscene.h - an SVG whiteboard scene class
 
3
 * Copyright (C) 2006  Joonas Govenius
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License
 
7
 * as published by the Free Software Foundation; either version 2
 
8
 * of the License, or (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this library; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 *
 
19
 */
 
20
#ifndef WBSCENE_H
 
21
#define WBSCENE_H
 
22
#include <QPointer>
 
23
#include "wbitem.h"
 
24
 
 
25
/*! \brief The scene class for whiteboard items.
 
26
 *  Inherits QGraphicsScene.
 
27
 *
 
28
 *  Processes remote whiteboard edits.
 
29
 *
 
30
 *  This class also provides methods for queueing new edits and
 
31
 *  emits a signal with the corresponding whiteboard element.
 
32
 *
 
33
 *  \sa WbWidget
 
34
 *  \sa WbItem
 
35
 */
 
36
class WbScene : public QGraphicsScene
 
37
{
 
38
        Q_OBJECT
 
39
 
 
40
public:
 
41
        /*! \brief Constructor
 
42
         *  Constructs a new scene with parent \a parent.
 
43
         */
 
44
        WbScene(SxeSession* session, QObject * parent = 0);
 
45
 
 
46
        /*! \brief Appends the item to a list of items whose "transform" attribute is to be regenerated.*/
 
47
        void queueTransformationRegeneration(WbItem* item);
 
48
        /*! \brief Regenerate the SVG transformation matrices for items queued by queueTransformationRegeneration(WbItem* item) since last regeneration.*/
 
49
        void regenerateTransformations();
 
50
        /*! \brief Returns the coordinates of the center of all selected items. */
 
51
    QPointF selectionCenter() const;
 
52
 
 
53
public slots:
 
54
    /*! \brief Brings the selected items \a n levels forward. */
 
55
    void bringForward(int n = 1);
 
56
    /*! \brief Brings the item to the top. */
 
57
    void bringToFront();
 
58
    /*! \brief Sends the selected items \a n levels backwards. */
 
59
    void sendBackwards(int n = 1);
 
60
    /*! \brief Brings the item to the back. */
 
61
    void sendToBack();
 
62
    /*! \brief Groups the selected items.*/
 
63
    void group();
 
64
    /*! \brief Ungroups the selected item groups.*/
 
65
    void ungroup();
 
66
 
 
67
private:
 
68
    /*! \brief Brings the selected items \a n levels forward.
 
69
    *  If \a n < 0, the items are send \a n levels baskwards.
 
70
    *  If \a toExtremum is true, the item is sent to the front/back.
 
71
    */
 
72
    void bring(int n, bool toExtremum);
 
73
 
 
74
    SxeSession* session_;
 
75
    QList< QPointer<WbItem> > pendingTranformations_;
 
76
    
 
77
    QPointF selectionCenter_;
 
78
};
 
79
 
 
80
#endif
 
81