2007-12-15 07:53:53 +01:00
|
|
|
#include "widget.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
calculate_alignments(Widget *widget)
|
|
|
|
{
|
2007-12-15 13:37:34 +01:00
|
|
|
for(; widget; widget = widget->next)
|
|
|
|
{
|
|
|
|
if(widget->alignment == AlignFlex)
|
|
|
|
{
|
2007-12-15 07:53:53 +01:00
|
|
|
widget = widget->next;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
widget->alignment = AlignLeft;
|
|
|
|
}
|
2007-12-15 13:37:34 +01:00
|
|
|
|
|
|
|
if(widget)
|
|
|
|
for(; widget; widget = widget->next)
|
2007-12-15 07:53:53 +01:00
|
|
|
widget->alignment = AlignRight;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
calculate_offset(int barwidth, int widgetwidth, int offset, int alignment)
|
|
|
|
{
|
|
|
|
if (alignment == AlignLeft || alignment == AlignFlex)
|
|
|
|
return offset;
|
2007-12-15 13:37:34 +01:00
|
|
|
|
|
|
|
return barwidth - offset - widgetwidth;
|
2007-12-15 07:53:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|