QGIS API Documentation  2.4.0-Chugiak
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsaddremoveitemcommand.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsaddremoveitemcommand.h
3  ------------------------
4  begin : 2010-11-27
5  copyright : (C) 2010 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7 ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSADDREMOVEITEMCOMMAND_H
19 #define QGSADDREMOVEITEMCOMMAND_H
20 
21 #include <QUndoCommand>
22 class QgsComposerItem;
23 class QgsComposition;
24 
26 class CORE_EXPORT QgsAddRemoveItemCommand: public QObject, public QUndoCommand
27 {
28  Q_OBJECT
29 
30  public:
31 
32  enum State
33  {
34  Added = 0,
35  Removed
36  };
37 
38  QgsAddRemoveItemCommand( State s, QgsComposerItem* item, QgsComposition* c, const QString& text, QUndoCommand* parent = 0 );
40 
41  void redo();
42  void undo();
43 
44  signals:
45  void itemAdded( QgsComposerItem* item );
46  void itemRemoved( QgsComposerItem* item );
47 
48  private:
52  bool mFirstRun; //flag to prevent execution when the command is pushed to the QUndoStack
53 
54  //changes between added / removed state
55  void switchState();
56 };
57 
58 #endif // QGSADDREMOVEITEMCOMMAND_H
A item that forms part of a map composition.
Graphics scene for map printing.
A composer command class for adding / removing composer items.