start with implementing fields

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@12 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-09 16:21:38 +00:00
parent 35ece4674d
commit b6c7e5bd01
16 changed files with 453 additions and 21 deletions
+60 -3
View File
@@ -10,20 +10,77 @@
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/reflect.hpp>
#ifndef HEADER_DATA_CARD
DECLARE_POINTER_TYPE(Field);
DECLARE_POINTER_TYPE(Style);
DECLARE_POINTER_TYPE(Value);
#endif
// ----------------------------------------------------------------------------- : Field
/// Information on how to store a value
class Field {
public:
UInt index; // used by IndexMap
Field();
virtual ~Field();
UInt index; ///< Used by IndexMap
String name; ///< Name of the field, for refering to it from scripts and files
String description; ///< Description, used in status bar
bool editable; ///< Can values of this field be edited?
bool saveValue; ///< Should values of this field be written to files? Can be false for script generated fields.
bool showStatistics; ///< Should this field appear as a group by choice in the statistics panel?
bool identifying; ///< Does this field give Card::identification()?
int cardListColumn; ///< What column to use in the card list? -1 = don't list
UInt cardListWidth; ///< Width of the card list column (pixels).
bool cardListAllow; ///< Is this field allowed to appear in the card list.
String cardListName; ///< Alternate name to use in card list.
// Alignment cardListAlign; ///< Alignment of the card list colummn.
int tabIndex; ///< Tab index in editor
// Vector<DependendScript> dependendScripts; // scripts that depend on values of this field
/// Creates a new Value corresponding to this Field
/** thisP is a smart pointer to this */
virtual ValueP newValue(FieldP thisP) = 0;
/// Creates a new Style corresponding to this Field
/** thisP is a smart pointer to this */
virtual StyleP newStyle(FieldP thisP) = 0;
/// create a copy of this field
virtual FieldP clone() = 0;
/// Type of this field
virtual String typeName() = 0;
private:
DECLARE_REFLECTION_VIRTUAL();
};
template <>
shared_ptr<Field> read_new<Field>(Reader& reader);
// ----------------------------------------------------------------------------- : Style
class Style {
public:
virtual ~Style();
private:
DECLARE_REFLECTION_VIRTUAL();
};
void initObject(const FieldP&, StyleP&);
// ----------------------------------------------------------------------------- : Value
class Value {
public:
virtual ~Value();
/// Create a copy of this value
virtual ValueP clone() = 0;
private:
DECLARE_REFLECTION_VIRTUAL();
};
void initObject(const FieldP&, ValueP&);