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

  1. unit StrGImpl;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
  7.   ComServ, StdVCL, AXCtrls, DelC_TLB, Grids;
  8.  
  9. type
  10.   TStringGridX = class(TActiveXControl, IStringGridX)
  11.   private
  12.     { Private declarations }
  13.     FDelphiControl: TStringGrid;
  14.     FEvents: IStringGridXEvents;
  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_BorderStyle: TxBorderStyle; safecall;
  21.     function Get_Col: Integer; safecall;
  22.     function Get_ColCount: Integer; safecall;
  23.     function Get_Color: TColor; safecall;
  24.     function Get_Ctl3D: WordBool; safecall;
  25.     function Get_Cursor: Smallint; safecall;
  26.     function Get_DefaultColWidth: Integer; safecall;
  27.     function Get_DefaultDrawing: WordBool; safecall;
  28.     function Get_DefaultRowHeight: Integer; safecall;
  29.     function Get_DragCursor: Smallint; safecall;
  30.     function Get_DragMode: TxDragMode; safecall;
  31.     function Get_EditorMode: WordBool; safecall;
  32.     function Get_Enabled: WordBool; safecall;
  33.     function Get_FixedColor: TColor; safecall;
  34.     function Get_FixedCols: Integer; safecall;
  35.     function Get_FixedRows: Integer; safecall;
  36.     function Get_Font: Font; safecall;
  37.     function Get_GridHeight: Integer; safecall;
  38.     function Get_GridLineWidth: Integer; safecall;
  39.     function Get_GridWidth: Integer; safecall;
  40.     function Get_LeftCol: Integer; safecall;
  41.     function Get_ParentColor: WordBool; safecall;
  42.     function Get_ParentCtl3D: WordBool; safecall;
  43.     function Get_Row: Integer; safecall;
  44.     function Get_RowCount: Integer; safecall;
  45.     function Get_ScrollBars: TxScrollStyle; safecall;
  46.     function Get_TopRow: Integer; safecall;
  47.     function Get_Visible: WordBool; safecall;
  48.     function Get_VisibleColCount: Integer; safecall;
  49.     function Get_VisibleRowCount: Integer; safecall;
  50.     procedure AboutBox; safecall;
  51.     procedure MouseToCell(X, Y: Integer; var ACol, ARow: Integer); safecall;
  52.     procedure Set_BorderStyle(Value: TxBorderStyle); safecall;
  53.     procedure Set_Col(Value: Integer); safecall;
  54.     procedure Set_ColCount(Value: Integer); safecall;
  55.     procedure Set_Color(Value: TColor); safecall;
  56.     procedure Set_Ctl3D(Value: WordBool); safecall;
  57.     procedure Set_Cursor(Value: Smallint); safecall;
  58.     procedure Set_DefaultColWidth(Value: Integer); safecall;
  59.     procedure Set_DefaultDrawing(Value: WordBool); safecall;
  60.     procedure Set_DefaultRowHeight(Value: Integer); safecall;
  61.     procedure Set_DragCursor(Value: Smallint); safecall;
  62.     procedure Set_DragMode(Value: TxDragMode); safecall;
  63.     procedure Set_EditorMode(Value: WordBool); safecall;
  64.     procedure Set_Enabled(Value: WordBool); safecall;
  65.     procedure Set_FixedColor(Value: TColor); safecall;
  66.     procedure Set_FixedCols(Value: Integer); safecall;
  67.     procedure Set_FixedRows(Value: Integer); safecall;
  68.     procedure Set_Font(const Value: Font); safecall;
  69.     procedure Set_GridLineWidth(Value: Integer); safecall;
  70.     procedure Set_LeftCol(Value: Integer); safecall;
  71.     procedure Set_ParentColor(Value: WordBool); safecall;
  72.     procedure Set_ParentCtl3D(Value: WordBool); safecall;
  73.     procedure Set_Row(Value: Integer); safecall;
  74.     procedure Set_RowCount(Value: Integer); safecall;
  75.     procedure Set_ScrollBars(Value: TxScrollStyle); safecall;
  76.     procedure Set_TopRow(Value: Integer); safecall;
  77.     procedure Set_Visible(Value: WordBool); safecall;
  78.   end;
  79.  
  80. implementation
  81.  
  82. uses About29;
  83.  
  84. { TStringGridX }
  85.  
  86. procedure TStringGridX.InitializeControl;
  87. begin
  88.   FDelphiControl := Control as TStringGrid;
  89. end;
  90.  
  91. procedure TStringGridX.EventSinkChanged(const EventSink: IUnknown);
  92. begin
  93.   FEvents := EventSink as IStringGridXEvents;
  94. end;
  95.  
  96. procedure TStringGridX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
  97. begin
  98.   { Define property pages here.  Property pages are defined by calling
  99.     DefinePropertyPage with the class id of the page.  For example,
  100.       DefinePropertyPage(Class_StringGridXPage); }
  101. end;
  102.  
  103. function TStringGridX.Get_BorderStyle: TxBorderStyle;
  104. begin
  105.   Result := Ord(FDelphiControl.BorderStyle);
  106. end;
  107.  
  108. function TStringGridX.Get_Col: Integer;
  109. begin
  110.   Result := FDelphiControl.Col;
  111. end;
  112.  
  113. function TStringGridX.Get_ColCount: Integer;
  114. begin
  115.   Result := FDelphiControl.ColCount;
  116. end;
  117.  
  118. function TStringGridX.Get_Color: TColor;
  119. begin
  120.   Result := FDelphiControl.Color;
  121. end;
  122.  
  123. function TStringGridX.Get_Ctl3D: WordBool;
  124. begin
  125.   Result := FDelphiControl.Ctl3D;
  126. end;
  127.  
  128. function TStringGridX.Get_Cursor: Smallint;
  129. begin
  130.   Result := Smallint(FDelphiControl.Cursor);
  131. end;
  132.  
  133. function TStringGridX.Get_DefaultColWidth: Integer;
  134. begin
  135.   Result := FDelphiControl.DefaultColWidth;
  136. end;
  137.  
  138. function TStringGridX.Get_DefaultDrawing: WordBool;
  139. begin
  140.   Result := FDelphiControl.DefaultDrawing;
  141. end;
  142.  
  143. function TStringGridX.Get_DefaultRowHeight: Integer;
  144. begin
  145.   Result := FDelphiControl.DefaultRowHeight;
  146. end;
  147.  
  148. function TStringGridX.Get_DragCursor: Smallint;
  149. begin
  150.   Result := Smallint(FDelphiControl.DragCursor);
  151. end;
  152.  
  153. function TStringGridX.Get_DragMode: TxDragMode;
  154. begin
  155.   Result := Ord(FDelphiControl.DragMode);
  156. end;
  157.  
  158. function TStringGridX.Get_EditorMode: WordBool;
  159. begin
  160.   Result := FDelphiControl.EditorMode;
  161. end;
  162.  
  163. function TStringGridX.Get_Enabled: WordBool;
  164. begin
  165.   Result := FDelphiControl.Enabled;
  166. end;
  167.  
  168. function TStringGridX.Get_FixedColor: TColor;
  169. begin
  170.   Result := FDelphiControl.FixedColor;
  171. end;
  172.  
  173. function TStringGridX.Get_FixedCols: Integer;
  174. begin
  175.   Result := FDelphiControl.FixedCols;
  176. end;
  177.  
  178. function TStringGridX.Get_FixedRows: Integer;
  179. begin
  180.   Result := FDelphiControl.FixedRows;
  181. end;
  182.  
  183. function TStringGridX.Get_Font: Font;
  184. begin
  185.   GetOleFont(FDelphiControl.Font, Result);
  186. end;
  187.  
  188. function TStringGridX.Get_GridHeight: Integer;
  189. begin
  190.   Result := FDelphiControl.GridHeight;
  191. end;
  192.  
  193. function TStringGridX.Get_GridLineWidth: Integer;
  194. begin
  195.   Result := FDelphiControl.GridLineWidth;
  196. end;
  197.  
  198. function TStringGridX.Get_GridWidth: Integer;
  199. begin
  200.   Result := FDelphiControl.GridWidth;
  201. end;
  202.  
  203. function TStringGridX.Get_LeftCol: Integer;
  204. begin
  205.   Result := FDelphiControl.LeftCol;
  206. end;
  207.  
  208. function TStringGridX.Get_ParentColor: WordBool;
  209. begin
  210.   Result := FDelphiControl.ParentColor;
  211. end;
  212.  
  213. function TStringGridX.Get_ParentCtl3D: WordBool;
  214. begin
  215.   Result := FDelphiControl.ParentCtl3D;
  216. end;
  217.  
  218. function TStringGridX.Get_Row: Integer;
  219. begin
  220.   Result := FDelphiControl.Row;
  221. end;
  222.  
  223. function TStringGridX.Get_RowCount: Integer;
  224. begin
  225.   Result := FDelphiControl.RowCount;
  226. end;
  227.  
  228. function TStringGridX.Get_ScrollBars: TxScrollStyle;
  229. begin
  230.   Result := Ord(FDelphiControl.ScrollBars);
  231. end;
  232.  
  233. function TStringGridX.Get_TopRow: Integer;
  234. begin
  235.   Result := FDelphiControl.TopRow;
  236. end;
  237.  
  238. function TStringGridX.Get_Visible: WordBool;
  239. begin
  240.   Result := FDelphiControl.Visible;
  241. end;
  242.  
  243. function TStringGridX.Get_VisibleColCount: Integer;
  244. begin
  245.   Result := FDelphiControl.VisibleColCount;
  246. end;
  247.  
  248. function TStringGridX.Get_VisibleRowCount: Integer;
  249. begin
  250.   Result := FDelphiControl.VisibleRowCount;
  251. end;
  252.  
  253. procedure TStringGridX.AboutBox;
  254. begin
  255.   ShowStringGridXAbout;
  256. end;
  257.  
  258. procedure TStringGridX.MouseToCell(X, Y: Integer; var ACol, ARow: Integer);
  259. begin
  260.  
  261. end;
  262.  
  263. procedure TStringGridX.Set_BorderStyle(Value: TxBorderStyle);
  264. begin
  265.   FDelphiControl.BorderStyle := TBorderStyle(Value);
  266. end;
  267.  
  268. procedure TStringGridX.Set_Col(Value: Integer);
  269. begin
  270.   FDelphiControl.Col := Value;
  271. end;
  272.  
  273. procedure TStringGridX.Set_ColCount(Value: Integer);
  274. begin
  275.   FDelphiControl.ColCount := Value;
  276. end;
  277.  
  278. procedure TStringGridX.Set_Color(Value: TColor);
  279. begin
  280.   FDelphiControl.Color := Value;
  281. end;
  282.  
  283. procedure TStringGridX.Set_Ctl3D(Value: WordBool);
  284. begin
  285.   FDelphiControl.Ctl3D := Value;
  286. end;
  287.  
  288. procedure TStringGridX.Set_Cursor(Value: Smallint);
  289. begin
  290.   FDelphiControl.Cursor := TCursor(Value);
  291. end;
  292.  
  293. procedure TStringGridX.Set_DefaultColWidth(Value: Integer);
  294. begin
  295.   FDelphiControl.DefaultColWidth := Value;
  296. end;
  297.  
  298. procedure TStringGridX.Set_DefaultDrawing(Value: WordBool);
  299. begin
  300.   FDelphiControl.DefaultDrawing := Value;
  301. end;
  302.  
  303. procedure TStringGridX.Set_DefaultRowHeight(Value: Integer);
  304. begin
  305.   FDelphiControl.DefaultRowHeight := Value;
  306. end;
  307.  
  308. procedure TStringGridX.Set_DragCursor(Value: Smallint);
  309. begin
  310.   FDelphiControl.DragCursor := TCursor(Value);
  311. end;
  312.  
  313. procedure TStringGridX.Set_DragMode(Value: TxDragMode);
  314. begin
  315.   FDelphiControl.DragMode := TDragMode(Value);
  316. end;
  317.  
  318. procedure TStringGridX.Set_EditorMode(Value: WordBool);
  319. begin
  320.   FDelphiControl.EditorMode := Value;
  321. end;
  322.  
  323. procedure TStringGridX.Set_Enabled(Value: WordBool);
  324. begin
  325.   FDelphiControl.Enabled := Value;
  326. end;
  327.  
  328. procedure TStringGridX.Set_FixedColor(Value: TColor);
  329. begin
  330.   FDelphiControl.FixedColor := Value;
  331. end;
  332.  
  333. procedure TStringGridX.Set_FixedCols(Value: Integer);
  334. begin
  335.   FDelphiControl.FixedCols := Value;
  336. end;
  337.  
  338. procedure TStringGridX.Set_FixedRows(Value: Integer);
  339. begin
  340.   FDelphiControl.FixedRows := Value;
  341. end;
  342.  
  343. procedure TStringGridX.Set_Font(const Value: Font);
  344. begin
  345.   SetOleFont(FDelphiControl.Font, Value);
  346. end;
  347.  
  348. procedure TStringGridX.Set_GridLineWidth(Value: Integer);
  349. begin
  350.   FDelphiControl.GridLineWidth := Value;
  351. end;
  352.  
  353. procedure TStringGridX.Set_LeftCol(Value: Integer);
  354. begin
  355.   FDelphiControl.LeftCol := Value;
  356. end;
  357.  
  358. procedure TStringGridX.Set_ParentColor(Value: WordBool);
  359. begin
  360.   FDelphiControl.ParentColor := Value;
  361. end;
  362.  
  363. procedure TStringGridX.Set_ParentCtl3D(Value: WordBool);
  364. begin
  365.   FDelphiControl.ParentCtl3D := Value;
  366. end;
  367.  
  368. procedure TStringGridX.Set_Row(Value: Integer);
  369. begin
  370.   FDelphiControl.Row := Value;
  371. end;
  372.  
  373. procedure TStringGridX.Set_RowCount(Value: Integer);
  374. begin
  375.   FDelphiControl.RowCount := Value;
  376. end;
  377.  
  378. procedure TStringGridX.Set_ScrollBars(Value: TxScrollStyle);
  379. begin
  380.   FDelphiControl.ScrollBars := TScrollStyle(Value);
  381. end;
  382.  
  383. procedure TStringGridX.Set_TopRow(Value: Integer);
  384. begin
  385.   FDelphiControl.TopRow := Value;
  386. end;
  387.  
  388. procedure TStringGridX.Set_Visible(Value: WordBool);
  389. begin
  390.   FDelphiControl.Visible := Value;
  391. end;
  392.  
  393. initialization
  394.   TActiveXControlFactory.Create(
  395.     ComServer,
  396.     TStringGridX,
  397.     TStringGrid,
  398.     Class_StringGridX,
  399.     29,
  400.     '{FA7B86B1-9ED7-11D0-AA40-444553540000}',
  401.     0);
  402. end.
  403.