
# 
# This file has been automatically generated by RaQt_maker V0.0.5.
# To modify and regenerate it, see the source code available here: 
#         https://github.com/yguillemot/RaQt_maker
# 



use NativeCall;
use Qt::QtWidgets::QtHelpers:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>;
use Qt::QtWidgets::QtWrappers:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>;
use Qt::QtWidgets::ConnectionManager:ver<0.0.5>:auth<cpan:YGUILLEMO>:api<2>;

#BEGIN_INSERTION_HERE
#ROLES_DECLARATION
use Qt::QtWidgets::QMouseEvent;
use Qt::QtWidgets::QEvent;
use Qt::QtWidgets::QPaintEvent;
use Qt::QtWidgets::QCloseEvent;
use Qt::QtWidgets::QResizeEvent;
#END_INSERTION_HERE



sub slotCallback(int32 $objectId, Str $slotName)
{
    $CM.objs{$objectId}."$slotName"();
}

sub slotCallbackInt(int32 $objectId, Str $slotName, int64 $i)
{
    $CM.objs{$objectId}."$slotName"($i);
}

sub slotCallbackInt2(int32 $objectId, Str $slotName, int64 $i1, int64 $i2)
{
    $CM.objs{$objectId}."$slotName"($i1, $i2);
}

sub slotCallbackStr(int32 $objectId, Str $slotName, Str $s)
{
# say "   *** slotCallbackStr slotName=$slotName s=$s";
    $CM.objs{$objectId}."$slotName"($s);
}

sub slotCallbackIntStr(int32 $objectId, Str $slotName, int64 $i, Str $s)
{
    $CM.objs{$objectId}."$slotName"($i, $s);
}

sub slotCallbackBool(int32 $objectId, Str $slotName, int8 $b)
{
    $CM.objs{$objectId}."$slotName"(?$b);
}

sub slotCallbackPointer(int32 $objectId, Str $slotName, Pointer $p)
{
    # say "   *** slotCallbackPointer objid=$objectId slotName=$slotName ", $p;

    $CM.objs{$objectId}."$slotName"($p);
}

#BEGIN_INSERTION_HERE
#CALLBACK_HANDLERS
sub slotCallbackQCloseEvent(int32 $objectId, Str $slotName, Pointer $event)
{
    my QCloseEvent $a1 = QCloseEvent.new($event);
    $CM.objs{$objectId}."$slotName"($a1)
}

sub slotCallbackQEvent(int32 $objectId, Str $slotName, Pointer $event)
{
    my QEvent $a1 = QEvent.new($event);
    $CM.objs{$objectId}."$slotName"($a1)
}

sub slotCallbackQMouseEvent(int32 $objectId, Str $slotName, Pointer $event)
{
    my QMouseEvent $a1 = QMouseEvent.new($event);
    $CM.objs{$objectId}."$slotName"($a1)
}

sub slotCallbackQPaintEvent(int32 $objectId, Str $slotName, Pointer $event)
{
    my QPaintEvent $a1 = QPaintEvent.new($event);
    $CM.objs{$objectId}."$slotName"($a1)
}

sub slotCallbackQResizeEvent(int32 $objectId, Str $slotName, Pointer $event)
{
    my QResizeEvent $a1 = QResizeEvent.new($event);
    $CM.objs{$objectId}."$slotName"($a1)
}

#END_INSERTION_HERE


sub slotCallbackComplexSig(int32 $objectId, Str $slotName, int32 $dataId)
{
    my ($capt, $ok) = $CM.getData($dataId);

    # say "Stack: " ~ Backtrace.new;
    # say "just before calling the slot ", $slotName;
    # say "ok = ", $ok;
    # say $capt.gist;
    # say "objectId : ", $objectId;
    # say $CM.objs{$objectId}.gist;

    if (!$ok) {
        note "INTERNAL ERROR: Data(Id=$dataId) not found in capture cache";
        # Should we die ???
        return;
    }
    $CM.objs{$objectId}."$slotName"(|$capt);
}


##############################################################################

# Called from QApplication.new
sub QtSetupEverything is export     # TODO : Should not be exported from here
{
    # Start the connections manager if needed
    $CM = ConnectionsManager.new if !$CM;

    # Register the addresses of the callbacks
    QWSetupSlotCallback(&slotCallback);
    QWSetupSlotCallbackInt(&slotCallbackInt);
    QWSetupSlotCallbackInt2(&slotCallbackInt2);
    QWSetupSlotCallbackStr(&slotCallbackStr);
    QWSetupSlotCallbackIntStr(&slotCallbackIntStr);
    QWSetupSlotCallbackBool(&slotCallbackBool);
    QWSetupSlotCallbackPointer(&slotCallbackPointer);
    QWSetupSlotCallbackComplexSig(&slotCallbackComplexSig);

    #BEGIN_INSERTION_HERE
    #INIT_CALLBACKS_POINTERS
    QWSetupSlotCallbackQCloseEvent(&slotCallbackQCloseEvent);
    QWSetupSlotCallbackQEvent(&slotCallbackQEvent);
    QWSetupSlotCallbackQMouseEvent(&slotCallbackQMouseEvent);
    QWSetupSlotCallbackQPaintEvent(&slotCallbackQPaintEvent);
    QWSetupSlotCallbackQResizeEvent(&slotCallbackQResizeEvent);
    #END_INSERTION_HERE

}

 
