rename.cpp 2.0 KB

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