1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include <XML.h>
- #include <TextFeld.h>
- #include <TastaturEreignis.h>
- #include "Dialog.h"
- #include "InventoryView.h"
- #include "Equipment.h"
- #include "CraftingGrid.h"
- #include "Globals.h"
- using namespace Framework;
- UIMLDialog::UIMLDialog(Framework::Text uiml, std::function<void(UIMLDialog* self)> onClose)
- : Fenster()
- {
- XML::Element* xml = new XML::Element(uiml);
- view = new UIMLView("<v/>", uiFactory);
- view->setStyle(UIMLView::Style::Erlaubt | UIMLView::Style::Sichtbar);
- view->setMausEreignis(_ret1ME);
- view->addKnownElement(new InventoryElement());
- view->addKnownElement(new EquipmentElement());
- view->addKnownElement(new CraftingGridElement());
- view->setUIML(xml);
- view->setSize((int)xml->getAttributeValue("width"), (int)xml->getAttributeValue("height"));
- name = xml->getAttributeValue("id");
- view->layout();
- addMember(view);
- setStyle(Fenster::Style::Sichtbar | Fenster::Style::Erlaubt | Fenster::Style::Rahmen | Fenster::Style::BodyHAlpha | Fenster::Style::Beweglich | Fenster::Style::Titel | Fenster::Style::TitelHAlpha | Fenster::Style::Closable | Fenster::Style::ClosingHAlpha | Fenster::Style::ClosingKlickBuffer | Fenster::Style::TitelHintergrund | Fenster::Style::BodyHintergrund | Fenster::Style::ClosingHintergrund | Fenster::Style::MEIgnoreInside);
- setKBgFarbe(0xA0000000);
- setTBgFarbe(0xA0000000);
- setSBgFarbe(0xA0000000);
- setSize(view->getBreite() + 4, view->getHeight() + 24);
- setPosition(window->zBildschirm()->getBackBufferSize() / 2 - getSize() / 2);
- setRBreite(2);
- setClosingMe([onClose, this](void* p, void* o, MausEreignis me)
- {
- if (me.id == ME_RLinks)
- onClose(this);
- return 1;
- });
- setRFarbe(0xFF52525E);
- setTitel(xml->getAttributeValue("title"));
- setTSchriftZ(dynamic_cast<Schrift*>(uiFactory.initParam.schrift->getThis()));
- zTTextFeld()->setSize(0, 20);
- zTTextFeld()->addStyle(TextFeld::Style::Center);
- setTastaturEreignis(_ret1TE);
- }
- UIMLDialog::~UIMLDialog()
- {}
- void UIMLDialog::api(char* message)
- {
- short idLen = *(short*)message;
- char* id = new char[idLen + 1];
- memcpy(id, message + 2, idLen);
- id[idLen] = 0;
- NetworkAPIProcessor* processor = dynamic_cast<NetworkAPIProcessor*>(view->zZeichnungById(id));
- if (processor)
- processor->api(message + 2 + idLen);
- delete[] id;
- }
- const Framework::Text& UIMLDialog::getName() const
- {
- return name;
- }
|