2
0

ArrayForm.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #include "arrayform.h"
  2. #include "arrayattr.h"
  3. #define WINDOW_WIDTH 180
  4. #define WINDOW_HEIGHT 65
  5. TArrayEdit::TArrayEdit (int posX, int posY) : GUIWindow (NULL, posX, posY, WINDOW_WIDTH, WINDOW_HEIGHT)
  6. {
  7. bPopupStyle = true;
  8. bAlwaysOnTop = true;
  9. bSystemButton = false;
  10. Caption = ARRAYEDIT_WINDOWNAME;
  11. eValue = NEW GUIEdit (this, 8, 5, 165, 19);
  12. eValue->Flat = true;
  13. //eValue->OnAccept = (CONTROL_EVENT)OnDataChange;
  14. eValue->pFont->SetName("arialcyrsmall");
  15. btnOK = NEW GUIButton (this, 9,30, 78, 24);
  16. btnOK->Glyph->Load ("meditor\\ok");
  17. btnOK->Caption = "Accept";
  18. btnOK->pFont->SetName("arialcyrsmall");
  19. btnOK->FlatButton = true;
  20. btnCancel = NEW GUIButton (this, 95,30, 78, 24);
  21. btnCancel->Glyph->Load ("meditor\\cancel");
  22. btnCancel->Caption = "Cancel";
  23. btnCancel->pFont->SetName("arialcyrsmall");
  24. btnCancel->FlatButton = true;
  25. btnOK->OnMousePressed = (CONTROL_EVENT)&TArrayEdit::OnButtonOK;
  26. btnCancel->OnMousePressed = (CONTROL_EVENT)&TArrayEdit::OnButtonCancel;
  27. }
  28. void TArrayEdit::OnCreate()
  29. {
  30. eValue->SelectText(0, eValue->Text.Size());
  31. eValue->SetFocus();
  32. }
  33. TArrayEdit::~TArrayEdit ()
  34. {
  35. delete eValue;
  36. delete btnOK;
  37. delete btnCancel;
  38. }
  39. void _cdecl TArrayEdit::OnDataChange (GUIControl* sender)
  40. {
  41. }
  42. void _cdecl TArrayEdit::OnButtonOK (GUIControl* sender)
  43. {
  44. // MasterAttrib->SetValue (cbValue->Checked);
  45. int newSize = atoi (eValue->Text.GetBuffer ());
  46. MasterAttrib->Resize(newSize);
  47. Close (this);
  48. }
  49. void _cdecl TArrayEdit::OnButtonCancel (GUIControl* sender)
  50. {
  51. Close (this);
  52. }
  53. void TArrayEdit::KeyPressed (int key, bool bSysKey)
  54. {
  55. if (!bSysKey) return;
  56. if (!IsActive) return;
  57. if (key == 13) OnButtonOK (this);
  58. }