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:
twanvl
2006-11-19 19:41:26 +00:00
parent ed336dea06
commit a218251fd6
27 changed files with 436 additions and 71 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
#define FOR_EACH_EDITOR \
FOR_EACH(v, viewers) \
if (ValueEditorP = static_pointer_cast<ValueEditor>(v))
if (ValueEditor* e = v->getEditor())
DataEditor::DataEditor(Window* parent, int id, long style)
: CardViewer(parent, id, style)
+11
View File
@@ -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 <gui/value/choice.hpp>
// ----------------------------------------------------------------------------- :
+25
View File
@@ -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 <util/prec.hpp>
#include <gui/value/editor.hpp>
#include <render/value/choice.hpp>
// ----------------------------------------------------------------------------- : ChoiceValueEditor
/// An editor 'control' for editing ChoiceValues
class ChoiceValueEditor : public ChoiceValueViewer, public ValueEditor {
public:
DECLARE_VALUE_EDITOR(Choice);
};
// ----------------------------------------------------------------------------- : EOF
#endif
+11
View File
@@ -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 <gui/value/color.hpp>
// ----------------------------------------------------------------------------- :
+25
View File
@@ -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 <util/prec.hpp>
#include <gui/value/editor.hpp>
#include <render/value/color.hpp>
// ----------------------------------------------------------------------------- : ColorValueEditor
/// An editor 'control' for editing ColorValues
class ColorValueEditor : public ColorValueViewer, public ValueEditor {
public:
DECLARE_VALUE_EDITOR(Color);
};
// ----------------------------------------------------------------------------- : EOF
#endif
+21
View File
@@ -7,5 +7,26 @@
// ----------------------------------------------------------------------------- : Includes
#include <gui/value/editor.hpp>
#include <gui/value/text.hpp>
#include <gui/value/choice.hpp>
#include <gui/value/multiple_choice.hpp>
#include <gui/value/image.hpp>
#include <gui/value/symbol.hpp>
#include <gui/value/color.hpp>
// ----------------------------------------------------------------------------- : 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<Type##Style>(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);
+26 -18
View File
@@ -10,32 +10,27 @@
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <gui/control/card_editor.hpp>
#include <render/value/viewer.hpp>
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<DataEditor&>(viewer); \
} \
public:
// ----------------------------------------------------------------------------- : EOF
#endif
+11
View File
@@ -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 <gui/value/image.hpp>
// ----------------------------------------------------------------------------- :
+25
View File
@@ -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 <util/prec.hpp>
#include <gui/value/editor.hpp>
#include <render/value/image.hpp>
// ----------------------------------------------------------------------------- : ImageValueEditor
/// An editor 'control' for editing ImageValues
class ImageValueEditor : public ImageValueViewer, public ValueEditor {
public:
DECLARE_VALUE_EDITOR(Image);
};
// ----------------------------------------------------------------------------- : EOF
#endif
+11
View File
@@ -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 <gui/value/multiple_choice.hpp>
// ----------------------------------------------------------------------------- :
+25
View File
@@ -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 <util/prec.hpp>
#include <gui/value/editor.hpp>
#include <render/value/multiple_choice.hpp>
// ----------------------------------------------------------------------------- : MultipleChoiceValueEditor
/// An editor 'control' for editing MultipleChoiceValues
class MultipleChoiceValueEditor : public MultipleChoiceValueViewer, public ValueEditor {
public:
DECLARE_VALUE_EDITOR(MultipleChoice);
};
// ----------------------------------------------------------------------------- : EOF
#endif
+11
View File
@@ -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 <gui/value/symbol.hpp>
// ----------------------------------------------------------------------------- :
+25
View File
@@ -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 <util/prec.hpp>
#include <gui/value/editor.hpp>
#include <render/value/symbol.hpp>
// ----------------------------------------------------------------------------- : SymbolValueEditor
/// An editor 'control' for editing SymbolValues
class SymbolValueEditor : public SymbolValueViewer, public ValueEditor {
public:
DECLARE_VALUE_EDITOR(Symbol);
};
// ----------------------------------------------------------------------------- : EOF
#endif
+11
View File
@@ -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 <gui/value/text.hpp>
// ----------------------------------------------------------------------------- :
+26
View File
@@ -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 <util/prec.hpp>
#include <gui/value/editor.hpp>
#include <render/value/text.hpp>
// ----------------------------------------------------------------------------- : TextValueEditor
/// An editor 'control' for editing TextValues
class TextValueEditor : public TextValueViewer, public ValueEditor {
public:
DECLARE_VALUE_EDITOR(Text);
};
// ----------------------------------------------------------------------------- : EOF
#endif