Subversion Repositories Scribus

Rev

Rev 13809 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
13808 pierre 1
/***************************************************************************
2
 *   Copyright (C) 2009 by Pierre Marchand                                 *
3
 *   pierre@oep-h.com                                                      *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (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 program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
18122 mrdocs 18
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
13808 pierre 19
 ***************************************************************************/
20
 
21
 
22
#ifndef PAGEITEMSETTERBASE_H
23
#define PAGEITEMSETTERBASE_H
24
 
25
#include <QWidget>
26
#include <QString>
27
 
13809 pierre 28
 
13808 pierre 29
//Not exactly clear what would be the best but we go for the Selection atm -pm
30
//class PageItem;
31
class Selection;
32
 
33
/**
34
*  PageItemSetterBase is base class for any widget that can set
35
*  properties of a page item.
36
*
37
* note about dragging:
38
* this base class is expected to handle propper dragging, droppers
39
* must ask the pageitemsettersmanager a clone of a dropped setter based
13809 pierre 40
* on the name.
13808 pierre 41
*
42
*/
43
class PageItemSetterBase : public QWidget
44
{
45
public:
46
        /**
47
          * Default constructor
48
          */
49
        PageItemSetterBase(QWidget * parent = 0);
50
 
51
        /**
52
        *  Reset parameters and internal state to reflect properties of
53
        *  newly assigned (page item)^^selection .
54
        */
55
        virtual void changeItem(Selection*) = 0;
56
 
57
        /**
13809 pierre 58
          * Return a full name which first identifies the type of a setter and can be used to assossiate setters
13808 pierre 59
          * and generally help the caller to layout widgets (think pages in PP as of 2009 :)
13809 pierre 60
          * Prototype of a name could be (retaining actual layout in PP):
61
          * type.group.page or the reverse page.group.type
13808 pierre 62
          */
13809 pierre 63
//      let put this in objectName which is yet available.
64
//      virtual QString name() const = 0;
13808 pierre 65
 
66
        /**
67
          * Return a setter on same property
68
          */
69
        virtual PageItemSetterBase* clone() = 0;
70
 
71
 
72
protected:
73
        QPoint startDragPoint;
74
        virtual void mousePressEvent(QMouseEvent *event);
75
        virtual void mouseMoveEvent(QMouseEvent *event);
76
 
77
        /**
78
          * Enable/Disable only children because doing the same
79
          * on the widget itself disables dragging.
80
          */
81
        virtual void activate(const bool& act);
82
 
83
};
84
#endif // PAGEITEMSETTERBASE_H