1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 08:19:56 +00:00
openmw-tes3mp/apps/openmw/mwgui/formatting.hpp

54 lines
1.3 KiB
C++
Raw Normal View History

#ifndef MWGUI_FORMATTING_H
#define MWGUI_FORMATTING_H
#include <MyGUI.h>
#include <boost/property_tree/ptree.hpp>
namespace MWGui
{
2012-05-08 23:34:32 +00:00
struct TextStyle
{
TextStyle() :
mColour(0,0,0)
, mFont("Default")
, mTextSize(16)
, mTextAlign(MyGUI::Align::Left | MyGUI::Align::Top)
{
}
MyGUI::Colour mColour;
std::string mFont;
int mTextSize;
MyGUI::Align mTextAlign;
};
/// \brief utilities for parsing book/scroll text as mygui widgets
class BookTextParser
{
public:
/**
* Parse markup as MyGUI widgets
* @param markup to parse
* @param parent for the created widgets
* @param maximum width
* @return size of the created widgets
*/
MyGUI::IntSize parse(std::string text, MyGUI::Widget* parent, const int width);
protected:
2012-05-08 23:34:32 +00:00
void parseSubText(std::string text);
void parseImage(std::string tag);
2012-05-09 00:11:44 +00:00
void parseDiv(std::string tag);
void parseFont(std::string tag);
private:
MyGUI::Widget* mParent;
2012-05-08 23:34:32 +00:00
int mWidth; // maximum width
int mHeight; // current height
TextStyle mTextStyle;
};
}
#endif