GUI mode dependent position

actorid
Sebastian Wick 12 years ago
parent e27ba55541
commit 7ed763262f

@ -36,6 +36,11 @@ namespace MWGui
, mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
, mPreviewDirty(true)
, mDragAndDrop(dragAndDrop)
, mPositionInventory(0, 342, 498, 258)
, mPositionContainer(0, 342, 498, 258)
, mPositionCompanion(0, 342, 498, 258)
, mPositionBarter(0, 342, 498, 258)
, mGuiMode(GM_Inventory)
{
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);
@ -67,7 +72,7 @@ namespace MWGui
mFilterAll->setStateSelected(true);
setCoord(0, 342, 498, 258);
setCoord(mPositionInventory.left, mPositionInventory.top, mPositionInventory.width, mPositionInventory.height);
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
mPreview.setup();
@ -83,6 +88,27 @@ namespace MWGui
mPreview.setup();
}
void InventoryWindow::setGuiMode(GuiMode mode)
{
mGuiMode = mode;
switch(mode) {
case GM_Container:
mMainWidget->setCoord(mPositionContainer);
break;
case GM_Companion:
mMainWidget->setCoord(mPositionCompanion);
break;
case GM_Barter:
mMainWidget->setCoord(mPositionBarter);
break;
case GM_Inventory:
default:
mMainWidget->setCoord(mPositionInventory);
break;
}
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
}
TradeItemModel* InventoryWindow::getTradeModel()
{
return mTradeModel;
@ -210,6 +236,21 @@ namespace MWGui
_sender->getSize().width - 12 - (_sender->getSize().height-44) * aspect - 15,
_sender->getSize().height-44 );
switch(mGuiMode) {
case GM_Container:
mPositionContainer = _sender->getCoord();
break;
case GM_Companion:
mPositionCompanion = _sender->getCoord();
break;
case GM_Barter:
mPositionBarter = _sender->getCoord();
break;
case GM_Inventory:
default:
mPositionInventory = _sender->getCoord();
}
if (mMainWidget->getSize().width != mLastXSize || mMainWidget->getSize().height != mLastYSize)
{
mLastXSize = mMainWidget->getSize().width;

@ -5,6 +5,7 @@
#include "windowpinnablebase.hpp"
#include "widgets.hpp"
#include "mode.hpp"
namespace MWGui
{
@ -47,6 +48,8 @@ namespace MWGui
void updatePlayer();
void setGuiMode(GuiMode mode);
private:
DragAndDrop* mDragAndDrop;
@ -73,6 +76,13 @@ namespace MWGui
MyGUI::Button* mFilterMagic;
MyGUI::Button* mFilterMisc;
MyGUI::IntCoord mPositionInventory;
MyGUI::IntCoord mPositionContainer;
MyGUI::IntCoord mPositionCompanion;
MyGUI::IntCoord mPositionBarter;
GuiMode mGuiMode;
int mLastXSize;
int mLastYSize;

@ -441,16 +441,19 @@ namespace MWGui
mMap ->setVisible(eff & GW_Map);
mStatsWindow ->setVisible(eff & GW_Stats);
mInventoryWindow->setVisible(eff & GW_Inventory);
mInventoryWindow->setGuiMode(mode);
mSpellWindow ->setVisible(eff & GW_Magic);
break;
}
case GM_Container:
mContainerWindow->setVisible(true);
mInventoryWindow->setVisible(true);
mInventoryWindow->setGuiMode(mode);
break;
case GM_Companion:
mCompanionWindow->setVisible(true);
mInventoryWindow->setVisible(true);
mInventoryWindow->setGuiMode(mode);
break;
case GM_Dialogue:
mDialogueWindow->setVisible(true);
@ -458,6 +461,7 @@ namespace MWGui
case GM_Barter:
mInventoryWindow->setVisible(true);
mInventoryWindow->setTrading(true);
mInventoryWindow->setGuiMode(mode);
mTradeWindow->setVisible(true);
break;
case GM_SpellBuying:

Loading…
Cancel
Save