CopyParamCustom.cpp 2.2 KB

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