cleanup 2

actorid
scrawl 13 years ago
parent a1b86acc38
commit 3a6fde5039

@ -1,24 +1,24 @@
#include "container.hpp"
#include <iterator>
#include <algorithm>
#include "window_manager.hpp"
#include "widgets.hpp"
#include "itemwidget.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/manualref.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/class.hpp"
#include "../mwclass/container.hpp"
#include "../mwinput/inputmanager.hpp"
#include <cmath>
#include <algorithm>
#include <iterator>
#include <assert.h>
#include <iostream>
#include "../mwclass/container.hpp"
#include "../mwworld/containerstore.hpp"
#include <boost/lexical_cast.hpp>
#include "../mwworld/class.hpp"
#include "../mwinput/inputmanager.hpp"
#include "itemwidget.hpp"
using namespace MWGui;
@ -32,22 +32,26 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dr
{
setText("_Main", "Name of Container");
int w = MyGUI::RenderManager::getInstance().getViewSize().width;
int h = MyGUI::RenderManager::getInstance().getViewSize().height;
setCoord(w-600,h-300,600,300);
//center();
adjustWindowCaption();
getWidget(mContainerWidget, "Items");
getWidget(mTakeButton, "TakeButton");
getWidget(mCloseButton, "CloseButton");
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onCloseButtonClicked);
mTakeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onTakeAllButtonClicked);
mContainerWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onContainerClicked);
setText("CloseButton","Close");
setText("TakeButton","Take All");
//mContainerWidget->eventMouseItemActivate += MyGUI::newDelegate(this,&ContainerWindow::onSelectedItem);
setText("CloseButton", MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sClose")->str);
setText("TakeButton", MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTakeAll")->str);
// adjust buttons size to fit text
int closeButtonWidth = mCloseButton->getTextSize().width+24;
int takeButtonWidth = mTakeButton->getTextSize().width+24;
mCloseButton->setCoord(600-20-closeButtonWidth, mCloseButton->getCoord().top, closeButtonWidth, mCloseButton->getCoord().height);
mTakeButton->setCoord(600-20-closeButtonWidth-takeButtonWidth-8, mTakeButton->getCoord().top, takeButtonWidth, mTakeButton->getCoord().height);
int w = MyGUI::RenderManager::getInstance().getViewSize().width;
int h = MyGUI::RenderManager::getInstance().getViewSize().height;
setCoord(w-600,h-300,600,300);
}
ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop,std::string guiFile)
@ -56,18 +60,9 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dr
mContainer()
{
setText("_Main", "Name of Container");
//center();
adjustWindowCaption();
getWidget(mContainerWidget, "Items");
mContainerWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onContainerClicked);
//getWidget(takeButton, "TakeButton");
//getWidget(closeButton, "CloseButton");
//closeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onByeClicked);
//setText("CloseButton","Close");
//setText("TakeButton","Take All");
//mContainerWidget->eventMouseItemActivate += MyGUI::newDelegate(this,&ContainerWindow::onSelectedItem);
}
ContainerWindow::~ContainerWindow()
{
@ -76,6 +71,7 @@ ContainerWindow::~ContainerWindow()
void ContainerWindow::setName(std::string contName)
{
setText("_Main", contName);
adjustWindowCaption();
}
@ -189,6 +185,16 @@ void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
}
}
void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
{
if(!mDragAndDrop->mIsOnDragAndDrop)
{
/// \todo
MWBase::Environment::get().getWindowManager()->setGuiMode(GM_Game);
setVisible(false);
}
}
void ContainerWindow::onSelectedItem(MyGUI::Widget* _sender)
{
if(!mDragAndDrop->mIsOnDragAndDrop)

@ -70,6 +70,7 @@ namespace MWGui
void drawItems();
void onCloseButtonClicked(MyGUI::Widget* _sender);
void onTakeAllButtonClicked(MyGUI::Widget* _sender);
void onSelectedItem(MyGUI::Widget* _sender);
void onContainerClicked(MyGUI::Widget* _sender);
void onMouseMove(MyGUI::Widget* _sender, int _left, int _top);

@ -3,22 +3,12 @@
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Window" layer="Windows" position="900 500 600 300" name="_Main">
<!-- HEADER
<Widget type="TextBox" skin="HeaderText" position="0 0 588 18" name="ContainerName" align="ALIGN_LEFT ALIGN_TOP">
<Property key="Caption" value="Name"/>
<Property key="TextAlign" value="ALIGN_CENTER"/>
</Widget>-->
<!-- Items in inventory -->
<Widget type="ItemBox" skin="MW_Box" position="5 10 570 220" name="Items"/>
<Widget type="Widget" position="300 235 300 24" align="ALIGN_TOP ALIGN_LEFT" name="Buttons">
<Widget type="Button" skin="MW_Button" position="100 0 75 24" name="TakeButton"/>
<Widget type="Button" skin="MW_Button" position="180 0 60 24" name="CloseButton"/>
</Widget>
<!-- buttons position adjusted at runtime to fit text -->
<Widget type="Button" skin="MW_Button" position="0 235 75 24" name="TakeButton" align="Right Bottom"/>
<Widget type="Button" skin="MW_Button" position="0 235 60 24" name="CloseButton" align="Right Bottom"/>
</Widget>
</MyGUI>

Loading…
Cancel
Save