Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] C++ Toolkit for SWT


How about this:
- write your GUI and Eclipse plugin related code in Java
- call out to your non-GUI C++ pieces using JNI
        (the best book on the subject is this one - your local bookstore may have it:  http://www.amazon.com/Java-Native-Interface-Programmers-Specification/dp/0201325772/ref=sr_1_2?ie=UTF8&s=books&qid=1271776778&sr=1-2)
- if you have any C++ GUI components that you want to keep, you can wrap them in SWT. Here's an article that has a section describing how: http://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm
Note sure if any of these other docs are useful: http://www.eclipse.org/swt/docs.php

Hope this helps,
Carolyn


From: Tech Id <tech.login.id2@xxxxxxxxx>
To: "Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
Date: 20/04/2010 11:03 AM
Subject: Re: [platform-swt-dev] C++ Toolkit for SWT
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx





I have a couple of doubts on SWT C++

1) As seen on pure-native.com, I don't think its free to use. Please confirm.
2) Its fairly young. Only 2 years old. Can we trust its stability.
3) Who owns the responsibility of maintaining SWT C++ in the long term. Before this discussion, I never heard of pure-native. I mean, what are the chances it will become an orphaned toolkit/software and so will the projects using it?

4) Has it been ported to Linux and Solaris too?

5) How about Qt in comparison to SWT? Is it too heavy weight? Are there any benchmarks to differentiate between the two?
6) Can GUIs built with Qt also be invoked as eclipse plug-ins?

Actually all the non-GUI code we have is in C++ and we want the GUI as an eclipse plug-in.
Also, performance has to be very good.
So, I was wondering exactly what to use?

Options:
1) Use SWT in Java along with  JNI
(I have no clue about JNI. Need to read about it.)
2) Use SWT C++ (but I am afraid because of above reasons).
3) Use Qt

Best Regards
Techieeeee


On Tue, Apr 20, 2010 at 6:25 PM, Philipp Hübner <philipp.huebner@xxxxxxxxxxx> wrote:
Am 19.04.2010 05:30, schrieb var@xxxxxxxxxxxxxxx:
>> Why do you want to this? This pure native thing doesn't really sound production ready and Java/Native hybrids have a lot of disadvatages. For a native >> application its more natural to use a native GUI like qt or wxWindows, and I'm sure these frameworks (especially QT) offer more than this native swt!
 
SWT C++ is not a Java/Native hybrid. It is 100% native C++; it is not a C++ layer on top of the Java runtime. Unlike certain other C++ toolkits, it is not a C++ layer on top of a C foundation. It is C++ all the way through. In fact, it could be considered more native than Qt because SWT C++ (and SWT Java) use the Win32 platform's native widgets whereas Qt uses emulated widgets. In addition, SWT C++ is built on standard C++ and does not depend on C++ compiler extensions or non-standard preprocessors. It is a natural experience for C++ developers. For example, on Windows, you can do everything in Visual C++; there are no special build steps or extra tools to run. Lastly, unlike much older C++ GUI toolkits, SWT C++ is designed and implemented on modern C++ and standards-compliant C++ compilers. From the ground up, SWT C++ is designed to use "smart pointers," templates, exception handling, and other C++ features that were not chosen or not available when the older C++ GUI toolkits were designed.
 
SWT C++ is a indeed new toolkit. This new toolkit is also in its third major release.
----- Original Message -----
From: Philipp Hübner
To: Eclipse Platform SWT component developers list.
Sent: Thursday, April 15, 2010 3:35 AM
Subject: Re: [platform-swt-dev] C++ Toolkit for SWT

Am 15.04.2010 09:19, schrieb Tech Id:
Wow!
That sounds great, Grant Gayed!
Thanks a lot for the link.

Just a few more doubts which I think you being an expert may be able to shed light upon :)
(I am also saving myself going through lengthy docs as well ;)  )
Please do help if you know.

1) We have already written a fair amount of code in SWT Java.
Can it be converted into C++ code by some Pure-Native tool?

2) After we have converted SWT Java code to C++ (by tool or manually), we should need only a C++ lib of SWT C++ to link with along with some headers. Is that correct? Please confirm.

Thanks again for the reply.
It really helped me.

Thanks
Techieeeeeeeee



On Thu, Apr 15, 2010 at 8:30 AM, <var@xxxxxxxxxxxxxxx> wrote:
As mentioned below, the answer is Yes. It's called SWT C++ and it's a 100% native C++ implementation of SWT. It's produced entirely from the SWT Java implementation. Basically, it is SWT Java source code compiled to C++ source code instead of compiled to Java bytecode. It is like another platform target for SWT: native C++, requiring no JRE and no JNI. It is feature-for-feature, bug-for-bug, and pixel-accurate to SWT Java. Presently, it is at SWT version 3.4.1 and only supported for Win32 desktop and Win CE (Pocket PC and Windows Mobile), and Visual C++ 8.0 (Visual Studio 2005) and 7.1 (Visual Studio 2003). Visual C++ 9.0 (Visual Studio 2008) support is working but not released. Other target OS platforms are being considered.
 
Regarding the use case " such that even the GUI elements could be coded in C++ only," this is not supported out-of-the-box, and we have not pursued this ourselves. That being said, by nature of SWT's design, it should be entirely possible to re-host an SWT C++ control in a SWT Java control or an Eclipse Workbench part (either a view or an editor) along with a JNI wrapper for the SWT C++ control. It may even be possible to do this without changing SWT C++ at all but no guarantees. There's a good explanation of how to wrap a native Win32 or Motif control as an SWT Java control along with JNI DLL on the Eclipse Web site. See the headings "Wrapping a Native Widget", "Windows Native Code", and "Motif Native Code" in the following article:
http://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm
 
----- Original Message -----
From: Grant Gayed
To: Eclipse Platform SWT component developers list.
Sent: Wednesday, April 14, 2010 12:44 PM
Subject: Re: [platform-swt-dev] C++ Toolkit for SWT


First to answer your question, there is a project at
http://www.pure-native.com/ that takes an SWT release and converts it to C++ for use in C++ apps (note: win32 only).

However, if I understand your question correctly, you'll be writing/re-writing your UI in SWT from scratch, and you want your app to run as an eclipse plug-in, right?  If so, I would suggest writing your UI using SWT's java implementation.  This will make the integration of your UI into eclipse straight-forward, and will be cross-platform.  You would then use JNI to interact with the application logic that you want to preserve from your existing C++ app.

Grant

_______________________________________________
platform-swt-dev mailing list

platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list

platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Why do you want to this? This pure native thing doesn't really sound production ready and Java/Native hybrids have a lot of disadvatages. For a native application its more natural to use a native GUI like qt or wxWindows, and I'm sure these frameworks (especially QT) offer more than this native swt!


_______________________________________________
platform-swt-dev mailing list

platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev
Sorry you misunderstood me. I think using Java-SWT is not a good idea cause the result will be a hybrid and C++-SWT because, on the one hand, it looks too young and on on the other, there are much better UI-Frameworks in C++. Sorry but I think SWT is a API-Design Anti-Pattern. In QT, I have to write 10 lines; for the same thing I write 100 lines in SWT. But yes, C++-SWT seems to be lighttweight....


_______________________________________________
platform-swt-dev mailing list

platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top