UIMLFuelState.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "UIMLFuelState.h"
  2. #include "Globals.h"
  3. #include "UIMLProgressAndStateView.h"
  4. #include "UIMLUtils.h"
  5. UIMLFuelStateElement::UIMLFuelStateElement()
  6. : UIMLElement()
  7. {}
  8. bool UIMLFuelStateElement::isApplicableFor(Framework::XML::Element& element)
  9. {
  10. return element.getName().istGleich("fuelState");
  11. }
  12. Framework::Zeichnung* UIMLFuelStateElement::parseElement(
  13. Framework::XML::Element& element, Framework::UIMLContainer& generalFactory)
  14. {
  15. int addressLength = 0;
  16. int* address = getUIMLTargetAddress(
  17. element.getAttributeValue("target"), addressLength);
  18. UIMLProgressAndStateView* view
  19. = new UIMLProgressAndStateView(element.getAttributeValue("id"),
  20. element.getAttributeValue("backgroundImagePath"),
  21. element.getAttributeValue("foregroundImagePath"),
  22. address,
  23. addressLength,
  24. 0,
  25. 2,
  26. "Fuel: ",
  27. "");
  28. Framework::Text direction = element.getAttributeValue("direction");
  29. view->setStyle(UIMLProgressAndStateView::Style::Sichtbar
  30. | UIMLProgressAndStateView::Style::Erlaubt);
  31. if (direction.istGleich("TOP") || direction.istGleich("BOTTOM"))
  32. {
  33. view->addStyle(UIMLProgressAndStateView::Style::Vertical);
  34. }
  35. if (direction.istGleich("TOP") || direction.istGleich("LEFT"))
  36. {
  37. view->addStyle(UIMLProgressAndStateView::Style::Reversed);
  38. }
  39. return view;
  40. }
  41. bool UIMLFuelStateElement::updateElement(Framework::XML::Element& element,
  42. Framework::Zeichnung& z,
  43. Framework::UIMLContainer& generalFactory)
  44. {
  45. return false; // No update needed for this element
  46. }