Frapper  1.0a
PainterPanel.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of FRAPPER
4 research.animationsinstitut.de
5 sourceforge.net/projects/frapper
6 
7 Copyright (c) 2008-2012 Filmakademie Baden-Wuerttemberg, Institute of Animation
8 
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
12 version.
13 
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License along with
19 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21 http://www.gnu.org/copyleft/lesser.txt.
22 -----------------------------------------------------------------------------
23 */
24 
34 
35 #ifndef PAINTERPANEL_H
36 #define PAINTERPANEL_H
37 
38 // includes, Frapper
39 #include "FrapperPrerequisites.h"
40 #include "ViewPanel.h"
41 #include "ImageNode.h"
42 
43 // includes, local classes
44 #include "PainterGraphicsView.h"
45 #include "PainterPanelListItem.h"
46 
47 // includes, GUI Elements
48 #include <QListWidget>
49 #include <QComboBox>
50 #include <QPushButton>
51 #include <QCheckBox>
52 
53 namespace PainterPanel {
54 using namespace Frapper;
55 
59 class PainterPanel : public ViewPanel
60 {
61 
62  Q_OBJECT
63 
64 public: // constructors and destructors
65 
72  PainterPanel ( QWidget *parent = 0, Qt::WindowFlags flags = 0 );
73 
81  virtual ~PainterPanel ();
82 
83 public slots: //
84 
85 
86 public: // functions
87 
88 
95  virtual void registerControl(NodeModel *nodeModel, SceneModel *sceneModel);
96 
103  void fillToolBars ( QToolBar *mainToolBar, QToolBar *panelToolBar );
104 
105 public: // static member
109  static QList <PainterPanelImageListItemData*> s_items;
110 
114  static size_t s_numInstances;
115 
116 
117 private slots: //
118 
124  void selectedNodeChanged(Node * selectedNode);
125 
131  void sceneChanged( QGraphicsScene *scene);
132 
136  void updateImageList();
137 
141  void imageListItemChanged(QListWidgetItem *clickedItem);
142 
146  void historyListItemChanged(QListWidgetItem *clickedItem);
147 
151  void historyListLayoutChanged();
152 
158  void selectionChanged(bool selected);
159 
163  void storeToNode();
164 
168  void changeDrawMode( int mode );
169 
173  void onSceneSelectionChanged(QList<QGraphicsItem*> selectedItems);
174 
179  void onPenChanged( QPen pen);
180 
185  void onBrushChanged( QBrush brush);
186 
190  void onFillCheckToggled( bool checked);
191 
195  void onRefreshButtonClicked();
196 
200  void updateDrawModeCombo( int drawmode);
201 
205  void selectPenColor();
206 
210  void selectPenSize( QString size);
211 
215  void selectBrushColor();
216 
217 signals:
218 
222  void triggerRedraw();
223 
224 private:
225 
229  void setPenColorButton( QColor color);
230 
234  void setBrushColorButton( QColor color);
235 
240  static void deleteListItems();
241 
245  void setStandardPenColor( PainterGraphicsView::DrawMode drawMode );
246 
247 
248 private: // data
249 
254 
259 
264 
269 
273 
275  QListWidget *m_imageListWidget;
276 
278  QListWidget *m_historyListWidget;
279 
281  QComboBox *m_drawModeCombo;
282 
284  QComboBox *m_penSizeCombo;
285 
287  QPushButton *m_penColorButton;
288 
290  QPushButton *m_brushColorButton;
291 
293  QPushButton *m_refreshBackground;
294 
296  QPushButton *m_deleteItemButton;
297 
299  QCheckBox *m_fillCheck;
300 
302  QColor m_penColor;
303  QColor m_brushColor;
304  QBrush m_brush;
305  QPen m_pen;
306 
308  QIcon m_inIcon;
309  QIcon m_outIcon;
310  QIcon m_inOutIcon;
311 };
312 
313 } // end namespace PainterPanel
314 
315 #endif