IdBaseComponent.pas 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.10 08.11.2004 ã. 20:00:46 DBondzhev
  18. changed TObject to &Object
  19. Rev 1.9 07.11.2004 ã. 18:17:54 DBondzhev
  20. This contains fix for proper call to unit initialization sections.
  21. Rev 1.8 2004.11.06 10:55:00 PM czhower
  22. Fix for Delphi 2005.
  23. Rev 1.7 2004.10.26 9:07:30 PM czhower
  24. More .NET implicit conversions
  25. Rev 1.6 2004.10.26 7:51:58 PM czhower
  26. Fixed ifdef and renamed TCLRStrings to TIdCLRStrings
  27. Rev 1.5 2004.10.26 7:35:16 PM czhower
  28. Moved IndyCat to CType in IdBaseComponent
  29. Rev 1.4 04.10.2004 13:15:06 Andreas Hausladen
  30. Thread Safe Unit initialization
  31. Rev 1.3 6/11/2004 8:28:26 AM DSiders
  32. Added "Do not Localize" comments.
  33. Rev 1.2 2004.04.16 9:18:34 PM czhower
  34. .NET fix to call initialization sections. Code taken from IntraWeb.
  35. Rev 1.1 2004.02.03 3:15:50 PM czhower
  36. Updates to move to System.
  37. Rev 1.0 2004.02.03 2:28:26 PM czhower
  38. Move
  39. Rev 1.4 2004.01.25 11:35:02 PM czhower
  40. IFDEF fix for .net.
  41. Rev 1.3 2004.01.25 10:56:44 PM czhower
  42. Bug fix for InitComponent at design time.
  43. Rev 1.2 2004.01.20 10:03:20 PM czhower
  44. InitComponent
  45. Rev 1.1 2003.12.23 7:33:00 PM czhower
  46. .Net change.
  47. Rev 1.0 11/13/2002 08:38:26 AM JPMugaas
  48. }
  49. unit IdBaseComponent;
  50. // Kudzu: This unit is permitted to viloate IFDEF restriction to harmonize
  51. // VCL / .Net difference at the base level.
  52. interface
  53. {$I IdCompilerDefines.inc}
  54. uses
  55. Classes;
  56. // ***********************************************************
  57. // TIdBaseComponent is the base class for all Indy components.
  58. // ***********************************************************
  59. type
  60. // TIdBaseComponent is the base class for all Indy components. Utility components, and other non
  61. // socket based components typically inherit directly from this. While socket components inherit
  62. // from TIdComponent instead as it introduces OnWork, OnStatus, etc.
  63. TIdBaseComponent = class(TComponent)
  64. protected
  65. function GetIndyVersion: string;
  66. function GetIsLoading: Boolean;
  67. function GetIsDesignTime: Boolean;
  68. property IsLoading: Boolean read GetIsLoading;
  69. property IsDesignTime: Boolean read GetIsDesignTime;
  70. public
  71. constructor Create; reintroduce; overload;
  72. constructor Create(AOwner: TComponent); overload; override;
  73. {$IFNDEF HAS_RemoveFreeNotification}
  74. procedure RemoveFreeNotification(AComponent: TComponent);
  75. {$ENDIF}
  76. property Version: string read GetIndyVersion;
  77. published
  78. end;
  79. implementation
  80. uses
  81. IdGlobal;
  82. { TIdBaseComponent }
  83. constructor TIdBaseComponent.Create;
  84. begin
  85. Create(nil);
  86. end;
  87. constructor TIdBaseComponent.Create(AOwner: TComponent);
  88. begin
  89. inherited Create(AOwner);
  90. end;
  91. function TIdBaseComponent.GetIsLoading: Boolean;
  92. begin
  93. Result := (csLoading in ComponentState);
  94. end;
  95. function TIdBaseComponent.GetIsDesignTime: Boolean;
  96. begin
  97. Result := (csDesigning in ComponentState);
  98. end;
  99. {$IFNDEF HAS_RemoveFreeNotification}
  100. procedure TIdBaseComponent.RemoveFreeNotification(AComponent: TComponent);
  101. begin
  102. // this is a no-op for now, as we can't access the private TComponent.FFreeNotifies list
  103. end;
  104. {$ENDIF}
  105. function TIdBaseComponent.GetIndyVersion: string;
  106. begin
  107. Result := gsIdVersion;
  108. end;
  109. end.