home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161b.iso / full / delphi / RUNIMAGE / DELPHI30 / DEMOS / ACTIVEX / DELCTRLS / HKEYIMPL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-04  |  2.9 KB  |  121 lines

  1. unit HKeyImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelC_TLB, ComCtrls;
  8.  
  9. type
  10.   THotKeyX = class(TActiveXControl, IHotKeyX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: THotKey;
  14.     FEvents: IHotKeyXEvents;
  15.   protected
  16.     { Protected declarations }
  17.     procedure InitializeControl; override;
  18.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  19.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  20.     function Get_AutoSize: WordBool; safecall;
  21.     function Get_Cursor: Smallint; safecall;
  22.     function Get_Enabled: WordBool; safecall;
  23.     function Get_HotKey: Smallint; safecall;
  24.     function Get_Visible: WordBool; safecall;
  25.     procedure AboutBox; safecall;
  26.     procedure Set_AutoSize(Value: WordBool); safecall;
  27.     procedure Set_Cursor(Value: Smallint); safecall;
  28.     procedure Set_Enabled(Value: WordBool); safecall;
  29.     procedure Set_HotKey(Value: Smallint); safecall;
  30.     procedure Set_Visible(Value: WordBool); safecall;
  31.   end;
  32.  
  33. implementation
  34.  
  35. uses About12;
  36.  
  37. { THotKeyX }
  38.  
  39. procedure THotKeyX.InitializeControl;
  40. begin
  41.   FDelphiControl := Control as THotKey;
  42. end;
  43.  
  44. procedure THotKeyX.EventSinkChanged(const EventSink: IUnknown);
  45. begin
  46.   FEvents := EventSink as IHotKeyXEvents;
  47. end;
  48.  
  49. procedure THotKeyX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  50. begin
  51.   { Define property pages here.  Property pages are defined by calling
  52.     DefinePropertyPage with the class id of the page.  For example,
  53.       DefinePropertyPage(Class_HotKeyXPage); }
  54. end;
  55.  
  56. function THotKeyX.Get_AutoSize: WordBool;
  57. begin
  58.   Result := FDelphiControl.AutoSize;
  59. end;
  60.  
  61. function THotKeyX.Get_Cursor: Smallint;
  62. begin
  63.   Result := Smallint(FDelphiControl.Cursor);
  64. end;
  65.  
  66. function THotKeyX.Get_Enabled: WordBool;
  67. begin
  68.   Result := FDelphiControl.Enabled;
  69. end;
  70.  
  71. function THotKeyX.Get_HotKey: Smallint;
  72. begin
  73.   Result := Smallint(FDelphiControl.HotKey);
  74. end;
  75.  
  76. function THotKeyX.Get_Visible: WordBool;
  77. begin
  78.   Result := FDelphiControl.Visible;
  79. end;
  80.  
  81. procedure THotKeyX.AboutBox;
  82. begin
  83.   ShowHotKeyXAbout;
  84. end;
  85.  
  86. procedure THotKeyX.Set_AutoSize(Value: WordBool);
  87. begin
  88.   FDelphiControl.AutoSize := Value;
  89. end;
  90.  
  91. procedure THotKeyX.Set_Cursor(Value: Smallint);
  92. begin
  93.   FDelphiControl.Cursor := TCursor(Value);
  94. end;
  95.  
  96. procedure THotKeyX.Set_Enabled(Value: WordBool);
  97. begin
  98.   FDelphiControl.Enabled := Value;
  99. end;
  100.  
  101. procedure THotKeyX.Set_HotKey(Value: Smallint);
  102. begin
  103.   FDelphiControl.HotKey := TShortCut(Value);
  104. end;
  105.  
  106. procedure THotKeyX.Set_Visible(Value: WordBool);
  107. begin
  108.   FDelphiControl.Visible := Value;
  109. end;
  110.  
  111. initialization
  112.   TActiveXControlFactory.Create(
  113.     ComServer,
  114.     THotKeyX,
  115.     THotKey,
  116.     Class_HotKeyX,
  117.     12,
  118.     '{FA7B83A8-9ED7-11D0-AA40-444553540000}',
  119.     0);
  120. end.
  121.