Authenticate.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //---------------------------------------------------------------------------
  2. #ifndef AuthenticateH
  3. #define AuthenticateH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Controls.hpp>
  7. #include <StdCtrls.hpp>
  8. #include <Forms.hpp>
  9. #include <ComCtrls.hpp>
  10. #include <ExtCtrls.hpp>
  11. #include "PasswordEdit.hpp"
  12. #include "WinInterface.h"
  13. #include "GUITools.h"
  14. #include <System.Actions.hpp>
  15. #include <Vcl.ActnList.hpp>
  16. #include <Vcl.Menus.hpp>
  17. #include <Vcl.StdActns.hpp>
  18. //---------------------------------------------------------------------------
  19. class TAuthenticateForm : public TForm
  20. {
  21. __published:
  22. TListBox *LogView;
  23. TPanel *PasswordPanel;
  24. TPanel *PromptEditPanel;
  25. TLabel *PromptLabel1;
  26. TPasswordEdit *PromptEdit1;
  27. TPanel *BannerPanel;
  28. TMemo *BannerMemo;
  29. TCheckBox *NeverShowAgainCheck;
  30. TButton *BannerCloseButton;
  31. TButton *BannerHelpButton;
  32. TPanel *SavePasswordPanel;
  33. TCheckBox *SavePasswordCheck;
  34. TPanel *ButtonsPanel;
  35. TButton *PasswordOKButton;
  36. TButton *PasswordCancelButton;
  37. TButton *PasswordHelpButton;
  38. TLabel *InstructionsLabel;
  39. TLabel *PromptLabel2;
  40. TPasswordEdit *PromptEdit2;
  41. TPanel *SessionRememberPasswordPanel;
  42. TCheckBox *SessionRememberPasswordCheck;
  43. TPanel *TopPanel;
  44. TPanel *LeftPanel;
  45. TPaintBox *AnimationPaintBox;
  46. TActionList *BannerActionList;
  47. TEditCopy *EditCopy;
  48. TEditSelectAll *EditSelectAll;
  49. TAction *BannerMonospacedFontAction;
  50. TPopupMenu *BannerPopupMenu;
  51. TMenuItem *CopyItem;
  52. TMenuItem *SelectAllItem;
  53. TMenuItem *N1;
  54. TMenuItem *AdjustWindowItem;
  55. void __fastcall FormShow(TObject *Sender);
  56. void __fastcall HelpButtonClick(TObject *Sender);
  57. void __fastcall LogViewMeasureItem(TWinControl *Control, int Index, int &Height);
  58. void __fastcall LogViewDrawItem(TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State);
  59. void __fastcall FormResize(TObject *Sender);
  60. void __fastcall BannerMemoContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled);
  61. void __fastcall BannerMonospacedFontActionExecute(TObject *Sender);
  62. void __fastcall LogViewMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
  63. public:
  64. __fastcall TAuthenticateForm(TComponent * Owner);
  65. virtual __fastcall ~TAuthenticateForm();
  66. void __fastcall Init(TTerminal * Terminal);
  67. void __fastcall ShowAsModal();
  68. void __fastcall Log(const UnicodeString & Message, const UnicodeString & Additional = UnicodeString());
  69. bool __fastcall PromptUser(TPromptKind Kind, UnicodeString Name, UnicodeString Instructions,
  70. TStrings * Prompts, TStrings * Results, bool ForceLog, bool StoredCredentialsTried);
  71. void __fastcall Banner(const UnicodeString & Banner, bool & NeverShowAgain,
  72. int Options, unsigned int & Params);
  73. __property TTerminal * Terminal = { read = FTerminal };
  74. __property TNotifyEvent OnCancel = { read = FOnCancel, write = FOnCancel };
  75. protected:
  76. void __fastcall AdjustControls();
  77. bool __fastcall Execute(UnicodeString Status, TPanel * Panel,
  78. TWinControl * FocusControl, TButton * DefaultButton, TButton * CancelButton,
  79. bool FixHeight, bool Zoom, bool ForceLog);
  80. virtual void __fastcall CreateParams(TCreateParams & Params);
  81. virtual void __fastcall Dispatch(void * AMessage);
  82. void __fastcall WMNCCreate(TWMNCCreate & Message);
  83. TLabel * __fastcall GenerateLabel(int Current, UnicodeString Caption);
  84. TCustomEdit * __fastcall GenerateEdit(int Current, bool Echo);
  85. TList * __fastcall GeneratePrompt(UnicodeString Instructions, TStrings * Prompts);
  86. void __fastcall DoCancel();
  87. void __fastcall AdjustLogView();
  88. void __fastcall MakeLogItemVisible(int Index);
  89. int __fastcall LogItemHeight(int Index);
  90. void __fastcall RedrawLog();
  91. void __fastcall CMShowingChanged(TMessage & Message);
  92. DYNAMIC void __fastcall ChangeScale(int M, int D);
  93. void __fastcall UpdateBannerFont();
  94. void __fastcall DoAdjustWindow();
  95. private:
  96. void * FShowAsModalStorage;
  97. TWinControl * FFocusControl;
  98. TSessionData * FSessionData;
  99. TTerminal * FTerminal;
  100. UnicodeString FStatus;
  101. TWinControl * FPromptParent;
  102. int FPromptLeft;
  103. int FPromptTop;
  104. int FPromptRight;
  105. int FPromptEditGap;
  106. int FPromptsGap;
  107. TNotifyEvent FOnCancel;
  108. TFrameAnimation FFrameAnimation;
  109. bool FAnimationPainted;
  110. int FHorizontalLogPadding;
  111. int FVerticalLogPadding;
  112. TTextFormat FLogTextFormat;
  113. bool FShowNoActivate;
  114. std::vector<UnicodeString> FHints;
  115. int FHintIndex;
  116. INTERFACE_HOOK;
  117. };
  118. //---------------------------------------------------------------------------
  119. #endif