PriceMarginFme.pas 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. end;
  65. procedure TPriceMarginFrame.tobtnBillsClick(Sender: TObject);
  66. begin
  67. tobtnGL.Down := tobtnGL.Tag = TToolButton(Sender).Tag;
  68. tobtnBills.Down := tobtnBills.Tag = TToolButton(Sender).Tag;
  69. tobtnLeafXmj.Down := tobtnLeafXmj.Tag = TToolButton(Sender).Tag;
  70. jpsPriceMargin.ActivePageIndex := TToolButton(Sender).Tag;
  71. end;
  72. end.