complete trade window layout

actorid
scrawl 13 years ago
parent 4213b4370f
commit 6ae642aa06

@ -470,7 +470,6 @@ void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
{
MWBase::Environment::get().getWindowManager()->setGuiMode(GM_Game);
setVisible(false);
}
}
@ -502,6 +501,5 @@ void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
containerStore.clear();
MWBase::Environment::get().getWindowManager()->setGuiMode(GM_Game);
setVisible(false);
}
}

@ -17,6 +17,7 @@
#include "widgets.hpp"
#include "list.hpp"
#include "tradewindow.hpp"
#include "inventorywindow.hpp"
using namespace MWGui;
using namespace Widgets;
@ -137,6 +138,7 @@ void DialogueWindow::onSelectTopic(std::string topic)
{
/// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
mWindowManager.getTradeWindow()->startTrade(mActor);
mWindowManager.setGuiMode(GM_Barter);
}
else

@ -3,24 +3,49 @@
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "window_manager.hpp"
namespace MWGui
{
TradeWindow::TradeWindow(WindowManager& parWindowManager) :
WindowBase("openmw_trade_window_layout.xml", parWindowManager),
ContainerBase(NULL) // no drag&drop
{
getWidget(mFilterAll, "AllButton");
getWidget(mFilterWeapon, "WeaponButton");
getWidget(mFilterApparel, "ApparelButton");
getWidget(mFilterMagic, "MagicButton");
getWidget(mFilterMisc, "MiscButton");
MyGUI::ScrollView* itemView;
MyGUI::Widget* containerWidget;
getWidget(containerWidget, "Items");
getWidget(itemView, "ItemView");
setWidgets(containerWidget, itemView);
getWidget(mFilterAll, "AllButton");
getWidget(mFilterWeapon, "WeaponButton");
getWidget(mFilterApparel, "ApparelButton");
getWidget(mFilterMagic, "MagicButton");
getWidget(mFilterMisc, "MiscButton");
getWidget(mMaxSaleButton, "MaxSaleButton");
getWidget(mCancelButton, "CancelButton");
getWidget(mOfferButton, "OfferButton");
getWidget(mPlayerGold, "PlayerGold");
getWidget(mMerchantGold, "MerchantGold");
getWidget(mIncreaseButton, "IncreaseButton");
getWidget(mDecreaseButton, "DecreaseButton");
getWidget(mTotalBalance, "TotalBalance");
getWidget(mTotalBalanceLabel, "TotalBalanceLabel");
getWidget(mBottomPane, "BottomPane");
// this GMST doesn't seem to get retrieved - even though i can clearly see it in the CS !??!?
mMaxSaleButton->setCaption(mWindowManager.getGameSettingString("sMaxSale", "Max. Sale"));
mCancelButton->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sCancel")->str);
mOfferButton->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sOffer")->str);
/*
mTotalBalanceLabel->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTotalCost")->str);
mTotalBalanceLabel->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTotalSold")->str);
mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sYourGold")->str);
mMerchantGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSellerGold")->str);
*/
mFilterAll->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sAllTab")->str);
mFilterWeapon->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sWeaponTab")->str);
mFilterApparel->setCaption (MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sApparelTab")->str);
@ -47,20 +72,42 @@ namespace MWGui
mFilterMisc->setPosition(curX, mFilterMisc->getPosition().top);
mFilterMisc->setSize( mFilterMisc->getTextSize().width + 24, mFilterMisc->getSize().height );
mFilterAll->setStateSelected(true);
mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
mFilterMagic->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
mFilterMisc->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
mFilterAll->setStateSelected(true);
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onCancelButtonClicked);
mOfferButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onOfferButtonClicked);
mMaxSaleButton->setSize(MyGUI::IntSize(mMaxSaleButton->getTextSize().width + 24, mMaxSaleButton->getHeight()));
int cancelButtonWidth = mCancelButton->getTextSize().width + 24;
mCancelButton->setCoord(mBottomPane->getWidth()-cancelButtonWidth,
mCancelButton->getTop(),
cancelButtonWidth,
mCancelButton->getHeight());
int offerButtonWidth = mOfferButton->getTextSize().width + 24;
mOfferButton->setCoord(mBottomPane->getWidth()-cancelButtonWidth-offerButtonWidth-8,
mOfferButton->getTop(),
offerButtonWidth,
mOfferButton->getHeight());
setCoord(400, 0, 400, 300);
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &TradeWindow::onWindowResize);
}
void TradeWindow::startTrade(MWWorld::Ptr actor)
{
ContainerBase::openContainer(actor);
setVisible(true);
setTitle(MWWorld::Class::get(actor).getName(actor));
adjustWindowCaption();
}
void TradeWindow::onFilterChanged(MyGUI::Widget* _sender)
@ -84,4 +131,18 @@ namespace MWGui
static_cast<MyGUI::Button*>(_sender)->setStateSelected(true);
}
void TradeWindow::onWindowResize(MyGUI::Window* _sender)
{
drawItems();
}
void TradeWindow::onOfferButtonClicked(MyGUI::Widget* _sender)
{
}
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
mWindowManager.setGuiMode(GM_Game);
}
}

