In previous issues of the Cincom Smalltalk Digest, we had a preview of the MarqueeDialog and the Progress Bar in the ObjectStudio GUI Project. Each month we’ll be opening one file, so don’t forget to check it out next month when we’ll be opening the first one … you don’t want to miss it!

The ObjectStudio GUI

One of the goals of this project is to create a new GUI library of Windows-native widgets for ObjectStudio using DLLCC instead of writing them in C.

Benefits

  • No more primitives—100% Smalltalk code
  • The code can be changed at any time
  • Easier for support to send fixes to customers
  • Customers can now overwrite or change the code to their liking
  • Easy enhancements of features not yet implemented

Architecture

Since every dialog and every control is essentially a window, we restructured the existing class hierarchy. There will only be one super-class for all of the new “User-Interface” classes.

Windows Classes and Controls

Every “type” of window needs an associated “class” (not a class in the Smalltalk sense, but a description in Windows) that describes the icon, mouse cursor and window procedure.

Each control is “subclassed” (again, not in the Smalltalk sense; Windows uses the same term here) of a native control, e.g., “BUTTON” or “EDIT.” We now map the existing functionality from these standard, native controls to Smalltalk classes.

Window Procedure

The old way of writing a Window Procedure was to implement a function in C and allow certain messages to be handled in Smalltalk. With the new code, all of the message handling is done in Smalltalk.

Window Procedures are implemented as callbacks and then passed back to Windows. Every message sent to this Window Procedure is now passed on to the right window and handled through the class hierarchy. If there is no handler in the class or its superclasses, the message is then forwarded to the default handler to ensure the standard behavior for this message. Each class can implement handlers for certain messages, therefore changing the behavior to the needs of the system.

In addition to the standard messages, each class can implement its own message map for an easy replacement of message handlers for certain situations, e.g., while the control is used in the UI Editor.

Announcements

The Announcement system is used to distribute events throughout the system. Certain types of events are received as WM_COMMAND or WM_NOTIFY messages. These messages are now “translated” into Smalltalk and a special announcement is sent. Just like the original event system, every class or instance can subscribe to these announcements and react to them.

Lookout

In the next Digest, we will start presenting certain classes. The first class is going to be the class “UIView.” “UIView” is the top-level class for all “UI” classes in the system. It’s not an abstract class, and it implements the main window functionality.

Advertisements