home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d3456 / SBPRO.ZIP / SBProReg.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2001-12-29  |  3.0 KB  |  118 lines

  1. {------------------------------------------------------------------------------}
  2. {                                                                              }
  3. {  TStatusBarPro v1.11                                                         }
  4. {  by Kambiz R. Khojasteh                                                      }
  5. {                                                                              }
  6. {  kambiz@delphiarea.com                                                       }
  7. {  http://www.delphiarea.com                                                   }
  8. {                                                                              }
  9. {  Special thanks to:                                                          }
  10. {    Rudi Loos <loos@intekom.co.za> for adding Color property to the panels.   }
  11. {                                                                              }
  12. {------------------------------------------------------------------------------}
  13.  
  14. {$I DELPHIAREA.INC}
  15.  
  16. unit SBProReg;
  17.  
  18. interface
  19.  
  20. uses
  21.   Windows, Classes, {$IFDEF DELPHI6_UP} DesignIntf, DesignEditors {$ELSE} DsgnIntf {$ENDIF};
  22.  
  23. type
  24.   TStatusBarProEditor = class(TDefaultEditor)
  25.   protected
  26.     {$IFNDEF DELPHI6_UP}
  27.     procedure PanelsEditor(Prop: TPropertyEditor);
  28.     {$ENDIF}
  29.   public
  30.     function GetVerbCount: Integer; override;
  31.     function GetVerb(Index: Integer): string; override;
  32.     procedure ExecuteVerb(Index: Integer); override;
  33.     {$IFDEF DELPHI6_UP}
  34.     procedure EditProperty(const Prop: IProperty; var Continue: Boolean); override;
  35.     {$ELSE}
  36.     procedure Edit; override;
  37.     {$ENDIF}
  38.   end;
  39.  
  40. procedure Register;
  41.  
  42. implementation
  43.  
  44. uses
  45.   SBPro, TypInfo;
  46.  
  47. function TStatusBarProEditor.GetVerbCount: Integer;
  48. begin
  49.   Result:= 1;
  50. end;
  51.  
  52. function TStatusBarProEditor.GetVerb(Index: Integer): string;
  53. begin
  54.   if Index = 0 then
  55.     Result := 'Panels Editor...'
  56.   else
  57.     Result := inherited GetVerb(Index);
  58. end;
  59.  
  60. procedure TStatusBarProEditor.ExecuteVerb(Index: Integer);
  61. begin
  62.   if Index = 0 then
  63.     Edit
  64.   else
  65.     inherited ExecuteVerb(Index);
  66. end;
  67.  
  68. {$IFDEF DELPHI6_UP}
  69.  
  70. procedure TStatusBarProEditor.EditProperty(const Prop: IProperty;
  71.   var Continue: Boolean);
  72. begin
  73.   if Prop.GetName = 'Panels' then
  74.   begin
  75.     Prop.Edit;
  76.     Continue := False;
  77.   end;
  78. end;
  79.  
  80. {$ELSE}
  81.  
  82. procedure TStatusBarProEditor.PanelsEditor(Prop: TPropertyEditor);
  83. begin
  84.   if Prop.GetName = 'Panels' then
  85.     Prop.Edit;
  86. end;
  87.  
  88. procedure TStatusBarProEditor.Edit;
  89. var
  90.   {$IFDEF DELPHI5}
  91.   List: TDesignerSelectionList;
  92.   {$ELSE}
  93.   List: TComponentList;
  94.   {$ENDIF}
  95. begin
  96.   {$IFDEF DELPHI5}
  97.   List := TDesignerSelectionList.Create;
  98.   {$ELSE}
  99.   List := TComponentList.Create;
  100.   {$ENDIF}
  101.   try
  102.     List.Add(Component);
  103.     GetComponentProperties(List, [tkClass], Designer, PanelsEditor);
  104.   finally
  105.     List.Free;
  106.   end;
  107. end;
  108.  
  109. {$ENDIF}
  110.  
  111. procedure Register;
  112. begin
  113.   RegisterComponents('Delphi Area', [TStatusBarPro]);
  114.   RegisterComponentEditor(TStatusBarPro, TStatusBarProEditor);
  115. end;
  116.  
  117. end.
  118.