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:
twanvl
2006-11-23 21:01:46 +00:00
parent c30dbec39e
commit edfe24a05f
17 changed files with 691 additions and 5 deletions
+13
View File
@@ -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);
+4 -1
View File
@@ -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();