Console.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //----------------------------------------------------------------------------
  2. #ifndef ConsoleH
  3. #define ConsoleH
  4. //----------------------------------------------------------------------------
  5. #include <vcl\System.hpp>
  6. #include <vcl\Windows.hpp>
  7. #include <vcl\SysUtils.hpp>
  8. #include <vcl\Classes.hpp>
  9. #include <vcl\Graphics.hpp>
  10. #include <vcl\StdCtrls.hpp>
  11. #include <vcl\Forms.hpp>
  12. #include <vcl\Controls.hpp>
  13. #include <vcl\Buttons.hpp>
  14. #include <vcl\ExtCtrls.hpp>
  15. #include <ComCtrls.hpp>
  16. #include <HistoryComboBox.hpp>
  17. #include <PathLabel.hpp>
  18. #include <ImgList.hpp>
  19. #include <Menus.hpp>
  20. #include <ActnList.hpp>
  21. #include <StdActns.hpp>
  22. //----------------------------------------------------------------------------
  23. #include "WinInterface.h"
  24. #include <Terminal.h>
  25. //----------------------------------------------------------------------------
  26. class TConsoleDialog : public TForm
  27. {
  28. __published:
  29. TMemo *OutputMemo;
  30. TBevel *Bevel1;
  31. TLabel *Label1;
  32. TLabel *Label2;
  33. TLabel *Label4;
  34. TButton *CancelBtn;
  35. THistoryComboBox *CommandEdit;
  36. TButton *ExecuteButton;
  37. TPathLabel *DirectoryLabel;
  38. TButton *HelpButton;
  39. TImageList *Images;
  40. TPopupMenu *PopupMenu;
  41. TMenuItem *SelectAllItem;
  42. TMenuItem *CopyItem;
  43. TMenuItem *N1;
  44. TMenuItem *AdjustWindowItem;
  45. TActionList *ActionList;
  46. TEditCopy *EditCopy;
  47. TEditSelectAll *EditSelectAll;
  48. TAction *AdjustWindow;
  49. void __fastcall ExecuteButtonClick(TObject *Sender);
  50. void __fastcall CommandEditChange(TObject *Sender);
  51. void __fastcall HelpButtonClick(TObject *Sender);
  52. void __fastcall ActionListExecute(TBasicAction *Action, bool &Handled);
  53. void __fastcall ActionListUpdate(TBasicAction *Action, bool &Handled);
  54. void __fastcall FormShow(TObject *Sender);
  55. void __fastcall OutputMemoContextPopup(TObject *Sender, TPoint &MousePos,
  56. bool &Handled);
  57. private:
  58. TTerminal * FTerminal;
  59. TTerminal * FLastTerminal;
  60. TNotifyEvent FOldChangeDirectory;
  61. TNotifyEvent FPrevTerminalClose;
  62. TRect FAutoBounds;
  63. bool FClearExceptionOnFail;
  64. bool FAnyCommandExecuted;
  65. void __fastcall DoExecuteCommand();
  66. void __fastcall ExecuteCommand();
  67. void __fastcall SetTerminal(TTerminal * value);
  68. void __fastcall TerminalClose(TObject * Sender);
  69. void __fastcall AddLine(const AnsiString & Line, bool StdError);
  70. protected:
  71. void __fastcall DoChangeDirectory(TObject * Sender);
  72. void __fastcall UpdateControls();
  73. virtual void __fastcall CreateParams(TCreateParams & Params);
  74. void __fastcall DoAdjustWindow();
  75. public:
  76. virtual __fastcall ~TConsoleDialog();
  77. virtual __fastcall TConsoleDialog(TComponent* AOwner);
  78. bool __fastcall Execute(const AnsiString Command = "",
  79. const TStrings * Log = NULL);
  80. __property TTerminal * Terminal = { read = FTerminal, write = SetTerminal };
  81. };
  82. //----------------------------------------------------------------------------
  83. #endif