From 1e8d894e1c9562010847fe4a5632055bab1093b3 Mon Sep 17 00:00:00 2001 From: gugus Date: Sat, 21 Apr 2012 10:51:01 +0200 Subject: [PATCH] Starting inventory window --- apps/openmw/mwgui/container.cpp | 21 +++++++++++++++++-- apps/openmw/mwgui/container.hpp | 1 + apps/openmw/mwgui/inventorywindow.cpp | 11 ++++++++++ apps/openmw/mwgui/inventorywindow.hpp | 30 +++++++++++++++++++++++++++ apps/openmw/mwgui/window_manager.cpp | 7 ++++++- apps/openmw/mwgui/window_manager.hpp | 2 ++ 6 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 apps/openmw/mwgui/inventorywindow.cpp create mode 100644 apps/openmw/mwgui/inventorywindow.hpp diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp index 3f27351a98..bc3bcf4752 100644 --- a/apps/openmw/mwgui/container.cpp +++ b/apps/openmw/mwgui/container.cpp @@ -41,6 +41,23 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Enviro setText("TakeButton","Take All"); } +ContainerWindow::ContainerWindow(WindowManager& parWindowManager,MWWorld::Environment& environment,std::string guiFile) + : WindowBase(guiFile, parWindowManager), + mEnvironment(environment) +{ + setText("_Main", "Name of Container"); + //center(); + adjustWindowCaption(); + + getWidget(containerWidget, "Items"); + //getWidget(takeButton, "TakeButton"); + //getWidget(closeButton, "CloseButton"); + + //closeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onByeClicked); + + //setText("CloseButton","Close"); + //setText("TakeButton","Take All"); +} ContainerWindow::~ContainerWindow() { } @@ -60,7 +77,7 @@ void ContainerWindow::open(MWWorld::Ptr& container) MWWorld::ContainerStore& containerStore = MWWorld::Class::get(container).getContainerStore(container); - MWWorld::ManualRef furRef (mWindowManager.getStore(), "fur_cuirass"); + /*MWWorld::ManualRef furRef (mWindowManager.getStore(), "fur_cuirass"); furRef.getPtr().getRefData().setCount (5); MWWorld::ManualRef bukkitRef (mWindowManager.getStore(), "misc_com_bucket_01"); MWWorld::ManualRef broomRef (mWindowManager.getStore(), "misc_com_broom_01"); @@ -89,7 +106,7 @@ void ContainerWindow::open(MWWorld::Ptr& container) containerStore.add(bukkitRef.getPtr()); containerStore.add(bukkitRef.getPtr()); containerStore.add(bukkitRef.getPtr()); - containerStore.add(goldRef.getPtr()); + containerStore.add(goldRef.getPtr());*/ diff --git a/apps/openmw/mwgui/container.hpp b/apps/openmw/mwgui/container.hpp index 76905a6814..3802d21afb 100644 --- a/apps/openmw/mwgui/container.hpp +++ b/apps/openmw/mwgui/container.hpp @@ -36,6 +36,7 @@ namespace MWGui { public: ContainerWindow(WindowManager& parWindowManager,MWWorld::Environment& environment); + ContainerWindow(WindowManager& parWindowManager,MWWorld::Environment& environment,std::string guiFile); void open(MWWorld::Ptr& container); diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp new file mode 100644 index 0000000000..7f3884bc17 --- /dev/null +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -0,0 +1,11 @@ +#include "inventorywindow.hpp" + +namespace MWGui +{ + + InventoryWindow::InventoryWindow(WindowManager& parWindowManager,MWWorld::Environment& environment) + :ContainerWindow(parWindowManager,environment,"openmw_inventory_window_layout.xml") + { + } + +} \ No newline at end of file diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp new file mode 100644 index 0000000000..ce177014a1 --- /dev/null +++ b/apps/openmw/mwgui/inventorywindow.hpp @@ -0,0 +1,30 @@ +#ifndef MGUI_Inventory_H +#define MGUI_Inventory_H + +#include "container.hpp" +namespace MWWorld +{ + class Environment; +} + +namespace MyGUI +{ + class Gui; + class Widget; +} + +namespace MWGui +{ + class WindowManager; +} + + +namespace MWGui +{ + class InventoryWindow : public MWGui::ContainerWindow + { + public: + InventoryWindow(WindowManager& parWindowManager,MWWorld::Environment& environment); + }; +} +#endif // Inventory_H diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index 34048c935d..065141963e 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -8,6 +8,7 @@ #include "stats_window.hpp" #include "messagebox.hpp" #include "container.hpp" +#include "inventorywindow.hpp" #include "../mwmechanics/mechanicsmanager.hpp" #include "../mwinput/inputmanager.hpp" @@ -82,6 +83,7 @@ WindowManager::WindowManager(MWWorld::Environment& environment, mMessageBoxManager = new MessageBoxManager(this); dialogueWindow = new DialogueWindow(*this,environment); containerWindow = new ContainerWindow(*this,environment); + mInventoryWindow = new InventoryWindow(*this,environment); // The HUD is always on hud->setVisible(true); @@ -121,6 +123,7 @@ WindowManager::~WindowManager() delete mJournal; delete dialogueWindow; delete containerWindow; + delete mInventoryWindow; delete mCharGen; cleanupGarbage(); @@ -182,6 +185,7 @@ void WindowManager::updateVisible() mJournal->setVisible(false); dialogueWindow->setVisible(false); containerWindow->setVisible(false); + mInventoryWindow->setVisible(false); // Mouse is visible whenever we're not in game mode MyGUI::PointerManager::getInstance().setVisible(isGuiMode()); @@ -217,11 +221,12 @@ void WindowManager::updateVisible() // Show the windows we want map -> setVisible( (eff & GW_Map) != 0 ); stats -> setVisible( (eff & GW_Stats) != 0 ); - + mInventoryWindow->setVisible(true); break; } case GM_Container: containerWindow->setVisible(true); + mInventoryWindow->setVisible(true); break; case GM_Dialogue: dialogueWindow->open(); diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index 4f54b41b8a..438a99a0ef 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -63,6 +63,7 @@ namespace MWGui class JournalWindow; class CharacterCreation; class ContainerWindow; + class InventoryWindow; class TextInputDialog; class InfoBoxDialog; class DialogueWindow; @@ -204,6 +205,7 @@ namespace MWGui JournalWindow* mJournal; DialogueWindow *dialogueWindow; ContainerWindow *containerWindow; + InventoryWindow *mInventoryWindow; CharacterCreation* mCharGen; // Various stats about player as needed by window manager