package at.int32.sweaty.ui.controls;

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Composite;

import at.int32.sweaty.ui.Control;

public class UserStatus extends Widget<Composite> {

	private Color color;
	
	public UserStatus(Control parent) {
		super(parent);
	}
	
	public UserStatus color(Color color) {
		this.color = color;
		ctrl().redraw();
		return this;
	}
	
	public UserStatus size(final int size, final int pos) {
		data().widthHint = size * 3;
		data().heightHint = size * 3;
		ctrl().addPaintListener(new PaintListener() {

			@Override
			public void paintControl(PaintEvent e) {
				GC gc = e.gc;
				gc.setForeground(color);
				gc.setLineWidth(size);
				gc.drawOval(size, pos, size, size);
			}
		});
		ctrl().redraw();
		
		return this;
	}

	@Override
	public Composite getBaseControl(Composite parent) {
		return createDefaultComposite();
	}

}

@@ -31,16 +31,44 @@
 trols;%0A%0A
+import org.eclipse.swt.SWT;%0A
 import o
@@ -781,16 +781,45 @@
 = e.gc;%0A
+%09%09%09%09gc.setAntialias(SWT.ON);%0A
 %09%09%09%09gc.s

enable anti alias