MDI behaviour, Shell floating in other Shell [message #457830] |
Tue, 05 July 2005 15:48 |
Eclipse User |
|
|
|
Originally posted by: bertram.herzog.web.de
Hello altogether,
I am trying to emulate the behaviour of an MDI app in the way, that I want
to have a component floating on top of a shell, but have it's borders
clipped whenever it's floating "out" of range. The concrete problem could
e.g. be a magnifier windows in a graphical app.
I worked myself along the examples of the magnifier in Steve Northover's
SWT-book (Chapter 19 "Image Drawing", combined with some stuff from
Chapters 11.4.5 "nonrect. Shells" and 16 "clipping and Regions"), but am
now at a point where I can't use all the nice things, because the two
shells just don't seem to want to be aware of each other regarding their
location and thus their clipping. If I declare clipping on the global
Display's GC to the region of the "Parent Shell", the Child Shell still
floats freely around without noticing it at all.
My first tries look like this:
//first define a new Region
Region reg = new Region();
//now add the whole parentShell to it
reg.add(parentShell.getClientArea());
//set the Clipping to this region, which will only keep this region
alive
//the gc ist taken from the mouse-event issued from a canvas derivative
//in the ParentShell
//bounds = "floatingShell".getClientArea();
gc.setClipping(reg);
gc.drawRoundRectangle(bounds.x, bounds.y,
bounds.width, bounds.height, 20, 20);
gc.fillRoundRectangle(bounds.x, bounds.y,
bounds.width, bounds.height, 20, 20);
parentShell.setRegion(reg);
The problem seems to be that, even if coordinates are all mapped to the
"Display space," the two Shells and their canvases the drawing takes place
at, cannot get in touch to each other.
If perhaps my way of dealing with the problem with two Shells is totally
wrong, please let me know.
Thanks a lot for sticking with me,
Bertram
P.S.: I've read the quotes about canvas in canvas and other MDI-like
threads, but could not find a solution yet.
|
|
|
Powered by
FUDForum. Page generated in 0.02721 seconds