CopyParamCustom.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include <Common.h>
  5. #include <TextsWin.h>
  6. #include <GUIConfiguration.h>
  7. #include <GUITools.h>
  8. #include <Tools.h>
  9. #include "CopyParamCustom.h"
  10. #include "VCLCommon.h"
  11. //---------------------------------------------------------------------------
  12. #pragma package(smart_init)
  13. #pragma link "XPThemes"
  14. #pragma link "CopyParams"
  15. #pragma resource "*.dfm"
  16. //---------------------------------------------------------------------------
  17. bool __fastcall DoCopyParamCustomDialog(TCopyParamType & CopyParam,
  18. int CopyParamAttrs)
  19. {
  20. bool Result;
  21. TCopyParamCustomDialog * Dialog = new TCopyParamCustomDialog(
  22. Application, CopyParamAttrs, 0);
  23. try
  24. {
  25. Result = Dialog->Execute(CopyParam);
  26. }
  27. __finally
  28. {
  29. delete Dialog;
  30. }
  31. return Result;
  32. }
  33. //---------------------------------------------------------------------------
  34. // Dummy parameter distinguishes the constructor from Object Pascals TForm::CreateNew
  35. __fastcall TCopyParamCustomDialog::TCopyParamCustomDialog(TComponent * Owner,
  36. int CopyParamAttrs, int /*Dummy*/)
  37. : TForm(Owner)
  38. {
  39. UseSystemSettings(this);
  40. CopyParamsFrame->Direction = pdAll;
  41. CopyParamsFrame->CopyParamAttrs = CopyParamAttrs;
  42. }
  43. //---------------------------------------------------------------------------
  44. bool __fastcall TCopyParamCustomDialog::Execute(TCopyParamType & CopyParam)
  45. {
  46. CopyParamsFrame->Params = CopyParam;
  47. CopyParamsFrame->BeforeExecute();
  48. bool Result = (ShowModal() == mrOk);
  49. if (Result)
  50. {
  51. CopyParamsFrame->AfterExecute();
  52. CopyParam = CopyParamsFrame->Params;
  53. }
  54. return Result;
  55. }
  56. //---------------------------------------------------------------------------
  57. void __fastcall TCopyParamCustomDialog::FormCloseQuery(TObject * /*Sender*/,
  58. bool & /*CanClose*/)
  59. {
  60. if (ModalResult != mrCancel)
  61. {
  62. ExitActiveControl(this);
  63. }
  64. }
  65. //---------------------------------------------------------------------------
  66. void __fastcall TCopyParamCustomDialog::HelpButtonClick(TObject * /*Sender*/)
  67. {
  68. FormHelp(this);
  69. }
  70. //---------------------------------------------------------------------------