Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Re: pushing SWT's display/interaction capabilities?

Andrey Tarantsov wrote:
Hi,

I'm not an SWT committer or something, but here are some of my thoughts:

    1. Can mouse events be passed to a composite not being shown on the
    screen?
    (i.e., a large composite stored within a smaller composite; most of the
    larger composite is not visible on the screen but contains components)


From your description I believe that you want to feed native events to the native widgets, not simply SWT events. As far as I know you are unlikely to find this capability in SWT (though maybe they have a half-cooked patch somewhere), but it should be easy to implement for every given platform. Do you mind writing and maintaining some natives?

pretty much all the platforms have some APIs for sending events to a widget (this is how gui testing is done), windows used to refer to it as the cbt hook. and because SWT is native widgets, you will ultimately get the events. but as I told you, draw2d will probably give u more freedom than swt ever will. the only problem is that u will loose the native look on each platform. unless u play around with the theming api (dunno how complete the code it, but there is a lot of it) to get some native look painted in your d2d figures.


I believe if you keep the widgets offscreen and feed them native mouse events (e.g. messages on Windows), things should go smoothly.
    3. Can shape and perspective transforms be applied to Composites,
    Controls,
    or Canvases? (i.e., make a Button look like a triangle going into the
    screen.) I think the answer is, "no, buddy, don't you understand
    that SWT
    uses native widgets and most platforms don't allow arbitrary
    transformations."  But if I'm wrong here, that would save a ton of
    trouble.


I have a code for a perspective transform in pure Java. If you want that please email me privately. But basically, you create a Button (or whatever), call paint() to snapshot it (a new method in Eclipse 3.4), apply any transforms and then draw it.

But please note that some platforms use animated controls (e.g. a pulsating button on a Mac), so if you want to transform those, you might need to do the snapshot-transform-draw cycle in a loop, eating up the CPU :)

--
Andrey.



--
Laurent Mihalkovic, co-author SWT/JFace in Action (www.manning.com/scarpino)



Back to the top