From a218251fd666da4ac0b4f599067ffe3aa52a41b4 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 19 Nov 2006 19:41:26 +0000 Subject: [PATCH] Added placeholder ValueEditors for all field types git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@75 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/data/field.hpp | 4 +- src/data/field/boolean.hpp | 2 +- src/gui/control/card_editor.cpp | 2 +- .../boolean.cpp => gui/value/choice.cpp} | 2 +- src/gui/value/choice.hpp | 25 +++ .../value/boolean.hpp => gui/value/color.cpp} | 9 +- src/gui/value/color.hpp | 25 +++ src/gui/value/editor.cpp | 21 +++ src/gui/value/editor.hpp | 44 ++--- src/gui/value/image.cpp | 11 ++ src/gui/value/image.hpp | 25 +++ src/gui/value/multiple_choice.cpp | 11 ++ src/gui/value/multiple_choice.hpp | 25 +++ src/gui/value/symbol.cpp | 11 ++ src/gui/value/symbol.hpp | 25 +++ src/gui/value/text.cpp | 11 ++ src/gui/value/text.hpp | 26 +++ src/mse.vcproj | 150 ++++++++++++++++++ src/render/value/choice.cpp | 2 +- src/render/value/color.hpp | 1 - src/render/value/image.hpp | 1 - src/render/value/multiple_choice.cpp | 6 +- src/render/value/multiple_choice.hpp | 11 +- src/render/value/symbol.cpp | 6 +- src/render/value/symbol.hpp | 11 +- src/render/value/viewer.cpp | 35 +--- src/render/value/viewer.hpp | 5 +- 27 files changed, 436 insertions(+), 71 deletions(-) rename src/{render/value/boolean.cpp => gui/value/choice.cpp} (92%) create mode 100644 src/gui/value/choice.hpp rename src/{render/value/boolean.hpp => gui/value/color.cpp} (73%) create mode 100644 src/gui/value/color.hpp create mode 100644 src/gui/value/image.cpp create mode 100644 src/gui/value/image.hpp create mode 100644 src/gui/value/multiple_choice.cpp create mode 100644 src/gui/value/multiple_choice.hpp create mode 100644 src/gui/value/symbol.cpp create mode 100644 src/gui/value/symbol.hpp create mode 100644 src/gui/value/text.cpp create mode 100644 src/gui/value/text.hpp diff --git a/src/data/field.hpp b/src/data/field.hpp index 7084abd0..5aebec81 100644 --- a/src/data/field.hpp +++ b/src/data/field.hpp @@ -95,7 +95,7 @@ class Style { virtual ValueViewerP makeViewer(DataViewer& parent, const StyleP& thisP) = 0; /// Make an editor object for values using this style /** thisP is a smart pointer to this */ - virtual ValueEditorP makeEditor(DataEditor& parent, const StyleP& thisP) = 0; + virtual ValueViewerP makeEditor(DataEditor& parent, const StyleP& thisP) = 0; /// Update scripted values of this style, return true if anything has changed virtual bool update(Context&); @@ -157,7 +157,7 @@ template <> ValueP read_new(Reader&); #define DECLARE_STYLE_TYPE(Type) \ DECLARE_HAS_FIELD(Type) \ virtual ValueViewerP makeViewer(DataViewer& parent, const StyleP& thisP); \ - virtual ValueEditorP 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) \ diff --git a/src/data/field/boolean.hpp b/src/data/field/boolean.hpp index 0d92aabc..5f8bc0f8 100644 --- a/src/data/field/boolean.hpp +++ b/src/data/field/boolean.hpp @@ -36,7 +36,7 @@ class BooleanField : public ChoiceField { class BooleanStyle : public ChoiceStyle { public: inline BooleanStyle(const ChoiceFieldP& field) : ChoiceStyle(field) {} - DECLARE_STYLE_TYPE(Boolean); + DECLARE_HAS_FIELD(Boolean); // not DECLARE_STYLE_TYPE, because we use a normal ChoiceValueViewer/Editor // no extra data diff --git a/src/gui/control/card_editor.cpp b/src/gui/control/card_editor.cpp index ffdce48f..2ccd5a0c 100644 --- a/src/gui/control/card_editor.cpp +++ b/src/gui/control/card_editor.cpp @@ -14,7 +14,7 @@ #define FOR_EACH_EDITOR \ FOR_EACH(v, viewers) \ - if (ValueEditorP = static_pointer_cast(v)) + if (ValueEditor* e = v->getEditor()) DataEditor::DataEditor(Window* parent, int id, long style) : CardViewer(parent, id, style) diff --git a/src/render/value/boolean.cpp b/src/gui/value/choice.cpp similarity index 92% rename from src/render/value/boolean.cpp rename to src/gui/value/choice.cpp index 9c8c6903..09331cb3 100644 --- a/src/render/value/boolean.cpp +++ b/src/gui/value/choice.cpp @@ -6,6 +6,6 @@ // ----------------------------------------------------------------------------- : Includes -#include +#include // ----------------------------------------------------------------------------- : diff --git a/src/gui/value/choice.hpp b/src/gui/value/choice.hpp new file mode 100644 index 00000000..a89f021d --- /dev/null +++ b/src/gui/value/choice.hpp @@ -0,0 +1,25 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +#ifndef HEADER_GUI_VALUE_CHOICE +#define HEADER_GUI_VALUE_CHOICE + +// ----------------------------------------------------------------------------- : Includes + +#include +#include +#include + +// ----------------------------------------------------------------------------- : ChoiceValueEditor + +/// An editor 'control' for editing ChoiceValues +class ChoiceValueEditor : public ChoiceValueViewer, public ValueEditor { + public: + DECLARE_VALUE_EDITOR(Choice); +}; + +// ----------------------------------------------------------------------------- : EOF +#endif diff --git a/src/render/value/boolean.hpp b/src/gui/value/color.cpp similarity index 73% rename from src/render/value/boolean.hpp rename to src/gui/value/color.cpp index 89a13e98..b4dca507 100644 --- a/src/render/value/boolean.hpp +++ b/src/gui/value/color.cpp @@ -4,15 +4,8 @@ //| License: GNU General Public License 2 or later (see file COPYING) | //+----------------------------------------------------------------------------+ -#ifndef HEADER_RENDER_VALUE_BOOLEAN -#define HEADER_RENDER_VALUE_BOOLEAN - // ----------------------------------------------------------------------------- : Includes -#include +#include // ----------------------------------------------------------------------------- : - - -// ----------------------------------------------------------------------------- : EOF -#endif diff --git a/src/gui/value/color.hpp b/src/gui/value/color.hpp new file mode 100644 index 00000000..1b5c20a9 --- /dev/null +++ b/src/gui/value/color.hpp @@ -0,0 +1,25 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +#ifndef HEADER_GUI_VALUE_COLOR +#define HEADER_GUI_VALUE_COLOR + +// ----------------------------------------------------------------------------- : Includes + +#include +#include +#include + +// ----------------------------------------------------------------------------- : ColorValueEditor + +/// An editor 'control' for editing ColorValues +class ColorValueEditor : public ColorValueViewer, public ValueEditor { + public: + DECLARE_VALUE_EDITOR(Color); +}; + +// ----------------------------------------------------------------------------- : EOF +#endif diff --git a/src/gui/value/editor.cpp b/src/gui/value/editor.cpp index ac827fcf..d6ebf0b0 100644 --- a/src/gui/value/editor.cpp +++ b/src/gui/value/editor.cpp @@ -7,5 +7,26 @@ // ----------------------------------------------------------------------------- : Includes #include +#include +#include +#include +#include +#include +#include // ----------------------------------------------------------------------------- : ValueEditor + +// ----------------------------------------------------------------------------- : Type dispatch + +#define IMPLEMENT_MAKE_EDITOR(Type) \ + ValueViewerP Type##Style::makeEditor(DataEditor& parent, const StyleP& thisP) { \ + assert(thisP.get() == this); \ + return ValueViewerP(new Type##ValueEditor(parent, static_pointer_cast(thisP))); \ + } + +IMPLEMENT_MAKE_EDITOR(Text); +IMPLEMENT_MAKE_EDITOR(Choice); +IMPLEMENT_MAKE_EDITOR(MultipleChoice); +IMPLEMENT_MAKE_EDITOR(Color); +IMPLEMENT_MAKE_EDITOR(Image); +IMPLEMENT_MAKE_EDITOR(Symbol); diff --git a/src/gui/value/editor.hpp b/src/gui/value/editor.hpp index 7198a1a9..bbcbcc6f 100644 --- a/src/gui/value/editor.hpp +++ b/src/gui/value/editor.hpp @@ -10,32 +10,27 @@ // ----------------------------------------------------------------------------- : Includes #include +#include #include -class DataEditor; - // ----------------------------------------------------------------------------- : ValueEditor /// An editor 'control' for a single value on a card /** The inheritance diagram for derived editors looks like: - * ValueViewer - * ^ ^ - * / . - * / . - * SomeViewer ValueEditor - * ^ ^ - * \ / - * \ / - * SomeEditor + * ValueViewer + * ^ + * / + * / + * SomeValueViewer ValueEditor + * ^ ^ + * \ / + * \ / + * SomeValueEditor * - * Where ... is virtual inheritance and -- is normal inheritance. - * This is slightly different from the usual virtual inheritance recipe, but it should still work. + * Note that ValueEditor does NOT inherit from ValueViewer, because that leads to all kinds of problems */ -class ValueEditor : public virtual ValueViewer { +class ValueEditor { public: - /// Construct a ValueEditor, set the value at a later time - ValueEditor(DataEditor& parent, const StyleP& style); - // --------------------------------------------------- : Events /// This editor gains focus @@ -52,7 +47,7 @@ class ValueEditor : public virtual ValueViewer { virtual void onMouseWheel (RealPoint pos, wxMouseEvent& ev) {} /// Key events - virtual void onChar(wxKeyEvent ev); + virtual void onChar(wxKeyEvent ev) {} /// A menu item was selected virtual void onMenu(wxCommandEvent& ev) { ev.Skip(); } @@ -102,5 +97,18 @@ class ValueEditor : public virtual ValueViewer { virtual wxCursor cursor() const { return wxCursor(); } }; +// ----------------------------------------------------------------------------- : Utility + +#define DECLARE_VALUE_EDITOR(Type) \ + Type##ValueEditor(DataEditor& parent, const Type##StyleP& style) \ + : Type##ValueViewer(parent, style) \ + {} \ + virtual ValueEditor* getEditor() { return this; } \ + private: \ + inline DataEditor& editor() const { \ + return static_cast(viewer); \ + } \ + public: + // ----------------------------------------------------------------------------- : EOF #endif diff --git a/src/gui/value/image.cpp b/src/gui/value/image.cpp new file mode 100644 index 00000000..9f321112 --- /dev/null +++ b/src/gui/value/image.cpp @@ -0,0 +1,11 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +// ----------------------------------------------------------------------------- : Includes + +#include + +// ----------------------------------------------------------------------------- : diff --git a/src/gui/value/image.hpp b/src/gui/value/image.hpp new file mode 100644 index 00000000..e856f54c --- /dev/null +++ b/src/gui/value/image.hpp @@ -0,0 +1,25 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +#ifndef HEADER_GUI_VALUE_IMAGE +#define HEADER_GUI_VALUE_IMAGE + +// ----------------------------------------------------------------------------- : Includes + +#include +#include +#include + +// ----------------------------------------------------------------------------- : ImageValueEditor + +/// An editor 'control' for editing ImageValues +class ImageValueEditor : public ImageValueViewer, public ValueEditor { + public: + DECLARE_VALUE_EDITOR(Image); +}; + +// ----------------------------------------------------------------------------- : EOF +#endif diff --git a/src/gui/value/multiple_choice.cpp b/src/gui/value/multiple_choice.cpp new file mode 100644 index 00000000..2e38bc66 --- /dev/null +++ b/src/gui/value/multiple_choice.cpp @@ -0,0 +1,11 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +// ----------------------------------------------------------------------------- : Includes + +#include + +// ----------------------------------------------------------------------------- : diff --git a/src/gui/value/multiple_choice.hpp b/src/gui/value/multiple_choice.hpp new file mode 100644 index 00000000..4fa76774 --- /dev/null +++ b/src/gui/value/multiple_choice.hpp @@ -0,0 +1,25 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +#ifndef HEADER_GUI_VALUE_MULTIPLE_CHOICE +#define HEADER_GUI_VALUE_MULTIPLE_CHOICE + +// ----------------------------------------------------------------------------- : Includes + +#include +#include +#include + +// ----------------------------------------------------------------------------- : MultipleChoiceValueEditor + +/// An editor 'control' for editing MultipleChoiceValues +class MultipleChoiceValueEditor : public MultipleChoiceValueViewer, public ValueEditor { + public: + DECLARE_VALUE_EDITOR(MultipleChoice); +}; + +// ----------------------------------------------------------------------------- : EOF +#endif diff --git a/src/gui/value/symbol.cpp b/src/gui/value/symbol.cpp new file mode 100644 index 00000000..e16c2804 --- /dev/null +++ b/src/gui/value/symbol.cpp @@ -0,0 +1,11 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +// ----------------------------------------------------------------------------- : Includes + +#include + +// ----------------------------------------------------------------------------- : diff --git a/src/gui/value/symbol.hpp b/src/gui/value/symbol.hpp new file mode 100644 index 00000000..304bca44 --- /dev/null +++ b/src/gui/value/symbol.hpp @@ -0,0 +1,25 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +#ifndef HEADER_GUI_VALUE_SYMBOL +#define HEADER_GUI_VALUE_SYMBOL + +// ----------------------------------------------------------------------------- : Includes + +#include +#include +#include + +// ----------------------------------------------------------------------------- : SymbolValueEditor + +/// An editor 'control' for editing SymbolValues +class SymbolValueEditor : public SymbolValueViewer, public ValueEditor { + public: + DECLARE_VALUE_EDITOR(Symbol); +}; + +// ----------------------------------------------------------------------------- : EOF +#endif diff --git a/src/gui/value/text.cpp b/src/gui/value/text.cpp new file mode 100644 index 00000000..4112dbcb --- /dev/null +++ b/src/gui/value/text.cpp @@ -0,0 +1,11 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +// ----------------------------------------------------------------------------- : Includes + +#include + +// ----------------------------------------------------------------------------- : diff --git a/src/gui/value/text.hpp b/src/gui/value/text.hpp new file mode 100644 index 00000000..aa9f34f8 --- /dev/null +++ b/src/gui/value/text.hpp @@ -0,0 +1,26 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) 2001 - 2006 Twan van Laarhoven | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + +#ifndef HEADER_GUI_VALUE_TEXT +#define HEADER_GUI_VALUE_TEXT + +// ----------------------------------------------------------------------------- : Includes + +#include +#include +#include + +// ----------------------------------------------------------------------------- : TextValueEditor + +/// An editor 'control' for editing TextValues +class TextValueEditor : public TextValueViewer, public ValueEditor { + public: + DECLARE_VALUE_EDITOR(Text); + +}; + +// ----------------------------------------------------------------------------- : EOF +#endif diff --git a/src/mse.vcproj b/src/mse.vcproj index 817a9668..f0b686e0 100644 --- a/src/mse.vcproj +++ b/src/mse.vcproj @@ -578,6 +578,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -// ----------------------------------------------------------------------------- : +// ----------------------------------------------------------------------------- : MultipleChoiceValueViewer + +void MultipleChoiceValueViewer::draw(RotatedDC& dc) { + // TODO +} diff --git a/src/render/value/multiple_choice.hpp b/src/render/value/multiple_choice.hpp index 2892cc8b..429b7c7a 100644 --- a/src/render/value/multiple_choice.hpp +++ b/src/render/value/multiple_choice.hpp @@ -10,9 +10,18 @@ // ----------------------------------------------------------------------------- : Includes #include +#include +#include -// ----------------------------------------------------------------------------- : +// ----------------------------------------------------------------------------- : MultipleChoiceValueViewer +/// Viewer that displays a multiple choice value +class MultipleChoiceValueViewer : public ValueViewer { + public: + DECLARE_VALUE_VIEWER(MultipleChoice) : ValueViewer(parent,style) {} + + virtual void draw(RotatedDC& dc); +}; // ----------------------------------------------------------------------------- : EOF #endif diff --git a/src/render/value/symbol.cpp b/src/render/value/symbol.cpp index 462d1918..16eba402 100644 --- a/src/render/value/symbol.cpp +++ b/src/render/value/symbol.cpp @@ -8,4 +8,8 @@ #include -// ----------------------------------------------------------------------------- : +// ----------------------------------------------------------------------------- : SymbolValueViewer + +void SymbolValueViewer::draw(RotatedDC& dc) { + // TODO +} diff --git a/src/render/value/symbol.hpp b/src/render/value/symbol.hpp index 01860d4a..3d708222 100644 --- a/src/render/value/symbol.hpp +++ b/src/render/value/symbol.hpp @@ -10,9 +10,18 @@ // ----------------------------------------------------------------------------- : Includes #include +#include +#include -// ----------------------------------------------------------------------------- : +// ----------------------------------------------------------------------------- : SymbolValueViewer +/// Viewer that displays a symbol value +class SymbolValueViewer : public ValueViewer { + public: + DECLARE_VALUE_VIEWER(Symbol) : ValueViewer(parent,style) {} + + virtual void draw(RotatedDC& dc); +}; // ----------------------------------------------------------------------------- : EOF #endif diff --git a/src/render/value/viewer.cpp b/src/render/value/viewer.cpp index 1df4690e..6fb79f65 100644 --- a/src/render/value/viewer.cpp +++ b/src/render/value/viewer.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -52,20 +51,7 @@ bool ValueViewer::nativeLook() const { return viewer.nativeLook(); } -// ----------------------------------------------------------------------------- : Development/debug - -#ifdef _DEBUG - -// REMOVEME - -#include -#include -#include -#include -#include -#include -#include -#include +// ----------------------------------------------------------------------------- : Type dispatch #define IMPLEMENT_MAKE_VIEWER(Type) \ ValueViewerP Type##Style::makeViewer(DataViewer& parent, const StyleP& thisP) { \ @@ -73,24 +59,9 @@ bool ValueViewer::nativeLook() const { return ValueViewerP(new Type##ValueViewer(parent, static_pointer_cast(thisP))); \ } -//ValueViewerP ChoiceStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); } -ValueViewerP BooleanStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); } -ValueViewerP MultipleChoiceStyle::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); } -//ValueViewerP ColorStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); } -//ValueViewerP ImageStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); } IMPLEMENT_MAKE_VIEWER(Text); IMPLEMENT_MAKE_VIEWER(Choice); +IMPLEMENT_MAKE_VIEWER(MultipleChoice); IMPLEMENT_MAKE_VIEWER(Color); IMPLEMENT_MAKE_VIEWER(Image); -ValueViewerP SymbolStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); } -//ValueViewerP TextStyle ::makeViewer(DataViewer& parent, const StyleP& thisP) { return ValueViewerP(); } - -ValueEditorP ChoiceStyle ::makeEditor(DataEditor& parent, const StyleP& thisP) { return ValueEditorP(); } -ValueEditorP BooleanStyle ::makeEditor(DataEditor& parent, const StyleP& thisP) { return ValueEditorP(); } -ValueEditorP MultipleChoiceStyle::makeEditor(DataEditor& parent, const StyleP& thisP) { return ValueEditorP(); } -ValueEditorP ColorStyle ::makeEditor(DataEditor& parent, const StyleP& thisP) { return ValueEditorP(); } -ValueEditorP ImageStyle ::makeEditor(DataEditor& parent, const StyleP& thisP) { return ValueEditorP(); } -ValueEditorP SymbolStyle ::makeEditor(DataEditor& parent, const StyleP& thisP) { return ValueEditorP(); } -ValueEditorP TextStyle ::makeEditor(DataEditor& parent, const StyleP& thisP) { return ValueEditorP(); } - -#endif \ No newline at end of file +IMPLEMENT_MAKE_VIEWER(Symbol); diff --git a/src/render/value/viewer.hpp b/src/render/value/viewer.hpp index e00f73c8..d688efee 100644 --- a/src/render/value/viewer.hpp +++ b/src/render/value/viewer.hpp @@ -55,6 +55,9 @@ class ValueViewer { /// Called when an action is performed on the associated value virtual void onAction(const ValueAction&, bool undone) { onValueChange(); } + /// Convert this viewer to an editor, if possible + virtual ValueEditor* getEditor() { return 0; } + protected: DataViewer& viewer; ///< Our parent object StyleP styleP; ///< The style of this viewer @@ -75,7 +78,7 @@ class ValueViewer { // ----------------------------------------------------------------------------- : Utility #define DECLARE_VALUE_VIEWER(Type) \ - private: \ + protected: \ inline Type##Style& style() const { return static_cast< Type##Style&>(*styleP); } \ inline const Type##Value& value() const { return static_cast(*valueP); } \ inline const Type##Field& field() const { return style().field(); } \