summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2OptionPluginList.cpp
blob: 13c08e6e31e176a7fa450e90ebec29d7ac853451 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "T2OptionPlugin.h"
#include "T2OptionPluginList.h"

T2OptionPluginList::T2OptionPluginList()
    : LArray(sizeof(T2OptionPlugin *))
{
}

/*virtual*/ T2OptionPluginList::~T2OptionPluginList() {
}

void T2OptionPluginList::Add(T2OptionPlugin* plugin) {
    if (!plugin)
        return;

    InsertItemsAt(1, mItemCount + 1, &plugin);
}

void T2OptionPluginList::OnIdle(T2TowerDoc* towerDoc) {
    DispatchEvent(kIdleOptionEvent, towerDoc, NULL);
}

BOOL T2OptionPluginList::DispatchEvent(OPTIONEVENTTYPE eventType, T2TowerDoc* towerDoc, void* data) {
    LArrayIterator iterator(*this);
    BOOL result = true;

    T2OptionPlugin *thePlugin;
    while (iterator.Next(&thePlugin)) {
        result = result && thePlugin->OnEvent(eventType, towerDoc, data);
    }

    return result;
}