paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-users] defining event handlers


From: Asko Kauppi
Subject: [paragui-users] defining event handlers
Date: Fri, 5 Sep 2003 23:04:14 +0300


What is the preferred way of defining event handlers..? I just want to provide functions for (all) the events of PG_Application, PG_Widget etc. so that they can be forwarded to Lua domain instead (see below).

This works (or at least compiles) on Win32 but on OS X, i get linker warnings of duplicate functions. I used to try deriving a 'PG_MyApp' from 'PG_Application' but that runs into problems with 'PG_Button' etc. widget-based classes (= need to redeclare _all_ widget events for any widget-derived class).

Any nice ideas are welcome!


//---
// Event callbacks..
//
bool PG_Application::eventKeyDown( const SDL_KeyboardEvent* e )
{
bool ok= false;

    GLUA_CALLBACK2( this, "eventKeyDown" )
        {
        glua_pushEvent(e);
glua_call(); // Calls Lua code, any results to stack (LUA_MULTRET)

        ok= glua_getBoolean(1);
        }
    GLUA_CALLBACK_END

    return ok;
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]