<- previous index next ->
Now that the class has been using one or more windowing systems to do homework and their project, let us peek under the cover and learn some fundamentals that are hidden by tool kits. The facilities and functions presented in this lecture are available for everyone to use. Yet, typically these "low level" facilities and functions are called by higher level tool kits. Both Microsoft Windows windowing and X Windows windowing will be covered. The names may be changed yet the observant student will see great similarity at the basic capability level. A first look at Microsoft Windows starts with the "C" header file Windows.h and the header files that are included: WinDef.h WinBase.h WinGDI.h WinUser.h ShellAPI.h and WindowsX.h A higher level Microsoft toolkit is the Microsoft Foundation Classes, MFC, for C++. Within this toolkit the top level files are: StdAfx.h and StdAfx.cpp An example use is: vc_plotd.h and vc_plotd.cpp Then, the Windows make file and a use of vc_plotd (one of many plotd's) hw7.mak and hw7vc.cpp Hopefully, you are using a higher level graphics tool kit than this for your project. To help understand some of the function calls, "h" as a first letter of a type usually means "handle" that means a "C" pointer. Thus, hwnd, is a handle to a specific window. hdc, is a handle to a device context, drawing context, that contains drawing parameters such as colors and pixels. The X Windows System considers the top level entity to be a "display" typically named "dpy". A display may have one or more "screens". Within each screen is a top level window that covers the entire screen. Within the top level window there can be any number of windows, some with the top level window being the parent and others nested, children, to any nesting depth. For each window that may be one or more graphics context, "gc" that contain drawing parameters. The basic header file for X Windows is Xlib.h XDrawArc and many other functions and data structures The next level header file is Intrinsic.h XtAddCallback and many other functions and data structures The Motif tool kit main header file is Xm.h XmCreateSimpleMenuBas and many other functions and data structures Note that the library names for linking are -lXm -lXt -lX11 for Xm.h Intrinsic.h and Xlib.h respectively. man X as a text file An example basic X Windows program is w1.c There are an amazing number of windows on a desktop. The program treewalk.c shows 465 windows for a Linux KDE desktop treewalk.out Note that some windows have names, some do not. Child windows are shown indented. Coordinates and sizes are shown. X Windows and Microsoft Windows give the user some control over what seem to be unchangeable programs. For X Windows check out /usr/X11R6/lib/X11/app-defaults directory, or /etc/X11/app-defaults, or /usr/lib/X11/app-defaults. "a rose by any other name ..." For example XCalc.ad used to produce GUI A user may modify one of these files, typically with an ".ad" extension meaning "application default". This particular .ad file defines almost the entire GUI of the calculator. For Microsoft Windows there is a resource file, typically with extension ".rc" that gets compiled by the resource compiler into a binary file. For example hw7.rc Application default or resource files can set simple items such as colors and sizes, can provide additional key bindings and in some cases can change the names of menu items or behavior of the application. Some blog comments are at blog homework 6 is assigned, 3 second splash
<- previous index next ->
Many web sites on Java GUI, AWT, Swing, etc. Many web sites on Python wx, tk, qt, etc.