1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-02 01:06:42 +00:00

hide the cursor during drag&drop and don't allow hotkeys that change guimode

This commit is contained in:
scrawl 2012-05-13 10:18:17 +02:00
parent f31853d30b
commit d266b4fe87
5 changed files with 38 additions and 3 deletions

View file

@ -60,12 +60,14 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
std::string sound = MWWorld::Class::get(object).getUpSoundId(object); std::string sound = MWWorld::Class::get(object).getUpSoundId(object);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
_sender->setUserString("drag","on");
mDragAndDrop->mDraggedWidget = _sender; mDragAndDrop->mDraggedWidget = _sender;
mDragAndDrop->mContainerWindow = const_cast<MWGui::ContainerBase*>(this); mDragAndDrop->mContainerWindow = const_cast<MWGui::ContainerBase*>(this);
// hide the count text // hide the count text
_sender->getChildAt(0)->getChildAt(0)->setVisible(false); _sender->getChildAt(0)->getChildAt(0)->setVisible(false);
drawItems(); drawItems();
MWBase::Environment::get().getInputManager()->setDragDrop(true);
MWBase::Environment::get().getWindowManager()->setMouseVisible(false);
} }
else else
onContainerClicked(mContainerWidget); onContainerClicked(mContainerWidget);
@ -90,6 +92,9 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
mDragAndDrop->mDraggedWidget = 0; mDragAndDrop->mDraggedWidget = 0;
mDragAndDrop->mContainerWindow = 0; mDragAndDrop->mContainerWindow = 0;
drawItems(); drawItems();
MWBase::Environment::get().getInputManager()->setDragDrop(false);
MWBase::Environment::get().getWindowManager()->setMouseVisible(true);
} }
} }
@ -146,7 +151,9 @@ void ContainerBase::drawItems()
else if (mFilter == Filter_Misc) else if (mFilter == Filter_Misc)
{ {
categories = MWWorld::ContainerStore::Type_Miscellaneous + MWWorld::ContainerStore::Type_Book categories = MWWorld::ContainerStore::Type_Miscellaneous + MWWorld::ContainerStore::Type_Book
+ MWWorld::ContainerStore::Type_Ingredient; + MWWorld::ContainerStore::Type_Ingredient + MWWorld::ContainerStore::Type_Repair
+ MWWorld::ContainerStore::Type_Lockpick + MWWorld::ContainerStore::Type_Light
+ MWWorld::ContainerStore::Type_Apparatus;
} }
for (MWWorld::ContainerStoreIterator iter (containerStore.begin(categories)); iter!=containerStore.end(); ++iter) for (MWWorld::ContainerStoreIterator iter (containerStore.begin(categories)); iter!=containerStore.end(); ++iter)

View file

@ -558,3 +558,8 @@ void WindowManager::setSpellVisibility(bool visible)
{ {
hud->spellBox->setVisible(visible); hud->spellBox->setVisible(visible);
} }
void WindowManager::setMouseVisible(bool visible)
{
MyGUI::PointerManager::getInstance().setVisible(visible);
}

View file

@ -166,6 +166,8 @@ namespace MWGui
void setFocusObject(const MWWorld::Ptr& focus); void setFocusObject(const MWWorld::Ptr& focus);
void setMouseVisible(bool visible);
void toggleFogOfWar(); void toggleFogOfWar();
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script) void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
bool getFullHelp() const; bool getFullHelp() const;

View file

@ -88,6 +88,8 @@ namespace MWInput
MWGui::WindowManager &windows; MWGui::WindowManager &windows;
OMW::Engine& mEngine; OMW::Engine& mEngine;
bool mDragDrop;
/* InputImpl Methods */ /* InputImpl Methods */
@ -143,6 +145,9 @@ namespace MWInput
{ {
using namespace MWGui; using namespace MWGui;
if (mDragDrop)
return;
GuiMode mode = windows.getMode(); GuiMode mode = windows.getMode();
// Toggle between game mode and inventory mode // Toggle between game mode and inventory mode
@ -159,6 +164,9 @@ namespace MWInput
{ {
using namespace MWGui; using namespace MWGui;
if (mDragDrop)
return;
GuiMode mode = windows.getMode(); GuiMode mode = windows.getMode();
// Switch to console mode no matter what mode we are currently // Switch to console mode no matter what mode we are currently
@ -219,7 +227,8 @@ namespace MWInput
poller(input), poller(input),
player(_player), player(_player),
windows(_windows), windows(_windows),
mEngine (engine) mEngine (engine),
mDragDrop(false)
{ {
using namespace OEngine::Input; using namespace OEngine::Input;
using namespace OEngine::Render; using namespace OEngine::Render;
@ -319,6 +328,11 @@ namespace MWInput
poller.bind(A_Crouch, KC_LCONTROL); poller.bind(A_Crouch, KC_LCONTROL);
} }
void setDragDrop(bool dragDrop)
{
mDragDrop = dragDrop;
}
//NOTE: Used to check for movement keys //NOTE: Used to check for movement keys
void update () void update ()
{ {
@ -426,4 +440,9 @@ namespace MWInput
{ {
impl->update(); impl->update();
} }
void MWInputManager::setDragDrop(bool dragDrop)
{
impl->setDragDrop(dragDrop);
}
} }

View file

@ -50,6 +50,8 @@ namespace MWInput
void update(); void update();
void setDragDrop(bool dragDrop);
void setGuiMode(MWGui::GuiMode mode); void setGuiMode(MWGui::GuiMode mode);
}; };
} }