implemented 'default set style', so that doesn't have to be duplicated for each style

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@224 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-03-22 12:57:10 +00:00
parent 3f0c284a50
commit 2a2471fda7
7 changed files with 97 additions and 55 deletions
+8 -1
View File
@@ -92,6 +92,9 @@ class Style {
inline RealSize getSize() const { return RealSize ( width, height); }
inline RealRect getRect() const { return RealRect (left, top, width, height); }
/// Get a copy of this style
virtual StyleP clone() const = 0;
/// Make a viewer object for values using this style
/** thisP is a smart pointer to this */
virtual ValueViewerP makeViewer(DataViewer& parent, const StyleP& thisP) = 0;
@@ -157,12 +160,16 @@ template <> ValueP read_new<Value>(Reader&);
ValueP Type ## Field::newValue(const FieldP& thisP) const { \
assert(thisP.get() == this); \
return new_shared1<Type ## Value>(static_pointer_cast<Type ## Field>(thisP)); \
} \
StyleP Type ## Style::clone() const { \
return new_shared1<Type ## Style>(*this); \
}
#define DECLARE_STYLE_TYPE(Type) \
DECLARE_HAS_FIELD(Type) \
virtual StyleP clone() const; \
virtual ValueViewerP makeViewer(DataViewer& parent, const StyleP& thisP); \
virtual ValueViewerP makeEditor(DataEditor& parent, const StyleP& thisP)
virtual ValueViewerP makeEditor(DataEditor& parent, const StyleP& thisP);
// implement field() which returns a field with the right (derived) type
#define DECLARE_HAS_FIELD(Type) \