Reputation: 1882
I want to make GUI for my application. It should work on multiple platforms. I want most of the code to be portable for all the OS (unix, windows, MAC).
GTK and GLib looks as a good solution. I want to use native APIs too
How to do this all??
Upvotes: 7
Views: 4717
Reputation: 36111
I Think its worthwhile learning the native windowing layer on each platform you are targetting.
As such:
I don't personally like QT as they've invented their own meta compiler, making QT code (ironically) hard to port to non QT environments. QT does however present an abstraction of the native Widget set where possible.
wxWidgets is a convenient wrapper API to use as it already wraps the Win32Api, Cocoa api and GTK+ on the relevant platforms. I avoided using it however as Wx is based on Microsoft MFC - a somewhat dated Document/View C++ framework and I wanted to understand the underlying platforms.
Upvotes: 1
Reputation: 803
Please take a look at Qt Framework. This will help you create cross platform GUI Applications. You would have to rely on API Offered by Qt for Native platform tasks, other wise if you proceed to use the native API's your code will not be portable.
Upvotes: 0
Reputation: 206616
You will have to implement a PAL(Platform abstraction layer).
This layer should provide a abstraction over the actual platform calls by providing interfaces which are not platform dependednt. Once you move on to another platform, only the PAL needs to be implemented for that particular platform and the rest of the application can be used as is.
Upvotes: 3
Reputation: 2166
Qt seems like an option. But if you want to use Windows API's, it will not be portable. Qt in Windows will use stuff like CreateWindow etc. but you will not. E.g. the disassembler IDA was recently rewritten in Qt and is now cross-platform.
Upvotes: 1
Reputation: 189
I like WxWidgets, really easy to use. It has bindings for multiple languages and you can mix it's C++ implementation with Win32 API (C code) easily.
A more lightweight alternative is FLTK
Upvotes: 5