|
@@ -1,6 +1,7 @@
|
|
|
#include "Dialog.h"
|
|
|
|
|
|
#include <DateiSystem.h>
|
|
|
+#include <InMemoryBuffer.h>
|
|
|
#include <TastaturEreignis.h>
|
|
|
#include <TextFeld.h>
|
|
|
#include <XML.h>
|
|
@@ -25,7 +26,8 @@ UIMLDialog::UIMLDialog(
|
|
|
{
|
|
|
XML::Element* xml = new XML::Element(uiml);
|
|
|
view = new UIMLView("<v/>", uiFactory);
|
|
|
- view->setStyle(UIMLView::Style::Erlaubt | UIMLView::Style::Sichtbar);
|
|
|
+ view->setStyle(UIMLView::Style::Erlaubt | UIMLView::Style::Sichtbar
|
|
|
+ | UIMLView::Style::GlobalMouseEvent);
|
|
|
view->setMausEreignis(_ret1ME);
|
|
|
view->addKnownElement(new InventoryElement());
|
|
|
view->addKnownElement(new EquipmentElement());
|
|
@@ -38,6 +40,92 @@ UIMLDialog::UIMLDialog(
|
|
|
view->addKnownElement(new ListViewElement());
|
|
|
view->addKnownElement(new QuestGraphElement());
|
|
|
view->addKnownElement(new QuestGraphItemElement());
|
|
|
+ view->setOnMemberMouseEvent([](Framework::XML::Element& element,
|
|
|
+ Framework::Zeichnung& z,
|
|
|
+ MausEreignis me) {
|
|
|
+ if (me.id == ME_RLinks)
|
|
|
+ {
|
|
|
+ Framework::Text onClick = element.getAttributeValue("onClick");
|
|
|
+ if (onClick.getLength() == 0)
|
|
|
+ {
|
|
|
+ return !element.hasAttribute("onClick");
|
|
|
+ }
|
|
|
+ Framework::Text* dialogName
|
|
|
+ = onClick.getTeilText(0, onClick.positionVon(";"));
|
|
|
+ Framework::Text* tail
|
|
|
+ = onClick.getTeilText(onClick.positionVon(";") + 1);
|
|
|
+ Framework::InMemoryBuffer buffer;
|
|
|
+ buffer.schreibe("\0", 1); // element message
|
|
|
+ while (tail->getLength() > 0)
|
|
|
+ {
|
|
|
+ Framework::Text* current = 0;
|
|
|
+ if (tail->positionVon(";") >= 0)
|
|
|
+ {
|
|
|
+ current = tail->getTeilText(0, tail->positionVon(";"));
|
|
|
+ Framework::Text* tmp
|
|
|
+ = tail->getTeilText(tail->positionVon(";") + 1);
|
|
|
+ tail->release();
|
|
|
+ tail = tmp;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ current = new Text(*tail);
|
|
|
+ tail->setText("");
|
|
|
+ }
|
|
|
+ if (current->positionVon("(char)") == 0)
|
|
|
+ {
|
|
|
+ current->ersetzen("(char)", "");
|
|
|
+ char d = (char)(int)*current;
|
|
|
+ buffer.schreibe(&d, 1);
|
|
|
+ }
|
|
|
+ else if (current->positionVon("(short)") == 0)
|
|
|
+ {
|
|
|
+ current->ersetzen("(short)", "");
|
|
|
+ short d = (short)(int)*current;
|
|
|
+ buffer.schreibe((char*)&d, 2);
|
|
|
+ }
|
|
|
+ else if (current->positionVon("(int)") == 0)
|
|
|
+ {
|
|
|
+ current->ersetzen("(int)", "");
|
|
|
+ int d = (int)*current;
|
|
|
+ buffer.schreibe((char*)&d, 4);
|
|
|
+ }
|
|
|
+ else if (current->positionVon("(__int64)") == 0)
|
|
|
+ {
|
|
|
+ current->ersetzen("(__int64)", "");
|
|
|
+ __int64 d = (__int64)*current;
|
|
|
+ buffer.schreibe((char*)&d, 8);
|
|
|
+ }
|
|
|
+ else if (current->positionVon("(float)") == 0)
|
|
|
+ {
|
|
|
+ current->ersetzen("(float)", "");
|
|
|
+ float d = (float)*current;
|
|
|
+ buffer.schreibe((char*)&d, 4);
|
|
|
+ }
|
|
|
+ else if (current->positionVon("(double)") == 0)
|
|
|
+ {
|
|
|
+ current->ersetzen("(double)", "");
|
|
|
+ double d = (double)*current;
|
|
|
+ buffer.schreibe((char*)&d, 8);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ unsigned char len = (unsigned char)current->getLength();
|
|
|
+ buffer.schreibe((char*)&len, 1);
|
|
|
+ buffer.schreibe(*current, len);
|
|
|
+ }
|
|
|
+ current->release();
|
|
|
+ }
|
|
|
+ char* message = new char[buffer.getSize()];
|
|
|
+ buffer.lese(message, (int)buffer.getSize());
|
|
|
+ World::INSTANCE->zClient()->uiRequest(
|
|
|
+ *dialogName, message, (int)buffer.getSize());
|
|
|
+ delete[] message;
|
|
|
+ dialogName->release();
|
|
|
+ tail->release();
|
|
|
+ }
|
|
|
+ return (bool)1;
|
|
|
+ });
|
|
|
view->setUIML(xml);
|
|
|
view->setSize((int)xml->getAttributeValue("width"),
|
|
|
(int)xml->getAttributeValue("height"));
|