////
//  This file was generated by VCL Generator
//  Copyright 1998 - Morgan Martinet
//  06/07/1999 07:59:02
//  it declares the content of the module _ImgList
////

unit Python_ImgList;

interface

uses
   Windows,
   Graphics,
   ImgList,
   Classes,
   SysUtils,
   PythonEngine;

type
  TModule_ImgList = class( TPythonModule )
  public
    procedure Initialize; override;
  end;

  function TChangeLink_ReadAttribute( Self : TChangeLink; argSelf : PPyObject; key : PChar ) : PPyObject;
  function TChangeLink_WriteAttribute( Self : TChangeLink; argSelf : PPyObject; key : PChar; value : PPyObject ) : PPyObject;
  function TCustomImageList_ReadAttribute( Self : TCustomImageList; argSelf : PPyObject; key : PChar ) : PPyObject;
  function TCustomImageList_WriteAttribute( Self : TCustomImageList; argSelf : PPyObject; key : PChar; value : PPyObject ) : PPyObject;

  procedure Init( AOwner : TComponent; AEngine : TPythonEngine ); 

implementation

uses
   Delphi_Classes,
   Python_Classes,
   Delphi_Graphics,
   Python_Graphics,
   Delphi_System,
   Delphi_ImgList,
   Python_System,
   Py_Misc,
   PyRecords,
   PyDelphiAssoc;

var
  IsInitialized : Boolean;
  gImgList : TModule_ImgList;
  gTChangeLink : TMethodsContainer;
  gTCustomImageList : TMethodsContainer;

procedure Init( AOwner : TComponent; AEngine : TPythonEngine ); 
begin
  if IsInitialized then
    Exit;
  IsInitialized := True;
  gImgList := TModule_ImgList.Create( AOwner );
  with gImgList do
    begin
      Engine := AEngine;
      ModuleName := '_ImgList';
    end;
  gTChangeLink := TMethodsContainer.Create( AOwner );
  gTCustomImageList := TMethodsContainer.Create( AOwner );
end;

///////////// Functions for class TChangeLink //////////////////

function TChangeLink_Create( Self, Args : PPyObject ) : PPyObject; cdecl; far;
var
  newObj : TPyChangeLink;
  _argSelf : PPyObject;
