ManaPlus
npcdialog.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2018 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #include "gui/windows/npcdialog.h"
24 
25 #include "actormanager.h"
26 #include "configuration.h"
27 #include "settings.h"
28 #include "soundmanager.h"
29 
30 #include "const/sound.h"
31 
32 #include "being/being.h"
33 #include "being/playerinfo.h"
34 
35 #include "enums/gui/layouttype.h"
36 
37 #include "gui/gui.h"
38 #include "gui/viewport.h"
39 
40 #include "gui/fonts/font.h"
41 
42 #include "gui/popups/popupmenu.h"
43 
46 
47 #include "gui/widgets/browserbox.h"
48 #include "gui/widgets/button.h"
50 #include "gui/widgets/icon.h"
54 #include "gui/widgets/layout.h"
56 #include "gui/widgets/playerbox.h"
57 #include "gui/widgets/scrollarea.h"
58 
60 
61 #include "resources/db/avatardb.h"
62 #include "resources/db/npcdb.h"
64 
66 
68 
70 
71 #include "net/npchandler.h"
72 #include "net/packetlimiter.h"
73 
74 #include "utils/copynpaste.h"
75 #include "utils/delete2.h"
76 #include "utils/foreach.h"
77 #include "utils/gettext.h"
78 
79 #include <sstream>
80 
81 #include "debug.h"
82 
83 // TRANSLATORS: npc dialog button
84 #define CAPTION_WAITING _("Stop waiting")
85 // TRANSLATORS: npc dialog button
86 #define CAPTION_NEXT _("Next")
87 // TRANSLATORS: npc dialog button
88 #define CAPTION_CLOSE _("Close")
89 // TRANSLATORS: npc dialog button
90 #define CAPTION_SUBMIT _("Submit")
91 
94 
95 typedef STD_VECTOR<Image *>::iterator ImageVectorIter;
96 
98  // TRANSLATORS: npc dialog name
99  Window(_("NPC"), Modal_false, nullptr, "npc.xml"),
100  ActionListener(),
101  mNpcId(npcId),
102  mDefaultInt(0),
103  mDefaultString(),
104  mTextBox(new BrowserBox(this, Opaque_true,
105  "browserbox.xml")),
106  mScrollArea(new ScrollArea(this, mTextBox,
107  fromBool(getOptionBool("showtextbackground", false), Opaque),
108  "npc_textbackground.xml")),
109  mText(),
110  mNewText(),
111  mItems(),
112  mImages(),
113  mItemList(CREATEWIDGETR(ExtendedListBox,
114  this, this, "extendedlistbox.xml", 13)),
115  mListScrollArea(new ScrollArea(this, mItemList,
116  fromBool(getOptionBool("showlistbackground", false), Opaque),
117  "npc_listbackground.xml")),
118  mSkinContainer(new Container(this)),
119  mSkinScrollArea(new ScrollArea(this, mSkinContainer,
120  fromBool(getOptionBool("showlistbackground", false), Opaque),
121  "npc_listbackground.xml")),
122  mItemLinkHandler(new ItemLinkHandler),
123  mTextField(new TextField(this, std::string(), LoseFocusOnTab_true,
124  nullptr, std::string(), false)),
125  mIntField(new IntTextField(this, 0, 0, 0, Enable_true, 0)),
126  // TRANSLATORS: npc dialog button
127  mPlusButton(new Button(this, _("+"), "inc", BUTTON_SKIN, this)),
128  // TRANSLATORS: npc dialog button
129  mMinusButton(new Button(this, _("-"), "dec", BUTTON_SKIN, this)),
130  // TRANSLATORS: npc dialog button
131  mClearButton(new Button(this, _("Clear"), "clear", BUTTON_SKIN, this)),
132  mButton(new Button(this, "", "ok", BUTTON_SKIN, this)),
133  // TRANSLATORS: npc dialog button
134  mButton2(new Button(this, _("Close"), "close", BUTTON_SKIN, this)),
135  // TRANSLATORS: npc dialog button
136  mButton3(new Button(this, _("Add"), "add", BUTTON_SKIN, this)),
137  // TRANSLATORS: npc dialog button
138  mResetButton(new Button(this, _("Reset"), "reset", BUTTON_SKIN, this)),
140  mComplexInventory(new ComplexInventory(InventoryType::Craft, 1)),
141  mItemContainer(new ItemContainer(this, mInventory,
143  mItemScrollArea(new ScrollArea(this, mItemContainer,
144  fromBool(getOptionBool("showitemsbackground", false), Opaque),
145  "npc_listbackground.xml")),
146  mInputState(NpcInputState::NONE),
147  mActionState(NpcActionState::WAIT),
148  mSkinControls(),
149  mSkinName(),
150  mPlayerBox(new PlayerBox(nullptr, std::string(), std::string())),
151  mAvatarBeing(nullptr),
152  mDialogInfo(nullptr),
153  mLastNextTime(0),
154  mCameraMode(-1),
155  mCameraX(0),
156  mCameraY(0),
157  mShowAvatar(false),
158  mLogInteraction(config.getBoolValue("logNpcInGui"))
159 {
160  // Basic Window Setup
161  setWindowName("NpcText");
162  setResizable(true);
163  setFocusable(true);
164  setStickyButtonLock(true);
165 
166  setMinWidth(200);
167  setMinHeight(150);
168 
169  setDefaultSize(300, 578, ImagePosition::LOWER_LEFT, 0, 0);
170 
171  mPlayerBox->setWidth(70);
172  mPlayerBox->setHeight(100);
173 
174  // Setup output text box
176  mTextBox->setMaxRow(config.getIntValue("ChatLogLength"));
178  mTextBox->setProcessVars(true);
180  mTextBox->setEnableKeys(true);
181  mTextBox->setEnableTabs(true);
182  mTextBox->setEnableImages(true);
183 
186 
187  // Setup listbox
193  if (gui->getNpcFont()->getHeight() < 20)
194  mItemList->setRowHeight(20);
195  else
197 
198  setContentSize(260, 175);
206 
207  const Font *const fnt = mButton->getFont();
208  int width = std::max(fnt->getWidth(CAPTION_WAITING),
209  fnt->getWidth(CAPTION_NEXT));
210  width = std::max(width, fnt->getWidth(CAPTION_CLOSE));
211  width = std::max(width, fnt->getWidth(CAPTION_SUBMIT));
212  mButton->setWidth(8 + width);
213 
214  // Place widgets
215  buildLayout();
216 
217  center();
218  loadWindowState();
219 
220  instances.push_back(this);
221 }
222 
224 {
227  requestFocus();
228  enableVisibleSound(true);
230 
231  if (actorManager != nullptr)
232  {
233  const Being *const being = actorManager->findBeing(mNpcId);
234  if (being != nullptr)
235  {
237  being->getSubType(), BeingTypeId)));
238  setCaption(being->getName());
239  }
240  }
241 
242  config.addListener("logNpcInGui", this);
243 }
244 
246 {
247  config.removeListeners(this);
249  clearLayout();
250 
251  if (mPlayerBox != nullptr)
252  {
253  delete mPlayerBox->getBeing();
254  delete mPlayerBox;
255  }
256 
258 
259  delete2(mTextBox);
261  delete2(mButton);
262  delete2(mButton2);
263  delete2(mButton3);
278 
280  {
281  if (*it != nullptr)
282  (*it)->decRef();
283  }
284 
285  mImages.clear();
286 
287  instances.remove(this);
288 }
289 
290 void NpcDialog::addText(const std::string &text, const bool save)
291 {
292  if (save || mLogInteraction)
293  {
294  if (mText.size() > 5000)
295  mText.clear();
296 
297  mNewText.append(text);
298  mTextBox->addRow(text,
299  false);
300  }
303  buildLayout();
304 }
305 
307 {
309  buildLayout();
310 }
311 
313 {
315  buildLayout();
316 }
317 
318 void NpcDialog::action(const ActionEvent &event)
319 {
320  const std::string &eventId = event.getId();
321  if (eventId == "ok")
322  {
324  {
326  return;
327 
328  nextDialog();
329  addText(std::string(), false);
330  }
333  {
334  if (cutInWindow != nullptr)
335  cutInWindow->hide();
336  closeDialog();
337  }
339  {
340  std::string printText; // Text that will get printed
341  // in the textbox
342  switch (mInputState)
343  {
344  case NpcInputState::LIST:
345  {
346  if (mDialogInfo != nullptr)
347  return;
348  if (gui != nullptr)
349  gui->resetClickCount();
350  const int selectedIndex = mItemList->getSelected();
351 
352  if (selectedIndex >= CAST_S32(mItems.size())
353  || selectedIndex < 0
356  {
357  return;
358  }
359  unsigned char choice = CAST_U8(
360  selectedIndex + 1);
361  printText = mItems[selectedIndex];
362 
363  npcHandler->listInput(mNpcId, choice);
364  break;
365  }
367  {
370  {
371  return;
372  }
373  printText = mTextField->getText();
374  npcHandler->stringInput(mNpcId, printText);
375  break;
376  }
378  {
381  {
382  return;
383  }
384  printText = strprintf("%d", mIntField->getValue());
387  break;
388  }
389  case NpcInputState::ITEM:
390  {
391  restoreVirtuals();
394  {
395  return;
396  }
397 
398  std::string str;
399  const int sz = mInventory->getSize();
400  if (sz == 0)
401  {
402  str = "0,0";
403  }
404  else
405  {
406  const Item *item = mInventory->getItem(0);
407  if (item != nullptr)
408  {
409  str = strprintf("%d,%d", item->getId(),
410  toInt(item->getColor(), int));
411  }
412  else
413  {
414  str = "0,0";
415  }
416  for (int f = 1; f < sz; f ++)
417  {
418  str.append(";");
419  item = mInventory->getItem(f);
420  if (item != nullptr)
421  {
422  str.append(strprintf("%d,%d", item->getId(),
423  toInt(item->getColor(), int)));
424  }
425  else
426  {
427  str.append("0,0");
428  }
429  }
430  }
431 
432  // need send selected item
434  mInventory->clear();
435  break;
436  }
438  {
439  restoreVirtuals();
442  {
443  return;
444  }
445 
446  std::string str;
447  const int sz = mInventory->getSize();
448  if (sz == 0)
449  {
450  str = "-1";
451  }
452  else
453  {
454  const Item *item = mInventory->getItem(0);
455  if (item != nullptr)
456  {
457  str = strprintf("%d", item->getTag());
458  }
459  else
460  {
461  str = "-1";
462  }
463  for (int f = 1; f < sz; f ++)
464  {
465  str.append(";");
466  item = mInventory->getItem(f);
467  if (item != nullptr)
468  str.append(strprintf("%d", item->getTag()));
469  else
470  str.append("-1");
471  }
472  }
473 
474  // need send selected item
476  mInventory->clear();
477  break;
478  }
480  {
481  restoreVirtuals();
484  {
485  return;
486  }
487 
488  std::string str;
489  const int sz = mComplexInventory->getSize();
490  if (sz == 0)
491  {
492  str.clear();
493  }
494  else
495  {
496  const ComplexItem *item = dynamic_cast<ComplexItem*>(
498  str = complexItemToStr(item);
499  for (int f = 1; f < sz; f ++)
500  {
501  str.append("|");
502  item = dynamic_cast<ComplexItem*>(
504  str.append(complexItemToStr(item));
505  }
506  }
507 
508  // need send selected item
510  mInventory->clear();
511  break;
512  }
513 
514  case NpcInputState::NONE:
515  default:
516  break;
517  }
521  {
522  // addText will auto remove the input layout
523  addText(strprintf("> \"%s\"", printText.c_str()), false);
524  }
525  mNewText.clear();
526  }
527 
528  if (!mLogInteraction)
529  mTextBox->clearRows();
530  }
531  else if (eventId == "reset")
532  {
533  switch (mInputState)
534  {
537  break;
540  break;
541  case NpcInputState::ITEM:
543  mInventory->clear();
544  break;
547  break;
548  case NpcInputState::NONE:
549  case NpcInputState::LIST:
550  default:
551  break;
552  }
553  }
554  else if (eventId == "inc")
555  {
557  }
558  else if (eventId == "dec")
559  {
561  }
562  else if (eventId == "clear")
563  {
564  switch (mInputState)
565  {
566  case NpcInputState::ITEM:
568  mInventory->clear();
569  break;
572  break;
575  case NpcInputState::LIST:
576  case NpcInputState::NONE:
577  default:
578  clearRows();
579  break;
580  }
581  }
582  else if (eventId == "close")
583  {
584  restoreVirtuals();
586  {
587  switch (mInputState)
588  {
589  case NpcInputState::ITEM:
590  npcHandler->stringInput(mNpcId, "0,0");
591  break;
593  npcHandler->stringInput(mNpcId, "-1");
594  break;
597  break;
600  case NpcInputState::NONE:
601  case NpcInputState::LIST:
602  default:
603  npcHandler->listInput(mNpcId, 255);
604  break;
605  }
606  if (cutInWindow != nullptr)
607  cutInWindow->hide();
608  closeDialog();
609  }
610  }
611  else if (eventId == "add")
612  {
613  if (inventoryWindow != nullptr)
614  {
616  Inventory *const inventory = PlayerInfo::getInventory();
617  if (inventory != nullptr)
618  {
620  {
621  if (mComplexInventory->addVirtualItem(item, -1, 1))
622  inventory->virtualRemove(item, 1);
623  }
624  else
625  {
626  if (mInventory->addVirtualItem(item, -1, 1))
627  inventory->virtualRemove(item, 1);
628  }
629  }
630  }
631  }
632  else if (eventId.find("skin_") == 0)
633  {
634  const std::string cmd = eventId.substr(5);
635  std::string printText;
636  int cnt = 0;
638  {
639  if (cmd == *it)
640  {
641  npcHandler->listInput(mNpcId, CAST_U8(cnt + 1));
642  printText = mItems[cnt];
643 
647  {
648  // addText will auto remove the input layout
649  addText(strprintf("> \"%s\"", printText.c_str()), false);
650  }
651  mNewText.clear();
652  break;
653  }
654  cnt ++;
655  }
656  }
657 }
658 
660 {
662 }
663 
665 {
666  restoreCamera();
668 }
669 
671 {
672  return CAST_S32(mItems.size());
673 }
674 
675 std::string NpcDialog::getElementAt(int i)
676 {
677  return mItems[i];
678 }
679 
681 {
682  return mImages[i];
683 }
684 
686 {
687  mItems.clear();
689  {
690  if (*it != nullptr)
691  (*it)->decRef();
692  }
693  mImages.clear();
696  buildLayout();
697 }
698 
699 void NpcDialog::addChoice(const std::string &choice)
700 {
701  mItems.push_back(choice);
702  mImages.push_back(nullptr);
703 }
704 
705 void NpcDialog::parseListItems(const std::string &itemString)
706 {
707  std::istringstream iss(itemString);
708  std::string tmp;
709  const std::string path = paths.getStringValue("guiIcons");
710  while (getline(iss, tmp, ':'))
711  {
712  if (tmp.empty())
713  continue;
714  const size_t pos = tmp.find('|');
715  if (pos == std::string::npos)
716  {
717  mItems.push_back(tmp);
718  mImages.push_back(nullptr);
719  }
720  else
721  {
722  mItems.push_back(tmp.substr(pos + 1));
723  Image *const img = Loader::getImage(pathJoin(path,
724  std::string(tmp.substr(0, pos)).append(".png")));
725  mImages.push_back(img);
726  }
727  }
728 
729  if (!mItems.empty())
730  {
733  }
734  else
735  {
736  mItemList->setSelected(-1);
737  }
738 }
739 
741 {
742  if (!mItems.empty())
743  mItemList->refocus();
744 }
745 
746 void NpcDialog::textRequest(const std::string &defaultText)
747 {
750  mDefaultString = defaultText;
751  mTextField->setText(defaultText);
752 
753  buildLayout();
754 }
755 
757 {
758  return mTextField->isFocused();
759 }
760 
762 {
763  return mTextField->isFocused() || mIntField->isFocused()
764  || mItemList->isFocused();
765 }
766 
768 {
769  FOR_EACH (DialogList::const_iterator, it, instances)
770  {
771  if (((*it) != nullptr) && (*it)->isInputFocused())
772  return true;
773  }
774 
775  return false;
776 }
777 
778 void NpcDialog::integerRequest(const int defaultValue,
779  const int min,
780  const int max)
781 {
784  mDefaultInt = defaultValue;
785  mIntField->setRange(min, max);
786  mIntField->setValue(defaultValue);
787  buildLayout();
788 }
789 
791 {
794  mInventory->resize(size);
795  buildLayout();
796 }
797 
799 {
802  mInventory->resize(size);
803  buildLayout();
804 }
805 
807 {
810  mComplexInventory->resize(size);
811  buildLayout();
812 }
813 
814 void NpcDialog::move(const int amount)
815 {
817  return;
818 
819  switch (mInputState)
820  {
822  mIntField->setValue(mIntField->getValue() + amount);
823  break;
824  case NpcInputState::LIST:
826  break;
827  case NpcInputState::NONE:
829  case NpcInputState::ITEM:
832  default:
833  break;
834  }
835 }
836 
838 {
839  Window::setVisible(visible);
840 
841  if (visible == Visible_false)
842  scheduleDelete();
843 }
844 
845 void NpcDialog::optionChanged(const std::string &name)
846 {
847  if (name == "logNpcInGui")
848  mLogInteraction = config.getBoolValue("logNpcInGui");
849 }
850 
852 {
853  if (instances.size() == 1)
854  return instances.front();
855 
856  FOR_EACH (DialogList::const_iterator, it, instances)
857  {
858  if (((*it) != nullptr) && (*it)->isFocused())
859  return (*it);
860  }
861 
862  return nullptr;
863 }
864 
866 {
867  FOR_EACH (DialogList::const_iterator, it, instances)
868  {
869  if (*it != nullptr)
870  (*it)->close();
871  }
872 }
873 
875 {
876  if (mShowAvatar)
877  {
878  place(0, 0, mPlayerBox, 1, 1);
879  place(1, 0, mScrollArea, 5, 3);
880  place(4, 3, mClearButton, 1, 1);
881  place(5, 3, mButton, 1, 1);
882  }
883  else
884  {
885  place(0, 0, mScrollArea, 5, 3);
886  place(3, 3, mClearButton, 1, 1);
887  place(4, 3, mButton, 1, 1);
888  }
889 }
890 
892 {
893  if (mShowAvatar)
894  {
895  place(0, 0, mPlayerBox, 1, 1);
896  place(1, 0, mScrollArea, 6, 3);
897  place(0, 3, mListScrollArea, 7, 3);
898  place(1, 6, mButton2, 2, 1);
899  place(3, 6, mClearButton, 2, 1);
900  place(5, 6, mButton, 2, 1);
901  }
902  else
903  {
904  place(0, 0, mScrollArea, 6, 3);
905  place(0, 3, mListScrollArea, 6, 3);
906  place(0, 6, mButton2, 2, 1);
907  place(2, 6, mClearButton, 2, 1);
908  place(4, 6, mButton, 2, 1);
909  }
910 }
911 
913 {
915  if ((mDialogInfo != nullptr) && mDialogInfo->hideText)
916  {
917  if (mShowAvatar)
918  {
919  place(0, 0, mPlayerBox, 1, 1);
920  place(1, 0, mSkinScrollArea, 7, 3);
921  place(1, 3, mButton2, 2, 1);
922  }
923  else
924  {
925  place(0, 0, mSkinScrollArea, 6, 3);
926  place(0, 3, mButton2, 2, 1);
927  }
928  }
929  else
930  {
931  if (mShowAvatar)
932  {
933  place(0, 0, mPlayerBox, 1, 1);
934  place(1, 0, mScrollArea, 6, 3);
935  place(0, 3, mSkinScrollArea, 7, 3);
936  place(1, 6, mButton2, 2, 1);
937  }
938  else
939  {
940  place(0, 0, mScrollArea, 6, 3);
941  place(0, 3, mSkinScrollArea, 6, 3);
942  place(0, 6, mButton2, 2, 1);
943  }
944  }
945 }
946 
948 {
949  if (mShowAvatar)
950  {
951  place(0, 0, mPlayerBox, 1, 1);
952  place(1, 0, mScrollArea, 6, 3);
953  place(1, 3, mTextField, 6, 1);
954  place(1, 4, mResetButton, 2, 1);
955  place(3, 4, mClearButton, 2, 1);
956  place(5, 4, mButton, 2, 1);
957  }
958  else
959  {
960  place(0, 0, mScrollArea, 6, 3);
961  place(0, 3, mTextField, 6, 1);
962  place(0, 4, mResetButton, 2, 1);
963  place(2, 4, mClearButton, 2, 1);
964  place(4, 4, mButton, 2, 1);
965  }
966 }
967 
969 {
970  if (mShowAvatar)
971  {
972  place(0, 0, mPlayerBox, 1, 1);
973  place(1, 0, mScrollArea, 6, 3);
974  place(1, 3, mMinusButton, 1, 1);
975  place(2, 3, mIntField, 4, 1);
976  place(6, 3, mPlusButton, 1, 1);
977  place(1, 4, mResetButton, 2, 1);
978  place(3, 4, mClearButton, 2, 1);
979  place(5, 4, mButton, 2, 1);
980  }
981  else
982  {
983  place(0, 0, mScrollArea, 6, 3);
984  place(0, 3, mMinusButton, 1, 1);
985  place(1, 3, mIntField, 4, 1);
986  place(5, 3, mPlusButton, 1, 1);
987  place(0, 4, mResetButton, 2, 1);
988  place(2, 4, mClearButton, 2, 1);
989  place(4, 4, mButton, 2, 1);
990  }
991 }
992 
994 {
995  if (mDialogInfo != nullptr)
996  {
999  }
1000  else
1001  {
1002  mItemContainer->setCellBackgroundImage("inventory_cell.xml");
1003  mItemContainer->setMaxColumns(10000);
1004  }
1005 
1008  else
1010 
1011  if ((mDialogInfo != nullptr) && mDialogInfo->hideText)
1012  {
1013  if (mShowAvatar)
1014  {
1015  place(0, 0, mPlayerBox, 1, 1);
1016  place(1, 0, mItemScrollArea, 7, 3);
1017  place(1, 3, mButton3, 2, 1);
1018  place(3, 3, mClearButton, 2, 1);
1019  place(5, 3, mButton, 2, 1);
1020  }
1021  else
1022  {
1023  place(0, 0, mItemScrollArea, 6, 3);
1024  place(0, 3, mButton3, 2, 1);
1025  place(2, 3, mClearButton, 2, 1);
1026  place(4, 3, mButton, 2, 1);
1027  }
1028  }
1029  else
1030  {
1031  if (mShowAvatar)
1032  {
1033  place(0, 0, mPlayerBox, 1, 1);
1034  place(1, 0, mScrollArea, 6, 3);
1035  place(0, 3, mItemScrollArea, 7, 3);
1036  place(1, 6, mButton3, 2, 1);
1037  place(3, 6, mClearButton, 2, 1);
1038  place(5, 6, mButton, 2, 1);
1039  }
1040  else
1041  {
1042  place(0, 0, mScrollArea, 6, 3);
1043  place(0, 3, mItemScrollArea, 6, 3);
1044  place(0, 6, mButton3, 2, 1);
1045  place(2, 6, mClearButton, 2, 1);
1046  place(4, 6, mButton, 2, 1);
1047  }
1048  }
1049 }
1050 
1052 {
1053  clearLayout();
1054 
1056  {
1059  else if (mActionState == NpcActionState::NEXT)
1061  else if (mActionState == NpcActionState::CLOSE)
1064  }
1065  else if (mInputState != NpcInputState::NONE)
1066  {
1068  switch (mInputState)
1069  {
1070  case NpcInputState::LIST:
1071  if (mDialogInfo == nullptr)
1073  else
1075  mItemList->setSelected(-1);
1076  break;
1077 
1078  case NpcInputState::STRING:
1080  break;
1081 
1084  break;
1085 
1086  case NpcInputState::ITEM:
1090  break;
1091 
1092  case NpcInputState::NONE:
1093  default:
1094  break;
1095  }
1096  }
1097 
1098  Layout &layout = getLayout();
1099  layout.setRowHeight(1, LayoutType::SET);
1100  redraw();
1102 }
1103 
1105 {
1106  if ((viewport == nullptr) || mCameraMode >= 0)
1107  return;
1108 
1112 }
1113 
1115 {
1116  if ((viewport == nullptr) || mCameraMode == -1)
1117  return;
1118 
1121  if (mCameraMode != 0)
1122  {
1125  }
1126  mCameraMode = -1;
1127 }
1128 
1130 {
1131  const bool needShow = (avatarId != BeingTypeId_zero);
1132  if (needShow)
1133  {
1134  delete mAvatarBeing;
1137  avatarId,
1138  nullptr);
1140  if (!mAvatarBeing->mSprites.empty())
1141  {
1142  mAvatarBeing->logic();
1143  const BeingInfo *const info = AvatarDB::get(avatarId);
1144  const int pad2 = 2 * mPadding;
1145  int width = 0;
1146  if (info != nullptr)
1147  {
1148  width = info->getWidth();
1149  mPlayerBox->setWidth(width + pad2);
1150  mPlayerBox->setHeight(info->getHeight() + pad2);
1151  }
1152  const Sprite *const sprite = mAvatarBeing->mSprites[0];
1153  if ((sprite != nullptr) && (width == 0))
1154  {
1155  mPlayerBox->setWidth(sprite->getWidth() + pad2);
1156  mPlayerBox->setHeight(sprite->getHeight() + pad2);
1157  }
1158  }
1159  }
1160  else
1161  {
1163  mPlayerBox->setPlayer(nullptr);
1164  }
1165  if (needShow != mShowAvatar)
1166  {
1167  mShowAvatar = needShow;
1168  buildLayout();
1169  }
1170  else
1171  {
1172  mShowAvatar = needShow;
1173  }
1174 }
1175 
1176 void NpcDialog::setAvatarDirection(const uint8_t direction)
1177 {
1178  Being *const being = mPlayerBox->getBeing();
1179  if (being != nullptr)
1180  being->setDirection(direction);
1181 }
1182 
1183 void NpcDialog::setAvatarAction(const int actionId)
1184 {
1185  Being *const being = mPlayerBox->getBeing();
1186  if (being != nullptr)
1187  being->setAction(static_cast<BeingActionT>(actionId), 0);
1188 }
1189 
1191 {
1192  BLOCK_START("NpcDialog::logic")
1193  Window::logic();
1194  if (mShowAvatar && (mAvatarBeing != nullptr))
1195  {
1196  mAvatarBeing->logic();
1197  if (mPlayerBox->getWidth() < CAST_S32(3 * getPadding()))
1198  {
1199  const Sprite *const sprite = mAvatarBeing->mSprites[0];
1200  if (sprite != nullptr)
1201  {
1202  mPlayerBox->setWidth(sprite->getWidth() + 2 * getPadding());
1203  mPlayerBox->setHeight(sprite->getHeight() + 2 * getPadding());
1204  buildLayout();
1205  }
1206  }
1207  }
1208  BLOCK_END("NpcDialog::logic")
1209 }
1210 
1212 {
1213  mTextBox->clearRows();
1214 }
1215 
1217 {
1218  NpcDialogs::iterator it = mNpcDialogs.begin();
1219  const NpcDialogs::iterator it_end = mNpcDialogs.end();
1220  while (it != it_end)
1221  {
1222  delete (*it).second;
1223  ++ it;
1224  }
1225  mNpcDialogs.clear();
1226 }
1227 
1229 {
1230  Window::mousePressed(event);
1231  if (event.getButton() == MouseButton::RIGHT
1232  && event.getSource() == mTextBox)
1233  {
1234  event.consume();
1235  if (popupMenu != nullptr)
1236  {
1238  viewport->mMouseX,
1239  viewport->mMouseY);
1240  }
1241  }
1242 }
1243 
1244 void NpcDialog::copyToClipboard(const int x, const int y) const
1245 {
1246  std::string str = mTextBox->getTextAtPos(x, y);
1247  sendBuffer(str);
1248 }
1249 
1250 void NpcDialog::setSkin(const std::string &skin)
1251 {
1252  if (skin.empty())
1253  {
1254  mSkinName = skin;
1255  mDialogInfo = nullptr;
1256  return;
1257  }
1258  const NpcDialogInfo *const dialog = NpcDialogDB::getDialog(skin);
1259  if (dialog == nullptr)
1260  {
1261  logger->log("Error: creating controls for not existing npc dialog %s",
1262  skin.c_str());
1263  return;
1264  }
1265  mSkinName = skin;
1266  mDialogInfo = dialog;
1267 }
1268 
1270 {
1272 }
1273 
1275 {
1277 
1278  if (mDialogInfo == nullptr)
1279  return;
1280 
1281  FOR_EACH (STD_VECTOR<NpcImageInfo*>::const_iterator,
1282  it,
1284  {
1285  const NpcImageInfo *const info = *it;
1286  Image *const image = Theme::getImageFromTheme(info->name);
1287  if (image != nullptr)
1288  {
1289  Icon *const icon = new Icon(this, image, AutoRelease_true);
1290  icon->setPosition(info->x, info->y);
1291  mSkinContainer->add(icon);
1292  }
1293  }
1294  FOR_EACH (STD_VECTOR<NpcTextInfo*>::const_iterator,
1295  it,
1297  {
1298  const NpcTextInfo *const info = *it;
1299  BrowserBox *box = new BrowserBox(this,
1300  Opaque_true,
1301  "browserbox.xml");
1302  box->setOpaque(Opaque_false);
1303  box->setMaxRow(config.getIntValue("ChatLogLength"));
1305  box->setProcessVars(true);
1306  box->setFont(gui->getNpcFont());
1307  box->setEnableKeys(true);
1308  box->setEnableTabs(true);
1309  box->setPosition(info->x, info->y);
1310  mSkinContainer->add(box);
1311  box->setWidth(info->width);
1312  box->setHeight(info->height);
1313  StringVect parts;
1314  splitToStringVector(parts, info->text, '\n');
1315  FOR_EACH (StringVectCIter, it2, parts)
1316  {
1317  box->addRow(*it2,
1318  false);
1319  }
1320  }
1321  FOR_EACH (STD_VECTOR<NpcButtonInfo*>::const_iterator,
1322  it,
1324  {
1325  const NpcButtonInfo *const info = *it;
1326  Button *const button = new Button(this,
1327  BUTTON_SKIN);
1328  button->setCaption(info->name);
1329  button->setActionEventId("skin_" + info->value);
1330  button->addActionListener(this);
1331  button->setPosition(info->x, info->y);
1332  if (!info->image.empty())
1333  {
1334  button->setImageWidth(info->imageWidth);
1335  button->setImageHeight(info->imageHeight);
1336  button->loadImageSet(info->image);
1337  }
1338  mSkinContainer->add(button);
1339  button->adjustSize();
1340  }
1341 }
1342 
1344 {
1345  Inventory *const inventory = PlayerInfo::getInventory();
1346  if (inventory != nullptr)
1347  inventory->restoreVirtuals();
1348 }
1349 
1351 {
1352  std::string str;
1353  if (item != nullptr)
1354  {
1355  const STD_VECTOR<Item*> &items = item->getChilds();
1356  const size_t sz = items.size();
1357  if (sz == 0U)
1358  return str;
1359 
1360  const Item *item2 = items[0];
1361 
1362  str = strprintf("%d,%d",
1363  item2->getInvIndex(),
1364  item2->getQuantity());
1365  for (size_t f = 1; f < sz; f ++)
1366  {
1367  str.append(";");
1368  item2 = items[f];
1369  str.append(strprintf("%d,%d",
1370  item2->getInvIndex(),
1371  item2->getQuantity()));
1372  }
1373  }
1374  else
1375  {
1376  str.clear();
1377  }
1378  return str;
1379 }
1380 
1382  const int amount,
1383  const int slot)
1384 {
1386  return;
1387 
1388  Inventory *const inventory = PlayerInfo::getInventory();
1389 
1390  if (inventory == nullptr)
1391  return;
1392 
1394  item,
1395  slot,
1396  amount))
1397  {
1398  inventory->virtualRemove(item, amount);
1399  }
1400 }
void resize(const unsigned int newSize)
Definition: inventory.cpp:396
int getInvIndex() const
Definition: item.h:164
Font * getFont() const
Definition: widget.cpp:330
void setPlayer(Being *being)
Definition: playerbox.h:73
bool sendBuffer(const std::string &text)
Definition: copynpaste.cpp:517
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
void optionChanged(const std::string &name)
Definition: npcdialog.cpp:845
int getWidth() const
Definition: beinginfo.h:203
void setDefaultSize()
Definition: window.cpp:1197
LayoutCell & place(const int x, const int y, Widget *const wg, const int w, const int h)
Definition: window.cpp:1383
std::string getStringValue(const std::string &key) const
#define _(s)
Definition: gettext.h:34
void showNpcDialogPopup(const BeingId npcId, const int x, const int y)
Definition: popupmenu.cpp:2244
void addChoice(const std::string &)
Definition: npcdialog.cpp:699
const bool ShowEmptyRows_true
Definition: showemptyrows.h:29
void redraw()
Definition: window.cpp:1405
void setSelected(const int selected)
Definition: listbox.cpp:398
void deleteSkinControls()
Definition: npcdialog.cpp:1269
void setValue(const int value)
void setCameraRelativeY(const int n)
Definition: viewport.h:148
int getWidth() const
Definition: widget.h:220
void placeNormalControls()
Definition: npcdialog.cpp:874
void restoreVirtuals()
Definition: inventory.cpp:499
int getTag() const
Definition: item.h:230
std::string value
Definition: npcbuttoninfo.h:44
void loadImageSet(const std::string &imageName)
Definition: button.cpp:394
void setEnableKeys(const bool n)
Definition: browserbox.h:138
const bool LoseFocusOnTab_true
#define CAST_U8
Definition: cast.h:26
void setWidth(const int width)
Definition: widget.cpp:132
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:30
void addText(const std::string &string, const bool save)
Definition: npcdialog.cpp:290
Button * mButton2
Definition: npcdialog.h:300
NpcActionStateT mActionState
Definition: npcdialog.h:312
int mPadding
Definition: window.h:617
void splitToStringVector(StringVect &tokens, const std::string &text, const char separator)
bool addVirtualItem(const Item *const item, int index, const int amount)
Gui * gui
Definition: gui.cpp:110
void showNextButton()
Definition: npcdialog.cpp:306
std::string name
Definition: npcbuttoninfo.h:43
Definition: font.h:88
virtual void integerInput(const BeingId npcId, const int value) const =0
#define CAPTION_CLOSE
Definition: npcdialog.cpp:88
const bool Visible_true
Definition: visible.h:29
void move(const int amount)
Definition: npcdialog.cpp:814
void loadWindowState()
Definition: window.cpp:1086
#define fromInt(val, name)
Definition: intdefines.h:45
std::vector< NpcButtonInfo * > buttons
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:251
void setImageHeight(const int height)
Definition: button.h:260
void setVisible(Visible visible)
Definition: widget.cpp:224
virtual void stringInput(const BeingId npcId, const std::string &value) const =0
std::string complexItemToStr(const ComplexItem *const item)
Definition: npcdialog.cpp:1350
BeingId mNpcId
Definition: npcdialog.h:271
MouseButtonT getButton() const
Definition: mouseevent.h:115
void setScrollPolicy(const ScrollPolicy hPolicy, const ScrollPolicy vPolicy)
std::string pathJoin(std::string str1, const std::string &str2)
void removeControls()
Definition: container.cpp:42
Definition: sprite.h:32
static NpcDialog * getActive()
Definition: npcdialog.cpp:851
ComplexInventory * mComplexInventory
Definition: npcdialog.h:307
Inventory * getInventory()
Definition: playerinfo.cpp:193
void restoreVirtuals()
Definition: npcdialog.cpp:1343
void setMinWidth(const int width)
Definition: window.cpp:590
std::string mDefaultString
Definition: npcdialog.h:274
Definition: window.h:98
StringVect mItems
Definition: npcdialog.h:283
ItemContainer * mItemContainer
Definition: npcdialog.h:308
#define BLOCK_START(name)
Definition: perfomance.h:78
Definition: button.h:96
SoundManager soundManager
Configuration config
const BeingTypeId BeingTypeId_zero
Definition: beingtypeid.h:29
int BeingId
Definition: beingid.h:29
void choiceRequest()
Definition: npcdialog.cpp:685
int getCameraRelativeY() const
Definition: viewport.h:142
void setVisible(Visible visible)
Definition: npcdialog.cpp:837
void refocus()
Definition: listbox.cpp:364
bool limitPackets(const PacketTypeT type)
void integerRequest(const int defaultValue, const int min, const int max)
Definition: npcdialog.cpp:778
ScrollArea * mScrollArea
Definition: npcdialog.h:278
#define BLOCK_END(name)
Definition: perfomance.h:79
void virtualRemove(Item *const item, const int amount)
Definition: inventory.cpp:484
Button * mButton3
Definition: npcdialog.h:301
void setDistributeMousePressed(const bool b)
Definition: listbox.h:140
std::vector< NpcTextInfo * > texts
int getIntValue(const std::string &key) const
const Image * getImageAt(int i)
Definition: npcdialog.cpp:680
void toggleCameraMode()
Definition: viewport.cpp:254
void setActionEventId(const std::string &actionEventId)
Definition: widget.h:595
void setVerticalScrollAmount(const int vScroll)
void placeTextInputControls()
Definition: npcdialog.cpp:947
void postInit()
Definition: npcdialog.cpp:223
int mMouseX
Definition: viewport.h:153
int getHeight() const
Definition: beinginfo.h:206
std::vector< std::string > StringVect
Definition: stringvector.h:28
void setAvatarDirection(const uint8_t direction)
Definition: npcdialog.cpp:1176
void copyToClipboard(const int x, const int y) const
Definition: npcdialog.cpp:1244
#define delete2(var)
Definition: delete2.h:24
void setSkin(const std::string &skin)
Definition: npcdialog.cpp:1250
InventoryWindow * inventoryWindow
const bool Enable_true
Definition: enable.h:29
Button * mResetButton
Definition: npcdialog.h:304
int getNumberOfElements()
Definition: npcdialog.cpp:670
std::string getTextAtPos(const int x, const int y) const
Definition: browserbox.cpp:869
void setVerticalScrollPolicy(const ScrollPolicy vPolicy)
std::list< NpcDialog * > DialogList
Definition: npcdialog.h:246
void addListener(const std::string &key, ConfigListener *const listener)
static Being * createBeing(const BeingId id, const ActorTypeT type, const BeingTypeId subtype, Map *const map)
Definition: being.cpp:5575
virtual bool isFocused() const
Definition: widget.cpp:183
void setText(const std::string &text)
Definition: textfield.cpp:802
void restoreCamera()
Definition: npcdialog.cpp:1114
void clear()
Definition: inventory.cpp:237
void adjustSize()
Definition: button.cpp:798
IntTextField * mIntField
Definition: npcdialog.h:293
int getVerticalMaxScroll()
Logger * logger
Definition: logger.cpp:88
virtual bool addVirtualItem(const Item *const item, int index, const int amount)
Definition: inventory.cpp:438
void itemCraftRequest(const int size)
Definition: npcdialog.cpp:806
BeingTypeId getAvatarFor(const BeingTypeId id)
Definition: npcdb.cpp:200
std::map< BeingId, NpcDialog * > NpcDialogs
Definition: npcdialog.h:55
virtual void setDirection(const uint8_t direction)
Definition: being.cpp:1689
#define new
Definition: debug_new.h:147
#define toInt(val, name)
Definition: intdefines.h:46
void buildLayout()
Definition: npcdialog.cpp:1051
void setContentSize(int width, int height)
Definition: window.cpp:491
Settings settings
Definition: settings.cpp:31
void placeMenuControls()
Definition: npcdialog.cpp:891
std::string image
Definition: npcbuttoninfo.h:45
void setCellBackgroundImage(const std::string &xmlName)
void nextDialog()
Definition: npcdialog.cpp:659
bool getBoolValue(const std::string &key) const
void clearRows()
Definition: npcdialog.cpp:1211
void setCaption(const std::string &caption)
Definition: button.h:213
Definition: icon.h:39
NpcDialogInfo * getDialog(const std::string &name)
void placeSkinControls()
Definition: npcdialog.cpp:912
void setWrappingEnabled(const bool wrappingEnabled)
Definition: listbox.h:222
std::string text
Definition: npctextinfo.h:41
#define CAST_S32
Definition: cast.h:29
virtual void requestFocus()
Definition: widget.cpp:203
virtual void nextDialog(const BeingId npcId) const =0
const std::string BUTTON_SKIN
Definition: button.h:88
int mCameraX
Definition: npcdialog.h:320
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
#define CAPTION_WAITING
Definition: npcdialog.cpp:84
void logic()
Definition: npcdialog.cpp:1190
virtual int getHeight() const =0
static NpcDialogs mNpcDialogs
Definition: npcdialog.h:241
const bool Visible_false
Definition: visible.h:29
std::string getElementAt(int i)
Definition: npcdialog.cpp:675
Image * getImage(const std::string &idPath)
Definition: imageloader.cpp:85
int getQuantity() const
Definition: item.h:104
#define fromBool(val, name)
Definition: booldefines.h:48
#define CAPTION_NEXT
Definition: npcdialog.cpp:86
NpcInventoryInfo inventory
Definition: npcdialoginfo.h:42
BrowserBox * mTextBox
Definition: npcdialog.h:277
bool info(InputEvent &event)
Definition: commands.cpp:56
const NpcDialogInfo * mDialogInfo
Definition: npcdialog.h:317
void closeDialog()
Definition: npcdialog.cpp:664
PopupMenu * popupMenu
Definition: popupmenu.cpp:102
static Image * getImageFromTheme(const std::string &path)
Definition: theme.cpp:654
virtual void add(Widget *const widget)
std::vector< Sprite * > mSprites
ItemColor getColor() const
Definition: item.h:180
void resetClickCount()
Definition: gui.cpp:979
void setProcessVars(const bool n)
Definition: browserbox.h:132
void setRange(const int minimum, const int maximum)
Being * findBeing(const BeingId id) const
void createSkinControls()
Definition: npcdialog.cpp:1274
void setEnableTabs(const bool n)
Definition: browserbox.h:141
int getSelected() const
Definition: listbox.h:167
Definition: item.h:48
#define nullptr
Definition: localconsts.h:44
void setMaxColumns(const int maxColumns)
std::vector< Image * > mImages
Definition: npcdialog.h:284
const bool Opaque_false
Definition: opaque.h:29
static void closeAll()
Definition: npcdialog.cpp:865
void setImageWidth(const int width)
Definition: button.h:257
void setPosition(const int x, const int y)
Definition: widget.cpp:160
int getValue() const
void refocus()
Definition: npcdialog.cpp:740
virtual void setAction(const BeingActionT &action, const int attackId)
Definition: being.cpp:1553
void setInventory(Inventory *const inventory)
Being * mAvatarBeing
Definition: npcdialog.h:316
void parseListItems(const std::string &itemString)
Definition: npcdialog.cpp:705
bool isTextInputFocused() const
Definition: npcdialog.cpp:756
std::string mSkinName
Definition: npcdialog.h:314
static bool isAnyInputFocused()
Definition: npcdialog.cpp:767
std::string mText
Definition: npcdialog.h:279
void showAvatar(const BeingTypeId avatarId)
Definition: npcdialog.cpp:1129
int mCameraY
Definition: npcdialog.h:321
const std::string & getName() const
Definition: being.h:231
void enableVisibleSound(bool b)
Definition: window.h:480
void setMinHeight(const int height)
Definition: window.cpp:603
virtual void listInput(const BeingId npcId, const unsigned char value) const =0
Button * mClearButton
Definition: npcdialog.h:296
Inventory * mInventory
Definition: npcdialog.h:306
ScrollArea * mSkinScrollArea
Definition: npcdialog.h:288
Inventory * mInventory
Definition: playerinfo.cpp:57
virtual void scheduleDelete()
Definition: window.cpp:830
virtual int getWidth() const =0
Layout & getLayout()
Definition: window.cpp:1364
unsigned int cameraMode
Definition: settings.h:142
int mMouseY
Definition: viewport.h:154
void saveCamera()
Definition: npcdialog.cpp:1104
int mDefaultInt
Definition: npcdialog.h:273
NpcInputStateT mInputState
Definition: npcdialog.h:311
static DialogList instances
Definition: npcdialog.h:247
void setHeight(const int height)
Definition: widget.cpp:139
ExtendedListBox * mItemList
Definition: npcdialog.h:285
Configuration paths
static void clearDialogs()
Definition: npcdialog.cpp:1216
bool mShowAvatar
Definition: npcdialog.h:322
Container * mSkinContainer
Definition: npcdialog.h:287
void showCloseButton()
Definition: npcdialog.cpp:312
void setMaxRow(unsigned max)
Definition: browserbox.h:80
int getId() const
Definition: item.h:80
void setFocusable(const bool focusable)
Definition: widget.cpp:191
virtual void setVisible(Visible visible)
Definition: window.cpp:777
void center()
Definition: window.cpp:1416
static const std::string SOUND_SHOW_WINDOW
Definition: sound.h:36
void addRow(const std::string &row, const bool atTop)
Definition: browserbox.cpp:170
Item * getSelectedItem() const
NpcDialog(const BeingId npcId)
Definition: npcdialog.cpp:97
BeingInfo * get(const BeingTypeId id)
Definition: avatardb.cpp:140
std::string mNewText
Definition: npcdialog.h:280
void setLinkHandler(LinkHandler *linkHandler)
Definition: browserbox.cpp:165
void setFont(Font *const font)
Definition: widget.cpp:348
void setEnableImages(const bool n)
Definition: browserbox.h:135
void removeListeners(ConfigListener *const listener)
int mCameraMode
Definition: npcdialog.h:319
const bool Opaque_true
Definition: opaque.h:29
const std::vector< Item * > & getChilds() const
Definition: complexitem.h:58
ItemLinkHandler * mItemLinkHandler
Definition: npcdialog.h:289
int getWidth(const std::string &text) const
Definition: font.cpp:333
ScrollArea * mItemScrollArea
Definition: npcdialog.h:309
void logic()
Definition: being.cpp:1833
void textRequest(const std::string &defaultText)
Definition: npcdialog.cpp:746
void placeIntInputControls()
Definition: npcdialog.cpp:968
const bool ForceQuantity_false
Definition: forcequantity.h:29
int getCameraRelativeX() const
Definition: viewport.h:139
void mousePressed(MouseEvent &event)
Definition: window.cpp:835
Definition: image.h:61
void action(const ActionEvent &event)
Definition: npcdialog.cpp:318
void mousePressed(MouseEvent &event)
Definition: npcdialog.cpp:1228
Font * getNpcFont() const
Definition: gui.h:177
const bool AutoRelease_true
Definition: autorelease.h:29
void setOpaque(Opaque opaque)
Definition: browserbox.h:74
void setResizable(const bool resize)
Definition: window.cpp:626
std::vector< NpcImageInfo * > images
void setCameraRelativeX(const int n)
Definition: viewport.h:145
void setStickyButtonLock(const bool sticky)
Definition: window.cpp:771
Net::NpcHandler * npcHandler
Definition: net.cpp:90
#define CHECKLISTENERS
Definition: localconsts.h:276
NpcDialogMenuInfo menu
Definition: npcdialoginfo.h:41
const BeingId BeingId_zero
Definition: beingid.h:29
void setAvatarAction(const int actionId)
Definition: npcdialog.cpp:1183
#define CREATEWIDGETR(type,...)
Definition: createwidget.h:35
void log(const char *const log_text,...)
Definition: logger.cpp:264
void placeItemInputControls()
Definition: npcdialog.cpp:993
int getHeight() const
Definition: font.cpp:361
Item * getItem(const int index) const
Definition: inventory.cpp:82
Definition: layout.h:43
void itemIndexRequest(const int size)
Definition: npcdialog.cpp:798
Button * mMinusButton
Definition: npcdialog.h:295
Button * mButton
Definition: npcdialog.h:299
void addCraftItem(Item *const item, const int amount, const int slot)
Definition: npcdialog.cpp:1381
#define CAPTION_SUBMIT
Definition: npcdialog.cpp:90
void clearLayout()
Definition: window.cpp:1371
void setCaption(const std::string &caption)
Definition: window.h:530
int BeingTypeId
Definition: beingtypeid.h:29
Definition: being.h:93
void setRowHeight(const int n, const int h)
Definition: layoutcell.cpp:127
void itemRequest(const int size)
Definition: npcdialog.cpp:790
BeingTypeId getSubType() const
Definition: being.h:399
void clearRows()
Definition: browserbox.cpp:358
ScrollArea * mListScrollArea
Definition: npcdialog.h:286
const std::string & getText() const
Definition: textfield.h:223
PlayerBox * mPlayerBox
Definition: npcdialog.h:315
virtual void closeDialog(const BeingId npcId)=0
int getPadding() const
Definition: window.h:503
bool isInputFocused() const
Definition: npcdialog.cpp:761
TextField * mTextField
Definition: npcdialog.h:292
std::vector< Image * >::iterator ImageVectorIter
Definition: npcdialog.cpp:95
void setRowHeight(unsigned int n)
Definition: listbox.h:158
bool mLogInteraction
Definition: npcdialog.h:323
void postInit()
Definition: window.cpp:248
ActorManager * actorManager
Viewport * viewport
Definition: viewport.cpp:35
void playGuiSound(const std::string &name)
std::string name
Definition: npcimageinfo.h:39
Button * mPlusButton
Definition: npcdialog.h:294
CutInWindow * cutInWindow
Definition: cutinwindow.cpp:36
void setWindowName(const std::string &name)
Definition: window.h:354
Being * getBeing()
Definition: playerbox.h:91
unsigned getSize() const
Definition: inventory.h:75
void setHorizontalScrollPolicy(const ScrollPolicy hPolicy)