diff --git a/fcl/inc/contnrs.pp b/fcl/inc/contnrs.pp index b11dc8c82f..450ff81f9c 100644 --- a/fcl/inc/contnrs.pp +++ b/fcl/inc/contnrs.pp @@ -25,6 +25,9 @@ uses Type + TObjectListCallback = procedure(data:TObject;arg:pointer) of object; + TObjectListStaticCallback = procedure(data:TObject;arg:pointer); + TFPObjectList = class(TObject) private FFreeObjects : Boolean; @@ -56,6 +59,8 @@ Type procedure Assign(Obj:TFPObjectList); procedure Pack; procedure Sort(Compare: TListSortCompare); + procedure ForEachCall(proc2call:TObjectListCallback;arg:pointer); + procedure ForEachCall(proc2call:TObjectListStaticCallback;arg:pointer); property Capacity: Integer read GetCapacity write SetCapacity; property Count: Integer read GetCount write SetCount; property OwnsObjects: Boolean read FFreeObjects write FFreeObjects; @@ -436,6 +441,17 @@ begin Result := TObject(FList.Last); end; +procedure TFPObjectList.ForEachCall(proc2call:TObjectListCallback;arg:pointer); +begin + FList.ForEachCall(TListCallBack(proc2call),arg); +end; + +procedure TFPObjectList.ForEachCall(proc2call:TObjectListStaticCallback;arg:pointer); +begin + FList.ForEachCall(TListStaticCallBack(proc2call),arg); +end; + + { TObjectList } constructor tobjectlist.create(freeobjects : boolean);