begin
  Result := nil;
  with GetPythonEngine do begin
    if PyArg_ParseTuple( Args, 'O:TChangeLink.Create', [ @_argSelf       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    newObj := TPyChangeLink.Create;
    DefInterfaceObject( newObj, _argSelf, True );
    Result := _argSelf;
    Py_XIncRef( Result );
  end;
end;

function TChangeLink_GetAttr( Self, Args : PPyObject ) : PPyObject; cdecl; far;
var
  argSelf : PPyObject;
  argKey : PChar;
  obj : TObject;
  realObj : TChangeLink;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Extract args
    if PyArg_ParseTuple( Args, 'Os', [@argSelf, @argKey]) = 0 then
      Exit;
    // Check Delphi object
    obj := GetObjectOf( argSelf );
    if not Assigned(obj) then begin
      ErrorNoObject( argSelf );
      Exit;
    end;
    // Check object type
    if not( obj is TChangeLink) then begin
      ErrorWrongExpectedType( argSelf, 'TChangeLink' );
      Exit;
    end;
    realObj := TChangeLink(obj);
    // Check attribute
    Result := TChangeLink_ReadAttribute( realObj, argSelf, argKey );
    // Check result
    if not Assigned(Result) and (PyErr_Occurred = nil) then
      UnknownProperty( argSelf, argKey );
  end;
end;

function TChangeLink_ReadAttribute( Self : TChangeLink; argSelf : PPyObject; key : PChar ) : PPyObject;
begin
  with GetPythonEngine do begin
    if gTChangeLink.MethodCount > 0 then 
      Result := Py_FindMethod( gTChangeLink.MethodsData, argSelf, key)
    else Result := nil;
    if Assigned(Result) then Exit else PyErr_Clear;
    if CompareText( key, 'Properties') = 0 then Result := GetPropList( Self )
    else if CompareText( key, 'OnChange' ) = 0 then begin ErrorTypeNotHandled( argSelf, key, 'TNotifyEvent' ); Result := nil; end
    else if CompareText( key, 'Sender' ) = 0 then Result := GetPythonObject( Self.Sender, 'ImgList', 'TCustomImageList' )
    else Result := TObject_ReadAttribute( Self, argSelf, key );
  end;
end;

function TChangeLink_SetAttr( Self, Args : PPyObject ) : PPyObject; cdecl; far;
var
  argSelf, argValue : PPyObject;
  argKey : PChar;
  obj : TObject;
  realObj : TChangeLink;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Extract args
    if PyArg_ParseTuple( Args, 'OsO', [@argSelf, @argKey, @argValue]) = 0 then
      Exit;
    // Check Delphi object
    obj := GetObjectOf( argSelf );
    if not Assigned(obj) then begin
      ErrorNoObject( argSelf );
      Exit;
    end;
    // Check object type
    if not( obj is TChangeLink) then begin
      ErrorWrongExpectedType( argSelf, 'TChangeLink' );
      Exit;
    end;
    realObj := TChangeLink(obj);
    // Check attribute
    Result := TChangeLink_WriteAttribute( realObj, argSelf, argKey, argValue );
    // Check result
    if not Assigned(Result) and (PyErr_Occurred = nil) then
      Result := AddNewMember( argSelf, argKey, argValue );
  end;
end;

function TChangeLink_WriteAttribute( Self : TChangeLink; argSelf : PPyObject; key : PChar; value : PPyObject ) : PPyObject;
var
  obj : TObject;
begin
  Result := nil;
  obj := nil;
  with GetPythonEngine do begin
    if False then begin
    end else if CompareText( key, 'OnChange' ) = 0 then begin
      if Value = Py_None then begin
        Self.OnChange := nil;
        Result := AddNewMember( argSelf, key, value );
      end else if CheckMethod( Value ) then begin
        if Self is TPyChangeLink then
          with TPyChangeLink(Self) do
            OnChange := EventOnChange;
        Result := AddNewMember( argSelf, key, value );
      end else ErrorBadEventType( argSelf, key );
    end else if CompareText( key, 'Sender' ) = 0 then begin
      obj := GetObjectOf(value);
      if obj is TCustomImageList then begin
        Self.Sender := TCustomImageList( obj );
        Result := PyInt_FromLong(0);
      end else ErrorWrongPropertyType( argSelf, obj, 'Sender', 'TCustomImageList' );
    end else Result := TObject_WriteAttribute( Self, argSelf, key, value );
  end;
end;

function TChangeLink_Change( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TChangeLink;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TChangeLink) then begin
      ErrorWrongExpectedType( Self, 'TChangeLink' );
      Exit;
    end;
    realObj := TChangeLink(obj);
    realObj.Change;
    Result := ReturnNone;
  end;
end;

///////////// Functions for class TCustomImageList //////////////////

function TCustomImageList_Create( Self, Args : PPyObject ) : PPyObject; cdecl; far;
var
  newObj : TPyCustomImageList;
  _argSelf : PPyObject;
  _argAOwner : PPyObject;
  _objAOwner : TComponent;
begin
  Result := nil;
  with GetPythonEngine do begin
    if PyArg_ParseTuple( Args, 'OO:TCustomImageList.Create', [ @_argSelf,
                  @_argAOwner       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objAOwner := GetObjectOf( _argAOwner ) as TComponent;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    newObj := TPyCustomImageList.Create( _objAOwner );
    DefInterfaceObject( newObj, _argSelf, True );
    Result := _argSelf;
    Py_XIncRef( Result );
  end;
end;

function TCustomImageList_CreateSize( Self, Args : PPyObject ) : PPyObject; cdecl; far;
var
  newObj : TPyCustomImageList;
  _argSelf : PPyObject;
  _argAWidth : Integer;
  _argAHeight : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    if PyArg_ParseTuple( Args, 'Oii:TCustomImageList.CreateSize', [ @_argSelf,
                  @_argAWidth,
                  @_argAHeight       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    newObj := TPyCustomImageList.CreateSize( Integer(_argAWidth), Integer(_argAHeight) );
    DefInterfaceObject( newObj, _argSelf, True );
    Result := _argSelf;
    Py_XIncRef( Result );
  end;
end;

function TCustomImageList_GetAttr( Self, Args : PPyObject ) : PPyObject; cdecl; far;
var
  argSelf : PPyObject;
  argKey : PChar;
  obj : TObject;
  realObj : TCustomImageList;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Extract args
    if PyArg_ParseTuple( Args, 'Os', [@argSelf, @argKey]) = 0 then
      Exit;
    // Check Delphi object
    obj := GetObjectOf( argSelf );
    if not Assigned(obj) then begin
      ErrorNoObject( argSelf );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( argSelf, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    // Check attribute
    Result := TCustomImageList_ReadAttribute( realObj, argSelf, argKey );
    // Check result
    if not Assigned(Result) and (PyErr_Occurred = nil) then
      UnknownProperty( argSelf, argKey );
  end;
end;

function TCustomImageList_ReadAttribute( Self : TCustomImageList; argSelf : PPyObject; key : PChar ) : PPyObject;
begin
  with GetPythonEngine do begin
    if gTCustomImageList.MethodCount > 0 then 
      Result := Py_FindMethod( gTCustomImageList.MethodsData, argSelf, key)
    else Result := nil;
    if Assigned(Result) then Exit else PyErr_Clear;
    if CompareText( key, 'Properties') = 0 then Result := GetPropList( Self )
    else if CompareText( key, 'Count' ) = 0 then Result := VariantAsPyObject( Self.Count )
    else if CompareText( key, 'Handle' ) = 0 then begin ErrorTypeNotHandled( argSelf, key, 'HImageList' ); Result := nil; end
    else if CompareText( key, 'AllocBy' ) = 0 then Result := VariantAsPyObject( Self.AllocBy )
    else if CompareText( key, 'BlendColor' ) = 0 then Result := VariantAsPyObject( Integer( Self.BlendColor ) )
    else if CompareText( key, 'BkColor' ) = 0 then Result := VariantAsPyObject( Integer( Self.BkColor ) )
    else if CompareText( key, 'DrawingStyle' ) = 0 then Result := VariantAsPyObject( Integer( Self.DrawingStyle ) )
    else if CompareText( key, 'Height' ) = 0 then Result := VariantAsPyObject( Self.Height )
    else if CompareText( key, 'ImageType' ) = 0 then Result := VariantAsPyObject( Integer( Self.ImageType ) )
    else if CompareText( key, 'Masked' ) = 0 then Result := VariantAsPyObject( Self.Masked )
    else if CompareText( key, 'ShareImages' ) = 0 then Result := VariantAsPyObject( Self.ShareImages )
    else if CompareText( key, 'Width' ) = 0 then Result := VariantAsPyObject( Self.Width )
    else if CompareText( key, 'OnChange' ) = 0 then begin ErrorTypeNotHandled( argSelf, key, 'TNotifyEvent' ); Result := nil; end
    else Result := TComponent_ReadAttribute( Self, argSelf, key );
  end;
end;

function TCustomImageList_SetAttr( Self, Args : PPyObject ) : PPyObject; cdecl; far;
var
  argSelf, argValue : PPyObject;
  argKey : PChar;
  obj : TObject;
  realObj : TCustomImageList;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Extract args
    if PyArg_ParseTuple( Args, 'OsO', [@argSelf, @argKey, @argValue]) = 0 then
      Exit;
    // Check Delphi object
    obj := GetObjectOf( argSelf );
    if not Assigned(obj) then begin
      ErrorNoObject( argSelf );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( argSelf, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    // Check attribute
    Result := TCustomImageList_WriteAttribute( realObj, argSelf, argKey, argValue );
    // Check result
    if not Assigned(Result) and (PyErr_Occurred = nil) then
      Result := AddNewMember( argSelf, argKey, argValue );
  end;
end;

function TCustomImageList_WriteAttribute( Self : TCustomImageList; argSelf : PPyObject; key : PChar; value : PPyObject ) : PPyObject;
var
  obj : TObject;
begin
  Result := nil;
  obj := nil;
  with GetPythonEngine do begin
    if False then begin
    end else if CompareText( key, 'Count' ) = 0 then begin
      ErrorPropReadOnly( argSelf, key );
    end else if CompareText( key, 'Handle' ) = 0 then begin
      ErrorTypeNotHandled( argSelf, key, 'HImageList' );
    end else if CompareText( key, 'AllocBy' ) = 0 then begin
      Self.AllocBy := PyObjectAsVariant( value );
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'BlendColor' ) = 0 then begin
      Self.BlendColor := TColor(PyObjectAsVariant( value ));
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'BkColor' ) = 0 then begin
      Self.BkColor := TColor(PyObjectAsVariant( value ));
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'DrawingStyle' ) = 0 then begin
      Self.DrawingStyle := TDrawingStyle(PyObjectAsVariant( value ));
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'Height' ) = 0 then begin
      Self.Height := PyObjectAsVariant( value );
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'ImageType' ) = 0 then begin
      Self.ImageType := TImageType(PyObjectAsVariant( value ));
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'Masked' ) = 0 then begin
      Self.Masked := PyObjectAsVariant( value );
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'ShareImages' ) = 0 then begin
      Self.ShareImages := PyObjectAsVariant( value );
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'Width' ) = 0 then begin
      Self.Width := PyObjectAsVariant( value );
      Result := PyInt_FromLong(0);
    end else if CompareText( key, 'OnChange' ) = 0 then begin
      if Value = Py_None then begin
        Self.OnChange := nil;
        Result := AddNewMember( argSelf, key, value );
      end else if CheckMethod( Value ) then begin
        if Self is TPyCustomImageList then
          with TPyCustomImageList(Self) do
            OnChange := EventOnChange;
        Result := AddNewMember( argSelf, key, value );
      end else ErrorBadEventType( argSelf, key );
    end else Result := TComponent_WriteAttribute( Self, argSelf, key, value );
  end;
