1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 22:19:54 +00:00
openmw-tes3mp/apps/openmw/mwgui/quickkeysmenu.hpp

121 lines
3 KiB
C++
Raw Normal View History

#ifndef MWGUI_QUICKKEYS_H
#define MWGUI_QUICKKEYS_H
#include "../mwworld/ptr.hpp"
#include "windowbase.hpp"
#include "spellmodel.hpp"
namespace MWGui
{
class QuickKeysMenuAssign;
class ItemSelectionDialog;
class MagicSelectionDialog;
class ItemWidget;
class SpellView;
class QuickKeysMenu : public WindowBase
{
public:
QuickKeysMenu();
~QuickKeysMenu();
2017-09-23 20:07:30 +00:00
void onResChange(int, int) { center(); }
void onItemButtonClicked(MyGUI::Widget* sender);
void onMagicButtonClicked(MyGUI::Widget* sender);
void onUnassignButtonClicked(MyGUI::Widget* sender);
void onCancelButtonClicked(MyGUI::Widget* sender);
void onAssignItem (MWWorld::Ptr item);
void onAssignItemCancel ();
void onAssignMagicItem (MWWorld::Ptr item);
void onAssignMagic (const std::string& spellId);
void onAssignMagicCancel ();
void onOpen();
2012-08-27 13:51:01 +00:00
void activateQuickKey(int index);
void updateActivatedQuickKey();
2012-08-27 13:51:01 +00:00
/// @note This enum is serialized, so don't move the items around!
2012-08-27 13:51:01 +00:00
enum QuickKeyType
{
Type_Item,
Type_Magic,
Type_MagicItem,
Type_Unassigned,
Type_HandToHand
2012-08-27 13:51:01 +00:00
};
void write (ESM::ESMWriter& writer);
2015-01-22 18:04:59 +00:00
void readRecord (ESM::ESMReader& reader, uint32_t type);
void clear();
private:
2018-06-28 03:27:08 +00:00
struct keyData {
int index;
ItemWidget* button;
QuickKeysMenu::QuickKeyType type;
std::string id;
std::string name;
keyData(): index(-1), button(nullptr), type(Type_Unassigned), id(""), name("") {}
};
std::vector<struct keyData> mKey;
struct keyData* mSelected;
struct keyData* mActivated;
2018-06-28 03:27:08 +00:00
MyGUI::EditBox* mInstructionLabel;
MyGUI::Button* mOkButton;
QuickKeysMenuAssign* mAssignDialog;
ItemSelectionDialog* mItemSelectionDialog;
MagicSelectionDialog* mMagicSelectionDialog;
void onQuickKeyButtonClicked(MyGUI::Widget* sender);
void onOkButtonClicked(MyGUI::Widget* sender);
2018-06-28 03:27:08 +00:00
void unassign(struct keyData* key);
};
class QuickKeysMenuAssign : public WindowModal
{
public:
QuickKeysMenuAssign(QuickKeysMenu* parent);
private:
MyGUI::TextBox* mLabel;
MyGUI::Button* mItemButton;
MyGUI::Button* mMagicButton;
MyGUI::Button* mUnassignButton;
MyGUI::Button* mCancelButton;
QuickKeysMenu* mParent;
};
class MagicSelectionDialog : public WindowModal
{
public:
MagicSelectionDialog(QuickKeysMenu* parent);
virtual void onOpen();
2017-09-23 10:18:39 +00:00
virtual bool exit();
2012-08-26 09:37:33 +00:00
private:
MyGUI::Button* mCancelButton;
SpellView* mMagicList;
QuickKeysMenu* mParent;
void onCancelButtonClicked (MyGUI::Widget* sender);
void onModelIndexSelected(SpellModel::ModelIndex index);
};
}
#endif