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,
64 class TLP_SCOPE EdgeShape {
76 class TLP_SCOPE EdgeExtremityShape {
80 enum EdgeExtremityShapes {
87 CubeOutlinedTransparent=9,
102 class TLP_SCOPE LabelPosition {
106 enum LabelPositions {
115 class TLP_SCOPE TulipViewSettings :
public Observable {
119 static TulipViewSettings &instance();
122 void setDefaultColor(
ElementType elem,
const Color& color);
125 void setDefaultBorderColor(
ElementType elem,
const Color& color);
128 void setdefaultBorderWidth(
ElementType elem,
float borderWidth);
130 Color defaultLabelColor()
const;
131 void setDefaultLabelColor(
const Color& color);
133 Color defaultLabelBorderColor()
const;
134 void setDefaultLabelBorderColor(
const Color& color);
136 float defaultLabelBorderWidth()
const;
137 void setDefaultLabelBorderWidth(
float borderWidth);
139 int defaultLabelPosition()
const;
140 void setDefaultLabelPosition(
int position);
143 void setDefaultSize(
ElementType elem,
const Size& size);
148 int defaultEdgeExtremitySrcShape()
const;
149 void setDefaultEdgeExtremitySrcShape(
int shape);
151 int defaultEdgeExtremityTgtShape()
const;
152 void setDefaultEdgeExtremityTgtShape(
int shape);
154 Size defaultEdgeExtremitySrcSize()
const;
155 void setDefaultEdgeExtremitySrcSize(
const Size &size);
157 Size defaultEdgeExtremityTgtSize()
const;
158 void setDefaultEdgeExtremityTgtSize(
const Size &size);
160 std::string defaultFontFile()
const;
161 void setDefaultFontFile(
const std::string &fontFile);
163 int defaultFontSize()
const;
164 void setDefaultFontSize(
int fontSize);
170 static TulipViewSettings *_instance;
172 Color _defaultNodeColor;
173 Color _defaultEdgeColor;
174 Color _defaultNodeBorderColor;
175 Color _defaultEdgeBorderColor;
176 Color _defaultLabelColor;
177 Color _defaultLabelBorderColor;
179 float _defaultNodeBorderWidth;
180 float _defaultEdgeBorderWidth;
181 float _defaultLabelBorderWidth;
183 int _defaultLabelPosition;
185 Size _defaultNodeSize;
186 Size _defaultEdgeSize;
188 int _defaultNodeShape;
189 int _defaultEdgeShape;
190 int _defaultEdgeExtremitySrcShape;
191 int _defaultEdgeExtremityTgtShape;
193 Size _defaultEdgeExtremitySrcSize;
194 Size _defaultEdgeExtremityTgtSize;
196 std::string _defaultFontFile;
197 int _defaultFontSize;
200 class TLP_SCOPE ViewSettingsEvent :
public tlp::Event {
204 enum ViewSettingsEventType {
205 TLP_DEFAULT_COLOR_MODIFIED,
206 TLP_DEFAULT_SHAPE_MODIFIED,
207 TLP_DEFAULT_SIZE_MODIFIED,
208 TLP_DEFAULT_LABEL_COLOR_MODIFIED
211 ViewSettingsEvent(
ElementType elem,
const Color &color) :
212 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
213 _type(TLP_DEFAULT_COLOR_MODIFIED), _elem(elem), _color(color) {}
215 ViewSettingsEvent(
ElementType elem,
const Size &size) :
216 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
217 _type(TLP_DEFAULT_SIZE_MODIFIED), _elem(elem), _size(size) {}
220 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
221 _type(TLP_DEFAULT_SHAPE_MODIFIED), _elem(elem), _shape(shape) {}
223 ViewSettingsEvent(
const Color &labelColor) :
224 Event(TulipViewSettings::instance(), Event::TLP_MODIFICATION),
225 _type(TLP_DEFAULT_LABEL_COLOR_MODIFIED), _color(labelColor) {}
227 ViewSettingsEventType getType()
const {
235 Color getColor()
const {
239 Size getSize()
const {
243 int getShape()
const {
249 ViewSettingsEventType _type;
259 #endif // TULIPVIEWSETTINGS_H
Event is the base class for all events used in the Observation mechanism.