home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kompon / d56 / MSYSINFO.ZIP / Source / MSystemInfo.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2001-07-24  |  2.2 KB  |  95 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       MiTeC System Information Component              }
  5. {           version 6.0 for Delphi 5,6                  }
  6. {                                                       }
  7. {       Copyright ⌐ 1997,2001 Michal Mutl               }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. {$INCLUDE MITEC_DEF.INC}
  12.  
  13. unit MSystemInfo;
  14.  
  15. interface
  16.  
  17. uses
  18.   Classes,
  19.   {$IFDEF D6PLUS}
  20.   DesignIntf, DesignEditors
  21.   {$ELSE}
  22.   DsgnIntf
  23.   {$ENDIF}
  24.   ;
  25.  
  26. type
  27.   TMSI_PropertyEditor = class(TStringProperty)
  28.   public
  29.     function GetAttributes: TPropertyAttributes; override;
  30.     procedure Edit; override;
  31.   end;
  32.  
  33.   TMSI_ComponentEditor = class(TComponentEditor)
  34.   public
  35.     function GetVerbCount: Integer; override;
  36.     function GetVerb(Index: Integer): String; override;
  37.     procedure ExecuteVerb(Index: Integer); override;
  38.     procedure Edit; override;
  39.   end;
  40.  
  41. procedure Register;
  42.  
  43. implementation
  44.  
  45. uses MSI_GUI, MSI_CPUUsage, Forms;
  46.  
  47. procedure Register;
  48. begin
  49.   RegisterComponents('MiTeC',[TMCPUUsage]);
  50.   RegisterComponents('MiTeC',[TMSystemInfo]);
  51.   RegisterPropertyEditor(TypeInfo(string),TMSystemInfo,'About',TMSI_PropertyEditor);
  52.   RegisterComponentEditor(TMSystemInfo,TMSI_ComponentEditor);
  53. end;
  54.  
  55. { TMSI_ComponentEditor }
  56.  
  57. procedure TMSI_ComponentEditor.Edit;
  58. begin
  59.   TMSystemInfo(Self.Component).ShowModalOverviewWithAbout;
  60. end;
  61.  
  62. procedure TMSI_ComponentEditor.ExecuteVerb(Index: Integer);
  63. begin
  64.   if Index=0 then
  65.     Edit;
  66. end;
  67.  
  68. function TMSI_ComponentEditor.GetVerb(Index: Integer): String;
  69. begin
  70.   if Index=0 then
  71.     Result:='System Overview...'
  72.   else
  73.     Result:=inherited GetVerb(Index-1);
  74. end;
  75.  
  76. function TMSI_ComponentEditor.GetVerbCount: Integer;
  77. begin
  78.   Result:=inherited GetVerbCount+1;
  79. end;
  80.  
  81. { TMSI_PropertyEditor }
  82.  
  83. procedure TMSI_PropertyEditor.Edit;
  84. begin
  85.   TMSystemInfo(Self.GetComponent(0)).ShowModalOverviewWithAbout;
  86. end;
  87.  
  88. function TMSI_PropertyEditor.GetAttributes: TPropertyAttributes;
  89. begin
  90.   Result:=[paDialog, paReadOnly];
  91. end;
  92.  
  93. end.
  94.  
  95.