summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2OptionPluginList.cpp
blob: cf9a60bf6d38411cebbb42fc343cc263b529f008 (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
34
#include "StdAfx.h"
#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;
}