add convenience function to box layout to set all margins
This commit is contained in:
parent
fd482ff455
commit
8b56dcd3dd
2 changed files with 9 additions and 0 deletions
|
@ -143,6 +143,14 @@ int box_layout_handle(UINode *component, enum UIEvent ev, size_t d, void *p)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void box_layout_set_margins(UIBoxLayoutNode *layout, double margin)
|
||||||
|
{
|
||||||
|
layout->margin_top = margin;
|
||||||
|
layout->margin_left = margin;
|
||||||
|
layout->margin_bottom = margin;
|
||||||
|
layout->margin_right = margin;
|
||||||
|
}
|
||||||
|
|
||||||
UIBoxLayoutNode *box_layout_new(UINode *parent, enum UIDirection direction)
|
UIBoxLayoutNode *box_layout_new(UINode *parent, enum UIDirection direction)
|
||||||
{
|
{
|
||||||
UIBoxLayoutNode *n = malloc(sizeof(UIBoxLayoutNode));
|
UIBoxLayoutNode *n = malloc(sizeof(UIBoxLayoutNode));
|
||||||
|
|
|
@ -10,6 +10,7 @@ typedef struct UIBoxLayoutNode {
|
||||||
} UIBoxLayoutNode;
|
} UIBoxLayoutNode;
|
||||||
|
|
||||||
UIBoxLayoutNode *box_layout_new(UINode *parent, enum UIDirection direction);
|
UIBoxLayoutNode *box_layout_new(UINode *parent, enum UIDirection direction);
|
||||||
|
void box_layout_set_margins(UIBoxLayoutNode *layout, double margin);
|
||||||
int box_layout_handle(UINode *component, enum UIEvent ev, size_t d, void *p);
|
int box_layout_handle(UINode *component, enum UIEvent ev, size_t d, void *p);
|
||||||
|
|
||||||
#endif // _UI__BOX_LAYOUT_NODE_H
|
#endif // _UI__BOX_LAYOUT_NODE_H
|
||||||
|
|
Loading…
Reference in a new issue