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

  1. unit RGrpImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelC_TLB, ExtCtrls;
  8.  
  9. type
  10.   TRadioGroupX = class(TActiveXControl, IRadioGroupX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: TRadioGroup;
  14.     FEvents: IRadioGroupXEvents;
  15.     procedure ClickEvent(Sender: TObject);
  16.   protected
  17.     { Protected declarations }
  18.     procedure InitializeControl; override;
  19.     procedure EventSinkChanged(const EventSink: IUnknown); override;
  20.     procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
  21.     function Get_Caption: WideString; safecall;
  22.     function Get_Color: TColor; safecall;
  23.     function Get_Columns: Integer; safecall;
  24.     function Get_Ctl3D: WordBool; safecall;
  25.     function Get_Cursor: Smallint; safecall;
  26.     function Get_DragCursor: Smallint; safecall;
  27.     function Get_DragMode: TxDragMode; safecall;
  28.     function Get_Enabled: WordBool; safecall;
  29.     function Get_Font: Font; safecall;
  30.     function Get_ItemIndex: Integer; safecall;
  31.     function Get_Items: IStrings; safecall;
  32.     function Get_ParentColor: WordBool; safecall;
  33.     function Get_ParentCtl3D: WordBool; safecall;
  34.     function Get_Visible: WordBool; safecall;
  35.     procedure AboutBox; safecall;
  36.     procedure Set_Caption(const Value: WideString); safecall;
  37.     procedure Set_Color(Value: TColor); safecall;
  38.     procedure Set_Columns(Value: Integer); safecall;
  39.     procedure Set_Ctl3D(Value: WordBool); safecall;
  40.     procedure Set_Cursor(Value: Smallint); safecall;
  41.     procedure Set_DragCursor(Value: Smallint); safecall;
  42.     procedure Set_DragMode(Value: TxDragMode); safecall;
  43.     procedure Set_Enabled(Value: WordBool); safecall;
  44.     procedure Set_Font(const Value: Font); safecall;
  45.     procedure Set_ItemIndex(Value: Integer); safecall;
  46.     procedure Set_Items(const Value: IStrings); safecall;
  47.     procedure Set_ParentColor(Value: WordBool); safecall;
  48.     procedure Set_ParentCtl3D(Value: WordBool); safecall;
  49.     procedure Set_Visible(Value: WordBool); safecall;
  50.   end;
  51.  
  52. implementation
  53.  
  54. uses About22;
  55.  
  56. { TRadioGroupX }
  57.  
  58. procedure TRadioGroupX.InitializeControl;
  59. begin
  60.   FDelphiControl := Control as TRadioGroup;
  61.   FDelphiControl.OnClick := ClickEvent;
  62. end;
  63.  
  64. procedure TRadioGroupX.EventSinkChanged(const EventSink: IUnknown);
  65. begin
  66.   FEvents := EventSink as IRadioGroupXEvents;
  67. end;
  68.  
  69. procedure TRadioGroupX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  70. begin
  71.   { Define property pages here.  Property pages are defined by calling
  72.     DefinePropertyPage with the class id of the page.  For example,
  73.       DefinePropertyPage(Class_RadioGroupXPage); }
  74. end;
  75.  
  76. function TRadioGroupX.Get_Caption: WideString;
  77. begin
  78.   Result := WideString(FDelphiControl.Caption);
  79. end;
  80.  
  81. function TRadioGroupX.Get_Color: TColor;
  82. begin
  83.   Result := FDelphiControl.Color;
  84. end;
  85.  
  86. function TRadioGroupX.Get_Columns: Integer;
  87. begin
  88.   Result := FDelphiControl.Columns;
  89. end;
  90.  
  91. function TRadioGroupX.Get_Ctl3D: WordBool;
  92. begin
  93.   Result := FDelphiControl.Ctl3D;
  94. end;
  95.  
  96. function TRadioGroupX.Get_Cursor: Smallint;
  97. begin
  98.   Result := Smallint(FDelphiControl.Cursor);
  99. end;
  100.  
  101. function TRadioGroupX.Get_DragCursor: Smallint;
  102. begin
  103.   Result := Smallint(FDelphiControl.DragCursor);
  104. end;
  105.  
  106. function TRadioGroupX.Get_DragMode: TxDragMode;
  107. begin
  108.   Result := Ord(FDelphiControl.DragMode);
  109. end;
  110.  
  111. function TRadioGroupX.Get_Enabled: WordBool;
  112. begin
  113.   Result := FDelphiControl.Enabled;
  114. end;
  115.  
  116. function TRadioGroupX.Get_Font: Font;
  117. begin
  118.   GetOleFont(FDelphiControl.Font, Result);
  119. end;
  120.  
  121. function TRadioGroupX.Get_ItemIndex: Integer;
  122. begin
  123.   Result := FDelphiControl.ItemIndex;
  124. end;
  125.  
  126. function TRadioGroupX.Get_Items: IStrings;
  127. begin
  128.   GetOleStrings(FDelphiControl.Items, Result);
  129. end;
  130.  
  131. function TRadioGroupX.Get_ParentColor: WordBool;
  132. begin
  133.   Result := FDelphiControl.ParentColor;
  134. end;
  135.  
  136. function TRadioGroupX.Get_ParentCtl3D: WordBool;
  137. begin
  138.   Result := FDelphiControl.ParentCtl3D;
  139. end;
  140.  
  141. function TRadioGroupX.Get_Visible: WordBool;
  142. begin
  143.   Result := FDelphiControl.Visible;
  144. end;
  145.  
  146. procedure TRadioGroupX.AboutBox;
  147. begin
  148.   ShowRadioGroupXAbout;
  149. end;
  150.  
  151. procedure TRadioGroupX.Set_Caption(const Value: WideString);
  152. begin
  153.   FDelphiControl.Caption := TCaption(Value);
  154. end;
  155.  
  156. procedure TRadioGroupX.Set_Color(Value: TColor);
  157. begin
  158.   FDelphiControl.Color := Value;
  159. end;
  160.  
  161. procedure TRadioGroupX.Set_Columns(Value: Integer);
  162. begin
  163.   FDelphiControl.Columns := Value;
  164. end;
  165.  
  166. procedure TRadioGroupX.Set_Ctl3D(Value: WordBool);
  167. begin
  168.   FDelphiControl.Ctl3D := Value;
  169. end;
  170.  
  171. procedure TRadioGroupX.Set_Cursor(Value: Smallint);
  172. begin
  173.   FDelphiControl.Cursor := TCursor(Value);
  174. end;
  175.  
  176. procedure TRadioGroupX.Set_DragCursor(Value: Smallint);
  177. begin
  178.   FDelphiControl.DragCursor := TCursor(Value);
  179. end;
  180.  
  181. procedure TRadioGroupX.Set_DragMode(Value: TxDragMode);
  182. begin
  183.   FDelphiControl.DragMode := TDragMode(Value);
  184. end;
  185.  
  186. procedure TRadioGroupX.Set_Enabled(Value: WordBool);
  187. begin
  188.   FDelphiControl.Enabled := Value;
  189. end;
  190.  
  191. procedure TRadioGroupX.Set_Font(const Value: Font);
  192. begin
  193.   SetOleFont(FDelphiControl.Font, Value);
  194. end;
  195.  
  196. procedure TRadioGroupX.Set_ItemIndex(Value: Integer);
  197. begin
  198.   FDelphiControl.ItemIndex := Value;
  199. end;
  200.  
  201. procedure TRadioGroupX.Set_Items(const Value: IStrings);
  202. begin
  203.   SetOleStrings(FDelphiControl.Items, Value);
  204. end;
  205.  
  206. procedure TRadioGroupX.Set_ParentColor(Value: WordBool);
  207. begin
  208.   FDelphiControl.ParentColor := Value;
  209. end;
  210.  
  211. procedure TRadioGroupX.Set_ParentCtl3D(Value: WordBool);
  212. begin
  213.   FDelphiControl.ParentCtl3D := Value;
  214. end;
  215.  
  216. procedure TRadioGroupX.Set_Visible(Value: WordBool);
  217. begin
  218.   FDelphiControl.Visible := Value;
  219. end;
  220.  
  221. procedure TRadioGroupX.ClickEvent(Sender: TObject);
  222. begin
  223.   if FEvents <> nil then FEvents.OnClick;
  224. end;
  225.  
  226. initialization
  227.   TActiveXControlFactory.Create(
  228.     ComServer,
  229.     TRadioGroupX,
  230.     TRadioGroup,
  231.     Class_RadioGroupX,
  232.     22,
  233.     '{FA7B852D-9ED7-11D0-AA40-444553540000}',
  234.     0);
  235. end.
  236.