Developer forums (C::B DEVELOPMENT STRICTLY!) > Contributions to C::B

Add event order(high, mid and low)?

(1/1)

mmkider:
I think about event order is requirement.

If I use the same event  into my two plug-ins,I can't estimate this event order because that depend on the name of plugin.

I only force to change my  plug-in's name or create a new event to use.
However, I think it's not general if event order is important.

Any suggest ??

Thank you.

MortenMacFly:

--- Quote from: mmkider on April 01, 2009, 06:10:54 am ---I think about event order is requirement. [...]

--- End quote ---
I am sorry to say this but (at least) I did not understand what you mean exactly. What events are you talking about? SDK events or self-made events? And why should the order of an event matter? Can you provide an example?

mmkider:

--- Quote from: MortenMacFly on April 10, 2009, 07:49:06 pm ---
--- Quote from: mmkider on April 01, 2009, 06:10:54 am ---I think about event order is requirement. [...]

--- End quote ---
I am sorry to say this but (at least) I did not understand what you mean exactly. What events are you talking about? SDK events or self-made events? And why should the order of an event matter? Can you provide an example?

--- End quote ---

For the sdk of codeblocks, codeblocks event will be stored in the map.
sometime these events should have priority for some plug-in.

For some of the plug-in dependencies, call evnets need a more specific order.

My english is poor, I post some pesudo-code for my mind.

Thank you for your reply.  :lol:


--- Code: ---enum EVENT_PRIORITY
{
    LOW=0,
    MID,
   HIGH
};


void RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksEvent>* functor,EVENT_PRIORITY priority=EVENT_PRIORITY::LOW);


void Manager::RegisterEventSink(wxEventType eventType, IEventFunctorBase<CodeBlocksEvent>* functor,EVENT_PRIORITY priority)
{
m_EventSinks[priority][eventType].push_back(functor);
}


--- End code ---


--- Code: ---        EventSinksMap m_EventSinks[2];

--- End code ---


--- Code: ---Manager::Get()->RegisterEventSink(cbEVT_EDITOR_OPEN, new cbEventFunctor<DebuggerGDB, CodeBlocksEvent>(this, &DebuggerGDB::OnEditorOpened),EVENT_PRIORITY::MID);

--- End code ---



Navigation

[0] Message Index

Go to full version