Console.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. private:
  54. TTerminal * FTerminal;
  55. TTerminal * FLastTerminal;
  56. TNotifyEvent FOldChangeDirectory;
  57. TNotifyEvent FPrevTerminalClose;
  58. TRect FAutoBounds;
  59. void __fastcall DoExecuteCommand();
  60. void __fastcall ExecuteCommand();
  61. void __fastcall SetTerminal(TTerminal * value);
  62. void __fastcall TerminalClose(TObject * Sender);
  63. inline void __fastcall AddLine(TLogLineType Type, const AnsiString & Line);
  64. protected:
  65. void __fastcall DoChangeDirectory(TObject * Sender);
  66. void __fastcall DoLogAddLine(System::TObject* Sender, TLogLineType Type,
  67. const AnsiString AddedLine);
  68. void __fastcall UpdateControls();
  69. virtual void __fastcall CreateParams(TCreateParams & Params);
  70. void __fastcall DoAdjustWindow();
  71. public:
  72. virtual __fastcall ~TConsoleDialog();
  73. virtual __fastcall TConsoleDialog(TComponent* AOwner);
  74. bool __fastcall Execute(const AnsiString Command = "",
  75. const TStrings * Log = NULL);
  76. __property TTerminal * Terminal = { read = FTerminal, write = SetTerminal };
  77. };
  78. //----------------------------------------------------------------------------
  79. #endif