|
Re: Use Draw2D on top of a StyledText [message #512892 is a reply to message #249454] |
Mon, 08 February 2010 10:07 |
David Forbes Messages: 1 Registered: February 2010 |
Junior Member |
|
|
Hi Kai,
this is what I found out: When defining a LightweightSystem, the constructor builds internally a Rootfigure with opaque = true!
Here is a way, that worked for me:
public void createControl(final Composite parent) {
...
cc = (StyledText) sourceviewer.getControl();
...
Canvas canvas = new Canvas(parent, SWT.TRANSPARENT);
canvas.moveAbove(cc);
// you'll have to add a way to set the bounds of your canvas
//e.g. PaintListener or so
canvas.setBounds(0,0,200,200);
LightweightSystem myLWS = new LightweightSystem();
IFigure root = myLWS.getRootFigure();
root.setOpaque(false);
root.setLayoutManager(new BorderLayout());
myLWS.setControl(canvas);
//now add your shapes here
...
}
Of course, there is still a lot to do (synchro Canvas and StyledText, etc.) this makes it possible to use Draw2d on StyledText!
Best regards,
David
|
|
|
Powered by
FUDForum. Page generated in 0.03090 seconds