### ----------------------------------------------------
### -- Qt::QtWidgets
### -- Licenses: GPL-3.0-or-later
### -- Authors: Yves Guillemot <yc.guillemot@wanadoo.fr>
### -- File: lib/Qt/QtWidgets/QtBase.rakumod
### ----------------------------------------------------

# 
# This file has been automatically generated by RaQt_maker V0.0.7.
# 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.7>:auth<zef:yguillemot>:api<2>;


# This class is parent of everything related to Qt.
# It owns a pointer to a Qt object.
class QtBase:ver<0.0.7>:auth<zef:yguillemot>:api<2>
    is export {

    has Pointer $.address is rw;
    has Bool $.ownedByRaku is rw;


    method validateCallBacks()
    {
        # say "--- validateCallbacks for object ", self.^name;

        my @uc = self;      # List of user's classes
        my @qc;             # List of Qt classes
        for self.^parents -> $cl {
            if $cl.raku (elem) $qtClasses {
                @qc.push: $cl;
            } else {
                @uc.push: $cl;
            }
        }

        # Create a set of possible callbacks
        my @pcb;
        for @qc>>.raku -> $c {
            @pcb.append: |%callbacks{$c} if %callbacks{$c}:exists;
        }
        # say "PCB : "; @pcb.say;
        my $spcb = set @pcb;

        # Create a set of user's methods
        my @um;
        for @uc -> $c {
            @um.append: $c.^methods(:local)>>.name
        }
        # say "UM : "; @um.say;
        my $sum = set @um;

        # Validate the callbacks found in the user's code
        for ($sum (&) $spcb).keys -> $m {
            self.validateCB($m);
            # say "       $m";
        }
    }

}


 


