From d451d7bb674c468ebdeec1d6670fe07f2bb4ffce Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 20 Mar 2012 20:24:36 +0100 Subject: [PATCH] compile fixes for mygui 3.2 --- apps/openmw/mwgui/class.hpp | 4 +- apps/openmw/mwgui/dialogue_history.cpp | 8 +- apps/openmw/mwgui/layouts.hpp | 2 +- apps/openmw/mwgui/messagebox.cpp | 17 +- apps/openmw/mwgui/stats_window.cpp | 2 +- apps/openmw/mwgui/widgets.cpp | 266 ++++++------------------- apps/openmw/mwgui/widgets.hpp | 38 +--- libs/openengine/gui/layout.hpp | 2 +- libs/openengine/gui/manager.cpp | 5 +- 9 files changed, 83 insertions(+), 261 deletions(-) diff --git a/apps/openmw/mwgui/class.hpp b/apps/openmw/mwgui/class.hpp index 5f1734b19..b8b1c0a5a 100644 --- a/apps/openmw/mwgui/class.hpp +++ b/apps/openmw/mwgui/class.hpp @@ -160,7 +160,7 @@ namespace MWGui void onCancelClicked(MyGUI::Widget* _sender); private: - MyGUI::WidgetPtr specialization0, specialization1, specialization2; + MyGUI::StaticTextPtr specialization0, specialization1, specialization2; ESM::Class::Specialization specializationId; }; @@ -287,7 +287,7 @@ namespace MWGui private: MyGUI::EditPtr editName; - MyGUI::WidgetPtr specializationName; + MyGUI::StaticTextPtr specializationName; Widgets::MWAttributePtr favoriteAttribute0, favoriteAttribute1; Widgets::MWSkillPtr majorSkill[5]; Widgets::MWSkillPtr minorSkill[5]; diff --git a/apps/openmw/mwgui/dialogue_history.cpp b/apps/openmw/mwgui/dialogue_history.cpp index ceb904528..acd55efa8 100644 --- a/apps/openmw/mwgui/dialogue_history.cpp +++ b/apps/openmw/mwgui/dialogue_history.cpp @@ -15,8 +15,8 @@ using namespace Widgets; UString DialogeHistory::getColorAtPos(size_t _pos) { - UString colour = TextIterator::convertTagColour(mText->getTextColour()); - TextIterator iterator(mText->getCaption()); + UString colour = TextIterator::convertTagColour(getTextColour()); + TextIterator iterator(getCaption()); while(iterator.moveNext()) { size_t pos = iterator.getPosition(); @@ -32,9 +32,9 @@ UString DialogeHistory::getColorAtPos(size_t _pos) UString DialogeHistory::getColorTextAt(size_t _pos) { bool breakOnNext = false; - UString colour = TextIterator::convertTagColour(mText->getTextColour()); + UString colour = TextIterator::convertTagColour(getTextColour()); UString colour2 = colour; - TextIterator iterator(mText->getCaption()); + TextIterator iterator(getCaption()); TextIterator col_start = iterator; while(iterator.moveNext()) { diff --git a/apps/openmw/mwgui/layouts.hpp b/apps/openmw/mwgui/layouts.hpp index 9917dcdcc..570394334 100644 --- a/apps/openmw/mwgui/layouts.hpp +++ b/apps/openmw/mwgui/layouts.hpp @@ -75,7 +75,7 @@ namespace MWGui void setCellName(const std::string& cellName) { - mMainWidget->setCaption(cellName); + static_cast(mMainWidget)->setCaption(cellName); } }; diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp index cd32fc40f..8e9201b53 100644 --- a/apps/openmw/mwgui/messagebox.cpp +++ b/apps/openmw/mwgui/messagebox.cpp @@ -166,7 +166,8 @@ MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::strin mMessageWidget->setSize(size); - MyGUI::IntSize textSize = mMessageWidget->_getTextSize(); + MyGUI::IntSize textSize = mMessageWidget->getTextSize(); + size.height = mHeight = textSize.height + 20; // this is the padding between the text and the box mMainWidget->setSize(size); @@ -219,7 +220,7 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan mMessageWidget->setOverflowToTheLeft(true); mMessageWidget->addText(message); - MyGUI::IntSize textSize = mMessageWidget->_getTextSize(); + MyGUI::IntSize textSize = mMessageWidget->getTextSize(); MyGUI::IntSize gameWindowSize = mMessageBoxManager.mWindowManager->getGui()->getViewSize(); @@ -243,9 +244,9 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan mButtons.push_back(button); - buttonWidth = button->_getTextSize().width + 2*buttonPadding + buttonLeftPadding; + buttonWidth = button->getTextSize().width + 2*buttonPadding + buttonLeftPadding; buttonsWidth += buttonWidth; - buttonHeight = button->_getTextSize().height + 2*buttonPadding + buttonTopPadding; + buttonHeight = button->getTextSize().height + 2*buttonPadding + buttonTopPadding; if(buttonWidth > biggestButtonWidth) { @@ -299,8 +300,8 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan buttonCord.left = left; buttonCord.top = textSize.height + textButtonPadding; - buttonSize.width = (*button)->_getTextSize().width + 2*buttonPadding; - buttonSize.height = (*button)->_getTextSize().height + 2*buttonPadding; + buttonSize.width = (*button)->getTextSize().width + 2*buttonPadding; + buttonSize.height = (*button)->getTextSize().height + 2*buttonPadding; (*button)->setCoord(buttonCord); (*button)->setSize(buttonSize); @@ -347,8 +348,8 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan std::vector::const_iterator button; for(button = mButtons.begin(); button != mButtons.end(); ++button) { - buttonSize.width = (*button)->_getTextSize().width + buttonPadding*2; - buttonSize.height = (*button)->_getTextSize().height + buttonPadding*2; + buttonSize.width = (*button)->getTextSize().width + buttonPadding*2; + buttonSize.height = (*button)->getTextSize().height + buttonPadding*2; buttonCord.top = top; buttonCord.left = (mainWidgetSize.width - buttonSize.width)/2 - 5; // FIXME: -5 is not so nice :/ diff --git a/apps/openmw/mwgui/stats_window.cpp b/apps/openmw/mwgui/stats_window.cpp index 30a4015e3..08aa9f65d 100644 --- a/apps/openmw/mwgui/stats_window.cpp +++ b/apps/openmw/mwgui/stats_window.cpp @@ -95,7 +95,7 @@ void StatsWindow::setBar(const std::string& name, const std::string& tname, int void StatsWindow::setPlayerName(const std::string& playerName) { - mMainWidget->setCaption(playerName); + static_cast(mMainWidget)->setCaption(playerName); } void StatsWindow::setStyledText(MyGUI::StaticTextPtr widget, ColorStyle style, const std::string &value) diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index f62da2bab..d45236425 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -62,24 +62,24 @@ void MWSkill::updateWidgets() { if (skillId == ESM::Skill::Length) { - skillNameWidget->setCaption(""); + static_cast(skillNameWidget)->setCaption(""); } else { const std::string &name = manager->getGameSettingString(ESM::Skill::sSkillNameIds[skillId], ""); - skillNameWidget->setCaption(name); + static_cast(skillNameWidget)->setCaption(name); } } if (skillValueWidget) { SkillValue::Type modified = value.getModified(), base = value.getBase(); - skillValueWidget->setCaption(boost::lexical_cast(modified)); + static_cast(skillValueWidget)->setCaption(boost::lexical_cast(modified)); if (modified > base) - skillValueWidget->setState("increased"); + skillValueWidget->_setWidgetState("increased"); else if (modified < base) - skillValueWidget->setState("decreased"); + skillValueWidget->_setWidgetState("decreased"); else - skillValueWidget->setState("normal"); + skillValueWidget->_setWidgetState("normal"); } } @@ -88,59 +88,25 @@ void MWSkill::onClicked(MyGUI::Widget* _sender) eventClicked(this); } -void MWSkill::_initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, Widget* _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name) -{ - Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name); - - initialiseWidgetSkin(_info); -} - MWSkill::~MWSkill() { - shutdownWidgetSkin(); } -void MWSkill::baseChangeWidgetSkin(ResourceSkin* _info) +void MWSkill::initialiseOverride() { - shutdownWidgetSkin(); - Base::baseChangeWidgetSkin(_info); - initialiseWidgetSkin(_info); -} + Base::initialiseOverride(); -void MWSkill::initialiseWidgetSkin(ResourceSkin* _info) -{ - for (VectorWidgetPtr::iterator iter=mWidgetChildSkin.begin(); iter!=mWidgetChildSkin.end(); ++iter) - { - const std::string &name = *(*iter)->_getInternalData(); - if (name == "StatName") - { - MYGUI_DEBUG_ASSERT( ! skillNameWidget, "widget already assigned"); - skillNameWidget = (*iter)->castType(); - } - else if (name == "StatValue") - { - MYGUI_DEBUG_ASSERT( ! skillValueWidget, "widget already assigned"); - skillValueWidget = (*iter)->castType(); - } - else if (name == "StatNameButton") - { - MYGUI_DEBUG_ASSERT( ! skillNameWidget, "widget already assigned"); - MyGUI::ButtonPtr button = (*iter)->castType