Console.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 <Terminal.h>
  19. #include <ImgList.hpp>
  20. #include <Menus.hpp>
  21. #include <ActnList.hpp>
  22. #include <StdActns.hpp>
  23. //----------------------------------------------------------------------------
  24. class TConsoleDialog : public TForm
  25. {
  26. __published:
  27. TMemo *OutputMemo;
  28. TBevel *Bevel1;
  29. TLabel *Label1;
  30. TLabel *Label2;
  31. TLabel *Label4;
  32. TButton *CancelBtn;
  33. THistoryComboBox *CommandEdit;
  34. TButton *ExecuteButton;
  35. TPathLabel *DirectoryLabel;
  36. TButton *HelpButton;
  37. TImageList *Images;
  38. TPopupMenu *PopupMenu;
  39. TMenuItem *SelectAllItem;
  40. TMenuItem *CopyItem;
  41. TMenuItem *N1;
  42. TMenuItem *AdjustWindowItem;
  43. TActionList *ActionList;
  44. TEditCopy *EditCopy;
  45. TEditSelectAll *EditSelectAll;
  46. TAction *AdjustWindow;
  47. void __fastcall ExecuteButtonClick(TObject *Sender);
  48. void __fastcall CommandEditChange(TObject *Sender);
  49. void __fastcall HelpButtonClick(TObject *Sender);
  50. void __fastcall ActionListExecute(TBasicAction *Action, bool &Handled);
  51. void __fastcall ActionListUpdate(TBasicAction *Action, bool &Handled);
  52. void __fastcall FormShow(TObject *Sender);
  53. void __fastcall OutputMemoContextPopup(TObject *Sender, TPoint &MousePos,
  54. bool &Handled);
  55. private:
  56. TTerminal * FTerminal;
  57. TTerminal * FLastTerminal;
  58. TNotifyEvent FOldChangeDirectory;
  59. TNotifyEvent FPrevTerminalClose;
  60. TRect FAutoBounds;
  61. bool FClearExceptionOnFail;
  62. void __fastcall DoExecuteCommand();
  63. void __fastcall ExecuteCommand();
  64. void __fastcall SetTerminal(TTerminal * value);
  65. void __fastcall TerminalClose(TObject * Sender);
  66. void __fastcall AddLine(const AnsiString & Line, bool StdError);
  67. protected:
  68. void __fastcall DoChangeDirectory(TObject * Sender);
  69. void __fastcall UpdateControls();
  70. virtual void __fastcall CreateParams(TCreateParams & Params);
  71. void __fastcall DoAdjustWindow();
  72. public:
  73. virtual __fastcall ~TConsoleDialog();
  74. virtual __fastcall TConsoleDialog(TComponent* AOwner);
  75. bool __fastcall Execute(const AnsiString Command = "",
  76. const TStrings * Log = NULL);
  77. __property TTerminal * Terminal = { read = FTerminal, write = SetTerminal };
  78. };
  79. //----------------------------------------------------------------------------
  80. #endif