mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Conversion to new ScriptableImage complete, this affected quite a bit, including the evil thumbnail thread;
Added StyleListener, so style changes are only propagated to interested viewers. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@329 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
#include <data/field/information.hpp>
|
||||
#include <util/error.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(StyleListener*);
|
||||
|
||||
// ----------------------------------------------------------------------------- : Field
|
||||
|
||||
Field::Field()
|
||||
@@ -120,6 +122,35 @@ void Style::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
// visible.initDependencies(ctx,dep);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : StyleListener
|
||||
|
||||
void Style::addListener(StyleListener* listener) {
|
||||
listeners.push_back(listener);
|
||||
}
|
||||
void Style::removeListener(StyleListener* listener) {
|
||||
listeners.erase(
|
||||
std::remove(
|
||||
listeners.begin(),
|
||||
listeners.end(),
|
||||
listener
|
||||
),
|
||||
listeners.end()
|
||||
);
|
||||
}
|
||||
void Style::tellListeners() {
|
||||
FOR_EACH(l, listeners) l->onStyleChange();
|
||||
}
|
||||
|
||||
StyleListener::StyleListener(const StyleP& style)
|
||||
: styleP(style)
|
||||
{
|
||||
style->addListener(this);
|
||||
}
|
||||
StyleListener::~StyleListener() {
|
||||
styleP->removeListener(this);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : Value
|
||||
|
||||
Value::~Value() {}
|
||||
|
||||
Reference in New Issue
Block a user