choosename.cpp 1.8 KB

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