mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 14:42:44 +00:00
Add VBox, HBox, and BoxFiller micro-classes.
This commit is contained in:
parent
3ad44e3004
commit
c7bf667f0d
@ -25,4 +25,24 @@ private:
|
||||
void box_set_position(JRect rect);
|
||||
};
|
||||
|
||||
class VBox : public Box
|
||||
{
|
||||
public:
|
||||
VBox() : Box(JI_VERTICAL) { }
|
||||
};
|
||||
|
||||
class HBox : public Box
|
||||
{
|
||||
public:
|
||||
HBox() : Box(JI_HORIZONTAL) { }
|
||||
};
|
||||
|
||||
class BoxFiller : public Box
|
||||
{
|
||||
public:
|
||||
BoxFiller() : Box(JI_HORIZONTAL) {
|
||||
jwidget_expansive(this, true);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -89,7 +89,7 @@ static Widget* convert_xmlelement_to_widget(TiXmlElement* elem, Widget* root)
|
||||
|
||||
/* TODO error handling: add a message if the widget is bad specified */
|
||||
|
||||
/* box */
|
||||
// Boxes
|
||||
if (ustrcmp(elem_name, "box") == 0) {
|
||||
bool horizontal = bool_attr_is_true(elem, "horizontal");
|
||||
bool vertical = bool_attr_is_true(elem, "vertical");
|
||||
@ -99,7 +99,24 @@ static Widget* convert_xmlelement_to_widget(TiXmlElement* elem, Widget* root)
|
||||
vertical ? JI_VERTICAL: 0) |
|
||||
(homogeneous ? JI_HOMOGENEOUS: 0));
|
||||
}
|
||||
/* button */
|
||||
else if (ustrcmp(elem_name, "vbox") == 0) {
|
||||
bool homogeneous = bool_attr_is_true(elem, "homogeneous");
|
||||
|
||||
widget = new VBox();
|
||||
if (homogeneous)
|
||||
widget->setAlign(widget->getAlign() | JI_HOMOGENEOUS);
|
||||
}
|
||||
else if (ustrcmp(elem_name, "hbox") == 0) {
|
||||
bool homogeneous = bool_attr_is_true(elem, "homogeneous");
|
||||
|
||||
widget = new HBox();
|
||||
if (homogeneous)
|
||||
widget->setAlign(widget->getAlign() | JI_HOMOGENEOUS);
|
||||
}
|
||||
else if (ustrcmp(elem_name, "boxfiller") == 0) {
|
||||
widget = new BoxFiller();
|
||||
}
|
||||
// Button
|
||||
else if (ustrcmp(elem_name, "button") == 0) {
|
||||
const char *text = elem->Attribute("text");
|
||||
|
||||
@ -142,7 +159,7 @@ static Widget* convert_xmlelement_to_widget(TiXmlElement* elem, Widget* root)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* check */
|
||||
// Check
|
||||
else if (ustrcmp(elem_name, "check") == 0) {
|
||||
const char *text = elem->Attribute("text");
|
||||
const char *looklike = elem->Attribute("looklike");
|
||||
|
Loading…
x
Reference in New Issue
Block a user