home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 February / Chip_2004-02_cd1.bin / zkuste / konfig / download / msic / D5 / MSI_DsgnIntf.pas < prev    next >
Pascal/Delphi Source File  |  2003-06-03  |  2KB  |  95 lines

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