Authenticate.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 *ActionList;
  47. TEditCopy *EditCopyAction;
  48. TEditSelectAll *EditSelectAllAction;
  49. TAction *BannerMonospacedFontAction;
  50. TPopupMenu *BannerPopupMenu;
  51. TMenuItem *CopyItem;
  52. TMenuItem *SelectAllItem;
  53. TMenuItem *N1;
  54. TMenuItem *AdjustWindowItem;
  55. TPopupMenu *LabelPopupMenu;
  56. TMenuItem *N2;
  57. TAction *LabelCopyAction;
  58. TAction *LabelOpenLinkAction2;
  59. TMenuItem *Open1;
  60. TMenuItem *Copy1;
  61. void __fastcall FormShow(TObject *Sender);
  62. void __fastcall HelpButtonClick(TObject *Sender);
  63. void __fastcall LogViewMeasureItem(TWinControl *Control, int Index, int &Height);
  64. void __fastcall LogViewDrawItem(TWinControl *Control, int Index, TRect &Rect, TOwnerDrawState State);
  65. void __fastcall FormResize(TObject *Sender);
  66. void __fastcall BannerMemoContextPopup(TObject *Sender, TPoint &MousePos, bool &Handled);
  67. void __fastcall BannerMonospacedFontActionExecute(TObject *Sender);
  68. void __fastcall LogViewMouseMove(TObject *Sender, TShiftState Shift, int X, int Y);
  69. void __fastcall LabelCopyActionExecute(TObject *Sender);
  70. void __fastcall LabelOpenLinkAction2Execute(TObject *Sender);
  71. void __fastcall FormAfterMonitorDpiChanged(TObject *Sender, int OldDPI, int NewDPI);
  72. public:
  73. __fastcall TAuthenticateForm(TComponent * Owner);
  74. virtual __fastcall ~TAuthenticateForm();
  75. void __fastcall Init(TTerminal * Terminal);
  76. void __fastcall ShowAsModal();
  77. void __fastcall Log(const UnicodeString & Message, const UnicodeString & Additional = UnicodeString());
  78. bool __fastcall PromptUser(TPromptKind Kind, UnicodeString Name, UnicodeString Instructions,
  79. TStrings * Prompts, TStrings * Results, bool ForceLog, bool StoredCredentialsTried);
  80. void __fastcall Banner(const UnicodeString & Banner, bool & NeverShowAgain,
  81. int Options, unsigned int & Params);
  82. __property TTerminal * Terminal = { read = FTerminal };
  83. __property TNotifyEvent OnCancel = { read = FOnCancel, write = FOnCancel };
  84. protected:
  85. void __fastcall AdjustControls();
  86. bool __fastcall Execute(UnicodeString Status, TPanel * Panel,
  87. TWinControl * FocusControl, TButton * DefaultButton, TButton * CancelButton,
  88. bool FixHeight, bool Zoom, bool ForceLog);
  89. virtual void __fastcall CreateParams(TCreateParams & Params);
  90. virtual void __fastcall Dispatch(void * AMessage);
  91. void __fastcall WMNCCreate(TWMNCCreate & Message);
  92. TLabel * __fastcall GenerateLabel(int Current, UnicodeString Caption);
  93. TCustomEdit * __fastcall GenerateEdit(int Current, bool Echo);
  94. TList * __fastcall GeneratePrompt(TPromptKind Kind, const UnicodeString & Instructions, TStrings * Prompts);
  95. void __fastcall DoCancel();
  96. void __fastcall AdjustLogView();
  97. void __fastcall MakeLogItemVisible(int Index);
  98. int __fastcall LogItemHeight(int Index);
  99. void __fastcall RedrawLog();
  100. void __fastcall CMShowingChanged(TMessage & Message);
  101. void __fastcall UpdateBannerFont();
  102. void __fastcall DoAdjustWindow();
  103. void __fastcall LabelContextPopup(TObject* Sender, const TPoint & MousePos, bool & Handled);
  104. bool ExtractUrl(const UnicodeString & Text, UnicodeString & Url);
  105. void ExternalLabel(TLabel * Label);
  106. void __fastcall LinkClick(TObject * Sender);
  107. void LabelOpen(TLabel * Label);
  108. private:
  109. void * FShowAsModalStorage;
  110. TWinControl * FFocusControl;
  111. TSessionData * FSessionData;
  112. TTerminal * FTerminal;
  113. UnicodeString FStatus;
  114. TWinControl * FPromptParent;
  115. int FPromptLeft;
  116. int FPromptTop;
  117. int FPromptRight;
  118. int FPromptEditGap;
  119. int FPromptsGap;
  120. TNotifyEvent FOnCancel;
  121. TFrameAnimation FFrameAnimation;
  122. bool FAnimationPainted;
  123. int FHorizontalLogPadding;
  124. int FVerticalLogPadding;
  125. TTextFormat FLogTextFormat;
  126. bool FShowNoActivate;
  127. std::vector<UnicodeString> FHints;
  128. int FHintIndex;
  129. TLabel * FContextLabel;
  130. INTERFACE_HOOK;
  131. };
  132. //---------------------------------------------------------------------------
  133. #endif