This article is aimed at Unix developers who already have some experience with programming languages and want to start developing GUI applications (mainly for The X Window System, though portability is discussed). It may also come in handy if you have used a particular GUI toolkit for some time and want to know whether others might suit your needs better. The main focus is comparison and introduction, but it serves as a bit of tutorial, as well. Why Do We Need Toolkits? There are two significant answers to this question: • The Xlib API is hard to use because. Its function calls bloat the code and limit readability. (By the way, did you know that the function prototypes are still K&R style? The color handling is awful. (Now you know why most applications that come with X are 1 bit colored.) • Portability. It must be pure hell to port Xlib code to Microsoft Windows or the Linux. Possible reasons for not choosing a toolkit are easily refuted. We'll take a look at three of them: • Money: All of the toolkits mentioned here can be used free of charge ( only for non-commercial applications, though). Even if they couldn't, the time saved would make up for the initial cost. • Performance: I was unsure myself whether the use of a toolkit would yield a performance penalty, and therefore collected some information regarding this issue. My research shows that the overhead caused by the additional far jumps (read: function calls) is negligible for all but the most critical applications (at least with 's drawing library, GDK; see ). Even there, I don't think that this is a problem with today's CPUs and graphics cards. • Flexibility: One could say that we're giving up flexibility by not using the most primitive functions. Most toolkits just remove the fuss of dealing with Xlib; I can't think of any case in which Xlib would give the programmer more freedom than a toolkit does. ![]() And if you pay attention to the fact that most toolkits are organized in an object-oriented fashion, which also means (multiple) inheritance, you will see that this argument certifies Xlib as a disadvantage instead of an advantage. Synopsis Below, I offer a guide to various toolkits for POSIX-based systems which can be used free of charge: GTK+/, Trolltech Qt,,,. It will start with some general information about the concepts of GUI programming, so beginners will have a better chance of understanding the code examples I provide. All toolkits will mainly be examined in terms of maturity (which means stability), popularity (which popular applications/how many applications use this toolkit?), accessibility and internationalization support, portability, language bindings, extensibility, licensing conditions, and documentation. The core of each toolkit's information is written in continuous English sentences, but a spotlight on the specific properties follows each section. Please note that I won't cover Motif/ in this article because it is similar to Xlib in terms of age and complexity. Isn't much better. If youive used KDE, a GUI for Linux, youive probably used an application built using Trolltechis Qt GUI toolkit. According to the company, it will release an OS X native version of Qt at Appleis. If you feel a specific toolkit should be mentioned here, drop me an email. Terminology Widget: From Eric S. Raymond's 'Jargon File': '[.] [poss. Evoking 'window gadget'] A user interface object in X graphical user interfaces.' So what exactly is a widget by example? A button you can click on, a value slider you can slide around, a window, checkboxes, radio buttons. The term 'widget' is used with most toolkits (also on Win32) nowadays as a generic name for these objects. Main Loop, GUI Loop, Main Event Loop: Most, if not all GUI toolkits, be they in C or C++, have this. Download internet explorer for mac. The main loop waits for user input and controls various other things (depending on the toolkit). Event: An event is something coming from the outside, maybe a resize event sent by the operating system so the application can take actions to rearrange its graphical interface elements.
0 Комментарии
Оставить ответ. |
АвторНапишите что-нибудь о себе. Не надо ничего особенного, просто общие данные. АрхивыКатегории |