20 #ifndef TULIPVIEWSETTINGS_H
21 #define TULIPVIEWSETTINGS_H
23 #include <tulip/tulipconf.h>
24 #include <tulip/Color.h>
25 #include <tulip/Size.h>
26 #include <tulip/Graph.h>
27 #include <tulip/Observable.h>
33 class TLP_SCOPE NodeShape {
45 CubeOutlinedTransparent=9,
63 class TLP_SCOPE EdgeShape {
75 class TLP_SCOPE EdgeExtremityShape {
79 enum EdgeExtremityShapes {
86 CubeOutlinedTransparent=9,
100 class TLP_SCOPE LabelPosition {
104 enum LabelPositions {
113 class TLP_SCOPE TulipViewSettings :
public Observable {
117 static TulipViewSettings &instance();
120 void setDefaultColor(
ElementType elem,
const Color& color);
123 void setDefaultBorderColor(
ElementType elem,
const Color& color);
126 void setdefaultBorderWidth(
ElementType elem,
float borderWidth);
128 Color defaultLabelColor()
const;
129 void setDefaultLabelColor(
const Color& color);
131 Color defaultLabelBorderColor()
const;
132 void setDefaultLabelBorderColor(
const Color& color);
134 float defaultLabelBorderWidth()
const;
135 void setDefaultLabelBorderWidth(
float borderWidth);
137 int defaultLabelPosition()
const;
138 void setDefaultLabelPosition(
int position);
141 void setDefaultSize(
ElementType elem,
const Size& size);
146 int defaultEdgeExtremitySrcShape()
const;
147 void setDefaultEdgeExtremitySrcShape(
int shape);
149 int defaultEdgeExtremityTgtShape()
const;
150 void setDefaultEdgeExtremityTgtShape(
int shape);
152 Size defaultEdgeExtremitySrcSize()
const;
153 void setDefaultEdgeExtremitySrcSize(
const Size &size);
155 Size defaultEdgeExtremityTgtSize()
const;
156 void setDefaultEdgeExtremityTgtSize(
const Size &size);
158 std::string defaultFontFile()
const;
159 void setDefaultFontFile(
const std::string &fontFile);
161 int defaultFontSize()
const;
162 void setDefaultFontSize(
int fontSize);
168 static TulipViewSettings *_instance;
170 Color _defaultNodeColor;
171 Color _defaultEdgeColor;
172 Color _defaultNodeBorderColor;
173 Color _defaultEdgeBorderColor;
174 Color _defaultLabelColor;
175 Color _defaultLabelBorderColor;
177 float _defaultNodeBorderWidth;
178 float _defaultEdgeBorderWidth;
179 float _defaultLabelBorderWidth;
181 int _defaultLabelPosition;
183 Size _defaultNodeSize;
184 Size _defaultEdgeSize;
186 int _defaultNodeShape;
187 int _defaultEdgeShape;
188 int _defaultEdgeExtremitySrcShape;
189 int _defaultEdgeExtremityTgtShape;
191 Size _defaultEdgeExtremitySrcSize;
192 Size _defaultEdgeExtremityTgtSize;
194 std::string _defaultFontFile;
195 int _defaultFontSize;
198 class TLP_SCOPE ViewSettingsEvent :
public tlp::Event {
202 enum ViewSettingsEventType {
203 TLP_DEFAULT_COLOR_MODIFIED,
204 TLP_DEFAULT_SHAPE_MODIFIED,
205 TLP_DEFAULT_SIZE_MODIFIED,
206 TLP_DEFAULT_LABEL_COLOR_MODIFIED
209 ViewSettingsEvent(
ElementType elem,
const Color &color) :
210 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
211 _type(TLP_DEFAULT_COLOR_MODIFIED), _elem(elem), _color(color) {}
213 ViewSettingsEvent(
ElementType elem,
const Size &size) :
214 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
215 _type(TLP_DEFAULT_SIZE_MODIFIED), _elem(elem), _size(size) {}
218 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
219 _type(TLP_DEFAULT_SHAPE_MODIFIED), _elem(elem), _shape(shape) {}
221 ViewSettingsEvent(
const Color &labelColor) :
222 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
223 _type(TLP_DEFAULT_LABEL_COLOR_MODIFIED), _color(labelColor) {}
225 ViewSettingsEventType getType()
const {
233 Color getColor()
const {
237 Size getSize()
const {
241 int getShape()
const {
247 ViewSettingsEventType _type;
257 #endif // TULIPVIEWSETTINGS_H
Event is the base class for all events used in the Observation mechanism.