mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Added drop down list box, specialization for color editor; todo: proper positioning & sizing, redrawing the arrow button
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@91 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <data/field/color.hpp>
|
||||
#include <script/script.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(ColorField::ChoiceP);
|
||||
|
||||
@@ -23,6 +24,13 @@ String ColorField::typeName() const {
|
||||
return _("color");
|
||||
}
|
||||
|
||||
void ColorField::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
Field ::initDependencies(ctx, dep);
|
||||
script .initDependencies(ctx, dep);
|
||||
default_script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_REFLECTION(ColorField) {
|
||||
REFLECT_BASE(Field);
|
||||
REFLECT(script);
|
||||
@@ -67,6 +75,11 @@ String ColorValue::toString() const {
|
||||
}
|
||||
return _("<color>");
|
||||
}
|
||||
bool ColorValue::update(Context& ctx) {
|
||||
Value::update(ctx);
|
||||
return field().default_script.invokeOnDefault(ctx, value)
|
||||
| field(). script.invokeOn(ctx, value);
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_NAMELESS(ColorValue) {
|
||||
REFLECT_NAMELESS(value);
|
||||
|
||||
@@ -34,7 +34,9 @@ class ColorField : public Field {
|
||||
vector<ChoiceP> choices; ///< Color choices available
|
||||
bool allow_custom; ///< Are colors not in the list of choices allowed?
|
||||
String default_name; ///< Name of "default" value
|
||||
|
||||
|
||||
virtual void initDependencies(Context&, const Dependency&) const;
|
||||
|
||||
private:
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
@@ -77,6 +79,7 @@ class ColorValue : public Value {
|
||||
Defaultable<Color> value; ///< The value
|
||||
|
||||
virtual String toString() const;
|
||||
virtual bool update(Context&);
|
||||
|
||||
private:
|
||||
DECLARE_REFLECTION();
|
||||
|
||||
Reference in New Issue
Block a user