VSSLogin.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #include "VSSLogin.h"
  2. #include "mainwindow.h"
  3. #include "globalParams.h"
  4. #define WINDOW_POSX 400
  5. #define WINDOW_POSY 10
  6. #define WINDOW_WIDTH 440
  7. #define WINDOW_HEIGHT 100
  8. extern TMainWindow* MainWindow;
  9. TVSSLogin::TVSSLogin () : GUIWindow (NULL, WINDOW_POSX, WINDOW_POSY, WINDOW_WIDTH, WINDOW_HEIGHT)
  10. {
  11. ExitByOK = false;
  12. bAlwaysOnTop = true;
  13. bSystemButton = false;
  14. Caption = "Login to VSS";
  15. pDesc = NEW GUILabel (this, 20, 3, 20, 18);
  16. pDesc->Layout = GUILABELLAYOUT_Left;
  17. pDesc->Caption = string ("User");
  18. pDesc->FontColor = 0xFF000000;
  19. pDesc->pFont->SetSize (16);
  20. pText = NEW GUIEdit (this, 23, 27, 300, 22);
  21. pText->Text = gp->VSSUserName;
  22. pText->FontColor = 0xFF000000;
  23. pText->pFont->SetSize (16);
  24. pText->OnAccept = (CONTROL_EVENT)&TVSSLogin::onOKPressed;
  25. pText->Flat = true;
  26. //onOKPressed;
  27. btnOK = NEW GUIButton (this, 340,9, 78, 24);
  28. btnOK->Glyph->Load ("ok");
  29. btnOK->Caption = "Accept";
  30. btnOK->pFont->SetSize (12);
  31. btnOK->OnMousePressed = (CONTROL_EVENT)&TVSSLogin::onOKPressed;
  32. btnOK->FlatButton = true;
  33. btnCancel = NEW GUIButton (this, 340,39, 78, 24);
  34. btnCancel->Glyph->Load ("cancel");
  35. btnCancel->Caption = "Cancel";
  36. btnCancel->pFont->SetSize (12);
  37. btnCancel->OnMousePressed = (CONTROL_EVENT)&TVSSLogin::onCancelPressed;
  38. btnCancel->FlatButton = true;
  39. SetScreenCenter ();
  40. }
  41. void TVSSLogin::OnCreate ()
  42. {
  43. pText->SetFocus ();
  44. pText->SelectText (0, pText->Text.Len ());
  45. }
  46. TVSSLogin::~TVSSLogin ()
  47. {
  48. delete pText;
  49. delete pDesc;
  50. }
  51. void _cdecl TVSSLogin::onOKPressed (GUIControl* sender)
  52. {
  53. gp->VSSUserName = pText->Text;
  54. ExitByOK = true;
  55. Close (this);
  56. }
  57. void _cdecl TVSSLogin::onCancelPressed (GUIControl* sender)
  58. {
  59. //folder_to_create = "";
  60. Close (this);
  61. }
  62. void TVSSLogin::KeyPressed(int Key, bool bSysKey)
  63. {
  64. if (!bSysKey) return;
  65. if (Key == 13) onOKPressed (NULL);
  66. if (Key == VK_ESCAPE) onCancelPressed (NULL);
  67. }