|
|
Re: Add SWT button to a GEF diagram [message #241183 is a reply to message #241161] |
Fri, 01 February 2008 13:32 |
Eclipse User |
|
|
|
Originally posted by: juavizga.hotmail.com
It is possible to include SWT widgets in a canvas, since GEF the creates elements upon a canvas it should be also possible, isn't it?
Can somebody to help me or recommend me a solution to embed SWT widgets in a GEF diagram.
Thanks in advance
|
|
|
Re: Add SWT button to a GEF diagram [message #241342 is a reply to message #241183] |
Thu, 07 February 2008 14:48 |
Eclipse User |
|
|
|
Originally posted by: none.ibm.com
Try this for starters. Note that SWT controls are always on top of any
other figure, including handles, feedback, etc.
ControlProxy extends Figure {
....
ControlProxy(Control control) {
this.control = control;
}
public Dimension getPreferredSize(int wHint, int hHint) {
Point p = control.computeSize(wHint, hHint);
return new Dimension(p.x, p.y);
}
public void setBounds(Rectangle rect) {
super.setBounds(rect);
rect = rect.getCopy();
translateToAbsolute(rect);
control.setBounds(rect.x, rect.y, rect.width, rect.height);
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03597 seconds