mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
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
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| 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 <render/value/boolean.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
@@ -1,18 +0,0 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| 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_RENDER_VALUE_BOOLEAN
|
||||
#define HEADER_RENDER_VALUE_BOOLEAN
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
@@ -48,4 +48,4 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
|
||||
align_in_rect(ALIGN_MIDDLE_LEFT, RealSize(0, dc.GetCharHeight()), style().getRect()) + RealSize(margin, 0)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,5 @@ class ColorValueViewer : public ValueViewer {
|
||||
virtual bool containsPoint(const RealPoint& p) const;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,5 @@ class ImageValueViewer : public ValueViewer {
|
||||
static Bitmap imagePlaceholder(const Rotation& rot, UInt w, UInt h, bool editing);
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
@@ -8,4 +8,8 @@
|
||||
|
||||
#include <render/value/multiple_choice.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
// ----------------------------------------------------------------------------- : MultipleChoiceValueViewer
|
||||
|
||||
void MultipleChoiceValueViewer::draw(RotatedDC& dc) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -10,9 +10,18 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <render/value/viewer.hpp>
|
||||
#include <data/field/multiple_choice.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
// ----------------------------------------------------------------------------- : 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
|
||||
|
||||
@@ -8,4 +8,8 @@
|
||||
|
||||
#include <render/value/symbol.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
// ----------------------------------------------------------------------------- : SymbolValueViewer
|
||||
|
||||
void SymbolValueViewer::draw(RotatedDC& dc) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -10,9 +10,18 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <render/value/viewer.hpp>
|
||||
#include <data/field/symbol.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
// ----------------------------------------------------------------------------- : 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
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <render/value/text.hpp>
|
||||
#include <render/value/choice.hpp>
|
||||
#include <render/value/multiple_choice.hpp>
|
||||
#include <render/value/boolean.hpp>
|
||||
#include <render/value/image.hpp>
|
||||
#include <render/value/symbol.hpp>
|
||||
#include <render/value/color.hpp>
|
||||
@@ -52,20 +51,7 @@ bool ValueViewer::nativeLook() const {
|
||||
return viewer.nativeLook();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Development/debug
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
// REMOVEME
|
||||
|
||||
#include <data/field.hpp>
|
||||
#include <data/field/choice.hpp>
|
||||
#include <data/field/boolean.hpp>
|
||||
#include <data/field/multiple_choice.hpp>
|
||||
#include <data/field/color.hpp>
|
||||
#include <data/field/image.hpp>
|
||||
#include <data/field/symbol.hpp>
|
||||
#include <data/field/text.hpp>
|
||||
// ----------------------------------------------------------------------------- : 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<Type##Style>(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
|
||||
IMPLEMENT_MAKE_VIEWER(Symbol);
|
||||
|
||||
@@ -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<const Type##Value&>(*valueP); } \
|
||||
inline const Type##Field& field() const { return style().field(); } \
|
||||
|
||||
Reference in New Issue
Block a user