basics for InteractiveMessageBox

actorid
Sebastian Wick 14 years ago
parent d74f834735
commit e77240dceb

@ -78,6 +78,10 @@ void MessageBoxManager::createInteractiveMessageBox (const std::string& message,
std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", ")); std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", "));
std::cout << std::endl; std::cout << std::endl;
InteractiveMessageBox *box = new InteractiveMessageBox(*this, message, buttons);
mInterMessageBoxes.push_back(box);
// delete all non-interactive MessageBox'es
std::vector<MessageBox*>::iterator it = mMessageBoxes.begin(); std::vector<MessageBox*>::iterator it = mMessageBoxes.begin();
while(it != mMessageBoxes.end()) while(it != mMessageBoxes.end())
{ {
@ -174,3 +178,18 @@ int MessageBox::getHeight ()
{ {
return mHeight+mNextBoxPadding; // 20 is the padding between this and the next MessageBox return mHeight+mNextBoxPadding; // 20 is the padding between this and the next MessageBox
} }
InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
: Layout("openmw_interactive_messagebox_layout.xml")
, mMessageBoxManager(parMessageBoxManager)
{
getWidget(mMessageWidget, "message");
getWidget(mButtonsWidget, "buttons");
mMessageWidget->setOverflowToTheLeft(true);
mMessageWidget->addText(message);
}

@ -11,6 +11,7 @@
namespace MWGui namespace MWGui
{ {
class InteractiveMessageBox;
class MessageBoxManager; class MessageBoxManager;
class MessageBox; class MessageBox;
@ -36,6 +37,7 @@ namespace MWGui
private: private:
std::vector<MessageBox*> mMessageBoxes; std::vector<MessageBox*> mMessageBoxes;
std::vector<InteractiveMessageBox*> mInterMessageBoxes;
std::vector<MessageBoxManagerTimer> mTimers; std::vector<MessageBoxManagerTimer> mTimers;
float mMessageBoxSpeed; float mMessageBoxSpeed;
}; };
@ -59,6 +61,17 @@ namespace MWGui
int mBottomPadding; int mBottomPadding;
int mNextBoxPadding; int mNextBoxPadding;
}; };
class InteractiveMessageBox : public OEngine::GUI::Layout
{
public:
InteractiveMessageBox (MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons);
protected:
MessageBoxManager& mMessageBoxManager;
MyGUI::EditPtr mMessageWidget;
MyGUI::WidgetPtr mButtonsWidget;
};
} }

@ -69,6 +69,7 @@ configure_file("${SDIR}/openmw_stats_window_layout.xml" "${DDIR}/openmw_stats_wi
configure_file("${SDIR}/openmw_text.skin.xml" "${DDIR}/openmw_text.skin.xml" COPYONLY) configure_file("${SDIR}/openmw_text.skin.xml" "${DDIR}/openmw_text.skin.xml" COPYONLY)
configure_file("${SDIR}/openmw_windows.skin.xml" "${DDIR}/openmw_windows.skin.xml" COPYONLY) configure_file("${SDIR}/openmw_windows.skin.xml" "${DDIR}/openmw_windows.skin.xml" COPYONLY)
configure_file("${SDIR}/openmw_messagebox_layout.xml" "${DDIR}/openmw_messagebox_layout.xml" COPYONLY) configure_file("${SDIR}/openmw_messagebox_layout.xml" "${DDIR}/openmw_messagebox_layout.xml" COPYONLY)
configure_file("${SDIR}/openmw_interactive_messagebox_layout.xml" "${DDIR}/openmw_interactive_messagebox_layout.xml" COPYONLY)
configure_file("${SDIR}/smallbars.png" "${DDIR}/smallbars.png" COPYONLY) configure_file("${SDIR}/smallbars.png" "${DDIR}/smallbars.png" COPYONLY)
configure_file("${SDIR}/transparent.png" "${DDIR}/transparent.png" COPYONLY) configure_file("${SDIR}/transparent.png" "${DDIR}/transparent.png" COPYONLY)
configure_file("${SDIR}/VeraMono.ttf" "${DDIR}/VeraMono.ttf" COPYONLY) configure_file("${SDIR}/VeraMono.ttf" "${DDIR}/VeraMono.ttf" COPYONLY)

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 0 0" name="_Main">
<Widget type="Edit" skin="MW_TextEditClient" position="5 -5 0 0" align="ALIGN_LEFT ALIGN_TOP STRETCH" name="message">
<Property key="Edit_Static" value="true"/>
<Property key="Edit_WordWrap" value="true"/>
<Property key="Text_FontHeight" value="18"/>
<Property key="Edit_MultiLine" value="1" />
<Property key="Edit_VisibleVScroll" value="1" />
<Property key="Widget_AlignText" value="ALIGN_CENTER" />
<Property key="FontName" value = "MyGUI_CoreFont.18" />
<Property key="TextColour" value = "0.7 0.7 0.7" />
</Widget>
<Widget type="Widget" skin="" position="0 0 0 0" align="ALIGN_STRETCH" name="buttons">
<!--buttons-->
</Widget>
</Widget>
</MyGUI>

@ -12,6 +12,8 @@
<Property key="Edit_MultiLine" value="1" /> <Property key="Edit_MultiLine" value="1" />
<Property key="Edit_VisibleVScroll" value="1" /> <Property key="Edit_VisibleVScroll" value="1" />
<Property key="Widget_AlignText" value="ALIGN_CENTER" /> <Property key="Widget_AlignText" value="ALIGN_CENTER" />
<Property key="FontName" value = "MyGUI_CoreFont.18" />
<Property key="TextColour" value = "0.7 0.7 0.7" />
</Widget> </Widget>
</Widget> </Widget>
</MyGUI> </MyGUI>

Loading…
Cancel
Save