| CS321 -- Lab 3: The Graphics Shell |
|
|
PurposeThe purpose of this lab is to develop independent learning skills through researching reference material associated with developing the framework for a graphical shell application. AcknowledgementThis lab was developed by Dr. Henry Welch. General Lab InformationTo simplify development of graphical programs and to provide a more robust and uniform interface for products. A specialized graphical shell has been developed by Dr. Henry Welch for CS321. It uses Qt to provide a simple graphical user interface (GUI) with a drawing area, buttons, menu, and command line. Your project WILL BE REQUIRED to work within this shell. Laptop Linux UsersTo use the shell you will need to replace your Imakefile from lab 2 with the Imakefile in /usr/local/cs321 on concord. (You should already have cs321.cpp copied for the procedures in lab 2.) Once you have replaced the Imakefile with the one from concord, you will need to make one change: #define CS321PATH /usr/local/cs321/ Concord UsersTo use the shell the only files you need in your own directories are the Imakefile, Imake.tmpl, and cs321.cpp. After copying these files use the Imakefile (imake) to generate the Makefile which can be used (make cs321) to build the shell and then run it (./cs321). Become familiar with the various features of the GUI shell and note that it simply generates event-driven call backs which do little more than cout before returning. (i.e., There is no functionality yet.) You are to derive a class from the Shell class to add some functionality that supports the drawing of white pixels on the black background of the drawing area. As a minimum you will need to link in your container and shape class work (NOTE: you will find it necessary to update some of this previous work) and override the following virtual functions of Shell:
Draw is activated whenever any event occurs in the drawing window. This includes button presses and motions of the mouse, resizing, and exposures (when any part of the window is suddenly uncovered). When the drawing window is initially created by the GUI shell it will automatically generate an exposure event. For the present, ignore the resize event. When an exposure event occurs simply redraw all the points in your container using the QPainter methods. When a button press occurs (actually press or release, your choice) you will have to access the QEvent to determine the mouse information contained therein. After determining the mouse location create a point object and add it to your container and draw it. Upon referencing QPainter you will find that you need a QWidget. The appropriate one is the protected drawArea member of the Shell class. I will be more than happy to consult with you on an individual basis, but I have purposely left many of the details for you to research on your own. More information on Qt can be found in the following places:
Application demonstrationYou should demonstrate the successful operation of your application before or during week 5 lab. Lab report (due 11pm, the day prior to week 5 lab)Your lab report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report and any previous reports that you have submitted. Your report should include:
As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic Submission Guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well. If you have any questions, consult the instructor. |
| © 1998-2001 Dr. Christopher C. Taylor | Office: CC-27C | Phone: 277-7339 | Last Updated: September 19, 2001 |
| I am responsible for all content posted on these pages; MSOE is welcome to share these opinions but may not want to. | |||