PriceMarginFme.pas 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. unit PriceMarginFme;
  2. interface
  3. uses
  4. ProjectGLFme, PriceMarginBillsFme, LeafXmjGlFme,
  5. ProjectData,
  6. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7. Dialogs, ExtCtrls, JimPages, ComCtrls, ToolWin, XPMenu;
  8. type
  9. TPriceMarginFrame = class(TFrame)
  10. pnlTopTag: TPanel;
  11. tbTopTag: TToolBar;
  12. tobtnBills: TToolButton;
  13. tobtnGL: TToolButton;
  14. jpsPriceMargin: TJimPages;
  15. jpsPriceMarginBills: TJimPage;
  16. jpsPriceMarginGL: TJimPage;
  17. xpm: TXPMenu;
  18. tobtnLeafXmj: TToolButton;
  19. jpsPriceMarginLeafXmj: TJimPage;
  20. procedure tobtnBillsClick(Sender: TObject);
  21. private
  22. FProjectData: TProjectData;
  23. FProjectGLFrame: TProjectGLFrame;
  24. FPriceMarginBillsFrame: TPriceMarginBillsFrame;
  25. FLeafXmjGlFrame: TLeafXmjGlFrame;
  26. public
  27. constructor Create(AProjectData: TProjectData);
  28. destructor Destroy; override;
  29. procedure RefreshBills;
  30. procedure ResetViewControl;
  31. end;
  32. implementation
  33. uses
  34. UtilMethods;
  35. {$R *.dfm}
  36. { TPriceMarginFrame }
  37. constructor TPriceMarginFrame.Create(AProjectData: TProjectData);
  38. begin
  39. inherited Create(nil);
  40. FProjectData := AProjectData;
  41. FProjectGLFrame := TProjectGLFrame.Create(FProjectData.ProjectGLData);
  42. AlignControl(FProjectGLFrame, jpsPriceMarginGL, alClient);
  43. FPriceMarginBillsFrame := TPriceMarginBillsFrame.Create(FProjectData.PriceMarginBillsData);
  44. AlignControl(FPriceMarginBillsFrame, jpsPriceMarginBills, alClient);
  45. FLeafXmjGlFrame := TLeafXmjGlFrame.Create(FProjectData.LeafXmjGlData);
  46. AlignControl(FLeafXmjGlFrame, jpsPriceMarginLeafXmj, alClient);
  47. end;
  48. destructor TPriceMarginFrame.Destroy;
  49. begin
  50. FLeafXmjGlFrame.Free;
  51. FPriceMarginBillsFrame.Free;
  52. FProjectGLFrame.Free;
  53. inherited;
  54. end;
  55. procedure TPriceMarginFrame.RefreshBills;
  56. begin
  57. FProjectData.PriceMarginBillsData.RefreshBills;
  58. FProjectData.LeafXmjGlData.RefreshLeafXmj;
  59. end;
  60. procedure TPriceMarginFrame.ResetViewControl;
  61. begin
  62. FProjectGLFrame.ResetViewControl;
  63. FPriceMarginBillsFrame.ResetViewControl;
  64. FLeafXmjGlFrame.ResetViewControl;
  65. end;
  66. procedure TPriceMarginFrame.tobtnBillsClick(Sender: TObject);
  67. begin
  68. tobtnGL.Down := tobtnGL.Tag = TToolButton(Sender).Tag;
  69. tobtnBills.Down := tobtnBills.Tag = TToolButton(Sender).Tag;
  70. tobtnLeafXmj.Down := tobtnLeafXmj.Tag = TToolButton(Sender).Tag;
  71. jpsPriceMargin.ActivePageIndex := TToolButton(Sender).Tag;
  72. end;
  73. end.