[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Closer native OS idiosyncrasies support / SWT Style constant

Emil Crumhorn wrote:
I'm not quite sure what you're asking for, but somehow magically making 
widgets behave natively via a flag would probably be every IBM SWT 
developer's dream, but that's not reality.

There's a hundered things Windows has that other OS's cannot do, and vice 
versa for every OS. How do you imagine custom features working just via a 
flag? What if windows supports combo boxes with images in them, how would 
one flag work to tell the combo to use an image? That's the whole thing, you 
can't have a bunch of method calls that do nothing on some platforms and 
nothing on other platforms, or the whole community would either be in uproar 
or complete confusion. There area already a select few SWT flags that may do 
nothing on other platforms, but as far as I know there's a lot of discussion 
before one of those is added.

Now, SWT is native already, that's the whole idea, I suggest reading up on 
the history of it on wikipedia 
http://en.wikipedia.org/wiki/Standard_Widget_Toolkit to give you an idea of 
the reason why it was developed and why it is being developed the way it is.

On OS X thanks to different API's on Mac's side.. Cocoa and so on.. and 
changes in in the newer OS X versions, it's not exactly easy for the SWT 
team to just make everything suddenly native on a whole new OS API. They're 
working on it, do some searches (for example Steve Northover's blog 
http://inside-swt.blogspot.com/ or more specifically 
http://inside-swt.blogspot.com/2007/11/hacking-at-apple.html ), but it's not 
an overnight thing.

If you truly wish to override the code to make your UI appear more native 
than it currently is, you'll have to extend classes that will make your code 
non-cross platform (such as classes in SWT that are marked as "not intended 
to be extended"), and most likely cause a whole bunch of new issues. Another 
options is that you write code in native Cocoa or such and create JNI 
bindings that connect to actual platform code. All of that will make your 
app Mac-only of course.

Regards,
Emil

--
Nebula Committer
http://www.hexapixel.com

"L. Mihalkovic" <totolaricot@xxxxxxx> wrote in message 
news:g1433l$k6o$1@xxxxxxxxxxxxxxxxx...
  
L. Mihalkovic wrote:
    
I know it is soon to be deprecated but I am looking at enhancing SWT
on Mac OS / Carbon. At the moment i am adding support for Sheets more
specifically looking at modifying MessageBox to optionally use sheets.
I know that you are all busy with Ganymede, but would it be possible
to create a SWT.NATIVE_LOOK style constant that would be a general
flag for branching off from the common SWT look to use whatever native
trickery exist on all supported platform.

for eg:

MessageBox mb = new MessageBox(parent, SWT.OK | SWT.ICON_INFORMATION |
SWT.NATIVE_LOOK);

would make the message box use a Mac OS sheet.

Toolbar tb = new Toolbar(..... | SWT.NATIVE_LOOK);

would use the native toolbar.

If nothing exist on the platform, the style would simply be ignored.

so... granted that you'd be interested in this, what value should this
constant have? (I can't figure the heuristic you follow to decide how
to allocate these constants).

Thx.

      
I only had to add a couple lines to MessageBox to make this work...
please consider how nice it would be to open the door to this type of
platform specific improvements...


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



    


  
The attachment is the current Mac PrintDialog working as a Sheet (I am using the same SWT.NATIVE_LOOK to fork inside the code and use the Sheet API).

more thoughts later about your comment...

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

GIF image