home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 November / Chip_2002-11_cd1.bin / zkuste / delphi / kompon / d456 / CAJSCRPT.ZIP / ifps3 / ifpii_graphics.pas < prev    next >
Pascal/Delphi Source File  |  2002-07-12  |  9KB  |  194 lines

  1. unit ifpii_graphics;
  2.  
  3. {$I ifps3_def.inc}
  4. interface
  5. uses
  6.   ifpscomp, ifps3common, ifps3utl, ifpiclass;
  7.  
  8. {
  9.   Will register files from:
  10.     Graphics
  11.  
  12.  
  13. Register the STD library first
  14.  
  15. }
  16.  
  17. procedure SIRegister_Graphics_TypesAndConsts(Cl: TIFPSCompileTimeClassesImporter);
  18. procedure SIRegisterTGRAPHICSOBJECT(Cl: TIFPSCompileTimeClassesImporter);
  19. procedure SIRegisterTFont(Cl: TIFPSCompileTimeClassesImporter);
  20. procedure SIRegisterTPEN(Cl: TIFPSCompileTimeClassesImporter);
  21. procedure SIRegisterTBRUSH(Cl: TIFPSCompileTimeClassesImporter);
  22. procedure SIRegisterTCanvas(cl: TIFPSCompileTimeClassesImporter);
  23.  
  24.  
  25. procedure SIRegister_Graphics(Cl: TIFPSCompileTimeClassesImporter);
  26.  
  27. implementation
  28. uses
  29.   Classes {$IFDEF CLX},QControls,QGraphics{$ELSE},Controls, Graphics{$ENDIF};
  30.  
  31. procedure SIRegisterTGRAPHICSOBJECT(Cl: TIFPSCompileTimeClassesImporter);
  32. begin
  33.   with Cl.Add(cl.FindClass('TPERSISTENT'), TGRAPHICSOBJECT) do
  34.   begin
  35.     RegisterProperty('ONCHANGE', 'TNOTIFYEVENT', iptrw);
  36.   end;
  37. end;
  38.  
  39. procedure SIRegisterTFont(Cl: TIFPSCompileTimeClassesImporter);
  40. begin
  41.   with Cl.Add(cl.FindClass('TGraphicsObject'), TFont) do
  42.   begin
  43.     RegisterMethod('constructor Create;');
  44. {$IFNDEF CLX}
  45.     RegisterProperty('Handle', 'Integer', iptR);
  46. {$ENDIF}
  47.     RegisterProperty('PixelsPerInch', 'Integer', iptRW);
  48.     RegisterProperty('Color', 'Integer', iptRW);
  49.     RegisterProperty('Height', 'Integer', iptRW);
  50.     RegisterProperty('Name', 'string', iptRW);
  51.     RegisterProperty('Pitch', 'Byte', iptRW);
  52.     RegisterProperty('Size', 'Integer', iptRW);
  53.     RegisterProperty('Handle', 'Integer', iptRW);
  54.     RegisterProperty('PixelsPerInch', 'Integer', iptRW);
  55.   end;
  56. end;
  57.  
  58. procedure SIRegisterTCanvas(cl: TIFPSCompileTimeClassesImporter); // requires TPersistent
  59. begin
  60.   with Cl.Add(cl.FindClass('TPersistent'), TCanvas) do
  61.   begin
  62.     RegisterMethod('procedure Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);');
  63.     RegisterMethod('procedure Chord(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);');
  64.     RegisterMethod('procedure Draw(X, Y: Integer; Graphic: TGraphic);');
  65.     RegisterMethod('procedure Ellipse(X1, Y1, X2, Y2: Integer);');
  66. {$IFNDEF CLX}
  67.     RegisterMethod('procedure FloodFill(X, Y: Integer; Color: TColor; FillStyle: Byte);');
  68. {$ENDIF}
  69.     RegisterMethod('procedure LineTo(X, Y: Integer);');
  70.     RegisterMethod('procedure MoveTo(X, Y: Integer);');
  71.     RegisterMethod('procedure Pie(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer);');
  72.     RegisterMethod('procedure Rectangle(X1, Y1, X2, Y2: Integer);');
  73.     RegisterMethod('procedure Refresh;');
  74.     RegisterMethod('procedure RoundRect(X1, Y1, X2, Y2, X3, Y3: Integer);');
  75.     RegisterMethod('function TextHeight(Text: string): Integer;');
  76.     RegisterMethod('procedure TextOut(X, Y: Integer; Text: string);');
  77.     RegisterMethod('function TextWidth(Text: string): Integer;');
  78. {$IFNDEF CLX}
  79.     RegisterProperty('Handle', 'Integer', iptRw);
  80. {$ENDIF}
  81.     RegisterProperty('Pixels', 'Integer Integer Integer', iptRW);
  82.     RegisterProperty('Brush', 'TBrush', iptR);
  83.     RegisterProperty('CopyMode', 'Byte', iptRw);
  84.     RegisterProperty('Font', 'TFont', iptR);
  85.     RegisterProperty('Pen', 'TPen', iptR);
  86.   end;
  87. end;
  88.  
  89. procedure SIRegisterTPEN(Cl: TIFPSCompileTimeClassesImporter);
  90. begin
  91.   with Cl.Add(cl.FindClass('TGRAPHICSOBJECT'), TPEN) do
  92.   begin
  93.     RegisterMethod('constructor CREATE');
  94.     RegisterProperty('COLOR', 'TCOLOR', iptrw);
  95.     RegisterProperty('MODE', 'TPENMODE', iptrw);
  96.     RegisterProperty('STYLE', 'TPENSTYLE', iptrw);
  97.     RegisterProperty('WIDTH', 'INTEGER', iptrw);
  98.   end;
  99. end;
  100.  
  101. procedure SIRegisterTBRUSH(Cl: TIFPSCompileTimeClassesImporter);
  102. begin
  103.   with Cl.Add(cl.FindClass('TGRAPHICSOBJECT'), TBrush) do
  104.   begin
  105.     RegisterMethod('constructor CREATE');
  106.     RegisterProperty('COLOR', 'TCOLOR', iptrw);
  107.     RegisterProperty('STYLE', 'TBRUSHSTYLE', iptrw);
  108.   end;
  109. end;
  110.  
  111. procedure SIRegister_Graphics_TypesAndConsts(Cl: TIFPSCompileTimeClassesImporter);
  112. begin
  113.   cl.se.AddConstantN('clScrollBar', 'Integer')^.Value.Value := TransLongintToStr(clScrollBar);
  114.   cl.se.AddConstantN('clBackground', 'Integer')^.Value.Value := TransLongintToStr(clBackground);
  115.   cl.se.AddConstantN('clActiveCaption', 'Integer')^.Value.Value := TransLongintToStr(clActiveCaption);
  116.   cl.se.AddConstantN('clInactiveCaption', 'Integer')^.Value.Value := TransLongintToStr(clInactiveCaption);
  117.   cl.se.AddConstantN('clMenu', 'Integer')^.Value.Value := TransLongintToStr(clMenu);
  118.   cl.se.AddConstantN('clWindow', 'Integer')^.Value.Value := TransLongintToStr(clWindow);
  119.   cl.se.AddConstantN('clWindowFrame', 'Integer')^.Value.Value := TransLongintToStr(clWindowFrame);
  120.   cl.se.AddConstantN('clMenuText', 'Integer')^.Value.Value := TransLongintToStr(clMenuText);
  121.   cl.se.AddConstantN('clWindowText', 'Integer')^.Value.Value := TransLongintToStr(clWindowText);
  122.   cl.se.AddConstantN('clCaptionText', 'Integer')^.Value.Value := TransLongintToStr(clCaptionText);
  123.   cl.se.AddConstantN('clActiveBorder', 'Integer')^.Value.Value := TransLongintToStr(clActiveBorder);
  124.   cl.se.AddConstantN('clInactiveBorder', 'Integer')^.Value.Value := TransLongintToStr(clInactiveCaption);
  125.   cl.se.AddConstantN('clAppWorkSpace', 'Integer')^.Value.Value := TransLongintToStr(clAppWorkSpace);
  126.   cl.se.AddConstantN('clHighlight', 'Integer')^.Value.Value := TransLongintToStr(clHighlight);
  127.   cl.se.AddConstantN('clHighlightText', 'Integer')^.Value.Value := TransLongintToStr(clHighlightText);
  128.   cl.se.AddConstantN('clBtnFace', 'Integer')^.Value.Value := TransLongintToStr(clBtnFace);
  129.   cl.se.AddConstantN('clBtnShadow', 'Integer')^.Value.Value := TransLongintToStr(clBtnShadow);
  130.   cl.se.AddConstantN('clGrayText', 'Integer')^.Value.Value := TransLongintToStr(clGrayText);
  131.   cl.se.AddConstantN('clBtnText', 'Integer')^.Value.Value := TransLongintToStr(clBtnText);
  132.   cl.se.AddConstantN('clInactiveCaptionText', 'Integer')^.Value.Value := TransLongintToStr(clInactiveCaptionText);
  133.   cl.se.AddConstantN('clBtnHighlight', 'Integer')^.Value.Value := TransLongintToStr(clBtnHighlight);
  134.   cl.se.AddConstantN('cl3DDkShadow', 'Integer')^.Value.Value := TransLongintToStr(cl3DDkShadow);
  135.   cl.se.AddConstantN('cl3DLight', 'Integer')^.Value.Value := TransLongintToStr(cl3DLight);
  136.   cl.se.AddConstantN('clInfoText', 'Integer')^.Value.Value := TransLongintToStr(clInfoText);
  137.   cl.se.AddConstantN('clInfoBk', 'Integer')^.Value.Value := TransLongintToStr(clInfoBk);
  138.  
  139.   cl.se.AddConstantN('clBlack', 'Integer')^.Value.Value := TransLongintToStr($000000);
  140.   cl.se.AddConstantN('clMaroon', 'Integer')^.Value.Value := TransLongintToStr($000080);
  141.   cl.se.AddConstantN('clGreen', 'Integer')^.Value.Value := TransLongintToStr($008000);
  142.   cl.se.AddConstantN('clOlive', 'Integer')^.Value.Value := TransLongintToStr($008080);
  143.   cl.se.AddConstantN('clNavy', 'Integer')^.Value.Value := TransLongintToStr($800000);
  144.   cl.se.AddConstantN('clPurple', 'Integer')^.Value.Value := TransLongintToStr($800080);
  145.   cl.se.AddConstantN('clTeal', 'Integer')^.Value.Value := TransLongintToStr($808000);
  146.   cl.se.AddConstantN('clGray', 'Integer')^.Value.Value := TransLongintToStr($808080);
  147.   cl.se.AddConstantN('clSilver', 'Integer')^.Value.Value := TransLongintToStr($C0C0C0);
  148.   cl.se.AddConstantN('clRed', 'Integer')^.Value.Value := TransLongintToStr($0000FF);
  149.   cl.se.AddConstantN('clLime', 'Integer')^.Value.Value := TransLongintToStr($00FF00);
  150.   cl.se.AddConstantN('clYellow', 'Integer')^.Value.Value := TransLongintToStr($00FFFF);
  151.   cl.se.AddConstantN('clBlue', 'Integer')^.Value.Value := TransLongintToStr($FF0000);
  152.   cl.se.AddConstantN('clFuchsia', 'Integer')^.Value.Value := TransLongintToStr($FF00FF);
  153.   cl.se.AddConstantN('clAqua', 'Integer')^.Value.Value := TransLongintToStr($FFFF00);
  154.   cl.se.AddConstantN('clLtGray', 'Integer')^.Value.Value := TransLongintToStr($C0C0C0);
  155.   cl.se.AddConstantN('clDkGray', 'Integer')^.Value.Value := TransLongintToStr($808080);
  156.   cl.se.AddConstantN('clWhite', 'Integer')^.Value.Value := TransLongintToStr($FFFFFF);
  157.   cl.se.AddConstantN('clNone', 'Integer')^.Value.Value := TransLongintToStr($1FFFFFFF);
  158.   cl.se.AddConstantN('clDefault', 'Integer')^.Value.Value := TransLongintToStr($20000000);
  159.   cl.se.AddConstantN('fsBold', 'Integer')^.Value.Value := #1;
  160.   cl.se.AddConstantN('fsItalic', 'Integer')^.Value.Value := #2;
  161.   cl.se.AddConstantN('fsUnderline', 'Integer')^.Value.Value := #4;
  162.   cl.se.AddConstantN('fsStrikeout', 'Integer')^.Value.Value := #8;
  163.  
  164.   cl.se.AddTypeS('TFontPitch', '(fpDefault, fpVariable, fpFixed)');
  165.   cl.se.AddTypeS('TPenStyle', '(psSolid, psDash, psDot, psDashDot, psDashDotDot, psClear, psInsideFrame)');
  166.   cl.se.AddTypeS('TPenMode', '(pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy, pmMergePenNot, pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge, pmNotMerge, pmMask, pmNotMask, pmXor, pmNotXor)');
  167.   cl.se.AddTypeS('TBrushStyle', '(bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross)');
  168.   cl.se.addTypeS('TColor', 'integer');
  169. end;
  170.  
  171.  
  172. procedure SIRegister_Graphics(Cl: TIFPSCompileTimeClassesImporter);
  173. begin
  174.   SIRegister_Graphics_TypesAndConsts(Cl);
  175.   SIRegisterTGRAPHICSOBJECT(Cl);
  176.   SIRegisterTFont(Cl);
  177.   SIRegisterTPEN(cl);
  178.   SIRegisterTBRUSH(cl);
  179.   SIRegisterTCanvas(cl);
  180. end;
  181.  
  182. // MiniVCL changes by Martijn Laan (mlaan at wintax _dot_ nl)
  183.  
  184.  
  185. End.
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.