mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -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:
+2
-2
@@ -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<Value>(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) \
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <render/value/boolean.hpp>
|
||||
#include <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 <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
|
||||
@@ -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 <util/prec.hpp>
|
||||
#include <gui/value/color.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
@@ -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
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
// ----------------------------------------------------------------------------- :
|
||||
@@ -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
|
||||
+150
@@ -578,6 +578,66 @@
|
||||
<Filter
|
||||
Name="value"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\gui\value\choice.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\choice.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\color.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\color.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\editor.cpp">
|
||||
<FileConfiguration
|
||||
@@ -626,6 +686,96 @@
|
||||
<File
|
||||
RelativePath=".\gui\value\image.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\multiple_choice.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\multiple_choice.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\symbol.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)4.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)4.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)4.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)4.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\symbol.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\text.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release Unicode|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)/$(InputName)2.obj"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\gui\value\text.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
||||
@@ -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