summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2OptionPluginList.cpp
blob: d060b955f4702de390dc6cd67cca1e4667c8a004 (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(OptionEventType_0, towerDoc, NULL);
}

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

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

    return result;
}