Re: What we really need...
- Posted by David Cuny <dcuny at LANSET.COM> Nov 13, 2002
- 478 views
Irv wrote on a topic near and dear to my heart: > Any cross-platform library is going to have to make a hard choice: > > 1. Support only those controls and functions that all GUI's have in com= mon, > thus losing a lot of functionality that makes a given library appealing= =2E Not necessarily. The wxWindows and Zinc cross-platform libraries both sup= port=20 native controls in they exist for a platform, and fall back to emulated=20 controls if they don't. > 2. Support a third-party GUI library, and live with the problems that > entails, which include: having to download and install a large library,= and > staying in sync with the third party library, (as if keeping up with > Windows versions wasn't enough!). This isn't as hard as it appears. Typically, you can create a file of=20 prototypes, and autogenerate the glue code between your application and t= he=20 GUI. For example, here's a prototype I use for the wxFindReplaceData clas= s in=20 wxWindows: %class wxFindReplaceData, wxObject %include "wx/fdrepdlg.h" wxFindReplaceData(wxUint32 flags =3D 0) const wxString& GetFindString() const wxString& GetReplaceString() int GetFlags() const void SetFlags(wxUint32 flags) void SetFindString(const wxString& str) void SetReplaceString(const wxString& str) Here's an example of a wrapper that it generates: // wxFindReplaceData(wxUint32 flags =3D 0) void wxFindReplaceData_new() { wxFindReplaceData *returns; wxUint32 flags =3D (wArgCount > 0 ? (wxUint32)wPopNumber() : 0); returns =3D new wxFindReplaceData(flags); wPushPtrHandle( wAddObject( _wxFindReplaceData, (int)returns ) ); } Obviously, you can set up the wrappers so that they support whatever data= =20 types and parameter passing you want. Maintaining the library becomes a=20 matter of maintaining the prototypes. > In addition, lots of people use Windows, or GTK, or QT, because they *l= ike* > the look and feel of those GUIs. Third party GUI's usually look and wor= k > differently. Perhaps differently enough to turn off some users. There are toolkits that use native controls. These tend to create larger=20 binaries, but don't have the 'look and feel' problem.=20 -- David Cuny