cregist.inc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. {
  2. $Id$
  3. This file is part of the Free Component Library (FCL)
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. { Class registration routines }
  12. procedure RegisterClass(AClass: TPersistentClass);
  13. begin
  14. end;
  15. procedure RegisterClasses(AClasses: array of TPersistentClass);
  16. begin
  17. end;
  18. procedure RegisterClassAlias(AClass: TPersistentClass; const Alias: string);
  19. begin
  20. end;
  21. procedure UnRegisterClass(AClass: TPersistentClass);
  22. begin
  23. end;
  24. procedure UnRegisterClasses(AClasses: array of TPersistentClass);
  25. begin
  26. end;
  27. procedure UnRegisterModuleClasses(Module: HMODULE);
  28. begin
  29. end;
  30. function FindClass(const ClassName: string): TPersistentClass;
  31. begin
  32. FindClass:=nil;
  33. end;
  34. function GetClass(const ClassName: string): TPersistentClass;
  35. begin
  36. GetClass:=nil;
  37. end;
  38. { Component registration routines }
  39. type
  40. TComponentPage = class(TCollectionItem)
  41. public
  42. Name: String;
  43. Classes: TList;
  44. end;
  45. var
  46. ComponentPages: TCollection;
  47. procedure InitComponentPages;
  48. begin
  49. ComponentPages := TCollection.Create(TComponentPage);
  50. { Add a empty page which will be used for storing the NoIcon components }
  51. ComponentPages.Add;
  52. end;
  53. procedure RegisterComponents(const Page: string;
  54. ComponentClasses: array of TComponentClass);
  55. var
  56. i: Integer;
  57. pg: TComponentPage;
  58. begin
  59. if Page = '' then exit; { prevent caller from doing nonsense }
  60. pg := nil;
  61. if not Assigned(ComponentPages) then
  62. InitComponentPages
  63. else
  64. for i := 0 to ComponentPages.Count - 1 do
  65. if TComponentPage(ComponentPages.Items[i]).Name = Page then begin
  66. pg := TComponentPage(ComponentPages.Items[i]);
  67. break;
  68. end;
  69. if pg = nil then begin
  70. pg := TComponentPage(ComponentPages.Add);
  71. pg.Name := Page;
  72. end;
  73. if pg.Classes = nil then
  74. pg.Classes := TList.Create;
  75. for i := Low(ComponentClasses) to High(ComponentClasses) do
  76. pg.Classes.Add(ComponentClasses[i]);
  77. if Assigned(RegisterComponentsProc) then
  78. RegisterComponentsProc(Page, ComponentClasses);
  79. end;
  80. procedure RegisterNoIcon(ComponentClasses: array of TComponentClass);
  81. var
  82. pg: TComponentPage;
  83. i: Integer;
  84. begin
  85. if not Assigned(ComponentPages) then
  86. InitComponentPages;
  87. pg := TComponentPage(ComponentPages.Items[0]);
  88. if pg.Classes = nil then
  89. pg.Classes := TList.Create;
  90. for i := Low(ComponentClasses) to High(ComponentClasses) do
  91. pg.Classes.Add(ComponentClasses[i]);
  92. if Assigned(RegisterNoIconProc) then
  93. RegisterNoIconProc(ComponentClasses);
  94. end;
  95. procedure RegisterNonActiveX(ComponentClasses: array of TComponentClass;
  96. AxRegType: TActiveXRegType);
  97. begin
  98. end;
  99. {
  100. $Log$
  101. Revision 1.4 2000-01-07 01:24:33 peter
  102. * updated copyright to 2000
  103. Revision 1.3 2000/01/06 01:20:33 peter
  104. * moved out of packages/ back to topdir
  105. Revision 1.1 2000/01/03 19:33:07 peter
  106. * moved to packages dir
  107. Revision 1.1 1999/09/11 22:02:35 fcl
  108. * Imported function skeletons from old classes.inc
  109. * Implementation of RegisterComponents and RegisterNoIcon (sg)
  110. }