Tulip  5.0.0
Large graphs analysis and drawing
QuickAccessBar.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 
22 #ifndef QUICKACCESSBAR_H
23 #define QUICKACCESSBAR_H
24 
25 #include <QWidget>
26 
27 #include <tulip/CaptionItem.h>
28 #include <tulip/tulipconf.h>
29 
30 class QGraphicsItem;
31 class QAbstractButton;
32 
33 namespace Ui {
34 class QuickAccessBar;
35 }
36 
37 namespace tlp {
38 class GlMainView;
39 class GlGraphRenderingParameters;
40 class GlGraphInputData;
41 class GlScene;
42 class TulipItemDelegate;
43 class ColorProperty;
44 class Color;
45 class PropertyInterface;
46 
47 class TLP_QT_SCOPE QuickAccessBar : public QWidget {
48  Q_OBJECT
49 
50 
51 
52 protected:
53  GlMainView* _mainView;
54  GlScene* scene() const;
55  GlGraphInputData* inputData() const;
56  GlGraphRenderingParameters* renderingParameters() const;
57 
58 public:
59  QuickAccessBar(QWidget *parent=0);
60 public slots:
61  void setGlMainView(tlp::GlMainView*);
62  virtual void reset()=0;
63 
64 signals:
65  void settingsChanged();
66 };
67 
68 class TLP_QT_SCOPE QuickAccessBarImpl : public QuickAccessBar {
69  Q_OBJECT
70  Ui::QuickAccessBar* _ui;
71  QGraphicsItem *_quickAccessBarItem;
72 
73  TulipItemDelegate* delegate;
74  bool _resetting;
75  double _oldFontScale;
76  double _oldNodeScale;
77  bool _captionsInitialized;
78  CaptionItem *_captions[4];
79 
80 
81 public:
82 
83  enum QuickAccessButton {NODESCOLORCAPTION=0x1,NODESSIZECAPTION=0x2,EDGESCOLORCAPTION=0x4,EDGESIZECAPTION=0x8,
84  SCREENSHOT=0x10,BACKGROUNDCOLOR=0x20,NODECOLOR=0x40,EDGECOLOR=0x80,NODEBORDERCOLOR=0x100,
85  EDGEBORDERCOLOR=0x200,LABELCOLOR=0x400,COLORINTERPOLATION=0x800,SIZEINTERPOLATION=0x1000,
86  SHOWEDGES=0x2000,SHOWLABELS=0x4000,LABELSSCALED=0x8000,
87  NODESHAPE=0x10000,EDGESHAPE=0x20000,NODESIZE=0x40000,EDGESIZE=0x80000,
88  NODELABELPOSITION=0x100000,SELECTFONT=0x200000,
89  ALLBUTTONS=0xFFFFFF
90  };
91  Q_DECLARE_FLAGS(QuickAccessButtons,QuickAccessButton)
92 
93  explicit QuickAccessBarImpl(QGraphicsItem *quickAccessBarItem=NULL,QuickAccessButtons button=ALLBUTTONS,QWidget *parent = 0);
94  virtual ~QuickAccessBarImpl();
95 
96 protected:
97  void addButtonAtEnd(QAbstractButton* button);
98  void addButtonsAtEnd(const QVector<QAbstractButton*>& buttonvect);
99  void addSeparator();
100  void updateFontButtonStyle();
101  void showHideCaption(CaptionItem::CaptionType captionType);
102  void setAllValues(unsigned int eltType, PropertyInterface* prop);
103  void setAllColorValues(unsigned int eltType, ColorProperty* prop,
104  const Color &color);
105 
106 public slots:
107  void reset();
108 
109  void setBackgroundColor(const QColor&);
110  void setColorInterpolation(bool);
111  void setLabelColor(const QColor&);
112  void setNodeColor(const QColor&);
113  void setNodeBorderColor(const QColor&);
114  void setEdgeColor(const QColor&);
115  void setEdgeBorderColor(const QColor&);
116  void setNodeShape();
117  void setEdgeShape();
118  void setNodeSize();
119  void setEdgeSize();
120  void setSizeInterpolation(bool);
121  void showHideNodesColorCaption();
122  void showHideNodesSizeCaption();
123  void showHideEdgesColorCaption();
124  void showHideEdgesSizeCaption();
125  void takeSnapshot();
126  void setEdgesVisible(bool);
127  void setLabelsVisible(bool);
128  void setLabelsScaled(bool);
129  void selectFont();
130  void setNodeLabelPosition();
131 };
132 }
133 Q_DECLARE_OPERATORS_FOR_FLAGS(tlp::QuickAccessBarImpl::QuickAccessButtons)
134 #endif // QUICKACCESSBAR_H
135 ///@endcond
An abstract view that displays a GlMainWidget as its central widget.
Definition: GlMainView.h:62