home *** CD-ROM | disk | FTP | other *** search
/ PC Expert 29 / Pce29cd.iso / RUNIMAGE / DELPHI40 / DEMOS / ACTIVEX / DELCTRLS / hotkeyimpl1.pas < prev    next >
Pascal/Delphi Source File  |  1998-06-16  |  5KB  |  206 lines

  1. unit HotKeyImpl1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelCtrls_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 DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  18.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  19.     procedure InitializeControl; override;
  20.     function ClassNameIs(const Name: WideString): WordBool; safecall;
  21.     function DrawTextBiDiModeFlags(Flags: Integer): Integer; safecall;
  22.     function DrawTextBiDiModeFlagsReadingOnly: Integer; safecall;
  23.     function Get_AutoSize: WordBool; safecall;
  24.     function Get_BiDiMode: TxBiDiMode; safecall;
  25.     function Get_Cursor: Smallint; safecall;
  26.     function Get_DoubleBuffered: WordBool; safecall;
  27.     function Get_Enabled: WordBool; safecall;
  28.     function Get_HotKey: Smallint; safecall;
  29.     function Get_Visible: WordBool; safecall;
  30.     function GetControlsAlignment: TxAlignment; safecall;
  31.     function IsRightToLeft: WordBool; safecall;
  32.     function UseRightToLeftAlignment: WordBool; safecall;
  33.     function UseRightToLeftReading: WordBool; safecall;
  34.     function UseRightToLeftScrollBar: WordBool; safecall;
  35.     procedure AboutBox; safecall;
  36.     procedure FlipChildren(AllLevels: WordBool); safecall;
  37.     procedure InitiateAction; safecall;
  38.     procedure Set_AutoSize(Value: WordBool); safecall;
  39.     procedure Set_BiDiMode(Value: TxBiDiMode); safecall;
  40.     procedure Set_Cursor(Value: Smallint); safecall;
  41.     procedure Set_DoubleBuffered(Value: WordBool); safecall;
  42.     procedure Set_Enabled(Value: WordBool); safecall;
  43.     procedure Set_HotKey(Value: Smallint); safecall;
  44.     procedure Set_Visible(Value: WordBool); safecall;
  45.   end;
  46.  
  47. implementation
  48.  
  49. uses ComObj, About13;
  50.  
  51. { THotKeyX }
  52.  
  53. procedure THotKeyX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  54. begin
  55.   { Define property pages here.  Property pages are defined by calling
  56.     DefinePropertyPage with the class id of the page.  For example,
  57.       DefinePropertyPage(Class_HotKeyXPage); }
  58. end;
  59.  
  60. procedure THotKeyX.EventSinkChanged(const EventSink: IUnknown);
  61. begin
  62.   FEvents := EventSink as IHotKeyXEvents;
  63. end;
  64.  
  65. procedure THotKeyX.InitializeControl;
  66. begin
  67.   FDelphiControl := Control as THotKey;
  68. end;
  69.  
  70. function THotKeyX.ClassNameIs(const Name: WideString): WordBool;
  71. begin
  72.   Result := FDelphiControl.ClassNameIs(Name);
  73. end;
  74.  
  75. function THotKeyX.DrawTextBiDiModeFlags(Flags: Integer): Integer;
  76. begin
  77.   Result := FDelphiControl.DrawTextBiDiModeFlags(Flags);
  78. end;
  79.  
  80. function THotKeyX.DrawTextBiDiModeFlagsReadingOnly: Integer;
  81. begin
  82.   Result := FDelphiControl.DrawTextBiDiModeFlagsReadingOnly;
  83. end;
  84.  
  85. function THotKeyX.Get_AutoSize: WordBool;
  86. begin
  87.   Result := FDelphiControl.AutoSize;
  88. end;
  89.  
  90. function THotKeyX.Get_BiDiMode: TxBiDiMode;
  91. begin
  92.   Result := Ord(FDelphiControl.BiDiMode);
  93. end;
  94.  
  95. function THotKeyX.Get_Cursor: Smallint;
  96. begin
  97.   Result := Smallint(FDelphiControl.Cursor);
  98. end;
  99.  
  100. function THotKeyX.Get_DoubleBuffered: WordBool;
  101. begin
  102.   Result := FDelphiControl.DoubleBuffered;
  103. end;
  104.  
  105. function THotKeyX.Get_Enabled: WordBool;
  106. begin
  107.   Result := FDelphiControl.Enabled;
  108. end;
  109.  
  110. function THotKeyX.Get_HotKey: Smallint;
  111. begin
  112.   Result := Smallint(FDelphiControl.HotKey);
  113. end;
  114.  
  115. function THotKeyX.Get_Visible: WordBool;
  116. begin
  117.   Result := FDelphiControl.Visible;
  118. end;
  119.  
  120. function THotKeyX.GetControlsAlignment: TxAlignment;
  121. begin
  122.  Result := TxAlignment(FDelphiControl.GetControlsAlignment);
  123. end;
  124.  
  125. function THotKeyX.IsRightToLeft: WordBool;
  126. begin
  127.   Result := FDelphiControl.IsRightToLeft;
  128. end;
  129.  
  130. function THotKeyX.UseRightToLeftAlignment: WordBool;
  131. begin
  132.   Result := FDelphiControl.UseRightToLeftAlignment;
  133. end;
  134.  
  135. function THotKeyX.UseRightToLeftReading: WordBool;
  136. begin
  137.   Result := FDelphiControl.UseRightToLeftReading;
  138. end;
  139.  
  140. function THotKeyX.UseRightToLeftScrollBar: WordBool;
  141. begin
  142.   Result := FDelphiControl.UseRightToLeftScrollBar;
  143. end;
  144.  
  145. procedure THotKeyX.AboutBox;
  146. begin
  147.   ShowHotKeyXAbout;
  148. end;
  149.  
  150. procedure THotKeyX.FlipChildren(AllLevels: WordBool);
  151. begin
  152.   FDelphiControl.FlipChildren(AllLevels);
  153. end;
  154.  
  155. procedure THotKeyX.InitiateAction;
  156. begin
  157.   FDelphiControl.InitiateAction;
  158. end;
  159.  
  160. procedure THotKeyX.Set_AutoSize(Value: WordBool);
  161. begin
  162.   FDelphiControl.AutoSize := Value;
  163. end;
  164.  
  165. procedure THotKeyX.Set_BiDiMode(Value: TxBiDiMode);
  166. begin
  167.   FDelphiControl.BiDiMode := TBiDiMode(Value);
  168. end;
  169.  
  170. procedure THotKeyX.Set_Cursor(Value: Smallint);
  171. begin
  172.   FDelphiControl.Cursor := TCursor(Value);
  173. end;
  174.  
  175. procedure THotKeyX.Set_DoubleBuffered(Value: WordBool);
  176. begin
  177.   FDelphiControl.DoubleBuffered := Value;
  178. end;
  179.  
  180. procedure THotKeyX.Set_Enabled(Value: WordBool);
  181. begin
  182.   FDelphiControl.Enabled := Value;
  183. end;
  184.  
  185. procedure THotKeyX.Set_HotKey(Value: Smallint);
  186. begin
  187.   FDelphiControl.HotKey := TShortCut(Value);
  188. end;
  189.  
  190. procedure THotKeyX.Set_Visible(Value: WordBool);
  191. begin
  192.   FDelphiControl.Visible := Value;
  193. end;
  194.  
  195. initialization
  196.   TActiveXControlFactory.Create(
  197.     ComServer,
  198.     THotKeyX,
  199.     THotKey,
  200.     Class_HotKeyX,
  201.     13,
  202.     '{695CDB38-02E5-11D2-B20D-00C04FA368D4}',
  203.     0,
  204.     tmApartment);
  205. end.
  206.