rework widget.c
This commit is contained in:
parent
8b62669970
commit
bf20f9cee9
20
widget.c
20
widget.c
|
@ -1,25 +1,21 @@
|
||||||
|
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
calculate_alignments(Widget *widget)
|
calculate_alignments(Widget *widget)
|
||||||
{
|
{
|
||||||
while (widget){
|
for(; widget; widget = widget->next)
|
||||||
printf("%s\n", widget->name);
|
{
|
||||||
if (widget->alignment == AlignFlex){
|
if(widget->alignment == AlignFlex)
|
||||||
|
{
|
||||||
widget = widget->next;
|
widget = widget->next;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
widget->alignment = AlignLeft;
|
widget->alignment = AlignLeft;
|
||||||
widget = widget->next;
|
|
||||||
}
|
}
|
||||||
if (widget){
|
|
||||||
while (widget){
|
if(widget)
|
||||||
|
for(; widget; widget = widget->next)
|
||||||
widget->alignment = AlignRight;
|
widget->alignment = AlignRight;
|
||||||
widget = widget->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -27,7 +23,7 @@ calculate_offset(int barwidth, int widgetwidth, int offset, int alignment)
|
||||||
{
|
{
|
||||||
if (alignment == AlignLeft || alignment == AlignFlex)
|
if (alignment == AlignLeft || alignment == AlignFlex)
|
||||||
return offset;
|
return offset;
|
||||||
else
|
|
||||||
return barwidth - offset - widgetwidth;
|
return barwidth - offset - widgetwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue