diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 661495559..d79693114 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -125,7 +125,8 @@ void ContainerBase::drawItems() int x = 4; int y = 4; - int count = 0; + int maxHeight = mItemView->getSize().height - 48; + int index = 0; for (MWWorld::ContainerStoreIterator iter (containerStore.begin()); iter!=containerStore.end(); ++iter) @@ -133,21 +134,21 @@ void ContainerBase::drawItems() index++; if(iter->getRefData().getCount() > 0) { - count++; std::string path = std::string("icons\\"); path+=MWWorld::Class::get(*iter).getInventoryIcon(*iter); ItemWidget* image = mContainerWidget->createWidget("ImageBox", MyGUI::IntCoord(x, y, 32, 32), MyGUI::Align::Default); - MyGUI::TextBox* text = image->createWidget("SandBrightText", MyGUI::IntCoord(x, y, 18, 18), MyGUI::Align::Default, std::string("Label")); + MyGUI::TextBox* text = image->createWidget("SandBrightText", MyGUI::IntCoord(14, 14, 18, 18), MyGUI::Align::Default, std::string("Label")); + text->setTextAlign(MyGUI::Align::Right); + text->setNeedMouseFocus(false); image->eventMouseButtonClick += MyGUI::newDelegate(this,&ContainerBase::onSelectedItem); image->setUserString("ToolTipType", "ItemPtr"); image->setUserData(*iter); image->mPos = index; - x += 36; - if(count % 20 == 0) - { y += 36; - x = 4; - count = 0; + if (y > maxHeight) + { + x += 36; + y = 4; } if(iter->getRefData().getCount() > 1) @@ -158,7 +159,11 @@ void ContainerBase::drawItems() path.append(".dds"); image->setImageTexture(path); } - } + } + + MyGUI::IntSize size = MyGUI::IntSize(std::max(mItemView->getSize().width, x), 2048); + mItemView->setCanvasSize(size); + mContainerWidget->setSize(size); } void ContainerBase::Update() @@ -204,6 +209,7 @@ ContainerWindow::~ContainerWindow() void ContainerWindow::onWindowResize(MyGUI::Window* window) { + drawItems(); } void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender) diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 416be5367..b85380968 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -24,6 +24,7 @@ namespace MWGui InventoryWindow::InventoryWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop) : ContainerBase(parWindowManager,dragAndDrop,"openmw_inventory_window_layout.xml") { + static_cast(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize); } void InventoryWindow::openInventory() @@ -31,4 +32,9 @@ namespace MWGui open(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); } + void InventoryWindow::onWindowResize(MyGUI::Window* _sender) + { + drawItems(); + } + } diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp index 152f8b0d0..813fc88ab 100644 --- a/apps/openmw/mwgui/inventorywindow.hpp +++ b/apps/openmw/mwgui/inventorywindow.hpp @@ -27,6 +27,9 @@ namespace MWGui InventoryWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop); void openInventory(); + + protected: + void onWindowResize(MyGUI::Window* _sender); }; } #endif // Inventory_H diff --git a/files/mygui/openmw_container_window_layout.xml b/files/mygui/openmw_container_window_layout.xml index 9679519d4..26fe0a3d3 100644 --- a/files/mygui/openmw_container_window_layout.xml +++ b/files/mygui/openmw_container_window_layout.xml @@ -4,10 +4,10 @@ - - + + - + diff --git a/files/mygui/openmw_inventory_window_layout.xml b/files/mygui/openmw_inventory_window_layout.xml index 40d89f221..a347a510e 100644 --- a/files/mygui/openmw_inventory_window_layout.xml +++ b/files/mygui/openmw_inventory_window_layout.xml @@ -15,7 +15,7 @@ - + diff --git a/files/mygui/openmw_list.skin.xml b/files/mygui/openmw_list.skin.xml index 89cc73123..213e8470f 100644 --- a/files/mygui/openmw_list.skin.xml +++ b/files/mygui/openmw_list.skin.xml @@ -131,6 +131,7 @@ + @@ -143,7 +144,7 @@ - + diff --git a/files/mygui/openmw_scroll_skin.xml b/files/mygui/openmw_scroll_skin.xml index 64e467661..70fad3f4b 100644 --- a/files/mygui/openmw_scroll_skin.xml +++ b/files/mygui/openmw_scroll_skin.xml @@ -7,4 +7,9 @@ + + + + +