float.cpp 758 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef _XBOX
  2. #include "float.h"
  3. #include "..\..\system\datasource\datafloat.h"
  4. FloatEditor::FloatEditor ()
  5. {
  6. EditedFloat = NULL;
  7. pLabel = NULL;
  8. pEdit = NULL;
  9. }
  10. FloatEditor::~FloatEditor ()
  11. {
  12. }
  13. void FloatEditor::Release ()
  14. {
  15. delete this;
  16. }
  17. void FloatEditor::BeginEdit (GUIControl* form, DataFloat* EditedFloat)
  18. {
  19. this->EditedFloat = EditedFloat;
  20. pLabel = NEW GUILabel (form, 10, 10, 300, 20);
  21. pLabel->Caption = EditedFloat->GetName ();
  22. pEdit = NEW GUIEdit (form, 10, 30, 300, 20);
  23. pEdit->Text.Format("%3.2f", EditedFloat->GetValue());
  24. }
  25. void FloatEditor::EndEdit ()
  26. {
  27. delete pEdit;
  28. pEdit = NULL;
  29. delete pLabel;
  30. pLabel = NULL;
  31. }
  32. void FloatEditor::Apply ()
  33. {
  34. EditedFloat->SetValue ((float)atof (pEdit->Text.GetBuffer()));
  35. }
  36. #endif