home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Runimage / Delphi50 / Source / Internet / PAGITEMS.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-11  |  2.2 KB  |  85 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Borland Delphi Visual Component Library         }
  5. {                                                       }
  6. {       Copyright (c) 1999 Inprise Corporation          }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit PagItems;
  11.  
  12. interface
  13.  
  14. uses Classes, Messages, ImgList, HTTPApp, WebComp,
  15.   CompProd;
  16.  
  17. type
  18.  
  19.   TPageItemsProducer = class(TComponentsPageProducer, IGetWebComponentList)
  20.   private
  21.     FWebPageItems: TWebComponentList;
  22.   protected
  23.     { IGetWebComponentsList }
  24.     function GetComponentList: TObject;
  25.     function GetDefaultComponentList: TObject;
  26.     procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
  27.     procedure SetChildOrder(Component: TComponent; Order: Integer); override;
  28.   public
  29.     constructor Create(AOwner: TComponent); override;
  30.     destructor Destroy; override;
  31.     property WebPageItems: TWebComponentList read FWebPageItems;
  32.   end;
  33.  
  34. implementation
  35.  
  36. constructor TPageItemsProducer.Create(AOwner: TComponent);
  37. begin
  38.   inherited;
  39.   FWebPageItems := TWebComponentList.Create(Self);
  40. end;
  41.  
  42. destructor TPageItemsProducer.Destroy;
  43. begin
  44.   inherited;
  45.   FWebPageItems.Free;
  46. end;
  47.  
  48. procedure TPageItemsProducer.GetChildren(Proc: TGetChildProc; Root: TComponent);
  49. var
  50.   I: Integer;
  51.   WebComponent: TComponent;
  52. begin
  53.   for I := 0 to FWebPageItems.Count - 1 do
  54.   begin
  55.     WebComponent := FWebPageItems.WebComponents[I];
  56.     if WebComponent.Owner = Root then Proc(WebComponent);
  57.   end;
  58. end;
  59.  
  60. function TPageItemsProducer.GetComponentList: TObject;
  61. begin
  62.   Result := FWebPageItems;
  63. end;
  64.  
  65. function TPageItemsProducer.GetDefaultComponentList: TObject;
  66. begin
  67.   Assert(False, 'No default components list');
  68.   Result := nil;
  69. end;
  70.  
  71. procedure TPageItemsProducer.SetChildOrder(Component: TComponent;
  72.   Order: Integer);
  73. var
  74.   Intf: IWebComponent;
  75. begin
  76.   if FWebPageItems.IndexOf(Component) >= 0 then
  77.     if Component.GetInterface(IWebComponent, Intf) then
  78.       Intf.Index := Order
  79.     else
  80.       Assert(False, 'Interface not supported');
  81. end;
  82.  
  83. end.
  84.  
  85.