Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8704351
  • 博文数量: 1413
  • 博客积分: 11128
  • 博客等级: 上将
  • 技术积分: 14685
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-13 10:03
个人简介

follow my heart...

文章分类

全部博文(1413)

文章存档

2013年(1)

2012年(5)

2011年(45)

2010年(176)

2009年(148)

2008年(190)

2007年(293)

2006年(555)

分类: C/C++

2006-09-21 13:03:49

[点评:WxWidgets我觉得最吸引人的地方在于他的跨平台性,还有一个更重要的特点是他的组件非常强大,类MFC,功能很多.纯C++开发.这几点,非常不错,这也是我更为钟爱他的理由.]



wxWidgets compared to other toolkits

Some general notes:

  • wxWidgets not only works for C++, but also has bindings for python, perl, java, lua, eiffel, C# (.NET), basic, ruby and even javascript (see [Related projects]).
  • it is one of the most complete GUI toolkits. There are many utility classes.
  • it is still heavily developed
  • there is a lot of documentation (though a bit fragmented in places)
  • free for personal and commercial use
  • whenever possible, wxWidgets uses the platform SDK. This means that a program compiled on Windows will have the look and feel of a Windows program, and when compiled on a Linux machine, it wil get the look and feel of a Linux program.

There is also a [slashdot thread] about cross-platform gui toolkits. Though it's old and, well, it's slashdot :), there are probably some useful insights there.

wxWidgets compared to Qt

  • Both Qt () and wxWidgets have many non-GUI-related classes, such as date/time, containers, networking and OpenGL functionality. However, if you are developing commercial applications (non-gpl) in Qt and want to use most of these classes (including the OpenGL widget), you have to pay extra for the "enterprise edition" () on top of the normal commercial version of Qt (the "professional edition").
  • Qt2 is available under the GPL for open-source applications, and under the QPL for commercial applications. Qt3 for Mac and GNU/Linux is similarly dual-licensed, but there is no free version of Qt3 for Windows. All ports of wxWidgets are distributed under a permissive modified (but explicitly OSI-approved) LGPL.
    • Trolltech has announced that Qt4 will be available under the GPL on Windows. See .
  • Qt doesn't have true native ports such as wxWidgets (.) Qt draws its own widgets on each platform instead of using the native widgets, whereas wxWidgets offers true native ports for all the supported platforms. Additionally, an approach similar to Qt's is achieved with wxUniversal (of course it should be noted that on some platforms, Qt _is_ the native GUI library.)
  • Qt programs are not true C++ programs and require a special pre-compiler, the so-called Meta Object Compiler or moc. wxWidgets programs do not require this kind of preprocessing and are true C++ programs.
  • Qt is used by several large projects like KDE and the Opera browser (on the other hand, wxWidgets is used by projects like the AOL Communicator)
  • Qt makes extremely liberal use of virtual functions (QTWidget, the base class of all widgets in Qt had 91 at last count), giving it a more OO design than wxWidgets (which uses a more MFC-like approach using macros). What this means is fewer lines of code in general when using Qt, but faster execution speed when using wxWidgets (although the degree to which this occurs depends on whom you ask).
  • Qt is used by IBM and Borland Kylix: this should yield more reliability. However, it is rumoured that wxWidgets will be used in the next version of C++BuilderX.
  • Qt has a full-featured (commercial and royalty dependent) embeddable GUI (Qt/Embedded) based on GNU/Linux with framebuffer, it gives you a very fast time to market. This means that once you have Linux with /dev/fb you are ready to run examples in minutes, with no additional pains. Qt/Embedded has a small footprint compared with X11.
  • There is an IDE for Qt, Qt Designer (though there are also several for wxWidgets).
  • Qt offers reliable commercial support.
  • There is nothing to stop somebody writing a Qt-based implementation of wxWidgets.

