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

  1. unit PBarImpl;
  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.   TProgressBarX = class(TActiveXControl, IProgressBarX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: TProgressBar;
  14.     FEvents: IProgressBarXEvents;
  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_Cursor: Smallint; safecall;
  21.     function Get_DragCursor: Smallint; safecall;
  22.     function Get_DragMode: TxDragMode; safecall;
  23.     function Get_Enabled: WordBool; safecall;
  24.     function Get_Max: Integer; safecall;
  25.     function Get_Min: Integer; safecall;
  26.     function Get_Position: Integer; safecall;
  27.     function Get_Step: Integer; safecall;
  28.     function Get_Visible: WordBool; safecall;
  29.     procedure AboutBox; safecall;
  30.     procedure Set_Cursor(Value: Smallint); safecall;
  31.     procedure Set_DragCursor(Value: Smallint); safecall;
  32.     procedure Set_DragMode(Value: TxDragMode); safecall;
  33.     procedure Set_Enabled(Value: WordBool); safecall;
  34.     procedure Set_Max(Value: Integer); safecall;
  35.     procedure Set_Min(Value: Integer); safecall;
  36.     procedure Set_Position(Value: Integer); safecall;
  37.     procedure Set_Step(Value: Integer); safecall;
  38.     procedure Set_Visible(Value: WordBool); safecall;
  39.     procedure StepBy(Delta: Integer); safecall;
  40.     procedure StepIt; safecall;
  41.   end;
  42.  
  43. implementation
  44.  
  45. uses About20;
  46.  
  47. { TProgressBarX }
  48.  
  49. procedure TProgressBarX.InitializeControl;
  50. begin
  51.   FDelphiControl := Control as TProgressBar;
  52. end;
  53.  
  54. procedure TProgressBarX.EventSinkChanged(const EventSink: IUnknown);
  55. begin
  56.   FEvents := EventSink as IProgressBarXEvents;
  57. end;
  58.  
  59. procedure TProgressBarX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  60. begin
  61.   { Define property pages here.  Property pages are defined by calling
  62.     DefinePropertyPage with the class id of the page.  For example,
  63.       DefinePropertyPage(Class_ProgressBarXPage); }
  64. end;
  65.  
  66. function TProgressBarX.Get_Cursor: Smallint;
  67. begin
  68.   Result := Smallint(FDelphiControl.Cursor);
  69. end;
  70.  
  71. function TProgressBarX.Get_DragCursor: Smallint;
  72. begin
  73.   Result := Smallint(FDelphiControl.DragCursor);
  74. end;
  75.  
  76. function TProgressBarX.Get_DragMode: TxDragMode;
  77. begin
  78.   Result := Ord(FDelphiControl.DragMode);
  79. end;
  80.  
  81. function TProgressBarX.Get_Enabled: WordBool;
  82. begin
  83.   Result := FDelphiControl.Enabled;
  84. end;
  85.  
  86. function TProgressBarX.Get_Max: Integer;
  87. begin
  88.   Result := FDelphiControl.Max;
  89. end;
  90.  
  91. function TProgressBarX.Get_Min: Integer;
  92. begin
  93.   Result := FDelphiControl.Min;
  94. end;
  95.  
  96. function TProgressBarX.Get_Position: Integer;
  97. begin
  98.   Result := FDelphiControl.Position;
  99. end;
  100.  
  101. function TProgressBarX.Get_Step: Integer;
  102. begin
  103.   Result := FDelphiControl.Step;
  104. end;
  105.  
  106. function TProgressBarX.Get_Visible: WordBool;
  107. begin
  108.   Result := FDelphiControl.Visible;
  109. end;
  110.  
  111. procedure TProgressBarX.AboutBox;
  112. begin
  113.   ShowProgressBarXAbout;
  114. end;
  115.  
  116. procedure TProgressBarX.Set_Cursor(Value: Smallint);
  117. begin
  118.   FDelphiControl.Cursor := TCursor(Value);
  119. end;
  120.  
  121. procedure TProgressBarX.Set_DragCursor(Value: Smallint);
  122. begin
  123.   FDelphiControl.DragCursor := TCursor(Value);
  124. end;
  125.  
  126. procedure TProgressBarX.Set_DragMode(Value: TxDragMode);
  127. begin
  128.   FDelphiControl.DragMode := TDragMode(Value);
  129. end;
  130.  
  131. procedure TProgressBarX.Set_Enabled(Value: WordBool);
  132. begin
  133.   FDelphiControl.Enabled := Value;
  134. end;
  135.  
  136. procedure TProgressBarX.Set_Max(Value: Integer);
  137. begin
  138.   FDelphiControl.Max := Value;
  139. end;
  140.  
  141. procedure TProgressBarX.Set_Min(Value: Integer);
  142. begin
  143.   FDelphiControl.Min := Value;
  144. end;
  145.  
  146. procedure TProgressBarX.Set_Position(Value: Integer);
  147. begin
  148.   FDelphiControl.Position := Value;
  149. end;
  150.  
  151. procedure TProgressBarX.Set_Step(Value: Integer);
  152. begin
  153.   FDelphiControl.Step := Value;
  154. end;
  155.  
  156. procedure TProgressBarX.Set_Visible(Value: WordBool);
  157. begin
  158.   FDelphiControl.Visible := Value;
  159. end;
  160.  
  161. procedure TProgressBarX.StepBy(Delta: Integer);
  162. begin
  163.  
  164. end;
  165.  
  166. procedure TProgressBarX.StepIt;
  167. begin
  168.   FDelphiControl.StepIt;
  169. end;
  170.  
  171. initialization
  172.   TActiveXControlFactory.Create(
  173.     ComServer,
  174.     TProgressBarX,
  175.     TProgressBar,
  176.     Class_ProgressBarX,
  177.     20,
  178.     '{FA7B84D1-9ED7-11D0-AA40-444553540000}',
  179.     0);
  180. end.
  181.