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,
62 class TLP_SCOPE EdgeShape {
74 class TLP_SCOPE EdgeExtremityShape {
78 enum EdgeExtremityShapes {
85 CubeOutlinedTransparent=9,
98 class TLP_SCOPE LabelPosition {
102 enum LabelPositions {
111 class TLP_SCOPE TulipViewSettings :
public Observable {
115 static TulipViewSettings &instance();
118 void setDefaultColor(
ElementType elem,
const Color& color);
121 void setDefaultBorderColor(
ElementType elem,
const Color& color);
124 void setdefaultBorderWidth(
ElementType elem,
float borderWidth);
126 Color defaultLabelColor()
const;
127 void setDefaultLabelColor(
const Color& color);
129 Color defaultLabelBorderColor()
const;
130 void setDefaultLabelBorderColor(
const Color& color);
132 float defaultLabelBorderWidth()
const;
133 void setDefaultLabelBorderWidth(
float borderWidth);
135 int defaultLabelPosition()
const;
136 void setDefaultLabelPosition(
int position);
139 void setDefaultSize(
ElementType elem,
const Size& size);
144 int defaultEdgeExtremitySrcShape()
const;
145 void setDefaultEdgeExtremitySrcShape(
int shape);
147 int defaultEdgeExtremityTgtShape()
const;
148 void setDefaultEdgeExtremityTgtShape(
int shape);
150 Size defaultEdgeExtremitySrcSize()
const;
151 void setDefaultEdgeExtremitySrcSize(
const Size &size);
153 Size defaultEdgeExtremityTgtSize()
const;
154 void setDefaultEdgeExtremityTgtSize(
const Size &size);
156 std::string defaultFontFile()
const;
157 void setDefaultFontFile(
const std::string &fontFile);
159 int defaultFontSize()
const;
160 void setDefaultFontSize(
int fontSize);
166 static TulipViewSettings *_instance;
168 Color _defaultNodeColor;
169 Color _defaultEdgeColor;
170 Color _defaultNodeBorderColor;
171 Color _defaultEdgeBorderColor;
172 Color _defaultLabelColor;
173 Color _defaultLabelBorderColor;
175 float _defaultNodeBorderWidth;
176 float _defaultEdgeBorderWidth;
177 float _defaultLabelBorderWidth;
179 int _defaultLabelPosition;
181 Size _defaultNodeSize;
182 Size _defaultEdgeSize;
184 int _defaultNodeShape;
185 int _defaultEdgeShape;
186 int _defaultEdgeExtremitySrcShape;
187 int _defaultEdgeExtremityTgtShape;
189 Size _defaultEdgeExtremitySrcSize;
190 Size _defaultEdgeExtremityTgtSize;
192 std::string _defaultFontFile;
193 int _defaultFontSize;
196 class TLP_SCOPE ViewSettingsEvent :
public tlp::Event {
200 enum ViewSettingsEventType {
201 TLP_DEFAULT_COLOR_MODIFIED,
202 TLP_DEFAULT_SHAPE_MODIFIED,
203 TLP_DEFAULT_SIZE_MODIFIED,
204 TLP_DEFAULT_LABEL_COLOR_MODIFIED
207 ViewSettingsEvent(
ElementType elem,
const Color &color) :
208 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
209 _type(TLP_DEFAULT_COLOR_MODIFIED), _elem(elem), _color(color) {}
211 ViewSettingsEvent(
ElementType elem,
const Size &size) :
212 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
213 _type(TLP_DEFAULT_SIZE_MODIFIED), _elem(elem), _size(size) {}
216 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
217 _type(TLP_DEFAULT_SHAPE_MODIFIED), _elem(elem), _shape(shape) {}
219 ViewSettingsEvent(
const Color &labelColor) :
220 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
221 _type(TLP_DEFAULT_LABEL_COLOR_MODIFIED), _color(labelColor) {}
223 ViewSettingsEventType getType()
const {
231 Color getColor()
const {
235 Size getSize()
const {
239 int getShape()
const {
245 ViewSettingsEventType _type;
255 #endif // TULIPVIEWSETTINGS_H