summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-10-04 23:47:58 +0300
committerAndrei Karas <akaras@inbox.ru>2016-10-04 23:47:58 +0300
commit360fac210a053c3217cc87a43ed00e2734ba9aa9 (patch)
tree5906a1ae86ad4dcc9b38329d19cbbea14dddfa88 /src/gui/windows
parent16be27ddb973b5c2dedb6b5b63083086984c2139 (diff)
downloadplus-360fac210a053c3217cc87a43ed00e2734ba9aa9.tar.gz
plus-360fac210a053c3217cc87a43ed00e2734ba9aa9.tar.bz2
plus-360fac210a053c3217cc87a43ed00e2734ba9aa9.tar.xz
plus-360fac210a053c3217cc87a43ed00e2734ba9aa9.zip
Move npcactionstate into enums directory.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/npcdialog.cpp40
-rw-r--r--src/gui/windows/npcdialog.h13
2 files changed, 23 insertions, 30 deletions
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 47bac3b92..38dbb8b92 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -142,7 +142,7 @@ NpcDialog::NpcDialog(const BeingId npcId) :
fromBool(getOptionBool("showitemsbackground"), Opaque),
"npc_listbackground.xml")),
mInputState(NpcInputState::NONE),
- mActionState(NPC_ACTION_WAIT),
+ mActionState(NpcActionState::WAIT),
mSkinControls(),
mSkinName(),
mPlayerBox(new PlayerBox(nullptr)),
@@ -296,19 +296,19 @@ void NpcDialog::addText(const std::string &text, const bool save)
mTextBox->addRow(text);
}
mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll());
- mActionState = NPC_ACTION_WAIT;
+ mActionState = NpcActionState::WAIT;
buildLayout();
}
void NpcDialog::showNextButton()
{
- mActionState = NPC_ACTION_NEXT;
+ mActionState = NpcActionState::NEXT;
buildLayout();
}
void NpcDialog::showCloseButton()
{
- mActionState = NPC_ACTION_CLOSE;
+ mActionState = NpcActionState::CLOSE;
buildLayout();
}
@@ -317,7 +317,7 @@ void NpcDialog::action(const ActionEvent &event)
const std::string &eventId = event.getId();
if (eventId == "ok")
{
- if (mActionState == NPC_ACTION_NEXT)
+ if (mActionState == NpcActionState::NEXT)
{
if (!PacketLimiter::limitPackets(PacketType::PACKET_NPC_NEXT))
return;
@@ -325,14 +325,14 @@ void NpcDialog::action(const ActionEvent &event)
nextDialog();
addText(std::string(), false);
}
- else if (mActionState == NPC_ACTION_CLOSE
- || mActionState == NPC_ACTION_WAIT)
+ else if (mActionState == NpcActionState::CLOSE
+ || mActionState == NpcActionState::WAIT)
{
if (cutInWindow)
cutInWindow->hide();
closeDialog();
}
- else if (mActionState == NPC_ACTION_INPUT)
+ else if (mActionState == NpcActionState::INPUT)
{
std::string printText; // Text that will get printed
// in the textbox
@@ -579,7 +579,7 @@ void NpcDialog::action(const ActionEvent &event)
else if (eventId == "close")
{
restoreVirtuals();
- if (mActionState == NPC_ACTION_INPUT)
+ if (mActionState == NpcActionState::INPUT)
{
switch (mInputState)
{
@@ -688,7 +688,7 @@ void NpcDialog::choiceRequest()
(*it)->decRef();
}
mImages.clear();
- mActionState = NPC_ACTION_INPUT;
+ mActionState = NpcActionState::INPUT;
mInputState = NpcInputState::LIST;
buildLayout();
}
@@ -742,7 +742,7 @@ void NpcDialog::refocus()
void NpcDialog::textRequest(const std::string &defaultText)
{
- mActionState = NPC_ACTION_INPUT;
+ mActionState = NpcActionState::INPUT;
mInputState = NpcInputState::STRING;
mDefaultString = defaultText;
mTextField->setText(defaultText);
@@ -775,7 +775,7 @@ bool NpcDialog::isAnyInputFocused()
void NpcDialog::integerRequest(const int defaultValue, const int min,
const int max)
{
- mActionState = NPC_ACTION_INPUT;
+ mActionState = NpcActionState::INPUT;
mInputState = NpcInputState::INTEGER;
mDefaultInt = defaultValue;
mIntField->setRange(min, max);
@@ -785,7 +785,7 @@ void NpcDialog::integerRequest(const int defaultValue, const int min,
void NpcDialog::itemRequest(const int size)
{
- mActionState = NPC_ACTION_INPUT;
+ mActionState = NpcActionState::INPUT;
mInputState = NpcInputState::ITEM;
mInventory->resize(size);
buildLayout();
@@ -793,7 +793,7 @@ void NpcDialog::itemRequest(const int size)
void NpcDialog::itemIndexRequest(const int size)
{
- mActionState = NPC_ACTION_INPUT;
+ mActionState = NpcActionState::INPUT;
mInputState = NpcInputState::ITEM_INDEX;
mInventory->resize(size);
buildLayout();
@@ -801,7 +801,7 @@ void NpcDialog::itemIndexRequest(const int size)
void NpcDialog::itemCraftRequest(const int size)
{
- mActionState = NPC_ACTION_INPUT;
+ mActionState = NpcActionState::INPUT;
mInputState = NpcInputState::ITEM_CRAFT;
mComplexInventory->resize(size);
buildLayout();
@@ -809,7 +809,7 @@ void NpcDialog::itemCraftRequest(const int size)
void NpcDialog::move(const int amount)
{
- if (mActionState != NPC_ACTION_INPUT)
+ if (mActionState != NpcActionState::INPUT)
return;
switch (mInputState)
@@ -1048,13 +1048,13 @@ void NpcDialog::buildLayout()
{
clearLayout();
- if (mActionState != NPC_ACTION_INPUT)
+ if (mActionState != NpcActionState::INPUT)
{
- if (mActionState == NPC_ACTION_WAIT)
+ if (mActionState == NpcActionState::WAIT)
mButton->setCaption(CAPTION_WAITING);
- else if (mActionState == NPC_ACTION_NEXT)
+ else if (mActionState == NpcActionState::NEXT)
mButton->setCaption(CAPTION_NEXT);
- else if (mActionState == NPC_ACTION_CLOSE)
+ else if (mActionState == NpcActionState::CLOSE)
mButton->setCaption(CAPTION_CLOSE);
placeNormalControls();
}
diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h
index 9a905e2f6..429cf95c7 100644
--- a/src/gui/windows/npcdialog.h
+++ b/src/gui/windows/npcdialog.h
@@ -26,6 +26,7 @@
#include "enums/simpletypes/beingid.h"
#include "enums/simpletypes/beingtypeid.h"
+#include "enums/gui/npcactionstate.h"
#include "enums/gui/npcinputstate.h"
#include "gui/models/extendedlistmodel.h"
@@ -79,14 +80,6 @@ class NpcDialog final : public Window,
void postInit() override final;
- enum NpcActionState
- {
- NPC_ACTION_WAIT = 0,
- NPC_ACTION_NEXT,
- NPC_ACTION_INPUT,
- NPC_ACTION_CLOSE
- };
-
/**
* Called when receiving actions from the widgets.
*/
@@ -230,7 +223,7 @@ class NpcDialog final : public Window,
void mousePressed(MouseEvent &event) override final;
int isCloseState() const
- { return mActionState == NPC_ACTION_CLOSE; }
+ { return mActionState == NpcActionState::CLOSE; }
void setSkin(const std::string &skin);
@@ -315,7 +308,7 @@ class NpcDialog final : public Window,
NpcInputStateT mInputState;
- NpcActionState mActionState;
+ NpcActionStateT mActionState;
std::vector<Widget*> mSkinControls;
std::string mSkinName;
PlayerBox *mPlayerBox A_NONNULLPOINTER;