wxWidgets compared to FLTK

  • FLTK website:
  • wxWidgets has a more mature OO design.
  • FLTK is more light-weight, whereas wxWidgets is more full-featured (wxWidgets supports networking, printing, etc. while FLTK has limited or no support for these things). See xwWidgets Feature List () vs. FLTK Feature List (http://www.fltk.org/documentation.php/doc-1.1/intro.html#2_2).
  • FLTK actually has more elaborate, different widget types. Just compare what you can do in FLUID to wxDesigner or DialogEdit. I ported a FLTK app to wxWidgets and had a hard time emulating the buttons. The window class we used gave screen flicker, etc. as the app grew in size, which was the motivation to transform it to wxWidgets.
  • FLTK's modified LGPL license is more restricting than wxWidgets license, although it does provide exceptions for static linking.

wxWidgets compared to FOX

  • FOX website:
  • FOX is more light-weight, whereas wxWidgets is more full-featured.
  • wxWidgets has a more complete API, while FOX focuses mainly on GUI features.
  • FOX draws its own widgets on each platform, instead of using the native widgets (like Qt), whereas wxWidgets offers true native ports for all the supported platforms. FOX may be faster because of this, but the provided look-and-feel may not be well integrated into the target platform (e.g. the Windows XP theme is not currently available).
  • FOX lacks printing and I18N support.
  • Standard Windows dialog boxes are not supported in FOX, but a portable similar feature is available.

wxWidgets compared to Java

  • Java is a platform while wxWidgets is a GUI API (and can be used with python, perl, C++, java, lua, eiffel, C# , basic, ruby, etc.) so a comparision of the two may not be completely balanced.
  • Java programs are compiled from bytecode at runtime. This means when a user first starts your program, it will take longer to load and the first few moments using the program will be sluggish. (Java compilers such as GJC are avalible, but do not support all Java features well/at all).
  • On the other hand, wxWidgets is compiled directly to machine code and gains all the speed advantages that go along with that.
  • Java bytecode can be decompiled. This is not a problem if your application is open source. However, if having users seeing your source code is a problem, then you may wish to consider other options.
  • Users of Java based applications must have a JVM installed. In recent years, this has become less of an issue as more computers are being installed with Sun's JVM. However, user's that have an older JVM may suffer from performance/security problems.
  • Due to the fact that Java's libraries are slow, some Java libraries are being written in C++ using wxWidgets!
  • An example of the above is wx4j, a wxWidgets implementation for Java. wx4j is a wxWidgets binding for Java which allows Java programmers to keep their Java language but still have the speed of a C++ written program.
  • In order to be cross-platform, Java generally targets the least common denominator. Features that are only available or relevant on one platform but not others are left out of the Java APIs. Examples include manipulating the Windows taskbar, the Mac OS menu bar, Unix file attributes, etc.
  • A corollary of the statement above: in a wxWidgets program, you can always write some platform-specific code where necessary, inside of an ifdef that makes it only compile on that one platform. In Java, there's no equivalent of an ifdef, and you have to jump through hoops to access external APIs. Also, wxWidgets emulates certain features that are not avalible on different platforms (such as MDI and tree controls).
  • Java programs invariably consume more memory than equivalent C++ programs.
  • While a great idea, "Write once, run anywhere" is still a myth. All JVMs have bugs in them, and it is simply impossible to develop a large Java program on one platform and expect it to work flawlessly on another. Not to say all problems have been eliminated from wxWidgets, but the situation is definately not worse.
  • wxWidgets is in many ways more complete and more intuitive. Compare wxString with . Be sure to compare both the features, and the quality of the documentation.
  • Some Java advocates claim that the next version of the JVM will fix many speed problems. However, .
  • (using JVM server 1.4.0) show that Java is still significantly slower than C++. Significant enough to warrent the use of C++ over Java.

wxWidgets compared to SDL

  • SDL (Simple DirectMedia Layer) is a multimedia C library more suited for when you're writing games and such, and want custom-everything and no convenient general-purpose UI elements. It is made of a lot of C structures starting with SDL_.
  • Under the LGPL with the additional restriction that the source to SDL must be distributed with your application.

wxWidgets compared to Allegro

  • Much like SDL, Allegro is a cross-platform c library (with quite a bit of assembly used in the backend) for programming games.
  • Almost as old as wxWidgets (circa 1993).
  • Giftware license (essentially public domain).
  • Requires gcc and an assembler to build.
  • Development has been stuck in the same version for years, there are a lack of core developers (original developer is no longer on the team), and there are some internal disputes which may lead to a fork.
  • Very basic GUI functionality - only supports one window with only bare bones operations supported - you can't move the window, etc.
  • "Controls" are sort of supported in allegro also through functions with (many) variable-length arguments, and are owner drawn much like QT (but don't look as good by default). They can be customized via a relatively easy API (and there are a few sub libraries that already have somewhat fair-looking versions).
  • Drawing routines are much faster than wx, and there is a opengl layer (allegrogl - ) that makes drawing with opengl even easier then it is to begin with.
  • Non-GUI routines (input, etc.) are lower-level and generally faster than wxWidgets' native implementations.
  • Can be used with wxWidgets without too much trouble - since allegro has some platform specific functions to get the window handle, you can create a wxWidgets window from the window handle and do what you want from that from that point on. While wxWindows uses a wxApp to handle platform-specific main/WinMain stuff, Allegro requres you put END_OF_MAIN() after your main function - getting the two to work together is somewhat of a task, but not a very large one.

wxWidgets compared to GTK+

  • GTK+, originally the Gimp toolkit, is a GPL GUI library for Unix systems, written in C. It has been ported to Windows, VMS, and other systems (MacOS?) using the same API.
  • GTKs Windows support is... miserable, not to be too blunt. It has nothing even remotely resembling native look and feel or behavior, and there are many drawing/flicker problems. If you are satisfied with the look and functionality of GTK on Windows, you probably weren't the target audience for wxWidgets anyway.
  • Unlike wxWidgets, GTK+ supports C (and there is a C++ wrapper called GTKMM)
  • The API is quite well developed, and includes safe casting and other things; but C++ has these built in.
  • It's built on top of glib, a general-purpose library (similar in some ways to the C++ STL -- it provides a few data structures, functions to help memory management, etc).
  • It looks the same on all platforms, except Windows XP, where it tries (with some success) to emulate Windows' native look and feel. However, it's still very much a Unix library.
  • Since wxWidgets uses GTK (or GTK2) on Unix, there seems to be little reason to use GTK over wxWidgets in a C++ program.

wxWidgets compared to Kylix

  • Kylix hasn't been much of a success for Borland/Inprise, so it's doubtful how long it will be continued to be supported.
  • Kylix is based on Qt, see above :)
  • Fewer platforms are supported by Kylix
  • The IDE, being based on no less than 3 toolkits, is rather unprofessional.

wxWidgets compared to Ultimate++

  • Ultimate++ only supports Windows and Linux, not MacOS
  • The comparision on isn't really fair. The (very old) wxWidgets sample they took is well-commented and well-structured to show the reader how to design a wxWidgets application. Their implementation is uncommented and doesn't even behave the same. Also, a small example like that doesn't show how the toolkit scales to bigger applications.

wxWidgets compared to Notus

  • See:
  • wxWidgets actually exists ;)
  • notus is likely to make a lot more use of standard library and modern C++ concepts, such as iterators, templates, namespaces, etc (whereas wxWidgets reimplements or works around many of these things in non-standard ways); and it's also likely to follow the design principles of Boost (which you could consider either a good or bad thing), and work well with the rest of the Boost library. Of course, since it doesn't yet exist, whether this is true in practice remains to be seen.

wxWidgets compared to MFC

  • MFC is only available for free for Windows
    • A macintosh version was (is?) available with Visual C++ Crossplatform Edition (~$800 at last check), and also comes with CodeWarrior
    • There are also UNIX variants such as MainWin, which are extremely expensive, require runtime licenses, and are reported to have problematic support
  • While the source for both wxWidgets and MFC is available, EULAs are not a concern with wxWidgets.
  • MFC has a smaller executable size than wx (generally irrelevant with a decent compiler).
  • MFC has greater range of good quality commercial components.
  • Some say event tables (wxWidgets) are 'better' than message maps (MFC).
  • wx's class hierarchy is more intuitive, while MFC tends to be more consistent among top-level class names.
  • wx provides a far greater abundance of convenience classes, while MFC provides more windows-specific classes.
  • .NET isn't an issue - MFC won't be ported to .NET. On the other hand, wx already has .NET wrappers in alpha stage!
  • MFC has a broader range of components available, especially data-bound controls.
  • Some things are easier with wxWidgets, such as certain types of windows (always on top, etc.), while other things are easier with MFC, such as detachable toolbars.
  • Probably the strongest point to use MFC is MSVC, the IDE, itself.
  • For info on class names and other points, see

wxWidgets compared to the Mozilla framework

  • See:
  • JavaScript, XUL and C++ are all needed to program in Mozilla; wxWindows only needs C++.
  • Programming Mozilla in C++ (XPCOM) is very difficult; C++ in wxWindows is easier.

So, why not use wxWidgets?

  • No commercial-grade resource editors specifically made for wxWidgets (although some have been built with wxWidgets!).
  • Lack of commercial GUI components for making nice GUI themes, grids, charts, etc (will usually have to hack the wxWidgets source code itself to get these results).
    • This is incorrect - you do not need to edit the wx library source to add new widgets, not even complicated ones. You would need to if you wanted to add theme support.
  • X11 port is very sub-par compared to other toolkits and very instable. You should use the wxGTK port instead, which builds upon GTK instead of directly onto X11.
阅读(4296) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~