News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Add event order(high, mid and low)?

Started by mmkider, April 01, 2009, 06:10:54 AM

Previous topic - Next topic

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. [...]
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?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

mmkider

#2
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. [...]
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?

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:


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);
}




        EventSinksMap m_EventSinks[2];



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