StandardLibsFme.pas 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. unit StandardLibsFme;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, JimPages, JimTabs, StandardBillsFme, UtilMethods, StandardLibs;
  6. type
  7. TStandardLibsFrame = class(TFrame)
  8. jtsStandardLibs: TJimTabSet;
  9. jpStandardLibs: TJimPages;
  10. jpStandardLibsXm: TJimPage;
  11. jpStandardLibsGcl: TJimPage;
  12. procedure jtsStandardLibsChange(Sender: TObject; NewTab: Integer;
  13. var AllowChange: Boolean);
  14. private
  15. FGclBillsFrame: TStandardBillsFrame;
  16. FXmBillsFrame: TStandardBillsFrame;
  17. FStandardLibs: TStandardLibs;
  18. function CreateBillsFrame(AParent: TWinControl; ABillsType: TBillsType): TStandardBillsFrame;
  19. public
  20. constructor Create(AStandardLibs: TStandardLibs);
  21. destructor Destroy; override;
  22. procedure ConnectStandardLibs;
  23. property StandardLibs: TStandardLibs read FStandardLibs;
  24. property XmBillsFrame: TStandardBillsFrame read FXmBillsFrame;
  25. property GclBillsFrame: TStandardBillsFrame read FGclBillsFrame;
  26. end;
  27. implementation
  28. {$R *.dfm}
  29. { TFrame1 }
  30. procedure TStandardLibsFrame.ConnectStandardLibs;
  31. begin
  32. FXmBillsFrame.ConnectStandardLib;
  33. FGclBillsFrame.ConnectStandardLib;
  34. end;
  35. constructor TStandardLibsFrame.Create(AStandardLibs: TStandardLibs);
  36. begin
  37. inherited Create(nil);
  38. FStandardLibs := AStandardLibs;
  39. FXmBillsFrame := CreateBillsFrame(jpStandardLibsXm, btXm);
  40. FGclBillsFrame := CreateBillsFrame(jpStandardLibsGcl, btGcl);
  41. ConnectStandardLibs;
  42. end;
  43. function TStandardLibsFrame.CreateBillsFrame(AParent: TWinControl;
  44. ABillsType: TBillsType): TStandardBillsFrame;
  45. begin
  46. Result := TStandardBillsFrame.Create(FStandardLibs);
  47. Result.BillsType := ABillsType;
  48. AlignControl(Result, AParent, alClient);
  49. end;
  50. destructor TStandardLibsFrame.Destroy;
  51. begin
  52. FXmBillsFrame.Free;
  53. FGclBillsFrame.Free;
  54. inherited;
  55. end;
  56. procedure TStandardLibsFrame.jtsStandardLibsChange(Sender: TObject;
  57. NewTab: Integer; var AllowChange: Boolean);
  58. begin
  59. jpStandardLibs.ActivePageIndex := NewTab;
  60. end;
  61. end.