@ -37,8 +37,23 @@ namespace MWGui
MyGUI::Button* mFilterMagic;
MyGUI::Button* mFilterMisc;
MyGUI::Button* mIncreaseButton;
MyGUI::Button* mDecreaseButton;
MyGUI::TextBox* mTotalBalanceLabel;
MyGUI::TextBox* mTotalBalance;
MyGUI::Widget* mBottomPane;
MyGUI::Button* mMaxSaleButton;
MyGUI::Button* mCancelButton;
MyGUI::Button* mOfferButton;
MyGUI::TextBox* mPlayerGold;
MyGUI::TextBox* mMerchantGold;
void onWindowResize(MyGUI::Window* _sender);
void onFilterChanged(MyGUI::Widget* _sender);
void onOfferButtonClicked(MyGUI::Widget* _sender);
void onCancelButtonClicked(MyGUI::Widget* _sender);
};
}

@ -215,6 +215,7 @@ void WindowManager::updateVisible()
mInventoryWindow->setVisible(false);
mScrollWindow->setVisible(false);
mBookWindow->setVisible(false);
mTradeWindow->setVisible(false);
// Mouse is visible whenever we're not in game mode
MyGUI::PointerManager::getInstance().setVisible(isGuiMode());
@ -273,6 +274,11 @@ void WindowManager::updateVisible()
case GM_Dialogue:
mDialogueWindow->open();
break;
case GM_Barter:
mInventoryWindow->setVisible(true);
mInventoryWindow->openInventory();
mTradeWindow->setVisible(true);
break;
case GM_InterMessageBox:
if(!mMessageBoxManager->isInteractiveMessageBox()) {
setGuiMode(GM_Game);

@ -130,9 +130,8 @@ namespace MWGui
}
MWGui::DialogueWindow* getDialogueWindow() {return mDialogueWindow;}
MWGui::ContainerWindow* getContainerWindow() {return mContainerWindow;}
MWGui::InventoryWindow* getInventoryWindow() {return mInventoryWindow;}
MWGui::BookWindow* getBookWindow() {return mBookWindow;}
MWGui::ScrollWindow* getScrollWindow() {return mScrollWindow;}
MWGui::CountDialog* getCountDialog() {return mCountDialog;}

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 600 300" name="_Main">
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 600 360" name="_Main">
<Property key="Visible" value="false"/>
<!-- Categories -->
<Widget type="Widget" position="8 8 584 24" align="Left Top HStretch" name="Categories">
<Widget type="Widget" position="8 8 566 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"/>
@ -14,14 +14,36 @@
</Widget>
<!-- Items -->
<Widget type="Widget" skin="MW_Box" position="8 38 584 185" name="box" align="Left Top Stretch">
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 576 181" align="Left Top Stretch" name="ItemView">
<Widget type="Button" skin="" name="Items" position="0 0 576 181" name="Items" align="Left Top Stretch"/>
<Widget type="Widget" skin="MW_Box" position="8 38 566 185" name="box" align="Left Top Stretch">
<Widget type="ScrollView" skin="MW_ScrollViewH" position="4 4 558 181" align="Left Top Stretch" name="ItemView">
<Property key="CanvasAlign" value="Left Top"/>
<Widget type="Button" skin="" name="Items" position="0 0 558 181" name="Items" align="Left Top Stretch"/>
</Widget>
</Widget>
<Widget type="Widget" skin="" position="8 201 584 91" name="BottomPanel" align="Left Bottom HStretch">
<Widget type="TextBox" skin="SandText" position="292 0 292 91" name="PlayerGold" align="Left Top HStretch"/>
<Widget type="Widget" skin="" position="8 231 566 92" name="BottomPane" align="Left Bottom HStretch">
<Widget type="TextBox" skin="SandText" position="292 0 274 24" name="PlayerGold" align="Left Top HStretch">
<Property key="TextAlign" value="Right"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="292 28 274 24" name="MerchantGold" align="Left Top HStretch">
<Property key="TextAlign" value="Right"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="0 0 40 24" name="IncreaseButton" align="Left Top">
<Property key="Caption" value="+"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="0 28 40 24" name="DecreaseButton" align="Left Top">
<Property key="Caption" value="-"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="48 0 110 24" name="TotalBalanceLabel" align="Left Top "/>
<Widget type="TextBox" skin="SandText" position="48 28 110 24" name="TotalBalance" align="Left Top">
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="Button" skin="MW_Button" position="0 60 60 24" name="MaxSaleButton" align="Left Top"/>
<Widget type="Button" skin="MW_Button" position="0 60 60 24" name="CancelButton" align="Right Top"/>
<Widget type="Button" skin="MW_Button" position="0 60 60 24" name="OfferButton" align="Right Top"/>
</Widget>
</Widget>

Loading…
Cancel
Save