Tulip  5.1.0
Large graphs analysis and drawing
QuickAccessBar.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
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 class QPushButton;
33 
34 namespace Ui {
35 class QuickAccessBar;
36 }
37 
38 namespace tlp {
39 class GlMainView;
40 class GlGraphRenderingParameters;
41 class GlGraphInputData;
42 class GlScene;
43 class TulipItemDelegate;
44 class ColorProperty;
45 class Color;
46 class PropertyInterface;
47 class ColorButton;
48 
49 class TLP_QT_SCOPE QuickAccessBar : public QWidget {
50  Q_OBJECT
51 
52 
53 
54 protected:
55  GlMainView* _mainView;
56  GlScene* scene() const;
57  GlGraphInputData* inputData() const;
58  GlGraphRenderingParameters* renderingParameters() const;
59 
60 public:
61  QuickAccessBar(QWidget *parent=0);
62 public slots:
63  void setGlMainView(tlp::GlMainView*);
64  virtual void reset()=0;
65 
66 signals:
67  void settingsChanged();
68 };
69 
70 class TLP_QT_SCOPE QuickAccessBarImpl : public QuickAccessBar {
71  Q_OBJECT
72  Ui::QuickAccessBar* _ui;
73  QGraphicsItem *_quickAccessBarItem;
74 
75  TulipItemDelegate* delegate;
76  bool _resetting;
77  double _oldFontScale;
78  double _oldNodeScale;
79  bool _captionsInitialized;
80  CaptionItem *_captions[4];
81 
82 
83 public:
84 
85  enum QuickAccessButton {NODESCOLORCAPTION=0x1,NODESSIZECAPTION=0x2,EDGESCOLORCAPTION=0x4,EDGESIZECAPTION=0x8,
86  SCREENSHOT=0x10,BACKGROUNDCOLOR=0x20,NODECOLOR=0x40,EDGECOLOR=0x80,NODEBORDERCOLOR=0x100,
87  EDGEBORDERCOLOR=0x200,LABELCOLOR=0x400,COLORINTERPOLATION=0x800,SIZEINTERPOLATION=0x1000,
88  SHOWEDGES=0x2000,SHOWLABELS=0x4000,LABELSSCALED=0x8000,
89  NODESHAPE=0x10000,EDGESHAPE=0x20000,NODESIZE=0x40000,EDGESIZE=0x80000,
90  NODELABELPOSITION=0x100000,SELECTFONT=0x200000, SHOWNODES=0x400000,
91  ALLBUTTONS=0xFFFFFF
92  };
93  Q_DECLARE_FLAGS(QuickAccessButtons,QuickAccessButton)
94 
95  explicit QuickAccessBarImpl(QGraphicsItem *quickAccessBarItem=NULL,QuickAccessButtons button=ALLBUTTONS,QWidget *parent = 0);
96  virtual ~QuickAccessBarImpl();
97 
98  QPushButton* showEdgesButton();
99  QPushButton* showNodesButton();
100  ColorButton* backgroundColorButton();
101  QPushButton* showLabelsButton();
102  QPushButton* showLabelScaled();
103  QPushButton* showColorInterpolation();
104 
105 protected:
106  void addButtonAtEnd(QAbstractButton* button);
107  void addButtonsAtEnd(const QVector<QAbstractButton*>& buttonvect);
108  void addSeparator();
109  void updateFontButtonStyle();
110  void showHideCaption(CaptionItem::CaptionType captionType);
111  void setAllValues(unsigned int eltType, PropertyInterface* prop);
112  void setAllColorValues(unsigned int eltType, ColorProperty* prop,
113  const Color &color);
114 
115 public slots:
116  void reset();
117 
118  virtual void setBackgroundColor(const QColor&);
119  virtual void setColorInterpolation(bool);
120  void setLabelColor(const QColor&);
121  void setNodeColor(const QColor&);
122  void setNodeBorderColor(const QColor&);
123  void setEdgeColor(const QColor&);
124  void setEdgeBorderColor(const QColor&);
125  void setNodeShape();
126  void setEdgeShape();
127  void setNodeSize();
128  void setEdgeSize();
129  void setSizeInterpolation(bool);
130  void showHideNodesColorCaption();
131  void showHideNodesSizeCaption();
132  void showHideEdgesColorCaption();
133  void showHideEdgesSizeCaption();
134  void takeSnapshot();
135  virtual void setEdgesVisible(bool);
136  virtual void setNodesVisible(bool);
137  virtual void setLabelsVisible(bool);
138  virtual void setLabelsScaled(bool);
139  void selectFont();
140  void setNodeLabelPosition();
141 };
142 }
143 Q_DECLARE_OPERATORS_FOR_FLAGS(tlp::QuickAccessBarImpl::QuickAccessButtons)
144 #endif // QUICKACCESSBAR_H
145 ///@endcond
An abstract view that displays a GlMainWidget as its central widget.
Definition: GlMainView.h:62