mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 13:49:40 +00:00
dynamic inventory layout like morrowind
This commit is contained in:
parent
d266b4fe87
commit
3a93df8db4
8 changed files with 78 additions and 33 deletions
|
@ -66,8 +66,7 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
|
||||||
_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()->setDragDrop(true);
|
||||||
MWBase::Environment::get().getWindowManager()->setMouseVisible(false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
onContainerClicked(mContainerWidget);
|
onContainerClicked(mContainerWidget);
|
||||||
|
@ -93,8 +92,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
|
||||||
mDragAndDrop->mContainerWindow = 0;
|
mDragAndDrop->mContainerWindow = 0;
|
||||||
drawItems();
|
drawItems();
|
||||||
|
|
||||||
MWBase::Environment::get().getInputManager()->setDragDrop(false);
|
MWBase::Environment::get().getWindowManager()->setDragDrop(false);
|
||||||
MWBase::Environment::get().getWindowManager()->setMouseVisible(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +126,7 @@ void ContainerBase::drawItems()
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int maxHeight = mItemView->getSize().height - 48;
|
int maxHeight = mItemView->getSize().height - 58;
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
|
@ -195,7 +193,12 @@ void ContainerBase::drawItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
if(iter->getRefData().getCount() > 1)
|
if(iter->getRefData().getCount() > 1)
|
||||||
text->setCaption(boost::lexical_cast<std::string>(iter->getRefData().getCount()));
|
{
|
||||||
|
if (iter->getRefData().getCount() > 9999)
|
||||||
|
text->setCaption(boost::lexical_cast<std::string>(iter->getRefData().getCount()/1000.f) + "k");
|
||||||
|
else
|
||||||
|
text->setCaption(boost::lexical_cast<std::string>(iter->getRefData().getCount()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +212,7 @@ void ContainerBase::Update()
|
||||||
if(mDragAndDrop->mIsOnDragAndDrop)
|
if(mDragAndDrop->mIsOnDragAndDrop)
|
||||||
{
|
{
|
||||||
if(mDragAndDrop->mDraggedWidget)
|
if(mDragAndDrop->mDraggedWidget)
|
||||||
mDragAndDrop->mDraggedWidget->setPosition(MyGUI::InputManager::getInstance().getMousePosition());
|
mDragAndDrop->mDraggedWidget->setPosition(MyGUI::InputManager::getInstance().getMousePosition() - MyGUI::IntPoint(21, 21));
|
||||||
else mDragAndDrop->mIsOnDragAndDrop = false; //If this happens, there is a bug.
|
else mDragAndDrop->mIsOnDragAndDrop = false; //If this happens, there is a bug.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace MWGui
|
||||||
getWidget(mFilterApparel, "ApparelButton");
|
getWidget(mFilterApparel, "ApparelButton");
|
||||||
getWidget(mFilterMagic, "MagicButton");
|
getWidget(mFilterMagic, "MagicButton");
|
||||||
getWidget(mFilterMisc, "MiscButton");
|
getWidget(mFilterMisc, "MiscButton");
|
||||||
|
getWidget(mLeftPane, "LeftPane");
|
||||||
|
getWidget(mRightPane, "RightPane");
|
||||||
|
|
||||||
MyGUI::ScrollView* itemView;
|
MyGUI::ScrollView* itemView;
|
||||||
MyGUI::Widget* containerWidget;
|
MyGUI::Widget* containerWidget;
|
||||||
|
@ -86,6 +88,12 @@ namespace MWGui
|
||||||
|
|
||||||
void InventoryWindow::onWindowResize(MyGUI::Window* _sender)
|
void InventoryWindow::onWindowResize(MyGUI::Window* _sender)
|
||||||
{
|
{
|
||||||
|
const float aspect = 0.5; // fixed aspect ratio for the left pane
|
||||||
|
mLeftPane->setSize( (_sender->getSize().height-44) * aspect, _sender->getSize().height-44 );
|
||||||
|
mRightPane->setCoord( mLeftPane->getPosition().left + (_sender->getSize().height-44) * aspect + 4,
|
||||||
|
mRightPane->getPosition().top,
|
||||||
|
_sender->getSize().width - 12 - (_sender->getSize().height-44) * aspect - 15,
|
||||||
|
_sender->getSize().height-44 );
|
||||||
drawItems();
|
drawItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,9 @@ namespace MWGui
|
||||||
MyGUI::ProgressBar* mEncumbranceBar;
|
MyGUI::ProgressBar* mEncumbranceBar;
|
||||||
MyGUI::TextBox* mEncumbranceText;
|
MyGUI::TextBox* mEncumbranceText;
|
||||||
|
|
||||||
|
MyGUI::Widget* mLeftPane;
|
||||||
|
MyGUI::Widget* mRightPane;
|
||||||
|
|
||||||
MyGUI::Button* mFilterAll;
|
MyGUI::Button* mFilterAll;
|
||||||
MyGUI::Button* mFilterWeapon;
|
MyGUI::Button* mFilterWeapon;
|
||||||
MyGUI::Button* mFilterApparel;
|
MyGUI::Button* mFilterApparel;
|
||||||
|
|
|
@ -16,6 +16,7 @@ ToolTips::ToolTips(WindowManager* windowManager) :
|
||||||
, mGameMode(true)
|
, mGameMode(true)
|
||||||
, mWindowManager(windowManager)
|
, mWindowManager(windowManager)
|
||||||
, mFullHelp(false)
|
, mFullHelp(false)
|
||||||
|
, mEnabled(true)
|
||||||
{
|
{
|
||||||
getWidget(mDynamicToolTipBox, "DynamicToolTipBox");
|
getWidget(mDynamicToolTipBox, "DynamicToolTipBox");
|
||||||
|
|
||||||
|
@ -27,6 +28,11 @@ ToolTips::ToolTips(WindowManager* windowManager) :
|
||||||
mMainWidget->setNeedMouseFocus(false);
|
mMainWidget->setNeedMouseFocus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolTips::setEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
mEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void ToolTips::onFrame(float frameDuration)
|
void ToolTips::onFrame(float frameDuration)
|
||||||
{
|
{
|
||||||
MyGUI::Gui::getInstance().destroyWidget(mDynamicToolTipBox);
|
MyGUI::Gui::getInstance().destroyWidget(mDynamicToolTipBox);
|
||||||
|
@ -36,6 +42,12 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
|
|
||||||
const IntSize &viewSize = RenderManager::getInstance().getViewSize();
|
const IntSize &viewSize = RenderManager::getInstance().getViewSize();
|
||||||
|
|
||||||
|
if (!mEnabled)
|
||||||
|
{
|
||||||
|
mDynamicToolTipBox->setVisible(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mGameMode)
|
if (!mGameMode)
|
||||||
{
|
{
|
||||||
Widget* focus = InputManager::getInstance().getMouseFocusWidget();
|
Widget* focus = InputManager::getInstance().getMouseFocusWidget();
|
||||||
|
|
|
@ -39,6 +39,8 @@ namespace MWGui
|
||||||
void enterGameMode();
|
void enterGameMode();
|
||||||
void enterGuiMode();
|
void enterGuiMode();
|
||||||
|
|
||||||
|
void setEnabled(bool enabled);
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -73,6 +75,8 @@ namespace MWGui
|
||||||
|
|
||||||
bool mGameMode;
|
bool mGameMode;
|
||||||
|
|
||||||
|
bool mEnabled;
|
||||||
|
|
||||||
bool mFullHelp;
|
bool mFullHelp;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,3 +563,10 @@ void WindowManager::setMouseVisible(bool visible)
|
||||||
{
|
{
|
||||||
MyGUI::PointerManager::getInstance().setVisible(visible);
|
MyGUI::PointerManager::getInstance().setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::setDragDrop(bool dragDrop)
|
||||||
|
{
|
||||||
|
mToolTips->setEnabled(!dragDrop);
|
||||||
|
MWBase::Environment::get().getInputManager()->setDragDrop(dragDrop);
|
||||||
|
setMouseVisible(!dragDrop);
|
||||||
|
}
|
||||||
|
|
|
@ -166,7 +166,8 @@ namespace MWGui
|
||||||
|
|
||||||
void setFocusObject(const MWWorld::Ptr& focus);
|
void setFocusObject(const MWWorld::Ptr& focus);
|
||||||
|
|
||||||
void setMouseVisible(bool visible);
|
void setMouseVisible(bool visible);
|
||||||
|
void setDragDrop(bool dragDrop);
|
||||||
|
|
||||||
void toggleFogOfWar();
|
void toggleFogOfWar();
|
||||||
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||||
|
|
|
@ -3,37 +3,44 @@
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 600 300" name="_Main">
|
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 600 300" name="_Main">
|
||||||
|
|
||||||
<!-- Player encumbrance -->
|
<Widget type="Widget" skin="" position="0 0 224 223" align="Left Top" name="LeftPane">
|
||||||
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="8 8 212 24" name="EncumbranceBar">
|
|
||||||
<Property key="Range" value="100"/>
|
<!-- Player encumbrance -->
|
||||||
<Property key="RangePosition" value="50"/>
|
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="8 8 212 24" name="EncumbranceBar" align="Left Top HStretch">
|
||||||
<Widget type="TextBox" skin="ProgressText" position="0 0 212 24" align="Center" name="EncumbranceBarT">
|
<Property key="Range" value="100"/>
|
||||||
<Property key="Caption" value="Encumbrance bar"/>
|
<Property key="RangePosition" value="50"/>
|
||||||
|
<Widget type="TextBox" skin="ProgressText" position="0 0 212 24" align="Center Stretch" name="EncumbranceBarT">
|
||||||
|
<Property key="Caption" value="Encumbrance bar"/>
|
||||||
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
<!-- Avatar -->
|
||||||
|
<Widget type="Widget" skin="MW_Box" position="8 38 212 185" name="Avatar" align="Left Top Stretch">
|
||||||
|
<Widget type="TextBox" skin="ProgressText" position="0 150 212 24" align="HCenter Bottom" name="ArmorRating">
|
||||||
|
<Property key="Caption" value="Armor Rating"/>
|
||||||
|
</Widget>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<!-- Avatar -->
|
<Widget type="Widget" skin="" position="228 0 350 223" align="Left Top" name="RightPane">
|
||||||
<Widget type="Widget" skin="MW_Box" position="8 38 212 219" name="Avatar" align="Left Top VStretch">
|
|
||||||
<Widget type="TextBox" skin="ProgressText" position="0 180 212 24" align="HCenter Bottom" name="ArmorRating">
|
|
||||||
<Property key="Caption" value="Armor Rating goes here"/>
|
|
||||||
</Widget>
|
|
||||||
</Widget>
|
|
||||||
|
|
||||||
<!-- Items in inventory -->
|
<!-- Items in inventory -->
|
||||||
<Widget type="Widget" skin="MW_Box" position="228 38 300 219" name="box" align="Left Top Stretch">
|
<Widget type="Widget" skin="MW_Box" position="0 38 350 185" name="box" align="Left Top Stretch">
|
||||||
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 292 215" align="Left Top Stretch" name="ItemView">
|
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 342 181" align="Left Top Stretch" name="ItemView">
|
||||||
<Property key="CanvasSize" value="1024 1024"/>
|
<Widget type="Button" skin="" name="Items" position="0 0 342 181" name="Items" align="Left Top Stretch"/>
|
||||||
<Widget type="Button" skin="" name="Items" position="0 0 292 215" name="Items" align="Left Top Stretch"/>
|
</Widget>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<!-- Categories -->
|
||||||
|
<Widget type="Widget" position="0 8 350 24" align="Left Top HStretch" name="Categories">
|
||||||
|
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="AllButton"/>
|
||||||
|
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="WeaponButton"/>
|
||||||
|
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="ApparelButton"/>
|
||||||
|
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="MagicButton"/>
|
||||||
|
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="MiscButton"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
</Widget>
|
|
||||||
|
|
||||||
<!-- Categories -->
|
|
||||||
<Widget type="Widget" position="228 8 300 24" align="ALIGN_TOP ALIGN_LEFT" name="Categories">
|
|
||||||
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="AllButton"/>
|
|
||||||
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="WeaponButton"/>
|
|
||||||
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="ApparelButton"/>
|
|
||||||
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="MagicButton"/>
|
|
||||||
<Widget type="Button" skin="MW_Button" position="0 0 60 24" name="MiscButton"/>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
Loading…
Reference in a new issue