| [news.eclipse.platform.swt] Re: Closer native OS idiosyncrasies support / SWT Style constant |
Grant Gayed wrote:
I know that this is the obvious answer. As I explained in the enhancement itself, I was thinking that using a single value would be a discriminator between opting for the default SWT behavior (the same accross all supported platforms) versus opting for sticking to everything else that is platform specific. Making it something like "static void SWT.setNativeBehavior(true/false) & boolean SWT.useNativeBehavior()" would provide a single point to configure an App. the responsibility would be on the various platform widgets to decide where to check and what to do based on the value. this is not mutually exclusive with doing what you described: add a single style at a time for new behaviors. the problem I see with that will be that you will have to answer an increasing amount of questions from people who will not read the doc and wonder why the new styles do not respond on such or such platform (I already tracked people inquiring about SWT.SEARCH on linux and windows... imagine when there are more flags to query about). the second problem (a minor one) is the possibility of running out of bits recognized on all platforms (SWT.class is already pretty 'dense' as it is if you ask me, not to mention the second layer of mappings to local flags like in the GridData class)Better late than never... It's hard to give a definite rule for whether a platform-specific feature should be exposed by swt. In the past, native support was required on "most" of the platforms to introduce something like this, unless it was considered to be "vital". But then the Text style SWT.SEARCH was added in 3.3, which is OSX-only. So the investigation into these possibilities is appreciated and will at least be considered, though no promises of course ;-). Having a single style hint like SWT.NATIVE is probably not descriptive enough, it would be better to have multiple styles that are more consistent. the point would be: use SWT.NATIVE_BEHAVIOR or the static functions when the flag is for something that 1) only exists on a single platform 2) or something that require absolutely no awareness of the programer using it. In all other cases (mainly when at least 2 platforms support some similar capabilities) then create a new style/hint. Note: I added a patch for PrintDialog() to enhancement 233608 Determining a value for a style involves identifying all widgets (and their subclasses) that it will apply to and making sure that the value does not collide with any of their existing supported styles. It's straight-forward, but requires caution. Grant "L. Mihalkovic" <totolaricot@xxxxxxx> wrote in message news:g16fa9$oe0$1@xxxxxxxxxxxxxxxxx...created the following to track these thoughts: https://bugs.eclipse.org/bugs/show_bug.cgi?id=233608 -- Laurent Mihalkovic, co-author SWT/JFace in Action (www.manning.com/scarpino) |