end;

function TCustomImageList_Assign( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argSource : PPyObject;
  _objSource : TPersistent;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'O:TCustomImageList.Assign', [ 
                  @_argSource       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objSource := GetObjectOf( _argSource ) as TPersistent;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.Assign( _objSource );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_Add( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Integer;
  _argImage : PPyObject;
  _objImage : TBitmap;
  _argMask : PPyObject;
  _objMask : TBitmap;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'OO:TCustomImageList.Add', [ 
                  @_argImage,
                  @_argMask       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TBitmap;
    _objMask := GetObjectOf( _argMask ) as TBitmap;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.Add( _objImage, _objMask );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_AddIcon( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Integer;
  _argImage : PPyObject;
  _objImage : TIcon;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'O:TCustomImageList.AddIcon', [ 
                  @_argImage       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TIcon;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.AddIcon( _objImage );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_AddImages( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argValue : PPyObject;
  _objValue : TCustomImageList;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'O:TCustomImageList.AddImages', [ 
                  @_argValue       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objValue := GetObjectOf( _argValue ) as TCustomImageList;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.AddImages( _objValue );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_AddMasked( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Integer;
  _argImage : PPyObject;
  _objImage : TBitmap;
  _argMaskColor : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'Oi:TCustomImageList.AddMasked', [ 
                  @_argImage,
                  @_argMaskColor       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TBitmap;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.AddMasked( _objImage, TColor(_argMaskColor) );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_Clear( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.Clear;
    Result := ReturnNone;
  end;
end;

function TCustomImageList_Delete( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'i:TCustomImageList.Delete', [ 
                  @_argIndex       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.Delete( Integer(_argIndex) );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_Draw( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argCanvas : PPyObject;
  _objCanvas : TCanvas;
  _argX : Integer;
  _argY : Integer;
  _argIndex : Integer;
  _argEnabled : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'Oiiii:TCustomImageList.Draw', [ 
                  @_argCanvas,
                  @_argX,
                  @_argY,
                  @_argIndex,
                  @_argEnabled       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objCanvas := GetObjectOf( _argCanvas ) as TCanvas;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.Draw( _objCanvas, Integer(_argX), Integer(_argY), Integer(_argIndex), Boolean(_argEnabled) );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_DrawOverlay( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argCanvas : PPyObject;
  _objCanvas : TCanvas;
  _argX : Integer;
  _argY : Integer;
  _argImageIndex : Integer;
  _argOverlay : Integer;
  _argEnabled : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'Oiiiii:TCustomImageList.DrawOverlay', [ 
                  @_argCanvas,
                  @_argX,
                  @_argY,
                  @_argImageIndex,
                  @_argOverlay,
                  @_argEnabled       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objCanvas := GetObjectOf( _argCanvas ) as TCanvas;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.DrawOverlay( _objCanvas, Integer(_argX), Integer(_argY), Integer(_argImageIndex), TOverlay(_argOverlay), Boolean(_argEnabled) );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_FileLoad( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Boolean;
  _argResType : Integer;
  _argName : PChar;
  _argMaskColor : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'isi:TCustomImageList.FileLoad', [ 
                  @_argResType,
                  @_argName,
                  @_argMaskColor       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.FileLoad( TResType(_argResType), string(_argName), TColor(_argMaskColor) );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_GetBitmap( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
  _argImage : PPyObject;
  _objImage : TBitmap;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iO:TCustomImageList.GetBitmap', [ 
                  @_argIndex,
                  @_argImage       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TBitmap;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.GetBitmap( Integer(_argIndex), _objImage );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_GetHotSpot( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : TPoint;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.GetHotSpot;
    Result := CreatePoint( rslt ).GetSelf;
  end;
end;

function TCustomImageList_GetIcon( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
  _argImage : PPyObject;
  _objImage : TIcon;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iO:TCustomImageList.GetIcon', [ 
                  @_argIndex,
                  @_argImage       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TIcon;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.GetIcon( Integer(_argIndex), _objImage );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_GetImageBitmap( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : HBITMAP;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.GetImageBitmap;
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_GetMaskBitmap( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : HBITMAP;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.GetMaskBitmap;
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_GetResource( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Boolean;
  _argResType : Integer;
  _argName : PChar;
  _argWidth : Integer;
  _argLoadFlags : PPyObject;
  _tmpLoadFlags : TLoadResources;
  _argMaskColor : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'isiOi:TCustomImageList.GetResource', [ 
                  @_argResType,
                  @_argName,
                  @_argWidth,
                  @_argLoadFlags,
                  @_argMaskColor       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyList_Check( _argLoadFlags ) then
      ListToSet( _argLoadFlags, @_tmpLoadFlags, sizeof(_tmpLoadFlags) )
    else
      ErrorWrongSetPropertyType( Self, 'LoadFlags', 'TLoadResources' );
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.GetResource( TResType(_argResType), string(_argName), Integer(_argWidth), _tmpLoadFlags, TColor(_argMaskColor) );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_GetInstRes( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Boolean;
  _argInstance : Integer;
  _argResType : Integer;
  _argName : PChar;
  _argWidth : Integer;
  _argLoadFlags : PPyObject;
  _tmpLoadFlags : TLoadResources;
  _argMaskColor : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iisiOi:TCustomImageList.GetInstRes', [ 
                  @_argInstance,
                  @_argResType,
                  @_argName,
                  @_argWidth,
                  @_argLoadFlags,
                  @_argMaskColor       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyList_Check( _argLoadFlags ) then
      ListToSet( _argLoadFlags, @_tmpLoadFlags, sizeof(_tmpLoadFlags) )
    else
      ErrorWrongSetPropertyType( Self, 'LoadFlags', 'TLoadResources' );
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.GetInstRes( THandle(_argInstance), TResType(_argResType), string(_argName), Integer(_argWidth), _tmpLoadFlags, TColor(_argMaskColor) );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_HandleAllocated( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Boolean;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.HandleAllocated;
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_Insert( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
  _argImage : PPyObject;
  _objImage : TBitmap;
  _argMask : PPyObject;
  _objMask : TBitmap;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iOO:TCustomImageList.Insert', [ 
                  @_argIndex,
                  @_argImage,
                  @_argMask       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TBitmap;
    _objMask := GetObjectOf( _argMask ) as TBitmap;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.Insert( Integer(_argIndex), _objImage, _objMask );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_InsertIcon( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
  _argImage : PPyObject;
  _objImage : TIcon;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iO:TCustomImageList.InsertIcon', [ 
                  @_argIndex,
                  @_argImage       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TIcon;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.InsertIcon( Integer(_argIndex), _objImage );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_InsertMasked( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
  _argImage : PPyObject;
  _objImage : TBitmap;
  _argMaskColor : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iOi:TCustomImageList.InsertMasked', [ 
                  @_argIndex,
                  @_argImage,
                  @_argMaskColor       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TBitmap;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.InsertMasked( Integer(_argIndex), _objImage, TColor(_argMaskColor) );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_Move( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argCurIndex : Integer;
  _argNewIndex : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'ii:TCustomImageList.Move', [ 
                  @_argCurIndex,
                  @_argNewIndex       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.Move( Integer(_argCurIndex), Integer(_argNewIndex) );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_Overlay( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Boolean;
  _argImageIndex : Integer;
  _argOverlay : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'ii:TCustomImageList.Overlay', [ 
                  @_argImageIndex,
                  @_argOverlay       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.Overlay( Integer(_argImageIndex), TOverlay(_argOverlay) );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_RegisterChanges( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argValue : PPyObject;
  _objValue : TChangeLink;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'O:TCustomImageList.RegisterChanges', [ 
                  @_argValue       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objValue := GetObjectOf( _argValue ) as TChangeLink;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.RegisterChanges( _objValue );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_ResourceLoad( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Boolean;
  _argResType : Integer;
  _argName : PChar;
  _argMaskColor : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'isi:TCustomImageList.ResourceLoad', [ 
                  @_argResType,
                  @_argName,
                  @_argMaskColor       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.ResourceLoad( TResType(_argResType), string(_argName), TColor(_argMaskColor) );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_ResInstLoad( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  rslt : Boolean;
  _argInstance : Integer;
  _argResType : Integer;
  _argName : PChar;
  _argMaskColor : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iisi:TCustomImageList.ResInstLoad', [ 
                  @_argInstance,
                  @_argResType,
                  @_argName,
                  @_argMaskColor       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    rslt := realObj.ResInstLoad( THandle(_argInstance), TResType(_argResType), string(_argName), TColor(_argMaskColor) );
    Result := VariantAsPyObject( rslt );
  end;
end;

function TCustomImageList_Replace( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
  _argImage : PPyObject;
  _objImage : TBitmap;
  _argMask : PPyObject;
  _objMask : TBitmap;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iOO:TCustomImageList.Replace', [ 
                  @_argIndex,
                  @_argImage,
                  @_argMask       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TBitmap;
    _objMask := GetObjectOf( _argMask ) as TBitmap;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.Replace( Integer(_argIndex), _objImage, _objMask );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_ReplaceIcon( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
  _argImage : PPyObject;
  _objImage : TIcon;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iO:TCustomImageList.ReplaceIcon', [ 
                  @_argIndex,
                  @_argImage       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objImage := GetObjectOf( _argImage ) as TIcon;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.ReplaceIcon( Integer(_argIndex), _objImage );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_ReplaceMasked( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argIndex : Integer;
  _argNewImage : PPyObject;
  _objNewImage : TBitmap;
  _argMaskColor : Integer;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'iOi:TCustomImageList.ReplaceMasked', [ 
                  @_argIndex,
                  @_argNewImage,
                  @_argMaskColor       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objNewImage := GetObjectOf( _argNewImage ) as TBitmap;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.ReplaceMasked( Integer(_argIndex), _objNewImage, TColor(_argMaskColor) );
    Result := ReturnNone;
  end;
end;

function TCustomImageList_UnRegisterChanges( Self, Args : PPyObject ) : PPyObject; cdecl;
var
  obj : TObject;
  realObj : TCustomImageList;
  _argValue : PPyObject;
  _objValue : TChangeLink;
begin
  Result := nil;
  with GetPythonEngine do begin
    // Parsing of method args
    if PyArg_ParseTuple( Args, 'O:TCustomImageList.UnRegisterChanges', [ 
                  @_argValue       ] ) = 0 then
      begin
        Result := nil;
        Exit;
      end;
    _objValue := GetObjectOf( _argValue ) as TChangeLink;
    if PyErr_Occurred <> nil then
      begin
        Result := nil;
        Exit;
      end;
    // Check Delphi object
    obj := GetObjectOf( Self );
    if not Assigned(obj) then begin
      ErrorNoObject( Self );
      Exit;
    end;
    // Check object type
    if not( obj is TCustomImageList) then begin
      ErrorWrongExpectedType( Self, 'TCustomImageList' );
      Exit;
    end;
    realObj := TCustomImageList(obj);
    realObj.UnRegisterChanges( _objValue );
    Result := ReturnNone;
  end;
end;

///////////// Initialization of the module ///////////

procedure TModule_ImgList.Initialize;
begin
  // class TChangeLink
  AddMethod( 'CreateChangeLink', TChangeLink_Create, '' );
  AddMethod( 'ChangeLink_GetAttr', TChangeLink_GetAttr, '' );
  AddMethod( 'ChangeLink_SetAttr', TChangeLink_SetAttr, '' );
  gTChangeLink.AddMethod( 'Change', TChangeLink_Change, '' );
  // class TCustomImageList
  AddMethod( 'CreateCustomImageList', TCustomImageList_Create, '' );
  AddMethod( 'CreateSizeCustomImageList', TCustomImageList_CreateSize, '' );
  AddMethod( 'CustomImageList_GetAttr', TCustomImageList_GetAttr, '' );
  AddMethod( 'CustomImageList_SetAttr', TCustomImageList_SetAttr, '' );
  gTCustomImageList.AddMethod( 'Create', TCustomImageList_Create, '' );
  gTCustomImageList.AddMethod( 'CreateSize', TCustomImageList_CreateSize, '' );
  gTCustomImageList.AddMethod( 'Assign', TCustomImageList_Assign, '' );
  gTCustomImageList.AddMethod( 'Add', TCustomImageList_Add, '' );
  gTCustomImageList.AddMethod( 'AddIcon', TCustomImageList_AddIcon, '' );
  gTCustomImageList.AddMethod( 'AddImages', TCustomImageList_AddImages, '' );
  gTCustomImageList.AddMethod( 'AddMasked', TCustomImageList_AddMasked, '' );
  gTCustomImageList.AddMethod( 'Clear', TCustomImageList_Clear, '' );
  gTCustomImageList.AddMethod( 'Delete', TCustomImageList_Delete, '' );
  gTCustomImageList.AddMethod( 'Draw', TCustomImageList_Draw, '' );
  gTCustomImageList.AddMethod( 'DrawOverlay', TCustomImageList_DrawOverlay, '' );
  gTCustomImageList.AddMethod( 'FileLoad', TCustomImageList_FileLoad, '' );
  gTCustomImageList.AddMethod( 'GetBitmap', TCustomImageList_GetBitmap, '' );
  gTCustomImageList.AddMethod( 'GetHotSpot', TCustomImageList_GetHotSpot, '' );
  gTCustomImageList.AddMethod( 'GetIcon', TCustomImageList_GetIcon, '' );
  gTCustomImageList.AddMethod( 'GetImageBitmap', TCustomImageList_GetImageBitmap, '' );
  gTCustomImageList.AddMethod( 'GetMaskBitmap', TCustomImageList_GetMaskBitmap, '' );
  gTCustomImageList.AddMethod( 'GetResource', TCustomImageList_GetResource, '' );
  gTCustomImageList.AddMethod( 'GetInstRes', TCustomImageList_GetInstRes, '' );
  gTCustomImageList.AddMethod( 'HandleAllocated', TCustomImageList_HandleAllocated, '' );
  gTCustomImageList.AddMethod( 'Insert', TCustomImageList_Insert, '' );
  gTCustomImageList.AddMethod( 'InsertIcon', TCustomImageList_InsertIcon, '' );
  gTCustomImageList.AddMethod( 'InsertMasked', TCustomImageList_InsertMasked, '' );
  gTCustomImageList.AddMethod( 'Move', TCustomImageList_Move, '' );
  gTCustomImageList.AddMethod( 'Overlay', TCustomImageList_Overlay, '' );
  gTCustomImageList.AddMethod( 'RegisterChanges', TCustomImageList_RegisterChanges, '' );
  gTCustomImageList.AddMethod( 'ResourceLoad', TCustomImageList_ResourceLoad, '' );
  gTCustomImageList.AddMethod( 'ResInstLoad', TCustomImageList_ResInstLoad, '' );
  gTCustomImageList.AddMethod( 'Replace', TCustomImageList_Replace, '' );
  gTCustomImageList.AddMethod( 'ReplaceIcon', TCustomImageList_ReplaceIcon, '' );
  gTCustomImageList.AddMethod( 'ReplaceMasked', TCustomImageList_ReplaceMasked, '' );
  gTCustomImageList.AddMethod( 'UnRegisterChanges', TCustomImageList_UnRegisterChanges, '' );
  inherited;
end;

end.
