home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161b.iso / full / delphi / INSTALL / data.z / SPNBIMPL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-05  |  4.7 KB  |  183 lines

  1. unit SpnBImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelC_TLB, Spin;
  8.  
  9. type
  10.   TSpinButtonX = class(TActiveXControl, ISpinButtonX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: TSpinButton;
  14.     FEvents: ISpinButtonXEvents;
  15.     procedure DownClickEvent(Sender: TObject);
  16.     procedure UpClickEvent(Sender: TObject);
  17.   protected
  18.     { Protected declarations }
  19.     procedure InitializeControl; override;
  20.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  21.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  22.     function Get_Ctl3D: WordBool; safecall;
  23.     function Get_Cursor: Smallint; safecall;
  24.     function Get_DownNumGlyphs: Smallint; safecall;
  25.     function Get_DragCursor: Smallint; safecall;
  26.     function Get_DragMode: TxDragMode; safecall;
  27.     function Get_Enabled: WordBool; safecall;
  28.     function Get_ParentCtl3D: WordBool; safecall;
  29.     function Get_UpNumGlyphs: Smallint; safecall;
  30.     function Get_Visible: WordBool; safecall;
  31.     procedure AboutBox; safecall;
  32.     procedure Set_Ctl3D(Value: WordBool); safecall;
  33.     procedure Set_Cursor(Value: Smallint); safecall;
  34.     procedure Set_DownNumGlyphs(Value: Smallint); safecall;
  35.     procedure Set_DragCursor(Value: Smallint); safecall;
  36.     procedure Set_DragMode(Value: TxDragMode); safecall;
  37.     procedure Set_Enabled(Value: WordBool); safecall;
  38.     procedure Set_ParentCtl3D(Value: WordBool); safecall;
  39.     procedure Set_UpNumGlyphs(Value: Smallint); safecall;
  40.     procedure Set_Visible(Value: WordBool); safecall;
  41.   end;
  42.  
  43. implementation
  44.  
  45. uses About26;
  46.  
  47. { TSpinButtonX }
  48.  
  49. procedure TSpinButtonX.InitializeControl;
  50. begin
  51.   FDelphiControl := Control as TSpinButton;
  52.   FDelphiControl.OnDownClick := DownClickEvent;
  53.   FDelphiControl.OnUpClick := UpClickEvent;
  54. end;
  55.  
  56. procedure TSpinButtonX.EventSinkChanged(const EventSink: IUnknown);
  57. begin
  58.   FEvents := EventSink as ISpinButtonXEvents;
  59. end;
  60.  
  61. procedure TSpinButtonX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  62. begin
  63.   { Define property pages here.  Property pages are defined by calling
  64.     DefinePropertyPage with the class id of the page.  For example,
  65.       DefinePropertyPage(Class_SpinButtonXPage); }
  66. end;
  67.  
  68. function TSpinButtonX.Get_Ctl3D: WordBool;
  69. begin
  70.   Result := FDelphiControl.Ctl3D;
  71. end;
  72.  
  73. function TSpinButtonX.Get_Cursor: Smallint;
  74. begin
  75.   Result := Smallint(FDelphiControl.Cursor);
  76. end;
  77.  
  78. function TSpinButtonX.Get_DownNumGlyphs: Smallint;
  79. begin
  80.   Result := Smallint(FDelphiControl.DownNumGlyphs);
  81. end;
  82.  
  83. function TSpinButtonX.Get_DragCursor: Smallint;
  84. begin
  85.   Result := Smallint(FDelphiControl.DragCursor);
  86. end;
  87.  
  88. function TSpinButtonX.Get_DragMode: TxDragMode;
  89. begin
  90.   Result := Ord(FDelphiControl.DragMode);
  91. end;
  92.  
  93. function TSpinButtonX.Get_Enabled: WordBool;
  94. begin
  95.   Result := FDelphiControl.Enabled;
  96. end;
  97.  
  98. function TSpinButtonX.Get_ParentCtl3D: WordBool;
  99. begin
  100.   Result := FDelphiControl.ParentCtl3D;
  101. end;
  102.  
  103. function TSpinButtonX.Get_UpNumGlyphs: Smallint;
  104. begin
  105.   Result := Smallint(FDelphiControl.UpNumGlyphs);
  106. end;
  107.  
  108. function TSpinButtonX.Get_Visible: WordBool;
  109. begin
  110.   Result := FDelphiControl.Visible;
  111. end;
  112.  
  113. procedure TSpinButtonX.AboutBox;
  114. begin
  115.   ShowSpinButtonXAbout;
  116. end;
  117.  
  118. procedure TSpinButtonX.Set_Ctl3D(Value: WordBool);
  119. begin
  120.   FDelphiControl.Ctl3D := Value;
  121. end;
  122.  
  123. procedure TSpinButtonX.Set_Cursor(Value: Smallint);
  124. begin
  125.   FDelphiControl.Cursor := TCursor(Value);
  126. end;
  127.  
  128. procedure TSpinButtonX.Set_DownNumGlyphs(Value: Smallint);
  129. begin
  130.   FDelphiControl.DownNumGlyphs := TNumGlyphs(Value);
  131. end;
  132.  
  133. procedure TSpinButtonX.Set_DragCursor(Value: Smallint);
  134. begin
  135.   FDelphiControl.DragCursor := TCursor(Value);
  136. end;
  137.  
  138. procedure TSpinButtonX.Set_DragMode(Value: TxDragMode);
  139. begin
  140.   FDelphiControl.DragMode := TDragMode(Value);
  141. end;
  142.  
  143. procedure TSpinButtonX.Set_Enabled(Value: WordBool);
  144. begin
  145.   FDelphiControl.Enabled := Value;
  146. end;
  147.  
  148. procedure TSpinButtonX.Set_ParentCtl3D(Value: WordBool);
  149. begin
  150.   FDelphiControl.ParentCtl3D := Value;
  151. end;
  152.  
  153. procedure TSpinButtonX.Set_UpNumGlyphs(Value: Smallint);
  154. begin
  155.   FDelphiControl.UpNumGlyphs := TNumGlyphs(Value);
  156. end;
  157.  
  158. procedure TSpinButtonX.Set_Visible(Value: WordBool);
  159. begin
  160.   FDelphiControl.Visible := Value;
  161. end;
  162.  
  163. procedure TSpinButtonX.DownClickEvent(Sender: TObject);
  164. begin
  165.   if FEvents <> nil then FEvents.OnDownClick;
  166. end;
  167.  
  168. procedure TSpinButtonX.UpClickEvent(Sender: TObject);
  169. begin
  170.   if FEvents <> nil then FEvents.OnUpClick;
  171. end;
  172.  
  173. initialization
  174.   TActiveXControlFactory.Create(
  175.     ComServer,
  176.     TSpinButtonX,
  177.     TSpinButton,
  178.     Class_SpinButtonX,
  179.     26,
  180.     '{FA7B85FF-9ED7-11D0-AA40-444553540000}',
  181.     0);
  182. end.
  183.