A label element is the simplest GUI type yet. It supports all of the default stylistic features but it doesn't do much else other than contain a certain string value that can be loaded in or set at runtime.
Let's take a look at its constructor and destructor:
GUI_Label::GUI_Label(const std::string& l_name, GUI_Interface* l_owner) : GUI_Element(l_name, GUI_ElementType::Label, l_owner){}
This is nothing short of child's play in comparison to the code we've written before. Its name, type, and owner are set up in the initializer list and there's nothing else to it.
The de-serialization of this type of element is also fairly simple. Recall the following line from an interface file:
Element Label TestLabel 0 0 Default.style "Some text"
Since the GUI_Manager
class takes care of all of this information except the last part, the ReadIn
method of this element might look like this:
void GUI_Label::ReadIn(std::stringstream& l_stream){ std::string content; Utils::ReadQuotedString...